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/modules/system.views.inc
14 14
  $data = array();
15 15

  
16 16
  // ----------------------------------------------------------------------
17
  // file_managed table
18

  
17
  // 'file_managed' table.
19 18
  $data['files']['moved to'] = 'file_managed';
20 19
  $data['file_managed']['table']['group']  = t('File');
21 20

  
22
  // Advertise this table as a possible base table
21
  // Advertise this table as a possible base table.
23 22
  $data['file_managed']['table']['base'] = array(
24 23
    'field' => 'fid',
25 24
    'title' => t('File'),
26 25
    'help' => t("Files maintained by Drupal and various modules."),
27 26
    'defaults' => array(
28
      'field' => 'filename'
27
      'field' => 'filename',
29 28
    ),
30 29
  );
31 30
  $data['file_managed']['table']['entity type'] = 'file';
32 31

  
33
  // fid
32
  // File ID / 'fid'.
34 33
  $data['file_managed']['fid'] = array(
35 34
    'title' => t('File ID'),
36 35
    'help' => t('The ID of the file.'),
......
40 39
    ),
41 40
    'argument' => array(
42 41
      'handler' => 'views_handler_argument_file_fid',
43
      'name field' => 'filename', // the field to display in the summary.
42
      'name field' => 'filename',
43
  // the field to display in the summary.
44 44
      'numeric' => TRUE,
45 45
    ),
46 46
    'filter' => array(
......
51 51
    ),
52 52
  );
53 53

  
54
  // filename
54
  // Filename.
55 55
  $data['file_managed']['filename'] = array(
56 56
    'title' => t('Name'),
57 57
    'help' => t('The name of the file.'),
58 58
    'field' => array(
59 59
      'handler' => 'views_handler_field_file',
60 60
      'click sortable' => TRUE,
61
     ),
61
    ),
62 62
    'sort' => array(
63 63
      'handler' => 'views_handler_sort',
64 64
    ),
......
70 70
    ),
71 71
  );
72 72

  
73
  // uri
73
  // URI.
74 74
  $data['file_managed']['uri'] = array(
75 75
    'title' => t('Path'),
76 76
    'help' => t('The path of the file.'),
77 77
    'field' => array(
78 78
      'handler' => 'views_handler_field_file_uri',
79 79
      'click sortable' => TRUE,
80
     ),
80
    ),
81 81
    'sort' => array(
82 82
      'handler' => 'views_handler_sort',
83 83
    ),
......
89 89
    ),
90 90
  );
91 91

  
92
  // filemime
92
  // The file's MIME Type.
93 93
  $data['file_managed']['filemime'] = array(
94 94
    'title' => t('Mime type'),
95 95
    'help' => t('The mime type of the file.'),
96 96
    'field' => array(
97 97
      'handler' => 'views_handler_field_file_filemime',
98 98
      'click sortable' => TRUE,
99
     ),
99
    ),
100 100
    'sort' => array(
101 101
      'handler' => 'views_handler_sort',
102 102
    ),
......
108 108
    ),
109 109
  );
110 110

  
111
  // extension
111
  // Extension.
112 112
  $data['file_managed']['extension'] = array(
113 113
    'title' => t('Extension'),
114 114
    'help' => t('The extension of the file.'),
......
116 116
    'field' => array(
117 117
      'handler' => 'views_handler_field_file_extension',
118 118
      'click sortable' => FALSE,
119
     ),
119
    ),
120 120
  );
121 121

  
122
  // filesize
122
  // Filesize.
123 123
  $data['file_managed']['filesize'] = array(
124 124
    'title' => t('Size'),
125 125
    'help' => t('The size of the file.'),
126 126
    'field' => array(
127 127
      'handler' => 'views_handler_field_file_size',
128 128
      'click sortable' => TRUE,
129
     ),
129
    ),
130 130
    'sort' => array(
131 131
      'handler' => 'views_handler_sort',
132 132
    ),
......
135 135
    ),
136 136
  );
137 137

  
138
  // status
138
  // Status.
139 139
  $data['file_managed']['status'] = array(
140 140
    'title' => t('Status'),
141 141
    'help' => t('The status of the file.'),
142 142
    'field' => array(
143 143
      'handler' => 'views_handler_field_file_status',
144 144
      'click sortable' => TRUE,
145
     ),
145
    ),
146 146
    'sort' => array(
147 147
      'handler' => 'views_handler_sort',
148 148
    ),
......
151 151
    ),
152 152
  );
153 153

  
154
  // timestamp field
154
  // Timestamp field.
155 155
  $data['file_managed']['timestamp'] = array(
156 156
    'title' => t('Upload date'),
157 157
    'help' => t('The date the file was uploaded.'),
......
167 167
    ),
168 168
  );
169 169

  
170
  // uid
170
  // User ID / 'uid'.
171 171
  $data['file_managed']['uid'] = array(
172 172
    'title' => t('User who uploaded'),
173 173
    'help' => t('The user that uploaded the file.'),
......
180 180
  );
181 181

  
182 182
  // ----------------------------------------------------------------------
183
  // file_usage table
184

  
183
  // file_usage table.
185 184
  $data['file_usage']['table']['group']  = t('File Usage');
186 185

  
187
  // Provide field-type-things to several base tables; on the core files table ("file_managed") so
188
  // that we can create relationships from files to entities, and then on each core entity type base
189
  // table so that we can provide general relationships between entities and files.
186
  // Provide field-type-things to several base tables; on the core files table
187
  // ("file_managed") so that we can create relationships from files to
188
  // entities, and then on each core entity type base table so that we can
189
  // provide general relationships between entities and files.
190 190
  $data['file_usage']['table']['join'] = array(
191
    // Link ourself to the {file_managed} table so we can provide file->entity relationships.
191
    // Link ourself to the {file_managed} table so we can provide file->entity
192
    // relationships.
192 193
    'file_managed' => array(
193 194
      'field' => 'fid',
194 195
      'left_field' => 'fid',
195 196
    ),
196
    // Link ourself to the {node} table so we can provide node->file relationships.
197
    // Link ourself to the {node} table so we can provide node->file
198
    // relationships.
197 199
    'node' => array(
198 200
      'field' => 'id',
199 201
      'left_field' => 'nid',
200 202
      'extra' => array(array('field' => 'type', 'value' => 'node')),
201 203
    ),
202
    // Link ourself to the {users} table so we can provide user->file relationships.
204
    // Link ourself to the {users} table so we can provide user->file
205
    // relationships.
203 206
    'users' => array(
204 207
      'field' => 'id',
205 208
      'left_field' => 'uid',
206 209
      'extra' => array(array('field' => 'type', 'value' => 'user')),
207 210
    ),
208
    // Link ourself to the {comment} table so we can provide comment->file relationships.
211
    // Link ourself to the {comment} table so we can provide comment->file
212
    // relationships.
209 213
    'comment' => array(
210 214
      'field' => 'id',
211 215
      'left_field' => 'cid',
212 216
      'extra' => array(array('field' => 'type', 'value' => 'comment')),
213 217
    ),
214
    // Link ourself to the {taxonomy_term_data} table so we can provide taxonomy_term->file relationships.
218
    // Link ourself to the {taxonomy_term_data} table so we can provide
219
    // taxonomy_term->file relationships.
215 220
    'taxonomy_term_data' => array(
216 221
      'field' => 'id',
217 222
      'left_field' => 'tid',
218 223
      'extra' => array(array('field' => 'type', 'value' => 'taxonomy_term')),
219 224
    ),
220
    // Link ourself to the {taxonomy_vocabulary} table so we can provide taxonomy_vocabulary->file relationships.
225
    // Link ourself to the {taxonomy_vocabulary} table so we can provide
226
    // taxonomy_vocabulary->file relationships.
221 227
    'taxonomy_vocabulary' => array(
222 228
      'field' => 'id',
223 229
      'left_field' => 'vid',
......
225 231
    ),
226 232
  );
227 233

  
228
  // Provide a relationship between the files table and each entity type, and between each entity
229
  // type and the files table. Entity->file relationships are type-restricted in the joins
230
  // declared above, and file->entity relationships are type-restricted in the relationship
231
  // declarations below.
232

  
234
  // Provide a relationship between the files table and each entity type, and
235
  // between each entity type and the files table. Entity->file relationships
236
  // are type-restricted in the joins declared above, and file->entity
237
  // relationships are type-restricted in the relationship declarations below.
233 238
  // Relationships between files and nodes.
234 239
  $data['file_usage']['file_to_node'] = array(
235 240
    'title' => t('Content'),
236 241
    'help' => t('Content that is associated with this file, usually because this file is in a field on the content.'),
237
    // Only provide this field/relationship/etc. when the 'file_managed' base table is present.
242
    // Only provide this field/relationship/etc. when the 'file_managed' base
243
    // table is present.
238 244
    'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
239 245
    'real field' => 'id',
240 246
    'relationship' => array(
......
249 255
  $data['file_usage']['node_to_file'] = array(
250 256
    'title' => t('File'),
251 257
    'help' => t('A file that is associated with this node, usually because it is in a field on the node.'),
252
    // Only provide this field/relationship/etc. when the 'node' base table is present.
258
    // Only provide this field/relationship/etc. when the 'node' base table is
259
    // present.
253 260
    'skip base' => array('file_managed', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
254 261
    'real field' => 'fid',
255 262
    'relationship' => array(
......
265 272
  $data['file_usage']['file_to_user'] = array(
266 273
    'title' => t('User'),
267 274
    'help' => t('A user that is associated with this file, usually because this file is in a field on the user.'),
268
    // Only provide this field/relationship/etc. when the 'file_managed' base table is present.
275
    // Only provide this field/relationship/etc. when the 'file_managed' base
276
    // table is present.
269 277
    'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
270 278
    'real field' => 'id',
271 279
    'relationship' => array(
......
280 288
  $data['file_usage']['user_to_file'] = array(
281 289
    'title' => t('File'),
282 290
    'help' => t('A file that is associated with this user, usually because it is in a field on the user.'),
283
    // Only provide this field/relationship/etc. when the 'users' base table is present.
291
    // Only provide this field/relationship/etc. when the 'users' base table is
292
    // present.
284 293
    'skip base' => array('file_managed', 'node', 'node_revision', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
285 294
    'real field' => 'fid',
286 295
    'relationship' => array(
......
296 305
  $data['file_usage']['file_to_comment'] = array(
297 306
    'title' => t('Comment'),
298 307
    'help' => t('A comment that is associated with this file, usually because this file is in a field on the comment.'),
299
    // Only provide this field/relationship/etc. when the 'file_managed' base table is present.
308
    // Only provide this field/relationship/etc. when the 'file_managed' base
309
    // table is present.
300 310
    'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
301 311
    'real field' => 'id',
302 312
    'relationship' => array(
......
311 321
  $data['file_usage']['comment_to_file'] = array(
312 322
    'title' => t('File'),
313 323
    'help' => t('A file that is associated with this comment, usually because it is in a field on the comment.'),
314
    // Only provide this field/relationship/etc. when the 'comment' base table is present.
324
    // Only provide this field/relationship/etc. when the 'comment' base table
325
    // is present.
315 326
    'skip base' => array('file_managed', 'node', 'node_revision', 'users', 'taxonomy_term_data', 'taxonomy_vocabulary'),
316 327
    'real field' => 'fid',
317 328
    'relationship' => array(
......
327 338
  $data['file_usage']['file_to_taxonomy_term'] = array(
328 339
    'title' => t('Taxonomy Term'),
329 340
    'help' => t('A taxonomy term that is associated with this file, usually because this file is in a field on the taxonomy term.'),
330
    // Only provide this field/relationship/etc. when the 'file_managed' base table is present.
341
    // Only provide this field/relationship/etc. when the 'file_managed' base
342
    // table is present.
331 343
    'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
332 344
    'real field' => 'id',
333 345
    'relationship' => array(
......
342 354
  $data['file_usage']['taxonomy_term_to_file'] = array(
343 355
    'title' => t('File'),
344 356
    'help' => t('A file that is associated with this taxonomy term, usually because it is in a field on the taxonomy term.'),
345
    // Only provide this field/relationship/etc. when the 'taxonomy_term_data' base table is present.
357
    // Only provide this field/relationship/etc. when the 'taxonomy_term_data'
358
    // base table is present.
346 359
    'skip base' => array('file_managed', 'node', 'node_revision', 'users', 'comment', 'taxonomy_vocabulary'),
347 360
    'real field' => 'fid',
348 361
    'relationship' => array(
......
358 371
  $data['file_usage']['file_to_taxonomy_vocabulary'] = array(
359 372
    'title' => t('Taxonomy Vocabulary'),
360 373
    'help' => t('A taxonomy vocabulary that is associated with this file, usually because this file is in a field on the taxonomy vocabulary.'),
361
    // Only provide this field/relationship/etc. when the 'file_managed' base table is present.
374
    // Only provide this field/relationship/etc. when the 'file_managed' base
375
    // table is present.
362 376
    'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
363 377
    'real field' => 'id',
364 378
    'relationship' => array(
......
373 387
  $data['file_usage']['taxonomy_vocabulary_to_file'] = array(
374 388
    'title' => t('File'),
375 389
    'help' => t('A file that is associated with this taxonomy vocabulary, usually because it is in a field on the taxonomy vocabulary.'),
376
    // Only provide this field/relationship/etc. when the 'taxonomy_vocabulary' base table is present.
390
    // Only provide this field/relationship/etc. when the 'taxonomy_vocabulary'
391
    // base table is present.
377 392
    'skip base' => array('file_managed', 'node', 'node_revision', 'users', 'comment', 'taxonomy_term_data'),
378 393
    'real field' => 'fid',
379 394
    'relationship' => array(
......
385 400
    ),
386 401
  );
387 402

  
388
  // Provide basic fields from the {file_usage} table to all of the base tables we've declared
389
  // joins to (because there is no 'skip base' property on these fields).
403
  // Provide basic fields from the {file_usage} table to all of the base tables
404
  // we've declared joins to (because there is no 'skip base' property on these
405
  // fields).
390 406
  $data['file_usage']['module'] = array(
391 407
    'title' => t('Module'),
392 408
    'help' => t('The module managing this file relationship.'),
393 409
    'field' => array(
394 410
      'handler' => 'views_handler_field',
395 411
      'click sortable' => TRUE,
396
     ),
412
    ),
397 413
    'filter' => array(
398 414
      'handler' => 'views_handler_filter_string',
399 415
    ),
......
410 426
    'field' => array(
411 427
      'handler' => 'views_handler_field',
412 428
      'click sortable' => TRUE,
413
     ),
429
    ),
414 430
    'filter' => array(
415 431
      'handler' => 'views_handler_filter_string',
416 432
    ),
......
444 460
    'field' => array(
445 461
      'handler' => 'views_handler_field_numeric',
446 462
      'click sortable' => TRUE,
447
     ),
463
    ),
448 464
    'filter' => array(
449 465
      'handler' => 'views_handler_filter_numeric',
450 466
    ),
......
454 470
  );
455 471

  
456 472
  // ----------------------------------------------------------------------
457
  // system table
473
  // System table.
458 474
  $data['system']['table']['group']  = t('System');
459 475

  
460
  // Advertise this table as a possible base table
476
  // Advertise this table as a possible base table.
461 477
  $data['system']['table']['base'] = array(
462 478
    'field' => 'filename',
463 479
    'title' => t('Module/Theme/Theme engine'),
464 480
    'help' => t('Modules/Themes/Theme engines in your codebase.'),
465 481
  );
466 482

  
467
  // fields
468
  // - filename
483
  // Fields.
484
  // - filename.
469 485
  $data['system']['filename'] = array(
470 486
    'title' => t('Module/Theme/Theme engine filename'),
471 487
    'help' => t('The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.'),
......
474 490
      'click sortable' => TRUE,
475 491
    ),
476 492
    'argument' => array(
493
      // The field to display in the summary.
477 494
      'handler' => 'views_handler_argument_string',
478
      'name field' => 'filename', // the field to display in the summary.
495
      'name field' => 'filename',
479 496
    ),
480 497
    'filter' => array(
481 498
      'handler' => 'views_handler_filter_string',
......
484 501
      'handler' => 'views_handler_sort',
485 502
    ),
486 503
  );
487
  // - name
504
  // - name.
488 505
  $data['system']['name'] = array(
489 506
    'title' => t('Module/Theme/Theme engine name'),
490 507
    'help' => t('The name of the item; e.g. node.'),
......
493 510
      'click sortable' => TRUE,
494 511
    ),
495 512
    'argument' => array(
513
      // The field to display in the summary.
496 514
      'handler' => 'views_handler_argument_string',
497
      'name field' => 'name', // the field to display in the summary.
515
      'name field' => 'name',
498 516
    ),
499 517
    'filter' => array(
500 518
      'handler' => 'views_handler_filter_string',
......
503 521
      'handler' => 'views_handler_sort',
504 522
    ),
505 523
  );
506
  // - type
524
  // - type.
507 525
  $data['system']['type'] = array(
508 526
    'title' => t('Type'),
509 527
    'help' => t('The type of the item, either module, theme, or theme_engine.'),
......
512 530
      'click sortable' => TRUE,
513 531
    ),
514 532
    'argument' => array(
533
      // The field to display in the summary.
515 534
      'handler' => 'views_handler_argument_string',
516
      'name field' => 'type', // the field to display in the summary.
535
      'name field' => 'type',
517 536
    ),
518 537
    'filter' => array(
519 538
      'handler' => 'views_handler_filter_system_type',
......
522 541
      'handler' => 'views_handler_sort',
523 542
    ),
524 543
  );
525
  // - status
544
  // - status.
526 545
  $data['system']['status'] = array(
527 546
    'title' => t('Status'),
528 547
    'help' => t('Boolean indicating whether or not this item is enabled.'),
......
531 550
      'click sortable' => TRUE,
532 551
    ),
533 552
    'argument' => array(
553
      // The field to display in the summary.
534 554
      'handler' => 'views_handler_argument_numeric',
535
      'name field' => 'status', // the field to display in the summary.
555
      'name field' => 'status',
536 556
    ),
537 557
    'filter' => array(
538 558
      'handler' => 'views_handler_filter_boolean_operator',
......
541 561
      'handler' => 'views_handler_sort',
542 562
    ),
543 563
  );
544
  // - schema version
564
  // - schema version.
545 565
  $data['system']['schema_version'] = array(
546 566
    'title' => t('Schema version'),
547 567
    'help' => t("The module's database schema version number. -1 if the module is not installed (its tables do not exist); 0 or the largest N of the module's hook_update_N() function that has either been run or existed when the module was first installed."),
......
550 570
      'click sortable' => TRUE,
551 571
    ),
552 572
    'argument' => array(
573
      // The field to display in the summary.
553 574
      'handler' => 'views_handler_argument_numeric',
554
      'name field' => 'schema_version', // the field to display in the summary.
575
      'name field' => 'schema_version',
555 576
    ),
556 577
    'filter' => array(
557 578
      'handler' => 'views_handler_filter_numeric',
......
564 585
  return $data;
565 586
}
566 587

  
588
/**
589
 * Obtain a human readable label for a file's status.
590
 *
591
 * @param int $choice
592
 *   Indicate the file's status, expected to be either '0' for a temporary file
593
 *   or the value of FILE_STATUS_PERMANENT for a permanent file; any other value
594
 *   will be indicated as being 'Unknown'.
595
 *
596
 * @return string
597
 *   A string representing the file's status.
598
 */
567 599
function _views_file_status($choice = NULL) {
568 600
  $status = array(
569 601
    0 => t('Temporary'),

Formats disponibles : Unified diff