Project

General

Profile

« Previous | Next » 

Revision 14a85a42

Added by Alexander Oppermann about 11 years ago

*added Admin Panel
*added region filter
*js method to select all checkboxes
*adaptable uuid for filter levels
*css fix in zen dataportal theme

View differences:

7.x/modules/cdm_dataportal/cdm_csv_export/cdm_csv_export.module
89 89
    '#attributes' => array('name' => 'classification'),
90 90
  );
91 91

  
92
  $form['csvExportOptions'] = array(
92
  $form['redListField'] = array(
93
      '#type' => 'fieldset',
94
      '#title'	=>t('Redlist Attributes'),
95
      '#collapsible' => TRUE,
96
      '#collapsed' => TRUE,
97
    );
98
  
99
  $form['redListField']['csvExportOptions'] = array(
93 100
      '#type'=>'checkboxes',
94
      '#title'	=>t('Download Options'),
95 101
      '#options' => array(),
96 102
  );
97 103
    
......
105 111
        $subform_id =  $featureNode->feature->uuid; //LAYOUT_SETTING_PREFIX .
106 112
        $settings = mixed_variable_get($subform_id, FEATURE_TREE_LAYOUT_DEFAULTS);
107 113
        $systemDefaults = unserialize(FEATURE_TREE_LAYOUT_DEFAULTS);
108
        $form['csvExportOptions'][$subform_id] = array(
114
        $form['redListField']['csvExportOptions'][$subform_id] = array(
109 115
          '#type' => 'checkbox',
110 116
          '#title' => $featureNode->feature->representation_L10n,
111 117
          '#default_value' => $featureNode->feature->uuid,//$settings,
......
123 129
      ),
124 130
    );
125 131

  
132
  $form['regionFilter'] = array(
133
    '#type' => 'fieldset',
134
    '#title' => t('Geographical filter'),
135
    '#collapsible' => TRUE,
136
    '#collapsed' => TRUE,
137
    );
138

  
139
  //TODO: #title value needs to be fetched from 'area_filter_country' 
140
  $form['regionFilter']['country'] = array (
141
    '#type' => 'checkbox',
142
    '#title' => 'Germany',
143
    '#attributes' => array('name' => 'area',
144
                            'id' => 'checkall',
145
                            'value' => variable_get('area_filter_country')
146
     ),
147
    );
148
  
149
  //GermanFederalStates
150
  $nameRelationshipTypeOptions = cdm_Vocabulary_as_option(variable_get('area_filter_state'));
151
  $form['regionFilter']['area'] = array(
152
    '#type' => 'checkboxes',
153
    '#description' =>t('Select an area to filter the list of taxa'),
154
    '#options' => $nameRelationshipTypeOptions,
155
    '#attributes' => array('name' => 'area',
156
                            'id' => 'area',
157
      ),
158
    );
159
  
126 160
  $form['button'] = array(
127 161
    '#type'  => 'submit',
128 162
    '#value' => 'Export',
129 163
    );
130 164
  
131
  $form['#action'] = url('../../csv/exportRedlist');
165
  $form['#action'] = url(variable_get('cdm_csv_export_webservice_url'));
132 166
  $form['#attributes'] = array('onsubmit' => 'return blockUIForDownload()');
133 167
  
134 168
  return $form;
135 169
}
170

  
171

  
172

  
173
/**
174
 * Implements Admin configuration hook_menu().
175
 */
176
function cdm_csv_export_menu() {
177
 $items = array();
178

  
179
 $items['admin/config/cdm_dataportal/csvexport'] = array(
180
   'title' => 'CDM CSV Export',
181
   'description' => 'Settings of CSV Export module.',
182
   'page callback' => 'drupal_get_form',
183
   'page arguments' => array('cdm_csv_export_admin'),
184
   'access arguments' => array('access administration pages'),
185
   'type' => MENU_NORMAL_ITEM,
186
 );
187

  
188
 return $items;
189
}
190

  
191
/**
192
 * Generate the HTML form for the CSV Export Settings.
193
 */
194
function cdm_csv_export_admin() {
195
 
196
 $form['cdm_csv_export_webservice'] = array(
197
   '#type' => 'fieldset',
198
   '#title' => t('CDM CSV Export web service'),
199
   '#collapsible' => TRUE,
200
   '#collapsed' => FALSE,
201
   '#description' => t('<em>CDM Server</em> makes the dialogue possible with
202
      <em>CDM Data Portal</em> thanks to its web services.'),
203
 );
204
 
205
 $form['cdm_csv_export_webservice']['cdm_csv_export_webservice_url'] = array(
206
   '#type' => 'textfield',
207
   '#title' => t('CSV Export web service URL') . ':',
208
   '#description' => t('This is the URL to the CDM-Server webservice exposing its controller
209
      e.g. <em>"http://localhost:8080/csv/exportRedlist"</em>'),
210
   '#default_value' => variable_get('cdm_csv_export_webservice_url', NULL),
211
 );
212
 
213
 // ---- Regional Filter ---- //
214
 $form['csv_export_area_filter'] = array(
215
   '#type' => 'fieldset',
216
   '#title' => t('CDM CSV Export Area Filter'),
217
   '#collapsible' => TRUE,
218
   '#collapsed' => FALSE,
219
   '#description' => t('The <em>Area Filter</em> can be freely configured to the need 
220
       of the specific <em>CDM Data Portal</em> and its catchment area. Right now it will 
221
       be only distinguished between two levels. If necessary it can be programmatically
222
       extended for a third level e.g. "continent level".'),
223
 );
224
 
225
 $form['csv_export_area_filter']['area_filter_country'] = array(
226
   '#type' => 'textfield',
227
   '#title' => t('Country Level') . ':',
228
   '#description' => t('This is the UUID for the country level, in order to be able to filter Germany,
229
      you should paste e.g. <em>"7b7c2db5-aa44-4302-bdec-6556fd74b0b9"</em> in the above text field'),
230
   '#default_value' => variable_get('area_filter_country', NULL),
231
 );
232
 
233
 $form['csv_export_area_filter']['area_filter_state'] = array(
234
   '#type' => 'textfield',
235
   '#title' => t('State Level') . ':',
236
   '#description' => t('This is the UUID for the state level, in order to be able to filter the german federal states,
237
      you should paste e.g. <em>"44a448f9-f4ca-49f6-b58c-d27d8a69efdb"</em> in the above text field'),
238
   '#default_value' => variable_get('area_filter_state', NULL),
239
 );
240
 
241
 // ---- FEATURE TREE ---- //
242
 $form['taxon_profile'] = array(
243
   '#type' => 'fieldset',
244
   '#title' => t('Features'),
245
   '#collapsible' => TRUE,
246
   '#collapsed' => FALSE,
247
   '#description' => t("This section covers settings related to the taxon's
248
      <em>Feature Tree</em>. The <em>feature tree</em> are the taxon's
249
      features such as description, distribution, common names, etc. that Drupal
250
      will render at the taxon profile page."),
251
 );
252
 
253
 $featureTrees = cdm_get_featureTrees_as_options(TRUE);
254
 $form['taxon_profile']['feature_trees'][CDM_PROFILE_FEATURETREE_UUID] = array(
255
   '#type' => 'radios',
256
   '#title' => t('Taxon profile sections') . ':',
257
   '#default_value' => variable_get(CDM_PROFILE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE),
258
   '#options' =>  $featureTrees['options'],
259
   // Comment @WA: because #options are sanitized in D7, it would
260
   // strip html like <fieldset>, so we put the fieldset in a suffix.
261
   '#field_suffix' => $featureTrees['treeRepresentations'],
262
   '#description' => t('Select the Feature Tree to be displayed at the taxon
263
      profile. Click "Show Details" to see the Feature Tree elements.'
264
   ),
265
 );
266

  
267
 return system_settings_form($form);
268
}

Also available in: Unified diff