Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/plugins/export_ui/views_ui.class.php
12 12
 */
13 13
class views_ui extends ctools_export_ui {
14 14

  
15
  /**
16
   *
17
   */
15 18
  function init($plugin) {
16
    // We modify the plugin info here so that we take the defaults and
17
    // twiddle, rather than completely override them.
18

  
19
    // We modify the plugin info here so that we take the defaults and twiddle,
20
    // rather than completely override them.
19 21
    // Reset the edit path to match what we're really using.
20 22
    $plugin['menu']['items']['edit']['path'] = 'view/%ctools_export_ui/edit';
21 23
    $plugin['menu']['items']['clone']['path'] = 'view/%ctools_export_ui/clone';
......
44 46
    return parent::init($plugin);
45 47
  }
46 48

  
49
  /**
50
   *
51
   */
47 52
  function hook_menu(&$items) {
48 53
    // We are using our own 'edit' still, rather than having edit on this
49
    // object (maybe in the future) so unset the edit callbacks:
50

  
51
    // Store this so we can put them back as sometimes they're needed
52
    // again laster:
54
    // object (maybe in the future) so unset the edit callbacks. Store this so
55
    // we can put them back as sometimes they're needed again laster.
53 56
    $stored_items = $this->plugin['menu']['items'];
54 57
    // We leave these to make sure the operations still exist in the plugin so
55 58
    // that the path finder.
......
63 66
    $this->plugin['menu']['items'] = $stored_items;
64 67
  }
65 68

  
69
  /**
70
   *
71
   */
66 72
  function load_item($item_name) {
67 73
    return views_ui_cache_load($item_name);
68 74
  }
69 75

  
76
  /**
77
   *
78
   */
70 79
  function list_form(&$form, &$form_state) {
71 80
    $row_class = 'container-inline';
72 81
    if (!variable_get('views_ui_show_listing_filters', FALSE)) {
......
77 86

  
78 87
    parent::list_form($form, $form_state);
79 88

  
80
    // ctools only has two rows. We want four.
81
    // That's why we create our own structure.
89
    // CTools only has two rows. We want four. That's why we create our own
90
    // structure.
82 91
    $form['bottom row']['submit']['#attributes']['class'][] = 'js-hide';
83 92
    $form['first row'] = array(
84 93
      '#prefix' => '<div class="' . $row_class . ' ctools-export-ui-row ctools-export-ui-first-row clearfix">',
......
164 173
    );
165 174
  }
166 175

  
176
  /**
177
   *
178
   */
167 179
  function list_filter($form_state, $view) {
168 180
    // Don't filter by tags if all is set up.
169 181
    if ($form_state['values']['tag'] != 'all') {
......
183 195
    return parent::list_filter($form_state, $view);
184 196
  }
185 197

  
198
  /**
199
   *
200
   */
186 201
  function list_sort_options() {
187 202
    return array(
188 203
      'disabled' => t('Enabled, name'),
......
193 208
    );
194 209
  }
195 210

  
196

  
211
  /**
212
   *
213
   */
197 214
  function list_build_row($view, &$form_state, $operations) {
198 215
    if (!empty($view->human_name)) {
199 216
      $title = $view->human_name;
......
212 229

  
213 230
    $info = theme('views_ui_view_info', array('view' => $view, 'base' => $base));
214 231

  
215
    // Reorder the operations so that enable is the default action for a templatic views
232
    // Reorder the operations so that enable is the default action for a
233
    // templatic views.
216 234
    if (!empty($operations['enable'])) {
217 235
      $operations = array('enable' => $operations['enable']) + $operations;
218 236
    }
219 237

  
220
    // Set up sorting
238
    // Set up sorting.
221 239
    switch ($form_state['values']['order']) {
222 240
      case 'disabled':
223 241
        $this->sorts[$view->name] = strtolower(empty($view->disabled) . $title);
224 242
        break;
243

  
225 244
      case 'name':
226 245
        $this->sorts[$view->name] = strtolower($title);
227 246
        break;
247

  
228 248
      case 'path':
229 249
        $this->sorts[$view->name] = strtolower($paths);
230 250
        break;
251

  
231 252
      case 'tag':
232 253
        $this->sorts[$view->name] = strtolower($view->tag);
233 254
        break;
255

  
234 256
      case 'storage':
235 257
        $this->sorts[$view->name] = strtolower($view->type . $title);
236 258
        break;
237 259
    }
238 260

  
239
    $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
261
    $theme_args = array(
262
      'links' => $operations,
263
      'attributes' => array(
264
        'class' => array(
265
          'links',
266
          'inline',
267
        ),
268
      ),
269
    );
270
    $ops = theme('links__ctools_dropbutton', $theme_args);
240 271

  
241 272
    $this->rows[$view->name] = array(
242 273
      'data' => array(
243
        array('data' => $info, 'class' => array('views-ui-name')),
244
        array('data' => check_plain($view->description), 'class' => array('views-ui-description')),
245
        array('data' => check_plain($view->tag), 'class' => array('views-ui-tag')),
246
        array('data' => $paths, 'class' => array('views-ui-path')),
247
        array('data' => $ops, 'class' => array('views-ui-operations')),
274
        array(
275
          'data' => $info,
276
          'class' => array('views-ui-name'),
277
        ),
278
        array(
279
          'data' => check_plain($view->description),
280
          'class' => array('views-ui-description'),
281
        ),
282
        array(
283
          'data' => check_plain($view->tag),
284
          'class' => array('views-ui-tag'),
285
        ),
286
        array(
287
          'data' => $paths,
288
          'class' => array('views-ui-path'),
289
        ),
290
        array(
291
          'data' => $ops,
292
          'class' => array('views-ui-operations'),
293
        ),
248 294
      ),
249 295
      'title' => t('Machine name: ') . check_plain($view->name),
250
      'class' => array(!empty($view->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'),
296
      'class' => array(
297
        !empty($view->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled',
298
      ),
251 299
    );
252 300
  }
253 301

  
302
  /**
303
   *
304
   */
254 305
  function list_render(&$form_state) {
255 306
    views_include('admin');
256 307
    views_ui_add_admin_css();
......
263 314
    $this->active = $form_state['values']['order'];
264 315
    $this->order = $form_state['values']['sort'];
265 316

  
266
    $query    = tablesort_get_query_parameters();
317
    $query = tablesort_get_query_parameters();
267 318

  
268 319
    $header = array(
269 320
      $this->tablesort_link(t('View name'), 'name', 'views-ui-name'),
......
282 333
    return theme('table', $table);
283 334
  }
284 335

  
336
  /**
337
   *
338
   */
285 339
  function tablesort_link($label, $field, $class) {
286 340
    $title = t('sort by @s', array('@s' => $label));
287 341
    $initial = 'asc';
......
306 360
    return array('data' => $link, 'class' => $class);
307 361
  }
308 362

  
363
  /**
364
   *
365
   */
309 366
  function clone_page($js, $input, $item, $step = NULL) {
310 367
    drupal_set_title($this->get_page_title('clone', $item));
311 368

  
......
339 396
    return $output;
340 397
  }
341 398

  
399
  /**
400
   *
401
   */
342 402
  function add_template_page($js, $input, $name, $step = NULL) {
343 403
    $templates = views_get_all_templates();
344 404

  
......
348 408

  
349 409
    $template = $templates[$name];
350 410

  
351
    // The template description probably describes the template, not the
352
    // view that will be created from it, but users aren't that likely to
353
    // touch it.
411
    // The template description probably describes the template, not the view
412
    // that will be created from it, but users aren't that likely to touch it.
354 413
    if (!empty($template->description)) {
355 414
      unset($template->description);
356 415
    }
......
363 422
    return $output;
364 423
  }
365 424

  
425
  /**
426
   *
427
   */
366 428
  function set_item_state($state, $js, $input, $item) {
367 429
    ctools_export_set_object_status($item, $state);
368 430
    menu_rebuild();
......
375 437
    }
376 438
  }
377 439

  
440
  /**
441
   *
442
   */
378 443
  function list_page($js, $input) {
379 444
    // Remove filters values from session if filters are hidden.
380 445
    if (!variable_get('views_ui_show_listing_filters', FALSE) && isset($_SESSION['ctools_export_ui'][$this->plugin['name']])) {
381 446
      unset($_SESSION['ctools_export_ui'][$this->plugin['name']]);
382 447
    }
383 448

  
384
    // wrap output in a div for CSS
449
    // Wrap output in a div for CSS.
385 450
    $output = parent::list_page($js, $input);
386 451
    if (is_string($output)) {
387 452
      $output = '<div id="views-ui-list-page">' . $output . '</div>';
388 453
    }
389 454
    return $output;
390 455
  }
456

  
391 457
}
392 458

  
393 459
/**
394
 * Form callback to edit an exportable item using the wizard
460
 * Form callback to edit an exportable item using the wizard.
395 461
 *
396 462
 * This simply loads the object defined in the plugin and hands it off.
397 463
 */

Formats disponibles : Unified diff