Project

General

Profile

« Previous | Next » 

Revision d1eb0a8c

Added by Andreas Kohlbecker almost 11 years ago

fixing validation in settings

View differences:

7.x/modules/cdm_dataportal/settings.php
504 504
    '#type' => 'textfield',
505 505
    '#title' => t('CDM web service URL') . ':',
506 506
    '#description' => t('This is the URL to the CDM-Server exposing your data
507
      e.g. <em>"http://localhost:8080/cichorieae/"</em> The URL <strong>must end
508
      with a slash</strong> character!'),
507
      e.g. <em>"http://myserver.net/cdmserver/myproject"</em>'),
509 508
    '#default_value' => variable_get('cdm_webservice_url', NULL),
510 509
  );
511 510

  
......
2109 2108
}
2110 2109

  
2111 2110
/**
2112
 * Form validation handler for ?
2111
 * Form validation handler for cdm_settings_general
2113 2112
 *
2114 2113
 * Comment @WA: currently this handler is not used.
2115 2114
 * It seems partly for cdm_settings_general en partly for cdm_settings_cache?
......
2117 2116
 * cdm_settings_cache_validate().
2118 2117
 * But cdm_api_secref_cache_clear is not doing anything (yet)?
2119 2118
 */
2120
function cdm_settings_validate($form, &$form_state) {
2119
function cdm_settings_general_validate($form, &$form_state) {
2121 2120

  
2122 2121
  if (!str_endsWith($form_state['values']['cdm_webservice_url'], '/')) {
2123
    // form_set_error('cdm_webservice_url', t("The URL to the CDM Web Service must end with a slash: '/'."));
2124 2122
    $form_state['values']['cdm_webservice_url'] .= '/';
2125 2123
  }
2126 2124

  
2125
}
2126

  
2127
/**
2128
 * Form validation handler for cdm_settings_cache
2129
 */
2130
function cdm_settings_cache_validate() {
2127 2131
  if ($form_state['values']['cdm_webservice_cache'] != variable_get('cdm_webservice_cache', 1)) {
2128 2132
    cache_clear_all(NULL, 'cache_cdm_ws');
2129 2133
    // Better clear secref_cache since I can not be sure if the cache has not
2130 2134
    // be used during this response.
2131 2135
    cdm_api_secref_cache_clear();
2132 2136
  }
2137

  
2133 2138
}
2134 2139

  
2135 2140
/**

Also available in: Unified diff