| 1 |
<?php
|
| 2 |
// $Id: comment.views_default.inc,v 1.6 2008/06/10 21:30:43 merlinofchaos Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Contains default views on behalf of the comment module.
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Implementation of hook_default_view_views().
|
| 10 |
*/
|
| 11 |
function comment_views_default_views() {
|
| 12 |
$view = new view;
|
| 13 |
$view->name = 'comments_recent';
|
| 14 |
$view->description = 'Contains a block and a page to list recent comments; the block will automatically link to the page, which displays the comment body as well as a link to the node.';
|
| 15 |
$view->tag = 'default';
|
| 16 |
$view->view_php = '';
|
| 17 |
$view->base_table = 'comments';
|
| 18 |
$view->is_cacheable = '0';
|
| 19 |
$view->api_version = 2;
|
| 20 |
$view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
|
| 21 |
$handler = $view->new_display('default', 'Defaults', 'default');
|
| 22 |
$handler->override_option('relationships', array(
|
| 23 |
'nid' => array(
|
| 24 |
'id' => 'nid',
|
| 25 |
'table' => 'comments',
|
| 26 |
'field' => 'nid',
|
| 27 |
'label' => 'Node',
|
| 28 |
'required' => FALSE,
|
| 29 |
),
|
| 30 |
));
|
| 31 |
$handler->override_option('fields', array(
|
| 32 |
'subject' => array(
|
| 33 |
'id' => 'subject',
|
| 34 |
'table' => 'comments',
|
| 35 |
'field' => 'subject',
|
| 36 |
'label' => '',
|
| 37 |
'link_to_comment' => 1,
|
| 38 |
'relationship' => 'none',
|
| 39 |
),
|
| 40 |
'timestamp' => array(
|
| 41 |
'id' => 'timestamp',
|
| 42 |
'table' => 'comments',
|
| 43 |
'field' => 'timestamp',
|
| 44 |
'label' => '',
|
| 45 |
'date_format' => 'time ago',
|
| 46 |
'custom_date_format' => '',
|
| 47 |
'relationship' => 'none',
|
| 48 |
),
|
| 49 |
));
|
| 50 |
$handler->override_option('sorts', array(
|
| 51 |
'timestamp' => array(
|
| 52 |
'id' => 'timestamp',
|
| 53 |
'table' => 'comments',
|
| 54 |
'field' => 'timestamp',
|
| 55 |
'order' => 'DESC',
|
| 56 |
'granularity' => 'second',
|
| 57 |
'relationship' => 'none',
|
| 58 |
),
|
| 59 |
));
|
| 60 |
$handler->override_option('filters', array(
|
| 61 |
'status_extra' => array(
|
| 62 |
'id' => 'status_extra',
|
| 63 |
'table' => 'node',
|
| 64 |
'field' => 'status_extra',
|
| 65 |
'operator' => '=',
|
| 66 |
'value' => '',
|
| 67 |
'group' => 0,
|
| 68 |
'exposed' => FALSE,
|
| 69 |
'expose' => array(
|
| 70 |
'operator' => FALSE,
|
| 71 |
'label' => '',
|
| 72 |
),
|
| 73 |
'relationship' => 'nid',
|
| 74 |
),
|
| 75 |
));
|
| 76 |
$handler->override_option('access', array(
|
| 77 |
'type' => 'none',
|
| 78 |
'role' => array(),
|
| 79 |
'perm' => '',
|
| 80 |
));
|
| 81 |
$handler->override_option('title', 'Recent comments');
|
| 82 |
$handler->override_option('items_per_page', 5);
|
| 83 |
$handler->override_option('use_more', 1);
|
| 84 |
$handler->override_option('style_plugin', 'list');
|
| 85 |
$handler->override_option('style_options', array(
|
| 86 |
'type' => 'ul',
|
| 87 |
));
|
| 88 |
$handler = $view->new_display('page', 'Page', 'page');
|
| 89 |
$handler->override_option('fields', array(
|
| 90 |
'title' => array(
|
| 91 |
'id' => 'title',
|
| 92 |
'table' => 'node',
|
| 93 |
'field' => 'title',
|
| 94 |
'label' => 'Reply to',
|
| 95 |
'relationship' => 'nid',
|
| 96 |
'link_to_node' => 1,
|
| 97 |
),
|
| 98 |
'timestamp' => array(
|
| 99 |
'id' => 'timestamp',
|
| 100 |
'table' => 'comments',
|
| 101 |
'field' => 'timestamp',
|
| 102 |
'label' => '',
|
| 103 |
'date_format' => 'time ago',
|
| 104 |
'custom_date_format' => '',
|
| 105 |
'relationship' => 'none',
|
| 106 |
),
|
| 107 |
'subject' => array(
|
| 108 |
'id' => 'subject',
|
| 109 |
'table' => 'comments',
|
| 110 |
'field' => 'subject',
|
| 111 |
'label' => '',
|
| 112 |
'link_to_comment' => 1,
|
| 113 |
'relationship' => 'none',
|
| 114 |
),
|
| 115 |
'comment' => array(
|
| 116 |
'id' => 'comment',
|
| 117 |
'table' => 'comments',
|
| 118 |
'field' => 'comment',
|
| 119 |
'label' => '',
|
| 120 |
'relationship' => 'none',
|
| 121 |
),
|
| 122 |
));
|
| 123 |
$handler->override_option('items_per_page', 25);
|
| 124 |
$handler->override_option('use_pager', '1');
|
| 125 |
$handler->override_option('row_options', array(
|
| 126 |
'inline' => array(
|
| 127 |
'title' => 'title',
|
| 128 |
'timestamp' => 'timestamp',
|
| 129 |
),
|
| 130 |
'separator' => ' ',
|
| 131 |
));
|
| 132 |
$handler->override_option('path', 'comments/recent');
|
| 133 |
$handler->override_option('menu', array(
|
| 134 |
'type' => 'none',
|
| 135 |
'title' => '',
|
| 136 |
'weight' => 0,
|
| 137 |
));
|
| 138 |
$handler->override_option('tab_options', array(
|
| 139 |
'type' => 'none',
|
| 140 |
'title' => '',
|
| 141 |
'weight' => 0,
|
| 142 |
));
|
| 143 |
$handler = $view->new_display('block', 'Block', 'block');
|
| 144 |
$handler->override_option('block_description', 'Recent comments view');
|
| 145 |
$views[$view->name] = $view;
|
| 146 |
|
| 147 |
$view = new view;
|
| 148 |
$view->name = 'tracker';
|
| 149 |
$view->description = 'Shows all new activity on system.';
|
| 150 |
$view->tag = 'default';
|
| 151 |
$view->view_php = '';
|
| 152 |
$view->base_table = 'node';
|
| 153 |
$view->is_cacheable = '0';
|
| 154 |
$view->api_version = 2;
|
| 155 |
$view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
|
| 156 |
$handler = $view->new_display('default', 'Defaults', 'default');
|
| 157 |
$handler->override_option('fields', array(
|
| 158 |
'type' => array(
|
| 159 |
'id' => 'type',
|
| 160 |
'table' => 'node',
|
| 161 |
'field' => 'type',
|
| 162 |
'label' => 'Type',
|
| 163 |
),
|
| 164 |
'title' => array(
|
| 165 |
'id' => 'title',
|
| 166 |
'table' => 'node',
|
| 167 |
'field' => 'title',
|
| 168 |
'label' => 'Title',
|
| 169 |
'link_to_node' => TRUE,
|
| 170 |
),
|
| 171 |
'name' => array(
|
| 172 |
'id' => 'name',
|
| 173 |
'table' => 'users',
|
| 174 |
'field' => 'name',
|
| 175 |
'label' => 'Author',
|
| 176 |
'link_to_user' => TRUE,
|
| 177 |
),
|
| 178 |
'comment_count' => array(
|
| 179 |
'id' => 'comment_count',
|
| 180 |
'table' => 'node_comment_statistics',
|
| 181 |
'field' => 'comment_count',
|
| 182 |
'label' => 'Replies',
|
| 183 |
'set_precision' => FALSE,
|
| 184 |
'precision' => 0,
|
| 185 |
'decimal' => '.',
|
| 186 |
'separator' => ',',
|
| 187 |
'prefix' => '',
|
| 188 |
'suffix' => '',
|
| 189 |
),
|
| 190 |
'last_comment_timestamp' => array(
|
| 191 |
'id' => 'last_comment_timestamp',
|
| 192 |
'table' => 'node_comment_statistics',
|
| 193 |
'field' => 'last_comment_timestamp',
|
| 194 |
'label' => 'Last Post',
|
| 195 |
'date_format' => 'small',
|
| 196 |
'custom_date_format' => '',
|
| 197 |
),
|
| 198 |
'timestamp' => array(
|
| 199 |
'id' => 'timestamp',
|
| 200 |
'table' => 'history_user',
|
| 201 |
'field' => 'timestamp',
|
| 202 |
'label' => '',
|
| 203 |
'comments' => 1,
|
| 204 |
'relationship' => 'none',
|
| 205 |
'link_to_node' => 0,
|
| 206 |
'comment' => 1,
|
| 207 |
),
|
| 208 |
'new_comments' => array(
|
| 209 |
'id' => 'new_comments',
|
| 210 |
'table' => 'node',
|
| 211 |
'field' => 'new_comments',
|
| 212 |
'label' => '',
|
| 213 |
'set_precision' => FALSE,
|
| 214 |
'precision' => 0,
|
| 215 |
'decimal' => '.',
|
| 216 |
'separator' => ',',
|
| 217 |
'prefix' => '',
|
| 218 |
'suffix' => ' new',
|
| 219 |
'link_to_comment' => 1,
|
| 220 |
'no_empty' => 1,
|
| 221 |
'relationship' => 'none',
|
| 222 |
),
|
| 223 |
));
|
| 224 |
$handler->override_option('sorts', array(
|
| 225 |
'last_comment_timestamp' => array(
|
| 226 |
'id' => 'last_comment_timestamp',
|
| 227 |
'table' => 'node_comment_statistics',
|
| 228 |
'field' => 'last_comment_timestamp',
|
| 229 |
'order' => 'ASC',
|
| 230 |
'granularity' => 'second',
|
| 231 |
),
|
| 232 |
));
|
| 233 |
$handler->override_option('arguments', array(
|
| 234 |
'uid_touch' => array(
|
| 235 |
'id' => 'uid_touch',
|
| 236 |
'table' => 'node',
|
| 237 |
'field' => 'uid_touch',
|
| 238 |
'default_action' => 'ignore',
|
| 239 |
'style_plugin' => 'default_summary',
|
| 240 |
'style_options' => array(
|
| 241 |
'count' => TRUE,
|
| 242 |
'override' => FALSE,
|
| 243 |
'items_per_page' => 25,
|
| 244 |
),
|
| 245 |
'wildcard' => 'all',
|
| 246 |
'wildcard_substitution' => 'All',
|
| 247 |
'title' => 'Recent posts for %1',
|
| 248 |
'default_argument_type' => 'fixed',
|
| 249 |
'default_argument' => '',
|
| 250 |
'validate_type' => 'none',
|
| 251 |
'validate_fail' => 'not found',
|
| 252 |
'relationship' => 'none',
|
| 253 |
'default_argument_fixed' => '',
|
| 254 |
'default_argument_php' => '',
|
| 255 |
'validate_argument_node_type' => array(
|
| 256 |
'album' => 0,
|
| 257 |
'artist' => 0,
|
| 258 |
'book' => 0,
|
| 259 |
'page' => 0,
|
| 260 |
'story' => 0,
|
| 261 |
'track' => 0,
|
| 262 |
),
|
| 263 |
'validate_argument_php' => '',
|
| 264 |
),
|
| 265 |
));
|
| 266 |
$handler->override_option('filters', array(
|
| 267 |
'status' => array(
|
| 268 |
'id' => 'status',
|
| 269 |
'table' => 'node',
|
| 270 |
'field' => 'status',
|
| 271 |
'operator' => '=',
|
| 272 |
'value' => '1',
|
| 273 |
'group' => 0,
|
| 274 |
'exposed' => FALSE,
|
| 275 |
'expose' => array(
|
| 276 |
'operator' => FALSE,
|
| 277 |
'label' => '',
|
| 278 |
),
|
| 279 |
'status' => array(
|
| 280 |
'id' => 'status',
|
| 281 |
'table' => 'comments',
|
| 282 |
'field' => 'status',
|
| 283 |
'operator' => '=',
|
| 284 |
'value' => 0,
|
| 285 |
'group' => 0,
|
| 286 |
'exposed' => FALSE,
|
| 287 |
'expose' => array(
|
| 288 |
'operator' => FALSE,
|
| 289 |
'label' => '',
|
| 290 |
),
|
| 291 |
'relationship' => 'none',
|
| 292 |
),
|
| 293 |
),
|
| 294 |
));
|
| 295 |
$handler->override_option('access', array(
|
| 296 |
'type' => 'none',
|
| 297 |
'role' => array(),
|
| 298 |
'perm' => '',
|
| 299 |
));
|
| 300 |
$handler->override_option('title', 'Recent posts');
|
| 301 |
$handler->override_option('items_per_page', '25');
|
| 302 |
$handler->override_option('use_pager', TRUE);
|
| 303 |
$handler->override_option('style_plugin', 'table');
|
| 304 |
$handler->override_option('style_options', array(
|
| 305 |
'override' => 1,
|
| 306 |
'order' => 'desc',
|
| 307 |
'columns' => array(
|
| 308 |
'type' => 'type',
|
| 309 |
'title' => 'title',
|
| 310 |
'name' => 'name',
|
| 311 |
'comment_count' => 'comment_count',
|
| 312 |
'last_comment_timestamp' => 'last_comment_timestamp',
|
| 313 |
'timestamp' => 'title',
|
| 314 |
'new_comments' => 'comment_count',
|
| 315 |
),
|
| 316 |
'info' => array(
|
| 317 |
'type' => array(
|
| 318 |
'sortable' => 1,
|
| 319 |
'separator' => '',
|
| 320 |
),
|
| 321 |
'title' => array(
|
| 322 |
'sortable' => 1,
|
| 323 |
'separator' => ' ',
|
| 324 |
),
|
| 325 |
'name' => array(
|
| 326 |
'sortable' => 1,
|
| 327 |
'separator' => '',
|
| 328 |
),
|
| 329 |
'comment_count' => array(
|
| 330 |
'sortable' => 1,
|
| 331 |
'separator' => '<br />',
|
| 332 |
),
|
| 333 |
'last_comment_timestamp' => array(
|
| 334 |
'sortable' => 1,
|
| 335 |
'separator' => ' ',
|
| 336 |
),
|
| 337 |
'timestamp' => array(
|
| 338 |
'separator' => '',
|
| 339 |
),
|
| 340 |
'new_comments' => array(
|
| 341 |
'separator' => '',
|
| 342 |
),
|
| 343 |
),
|
| 344 |
'default' => 'last_comment_timestamp',
|
| 345 |
));
|
| 346 |
$handler = $view->new_display('page', 'Page', 'page');
|
| 347 |
$handler->override_option('path', 'tracker');
|
| 348 |
$handler->override_option('menu', array(
|
| 349 |
'type' => 'normal',
|
| 350 |
'title' => 'Recent posts',
|
| 351 |
'weight' => 0,
|
| 352 |
));
|
| 353 |
$handler->override_option('tab_options', array(
|
| 354 |
'type' => 'none',
|
| 355 |
'title' => NULL,
|
| 356 |
'weight' => NULL,
|
| 357 |
));
|
| 358 |
$views[$view->name] = $view;
|
| 359 |
|
| 360 |
return $views;
|
| 361 |
}
|