function get_tripal_stock_admin_form_url_set

1.x tripal_stock.admin.inc get_tripal_stock_admin_form_url_set(&$form)

Parameters

$form:

1 call to get_tripal_stock_admin_form_url_set()
tripal_stock_admin in tripal_stock/includes/tripal_stock.admin.inc
Purpose: Provide administration options for chado_stocks

File

tripal_stock/includes/tripal_stock.admin.inc, line 105
@todo Add file header description

Code

function get_tripal_stock_admin_form_url_set(&$form) {

  $form['url'] = array(
    '#type' => 'fieldset',
    '#title' => t('Stock URL Path'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  $options = array(
    'SID[id]' => '[id]:' . t('The Chado stock_id'),
    'stock' => 'stock:' . t('Chado table name'),
    '[genus]' => '[genus]:' . t('Genus to which the stock belongs'),
    '[species]' => '[species]:' . t('Species to which the stock belongs'),
    '[type]' => '[type]:' . t('The type of stock'),
    '[uniquename]' => '[uniquename]:' . t('The stock unique name'),
    '[name]' => '[name]:' . t('The stock name'),
    'reset' => t('Reset'),
  );


  $form['url']['chado_stock_url_string'] = array(
    '#title' => 'URL Syntax',
    '#type' => 'textfield',
    '#description' => t('You may rearrange elements in this text box to
      customize the URLs.  The available tags include: [id],
      [uniquename]. [name], [species], [genus], [type]. You can separate or
      include any text between the tags. Click the "Set Stock URLs" button to 
      reset the URLs for all stock pages.  Click the "Save Configuration" button to
      simply save this setup. <b>Important</b>: be sure that whatever you choose will always be unique even considering
      future data that may be added.  If you include the Chado table name, genus, species, type 
      and uniquename you are guaranteed to have a unique URL. For example stock/[genus]/[species]/[type]/[uniquename]'),
    '#size' => 150,
    '#default_value' => variable_get('chado_stock_url_string', '/stock/[genus]/[species]/[type]/[uniquename]'),
  );

  $form['url']['chado_stock_url'] = array(
    '#title' => t('URL components'),
    '#type' => 'checkboxes',
    '#required' => FALSE,
    '#options' => $options,
    '#description' => t('Click the item above to make it appear in the URL Syntax box'),
    '#attributes' => array(
      'onclick' => '
        box = $(\'#edit-chado-stock-url-string\');
        if (this.value == \'reset\') {
          box.val(\'\');
        }
        else {        
          box.val(box.val() + "/" + this.value);          
        }
        this.checked = false;
      ',
    ),
  );

  $form['url']['button'] = array(
    '#type' => 'submit',
    '#value' => t('Set Stock URLs'),
  );
}