|
@@ -105,8 +105,6 @@ class chado_linker__relationship extends TripalField {
|
|
'required' => FALSE,
|
|
'required' => FALSE,
|
|
'settings' => array(
|
|
'settings' => array(
|
|
'auto_attach' => FALSE,
|
|
'auto_attach' => FALSE,
|
|
- 'child_relationship_types' => '',
|
|
|
|
- 'relationship_types' => '',
|
|
|
|
),
|
|
),
|
|
'widget' => array(
|
|
'widget' => array(
|
|
'type' => 'chado_linker__relationship_widget',
|
|
'type' => 'chado_linker__relationship_widget',
|
|
@@ -130,7 +128,7 @@ class chado_linker__relationship extends TripalField {
|
|
public static function widgetInfo() {
|
|
public static function widgetInfo() {
|
|
return array(
|
|
return array(
|
|
'chado_linker__relationship_widget' => array(
|
|
'chado_linker__relationship_widget' => array(
|
|
- 'label' => t('Relationship Settings'),
|
|
|
|
|
|
+ 'label' => t('Relationships'),
|
|
'field types' => array('chado_linker__relationship')
|
|
'field types' => array('chado_linker__relationship')
|
|
),
|
|
),
|
|
);
|
|
);
|
|
@@ -876,7 +874,7 @@ class chado_linker__relationship extends TripalField {
|
|
'#title' => 'Allowed Relationship Types',
|
|
'#title' => 'Allowed Relationship Types',
|
|
'#description' => t('There are three ways that relationship types
|
|
'#description' => t('There are three ways that relationship types
|
|
can be limited for users who have permission to add new relationships.
|
|
can be limited for users who have permission to add new relationships.
|
|
- Please select the most appropriate for you use case. By default
|
|
|
|
|
|
+ Please select the most appropriate for your use case. By default
|
|
all vocabularies are provided to the user which allows use of any
|
|
all vocabularies are provided to the user which allows use of any
|
|
term for the relationship type.'),
|
|
term for the relationship type.'),
|
|
'#collapsed' => TRUE,
|
|
'#collapsed' => TRUE,
|
|
@@ -894,7 +892,7 @@ class chado_linker__relationship extends TripalField {
|
|
'#type' => 'item',
|
|
'#type' => 'item',
|
|
'#title' => 'Option #1',
|
|
'#title' => 'Option #1',
|
|
'#description' => t('Use this option to limit the vocabularies that a user .
|
|
'#description' => t('Use this option to limit the vocabularies that a user .
|
|
- could use to specify relationship types. With this option any term in .
|
|
|
|
|
|
+ could use to specify relationship types. With this option any term in
|
|
the vocabulary can be used for the relationship type. You may select
|
|
the vocabulary can be used for the relationship type. You may select
|
|
more than one vocabulary.'),
|
|
more than one vocabulary.'),
|
|
|
|
|
|
@@ -904,7 +902,7 @@ class chado_linker__relationship extends TripalField {
|
|
'#multiple' => TRUE,
|
|
'#multiple' => TRUE,
|
|
'#options' => $vocs,
|
|
'#options' => $vocs,
|
|
'#size' => 6,
|
|
'#size' => 6,
|
|
- '#default_value' => $instance['settings']['default_vocabs'],
|
|
|
|
|
|
+ '#default_value' => $instance['settings']['relationships']['option1_vocabs'],
|
|
// TODO add ajax here so that the relationship autocomplete below works
|
|
// TODO add ajax here so that the relationship autocomplete below works
|
|
);
|
|
);
|
|
|
|
|
|
@@ -915,21 +913,28 @@ class chado_linker__relationship extends TripalField {
|
|
heirarchy groups of related terms typically fall under a common parent. If you
|
|
heirarchy groups of related terms typically fall under a common parent. If you
|
|
wish to limit the list of terms that a user can use for the relationship type,
|
|
wish to limit the list of terms that a user can use for the relationship type,
|
|
you can provide the parent term here. Then, only that term\'s children will
|
|
you can provide the parent term here. Then, only that term\'s children will
|
|
- then be avilable for use as a relationship type.',
|
|
|
|
|
|
+ be avilable for use as a relationship type.',
|
|
);
|
|
);
|
|
$element['relationships']['option2_vocab'] = array(
|
|
$element['relationships']['option2_vocab'] = array(
|
|
'#type' => 'select',
|
|
'#type' => 'select',
|
|
- '#description' => 'Specify Default Vocabularies',
|
|
|
|
|
|
+ '#description' => 'Specify Default Vocabulary',
|
|
'#multiple' => FALSE,
|
|
'#multiple' => FALSE,
|
|
'#options' => $vocs,
|
|
'#options' => $vocs,
|
|
- '#default_value' => $instance['settings']['default_vocabs'],
|
|
|
|
- // TODO add ajax here so that the relationship autocomplete below works
|
|
|
|
|
|
+ '#default_value' => $instance['settings']['relationships']['option2_vocab'],
|
|
|
|
+ '#ajax' => array(
|
|
|
|
+ 'callback' => "chado_linker__relationship_instance_settings_form_ajax_callback",
|
|
|
|
+ 'wrapper' => 'relationships-option2-parent',
|
|
|
|
+ 'effect' => 'fade',
|
|
|
|
+ 'method' => 'replace'
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
$element['relationships']['option2_parent'] = array(
|
|
$element['relationships']['option2_parent'] = array(
|
|
'#type' => 'textfield',
|
|
'#type' => 'textfield',
|
|
'#description' => 'Specify a Heirarchical Parent Term',
|
|
'#description' => 'Specify a Heirarchical Parent Term',
|
|
- '#default_value' => $instance['settings']['child_relationship_types'],
|
|
|
|
- '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/"
|
|
|
|
|
|
+ '#default_value' => $instance['settings']['relationships']['option2_parent'],
|
|
|
|
+ '#autocomplete_path' => "admin/tripal/storage/chado/auto_name/cvterm/",
|
|
|
|
+ '#prefix' => '<div id=relationships-option2-parent>',
|
|
|
|
+ '#suffix' => '</div>'
|
|
);
|
|
);
|
|
$element['relationships']['option3'] = array(
|
|
$element['relationships']['option3'] = array(
|
|
'#type' => 'item',
|
|
'#type' => 'item',
|
|
@@ -939,7 +944,7 @@ class chado_linker__relationship extends TripalField {
|
|
);
|
|
);
|
|
$element['relationships']['relationship_types'] = array(
|
|
$element['relationships']['relationship_types'] = array(
|
|
'#type' => 'textarea',
|
|
'#type' => 'textarea',
|
|
- '#default_value' => $instance['settings']['relationship_types'],
|
|
|
|
|
|
+ '#default_value' => $instance['settings']['relationships']['relationship_types'],
|
|
);
|
|
);
|
|
|
|
|
|
return $element;
|
|
return $element;
|
|
@@ -1014,7 +1019,7 @@ function theme_chado_linker__relationship_widget($variables) {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * An Ajax callback for the dbxref widget.
|
|
|
|
|
|
+ * An Ajax callback for the relationshp widget.
|
|
*/
|
|
*/
|
|
function chado_linker__relationship_widget_form_ajax_callback(&$form, $form_state) {
|
|
function chado_linker__relationship_widget_form_ajax_callback(&$form, $form_state) {
|
|
// Get the triggering element
|
|
// Get the triggering element
|
|
@@ -1033,4 +1038,10 @@ function chado_linker__relationship_widget_form_ajax_callback(&$form, $form_stat
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * An Ajax callback for the relationshp instance setting form.
|
|
|
|
+ */
|
|
|
|
+function chado_linker__relationship_instance_settings_form_ajax_callback(&$form, $form_state) {
|
|
|
|
+ return $form['instance']['settings']['relationships']['option2_parent'];
|
|
|
|
+}
|
|
|
|
|