/[drupal]/contributions/modules/spaces/spaces_core/spaces_core.module
ViewVC logotype

Contents of /contributions/modules/spaces/spaces_core/spaces_core.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.16 - (show annotations) (download) (as text)
Mon Oct 6 21:56:41 2008 UTC (13 months, 3 weeks ago) by yhahn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +168 -172 lines
File MIME type: text/x-php
Beginning merge of Spaces 2 to DRUPAL-6 branch
1 <?php
2 // $Id: spaces_core.module,v 1.14.2.1.2.3 2008/10/01 06:00:58 yhahn Exp $
3
4 /**
5 * Implementation of hook_menu().
6 */
7 function spaces_core_menu() {
8 $items = array();
9 if (module_exists('book')) {
10 $items['documents'] = array(
11 'title' => t('Documents'),
12 'description' => t('Displays the parent book node for a given spaces group.'),
13 'page callback' => 'spaces_core_documents',
14 'page arguments' => array(1),
15 'access callback' => 'user_access',
16 'access arguments' => array('access content'),
17 'type' => MENU_NORMAL_ITEM,
18 );
19 }
20 if (module_exists('taxonomy')) {
21 $items['taxonomy/term'] = array(
22 'title' => t('Taxonomy'),
23 'description' => t('Custom taxonomy term callback.'),
24 'page callback' => 'spaces_core_taxonomy',
25 'page arguments' => array(1),
26 'access callback' => 'user_access',
27 'access arguments' => array('access content'),
28 'type' => MENU_CALLBACK,
29 );
30 }
31 return $items;
32 }
33
34 /**
35 * Implementation of hook_help().
36 */
37 function spaces_core_help($page) {
38 switch (context_get('spaces', 'feature')) {
39 case 'blog':
40 return "<p>". t('The blog is a team discussion place where you can post and discuss information relevant to your team.') ."</p>";
41 case 'book':
42 return "<p>". t('The book provides a place for you to post documents and other reference material.') ."</p>";
43 }
44 }
45
46 /**
47 * Implementation of hook_block().
48 */
49 function spaces_core_block($op = 'list', $delta = 0) {
50 if ($op == 'list') {
51 $blocks['tags']['info'] = t('Spaces Core: Tag chart');
52 $blocks['book']['info'] = t('Spaces Core: Book navigation');
53 return $blocks;
54 }
55 else if ($op == 'view') {
56 switch ($delta) {
57 case 'tags':
58 return _spaces_core_block_tags();
59 case 'book':
60 return _spaces_core_block_book();
61 }
62 }
63 }
64
65 /**
66 * Implementation of hook_form_alter().
67 */
68 function spaces_core_form_alter($form_id, &$form) {
69 switch ($form_id) {
70 case 'user_edit':
71 unset($form['og_settings']); // Remove the og email settings.
72 break;
73 case 'comment_form':
74 if (!drupal_get_title()) drupal_set_title(t('Reply'));
75 break;
76 }
77 }
78
79 /**
80 * Implementation of hook_nodeapi().
81 */
82 function spaces_core_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
83 switch ($op) {
84 case "view":
85 switch ($node->type) {
86 case 'book':
87 // Hide top book navigation if page is unusually short
88 if (strlen(strip_tags($node->content['body']['#value'])) > 1000) {
89 $node->content['spaces_book'] = array(
90 '#value' => theme('book_navigation', $node, false),
91 '#weight' => -100,
92 );
93 }
94 break;
95 }
96 break;
97 }
98 }
99
100 /**
101 * Implementation of hook_user().
102 */
103 function spaces_core_user($op, &$edit, &$account, $category = NULL) {
104 switch ($op) {
105 case 'view':
106 global $user;
107 context_set('spaces', 'user', $account->uid);
108 if ($user->uid == $account->uid) {
109 $links = array();
110 $links['user']['title'] = t('Edit my account');
111 $links['user']['href'] = 'user/'. $account->uid .'/edit';
112 $links['user']['custom'] = true;
113 context_set('spaces', 'links', $links);
114 }
115 break;
116 }
117 }
118
119 /**
120 * Implementation of hook_default_views().
121 */
122 function spaces_core_views_default_views() {
123 $default_views = array(
124 '_spaces_core_views_blog',
125 '_spaces_core_views_blog_comments',
126 '_spaces_core_views_ref_blog2book',
127 '_spaces_core_views_user_posts',
128 '_spaces_core_views_changes',
129 '_spaces_core_views_comments',
130 '_spaces_core_views_taxonomy',
131 '_spaces_core_views_tags',
132 );
133 foreach ($default_views as $v) {
134 $view = call_user_func($v);
135 if (is_object($view) && $view->name) {
136 $views[$view->name] = $view;
137 }
138 }
139 return $views;
140 }
141
142 /**
143 * Implementation of hook_context_define().
144 */
145 function spaces_core_context_define() {
146 $items = array();
147 if (module_exists('blog')) {
148 $items[] = array(
149 'namespace' => 'spaces',
150 'attribute' => 'feature',
151 'value' => 'blog',
152 'node' => array('blog'),
153 'views' => array('spaces_blog', 'spaces_blog_comments'),
154 'block' => array(
155 array(
156 'module' => 'views',
157 'delta' => 'spaces_blog_comments',
158 'region' => 'right',
159 'weight' => -11,
160 ),
161 ),
162 'spaces' => array(
163 'label' => t('Blog'),
164 'description' => t('A member blog and team discussion space.'),
165 'menu' => array(
166 'blog' => array('title' => t('Blog'), 'weight' => -5),
167 ),
168 ),
169 );
170 }
171 if (module_exists('book')) {
172 $items[] = array(
173 'namespace' => 'spaces',
174 'attribute' => 'feature',
175 'value' => 'book',
176 'node' => array('book'),
177 'block' => array(
178 array(
179 'module' => 'spaces_core',
180 'delta' => 'book',
181 'region' => 'right',
182 'weight' => -11,
183 ),
184 ),
185 'spaces' => array(
186 'label' => t('Documents'),
187 'description' => t('A document section for maintaining a knowledge base.'),
188 'menu' => array(
189 'documents' => array('title' => t('Documents')),
190 ),
191 'types' => array('og'),
192 ),
193 );
194 }
195 if (module_exists('taxonomy')) {
196 $items[] = array(
197 'namespace' => 'spaces',
198 'attribute' => 'feature',
199 'value' => 'taxonomy',
200 'views' => array('spaces_taxonomy'),
201 'block' => array(
202 array(
203 'module' => 'spaces_core',
204 'delta' => 'tags',
205 'region' => 'right',
206 'weight' => -11,
207 ),
208 ),
209 );
210 }
211 return $items;
212 }
213
214 /*
215 * This function acts as a fallback in case users delete or re-path the root book page at 'documents'
216 */
217 function spaces_core_documents() {
218 // og version of the book root lookup
219 if ($space = spaces_get_space()) {
220 if ($view = views_get_view('spaces_book_current')) {
221 $view->set_display();
222 $view->set_items_per_page(0);
223 $view->execute();
224 if (is_array($view->result) && count($view->result)) {
225 $row = array_shift($view->result);
226 drupal_goto('node/'. $row->nid);
227 }
228 }
229 context_ui_set('node', 'book');
230 $message = t('Please add your first book page to get started.');
231 $button = spaces_node_links();
232 $o = "<p>$message</p>$button";
233 return $o;
234 }
235 }
236
237 /**
238 * @TODO: Abstract this into a hook -- we will not always be testing
239 * against OG conditions!
240 *
241 * Page call back to handle taxonomy listing
242 *
243 * If a term is requested in a group context we use a group aware page
244 * when then term's vocabulary is related to any group targeted node
245 * types. If it is from a vocab that doesn't relate to any group aware
246 * content or is request outsite of a group contexts we use a group
247 * agnostic listing.
248 *
249 * @param $tid
250 * The term id to generate a listing page for.
251 *
252 * @return
253 * A themed taxonomy listing page.
254 */
255 function spaces_core_taxonomy($tid) {
256 if (is_numeric($tid) && $t = taxonomy_get_term($tid)) {
257 $v = taxonomy_get_vocabulary($t->vid);
258 }
259 if ($v && $t) {
260 $view = views_get_view('spaces_taxonomy');
261 $content = views_build_view('page', $view, array($tid), true, 25);
262
263 if (is_object($t) && is_object($v)) {
264 drupal_set_title($v->name .': '. $t->name);
265
266 // set taxonomy context
267 context_set('taxonomy', array('vid' => $t->vid, 'tid' => $t->tid));
268 if ($use_gid) {
269 context_set('taxonomy', 'group_vocab', true);
270 }
271 }
272 return $content;
273 }
274 return drupal_not_found(); exit;
275 }
276
277 /**
278 * Implementation of hook_spaces_node_links_alter();
279 */
280 function spaces_core_spaces_node_links_alter(&$links) {
281 if (isset($links['book'])) {
282 if ($space = spaces_get_space()) {
283 if ($space->feature_access('book') && arg(0) == 'node' && is_numeric(arg(1))) {
284 $pid = arg(1);
285 $links['book']['href'] = 'node/add/book/parent/'. $pid;
286 }
287 }
288 }
289 }
290
291 /**
292 * BLOCKS =============================================================
293 */
294 function _spaces_core_block_tags() {
295 $space = spaces_get_space();
296 if (context_get('spaces', 'feature') == 'taxonomy') {
297 $terms = taxonomy_terms_parse_string(arg(2));
298 $tid = $terms['tids'][0];
299 if ($term = taxonomy_get_term($tid)) {
300 $vocab = taxonomy_get_vocabulary($term->vid);
301 $view = views_get_view('spaces_tags');
302 $view->filter[1]['value'] = array($term->vid);
303 $block['content'] = views_build_view('block', $view, array($space->sid));
304 $block['subject'] = $vocab->name;
305 return $block;
306 }
307 }
308 }
309
310 /**
311 * Spaces version of the book nav block -- shows all root books in a group
312 */
313 function _spaces_core_block_book() {
314 $space = spaces_get_space();
315 $block = array();
316 if ($space) {
317 if ($node = menu_get_object()) {
318 $current_bid = empty($node->book['bid']) ? 0 : $node->book['bid'];
319 }
320 // Only display this block when the user is browsing a book.
321 $title = db_result(db_query(db_rewrite_sql('SELECT n.title FROM {node} n WHERE n.nid = %d'), $node->book['bid']));
322
323 // Only show the block if the user has view access for the top-level node.
324 if ($title) {
325 // Set customized title
326 $features = spaces_features();
327 $feature_menu = space_customizer_menu::customize($space, 'book', $features['book']->spaces['menu']);
328 $block['subject'] = isset($feature_menu['documents']['title']) ? $feature_menu['documents']['title'] : t('Documents');
329
330 // Generate book tree per book node in current space
331 $output = '';
332 if ($view = views_get_view('spaces_book_current')) {
333 $view->set_display();
334 $view->set_items_per_page(0);
335 $view->execute();
336 if (is_array($view->result) && count($view->result)) {
337 foreach($view->result as $row) {
338 $tree = menu_tree_all_data(book_menu_name($row->nid), $node->book);
339 $output .= menu_tree_output($tree);
340 }
341 }
342 }
343 $block['content'] = $output;
344 }
345 }
346 return $block;
347 }
348
349 /**
350 * Group-aware book tree generation
351 */
352 function _spaces_core_book_tree($parent = 0, $depth = 3, $unfold = array(), $sid = NULL) {
353 if (!$sid && $space = spaces_get_space()) {
354 $sid = $space->sid;
355 }
356 if ($sid) {
357 $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid JOIN {og_ancestry} og ON og.nid = b.nid WHERE n.status = 1 AND og.group_nid = %d ORDER BY b.weight, n.title'), $sid);
358
359 while ($node = db_fetch_object($result)) {
360 $list = isset($children[$node->parent]) ? $children[$node->parent] : array();
361 $list[] = $node;
362 $children[$node->parent] = $list;
363 }
364
365 if ($tree = book_tree_recurse($parent, $depth, $children, $unfold)) {
366 return '<ul class="menu">'. $tree .'</ul>';
367 }
368 }
369 else {
370 return '';
371 }
372 }
373
374 /* VIEWS */
375
376 function _spaces_core_views_blog() {
377 $view = new stdClass();
378 $view->name = 'spaces_blog';
379 $view->description = t('Provides a default blog listing that is filterable by uid.');
380 $view->access = array();
381 $view->view_args_php = '';
382 $view->menu = TRUE;
383 $view->menu_title = t('Blog');
384 $view->page = TRUE;
385 $view->page_title = t('Blog');
386 $view->page_empty = '<?php print _spaces_views_empty("blog"); ?>';
387 $view->page_empty_format = '2';
388 $view->page_type = 'teaser';
389 $view->url = 'blog';
390 $view->use_pager = TRUE;
391 $view->nodes_per_page = '5';
392 $view->block = TRUE;
393 $view->block_title = t('Recent blog posts');
394 $view->block_empty = "<p class='views-empty'>" . t('No blog entries found.') . "</p>";
395 $view->block_empty_format = '1';
396 $view->block_type = 'spaces_datetitle';
397 $view->nodes_per_block = '3';
398 $view->block_more = TRUE;
399 $view->sort = array (
400 array (
401 'tablename' => 'node',
402 'field' => 'created',
403 'sortorder' => 'DESC',
404 'options' => 'normal',
405 ),
406 );
407 $view->argument = array (
408 array (
409 'type' => 'uid',
410 'argdefault' => '2',
411 'title' => '%1\'s Blog',
412 'options' => '',
413 'wildcard' => 'all',
414 'wildcard_substitution' => '',
415 ),
416 array (
417 'type' => 'node_feed',
418 'argdefault' => '2',
419 'title' => 'Blog',
420 'options' => '',
421 'wildcard' => '',
422 'wildcard_substitution' => '',
423 ),
424 );
425 $view->field = array (
426 array (
427 'tablename' => 'node',
428 'field' => 'created',
429 'label' => '',
430 'handler' => 'views_handler_field_date_small',
431 ),
432 array (
433 'tablename' => 'node',
434 'field' => 'title',
435 'label' => '',
436 'handler' => 'views_handler_field_nodelink',
437 'options' => 'link',
438 ),
439 );
440 $view->filter = array (
441 array (
442 'tablename' => 'node',
443 'field' => 'status',
444 'operator' => '=',
445 'options' => '',
446 'value' => '1',
447 ),
448 array (
449 'tablename' => 'node',
450 'field' => 'type',
451 'operator' => 'OR',
452 'options' => '',
453 'value' => array (
454 0 => 'blog',
455 ),
456 ),
457 array (
458 'tablename' => 'spaces',
459 'field' => 'type',
460 'operator' => 'all',
461 'options' => '',
462 'value' => 'all',
463 ),
464 );
465 $view->exposed_filter = array();
466 $view->requires = array(node);
467 return $view;
468 }
469
470 function _spaces_core_views_blog_comments() {
471 $view = new stdClass();
472 $view->name = 'spaces_blog_comments';
473 $view->description = t('');
474 $view->access = array();
475 $view->view_args_php = '';
476 $view->page = FALSE;
477 $view->block = TRUE;
478 $view->block_title = t('Recent Comments');
479 $view->block_empty = "<p class='views-empty'>" . t('No recent comments.') . "</p>";
480 $view->block_empty_format = '1';
481 $view->block_type = 'spaces_datetitle';
482 $view->nodes_per_block = '5';
483 $view->sort = array (
484 array (
485 'tablename' => 'node_comment_statistics',
486 'field' => 'last_comment_timestamp',
487 'sortorder' => 'DESC',
488 'options' => 'normal',
489 ),
490 );
491 $view->argument = array();
492 $view->field = array (
493 array (
494 'tablename' => 'comments',
495 'field' => 'subject',
496 'label' => t('Comment'),
497 'handler' => 'views_handler_field_commentlink',
498 'options' => 'link',
499 ),
500 array (
501 'tablename' => 'comments',
502 'field' => 'name',
503 'label' => t('By'),
504 ),
505 array (
506 'tablename' => 'node',
507 'field' => 'title',
508 'label' => t('On Post'),
509 'handler' => 'views_handler_field_nodelink',
510 'options' => 'nolink',
511 ),
512 array (
513 'tablename' => 'node_comment_statistics',
514 'field' => 'last_comment_timestamp',
515 'label' => t('Date'),
516 'handler' => 'views_handler_field_date_small',
517 ),
518 );
519 $view->filter = array (
520 array (
521 'tablename' => 'node',
522 'field' => 'status',
523 'operator' => '=',
524 'options' => '',
525 'value' => '1',
526 ),
527 array (
528 'tablename' => 'node_comment_statistics',
529 'field' => 'comment_count',
530 'operator' => '>',
531 'options' => '',
532 'value' => '0',
533 ),
534 array (
535 'tablename' => 'node',
536 'field' => 'type',
537 'operator' => 'OR',
538 'options' => '',
539 'value' => array (
540 0 => 'blog',
541 ),
542 ),
543 array (
544 'tablename' => 'spaces',
545 'field' => 'type',
546 'operator' => 'all',
547 'options' => '',
548 'value' => 'all',
549 ),
550 array (
551 'tablename' => 'node_comment_statistics',
552 'field' => 'last_comment_timestamp',
553 'operator' => '>',
554 'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
555 'value' => 'now',
556 ),
557 );
558 $view->exposed_filter = array();
559 $view->requires = array(node_comment_statistics, comments, node);
560 return $view;
561 }
562
563
564 function _spaces_core_views_ref_blog2book() {
565 $view = new stdClass();
566 $view->name = 'ref_blog2book';
567 $view->description = 'Provides a list of blog entries that refer to the given book page.';
568 $view->access = array();
569 $view->view_args_php = '';
570 $view->page = FALSE;
571 $view->block = TRUE;
572 $view->block_title = t('Discussions');
573 $view->block_type = 'table';
574 $view->nodes_per_block = '50';
575 $view->sort = array (
576 array (
577 'tablename' => 'node',
578 'field' => 'created',
579 'sortorder' => 'DESC',
580 'options' => 'normal',
581 ),
582 );
583 $view->argument = array(
584 array(
585 'type' => 'content: field_referenced_book_page',
586 'argdefault' => '1',
587 ),
588 );
589 $view->field = array (
590 array (
591 'tablename' => 'node',
592 'field' => 'title',
593 'label' => t('Title'),
594 'handler' => 'views_handler_field_nodelink',
595 'options' => 'link',
596 ),
597 array (
598 'tablename' => 'users',
599 'field' => 'name',
600 'label' => t('Author'),
601 ),
602 array (
603 'tablename' => 'node',
604 'field' => 'created',
605 'label' => t('Posted'),
606 'handler' => 'views_handler_field_date_small',
607 ),
608 );
609 $view->filter = array (
610 array (
611 'tablename' => 'node',
612 'field' => 'type',
613 'operator' => 'OR',
614 'options' => '',
615 'value' => array (
616 0 => 'blog',
617 ),
618 ),
619 array (
620 'tablename' => 'spaces',
621 'field' => 'type',
622 'operator' => 'all',
623 'options' => '',
624 'value' => 'all',
625 ),
626 );
627 $view->requires = array(node, node_comment_statistics, users);
628 return $view;
629 }
630
631 function _spaces_core_views_user_posts() {
632 $view = new stdClass();
633 $view->name = 'spaces_user_posts';
634 $view->description = t('Shows updated posts.');
635 $view->access = array();
636 $view->view_args_php = '';
637 $view->page = TRUE;
638 $view->page_title = t('Recent Posts');
639 $view->page_empty = '<p class="views-empty">'.t('No recent posts found').'</p>';
640 $view->page_empty_format = '2';
641 $view->page_type = 'table';
642 $view->url = 'userposts';
643 $view->use_pager = TRUE;
644 $view->nodes_per_page = '25';
645 $view->block = TRUE;
646 $view->block_title = t('Recent Posts');
647 $view->block_empty = '<p class="views-empty">'.t('No recent posts found').'</p>';
648 $view->block_empty_format = '1';
649 $view->block_type = 'table';
650 $view->nodes_per_block = '10';
651 $view->block_more = TRUE;
652 $view->sort = array (
653 array (
654 'tablename' => 'node_comment_statistics',
655 'field' => 'last_comment_timestamp',
656 'sortorder' => 'DESC',
657 'options' => 'normal',
658 ),
659 );
660 $view->argument = array(
661 array (
662 'type' => 'uidtouch',
663 'argdefault' => '7',
664 'title' => "%1's Posts",
665 ),
666 );
667 $view->field = array (
668 array (
669 'tablename' => 'node',
670 'field' => 'title',
671 'label' => 'Title',
672 'handler' => 'views_handler_field_nodelink_with_mark',
673 'options' => 'link',
674 ),
675 array (
676 'tablename' => 'node',
677 'field' => 'type',
678 'label' => 'Type',
679 ),
680 array (
681 'tablename' => 'node_comment_statistics',
682 'field' => 'comment_count',
683 'label' => 'Replies',
684 'handler' => 'views_handler_comments',
685 ),
686 array (
687 'tablename' => 'node_comment_statistics',
688 'field' => 'last_comment_timestamp',
689 'label' => 'Last Post',
690 'handler' => 'views_handler_field_since',
691 'options' => 1,
692 ),
693 );
694 $view->filter = array (
695 array (
696 'tablename' => 'node',
697 'field' => 'status',
698 'operator' => '=',
699 'options' => '',
700 'value' => '1',
701 ),
702 array (
703 'tablename' => 'node',
704 'field' => 'type',
705 'operator' => 'NOR',
706 'options' => '',
707 'value' => array_merge(og_get_types('group'), array('shout')),
708 ),
709 array (
710 'tablename' => 'spaces',
711 'field' => 'type',
712 'operator' => 'all',
713 'options' => '',
714 'value' => 'all',
715 ),
716 );
717 $view->requires = array(node_comment_statistics, node);
718 return $view;
719 }
720
721 function _spaces_core_views_changes() {
722 $view = new stdClass();
723 $view->name = 'spaces_changes';
724 $view->description = t('Displays a list of recently modified nodes.');
725 $view->access = array();
726 $view->view_args_php = '';
727 $view->page = TRUE;
728 $view->page_title = t('Recent Changes');
729 $view->page_type = 'table';
730 $view->url = 'changes';
731 $view->use_pager = TRUE;
732 $view->nodes_per_page = '25';
733 $view->block = TRUE;
734 $view->block_title = t('Recent Changes');
735 $view->block_empty = "<p class='views-empty'>" . t('No recent changes.') . "</p>";
736 $view->block_empty_format = '1';
737 $view->block_type = 'spaces_datetitle';
738 $view->nodes_per_block = '5';
739 $view->argument = array();
740 $view->sort = array (
741 array (
742 'tablename' => 'node',
743 'field' => 'changed',
744 'sortorder' => 'DESC',
745 'options' => 'normal',
746 ),
747 );
748 $view->field = array (
749 array (
750 'tablename' => 'og_node_data',
751 'field' => 'title',
752 'label' => 'Group',
753 'handler' => 'spaces_views_handler_crayon_name',
754 'options' => 'og',
755 ),
756 array (
757 'tablename' => 'node',
758 'field' => 'title',
759 'label' => t('Title'),
760 'handler' => 'views_handler_field_nodelink',
761 'options' => 'link',
762 ),
763 array (
764 'tablename' => 'node',
765 'field' => 'changed',
766 'label' => t('Changed'),
767 'handler' => 'views_handler_field_since',
768 'options' => 1,
769 ),
770 array (
771 'tablename' => 'node',
772 'field' => 'type',
773 'label' => t('Type'),
774 ),
775 array (
776 'tablename' => 'users',
777 'field' => 'name',
778 'label' => t('Author'),
779 ),
780 );
781 if (variable_get('spaces_calendar_feed_itemtype', '')) {
782 $excluded = array('shout', variable_get('spaces_calendar_feed_itemtype', ''));
783 }
784 else {
785 $excluded = array('shout');
786 }
787 $view->filter = array (
788 array (
789 'tablename' => 'node',
790 'field' => 'type',
791 'operator' => 'NOR',
792 'options' => '',
793 'value' => array_merge(og_get_types('group'), $excluded),
794 ),
795 array (
796 'tablename' => 'og_uid_node',
797 'field' => 'currentuid',
798 'operator' => '=',
799 'options' => '',
800 'value' => '***CURRENT_USER***',
801 ),
802 array (
803 'tablename' => 'spaces',
804 'field' => 'type',
805 'operator' => 'active',
806 'options' => '',
807 'value' => 'all',
808 ),
809 array (
810 'tablename' => 'node',
811 'field' => 'changed',
812 'operator' => '>',
813 'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
814 'value' => 'now',
815 ),
816 );
817 $view->exposed_filter = array();
818 $view->requires = array('node', 'users', 'og_node_data', 'og_uid_node');
819 return $view;
820 }
821
822 function _spaces_core_views_comments() {
823 $view = new stdClass();
824 $view->name = 'spaces_comments';
825 $view->description = t('Displays a listing of recent comments');
826 $view->access = array();
827 $view->view_args_php = '';
828 $view->page = TRUE;
829 $view->page_title = t('Recent Comments');
830 $view->page_empty = '<p class="views-empty">'. t('No recent comments found.') .'</p>';
831 $view->page_empty_format = '2';
832 $view->page_type = 'table';
833 $view->url = 'comments';
834 $view->use_pager = TRUE;
835 $view->nodes_per_page = '25';
836 $view->block = TRUE;
837 $view->block_title = t('Recent Comments');
838 $view->block_empty = "<p class='views-empty'>". t('No recent comments.') ."</p>";
839 $view->block_empty_format = '1';
840 $view->block_type = 'spaces_datetitle';
841 $view->nodes_per_block = '5';
842 $view->sort = array (
843 array (
844 'tablename' => 'node_comment_statistics',
845 'field' => 'last_comment_timestamp',
846 'sortorder' => 'DESC',
847 'options' => 'normal',
848 ),
849 );
850 $view->argument = array();
851 $view->field = array (
852 array (
853 'tablename' => 'og_node_data',
854 'field' => 'title',
855 'label' => 'Group',
856 'handler' => 'spaces_views_handler_crayon_name',
857 'options' => 'og',
858 ),
859 array (
860 'tablename' => 'comments',
861 'field' => 'subject',
862 'label' => t('Comment'),
863 'handler' => 'views_handler_field_commentlink',
864 'options' => 'link',
865 ),
866 array (
867 'tablename' => 'comments',
868 'field' => 'name',
869 'label' => t('By'),
870 ),
871 array (
872 'tablename' => 'node',
873 'field' => 'title',
874 'label' => t('On Post'),
875 'handler' => 'views_handler_field_nodelink',
876 'options' => 'nolink',
877 ),
878 array (
879 'tablename' => 'node',
880 'field' => 'type',
881 'label' => t('Type'),
882 ),
883 array (
884 'tablename' => 'node_comment_statistics',
885 'field' => 'last_comment_timestamp',
886 'label' => t('Date'),
887 'handler' => 'views_handler_field_date_small',
888 ),
889 );
890 $view->filter = array (
891 array (
892 'tablename' => 'node',
893 'field' => 'status',
894 'operator' => '=',
895 'options' => '',
896 'value' => '1',
897 ),
898 array (
899 'tablename' => 'node_comment_statistics',
900 'field' => 'comment_count',
901 'operator' => '>',
902 'options' => '',
903 'value' => '0',
904 ),
905 array (
906 'tablename' => 'og_uid_node',
907 'field' => 'currentuid',
908 'operator' => '=',
909 'options' => '',
910 'value' => '***CURRENT_USER***',
911 ),
912 array (
913 'tablename' => 'spaces',
914 'field' => 'type',
915 'operator' => 'active',
916 'options' => '',
917 'value' => 'all',
918 ),
919 array (
920 'tablename' => 'node_comment_statistics',
921 'field' => 'last_comment_timestamp',
922 'operator' => '>',
923 'options' => -1*SPACES_ARCHIVE_TIMESTAMP,
924 'value' => 'now',
925 ),
926 );
927 $view->exposed_filter = array();
928 $view->requires = array(node_comment_statistics, comments, node, og_node_data, og_uid_node);
929 return $view;
930 }
931
932 function _spaces_core_views_taxonomy() {
933 $view = new stdClass();
934 $view->name = 'spaces_taxonomy';
935 $view->description = t('Spaces taxonomy override.');
936 $view->access = $view->field = $view->exposed_filter = array ();
937 $view->page = TRUE;
938 $view->page_empty = '<p>'. t('No entries found.') . '</p>';
939 $view->page_empty_format = '2';
940 $view->page_type = 'table';
941 $view->use_pager = TRUE;
942 $view->nodes_per_page = '20';
943 $view->field = array(
944 array (
945 'tablename' => 'node',
946 'field' => 'title',
947 'label' => 'Title',
948 'handler' => 'views_handler_field_nodelink',
949 'sortable' => '1',
950 'options' => 'link',
951 ),
952 array (
953 'tablename' => 'node',
954 'field' => 'created',
955 'label' => 'Date',
956 'handler' => 'views_handler_field_date_small',
957 'sortable' => '1',
958 'defaultsort' => 'DESC',
959 ),
960 array (
961 'tablename' => 'node',
962 'field' => 'type',
963 'label' => 'Type',
964 'sortable' => '1',
965 ),
966 );
967 $view->sort = array ();
968 $view->argument = array (
969 array (
970 'type' => 'taxid',
971 'argdefault' => '1',
972 'options' => '0',
973 'wildcard' => '',
974 'wildcard_substitution' => '',
975 ),
976 );
977 $view->filter = array (
978 array (
979 'tablename' => 'node',
980 'field' => 'status',
981 'operator' => '=',
982 'options' => '',
983 'value' => '1',
984 ),
985 array (
986 'tablename' => 'spaces',
987 'field' => 'type',
988 'operator' => 'active',
989 'options' => '',
990 'value' => 'all',
991 ),
992 );
993 $view->requires = array(node);
994 return $view;
995 }
996
997 function _spaces_core_views_tags() {
998 $view = new stdClass();
999 $view->name = 'spaces_tags';
1000 $view->description = '';
1001 $view->access = array();
1002 $view->page = FALSE;
1003 $view->block = TRUE;
1004 $view->block_title = t('Tags');
1005 $view->block_empty = '<p>'. t('No tags found.') .'</p>';
1006 $view->block_empty_format = '1';
1007 $view->block_type = 'tagadelic';
1008 $view->nodes_per_block = '20';
1009 $view->sort = array ();
1010 $view->filter = array (
1011 array (
1012 'tablename' => 'node',
1013 'field' => 'status',
1014 'operator' => '=',
1015 'options' => '',
1016 'value' => '1',
1017 ),
1018 array (
1019 'tablename' => 'term_data',
1020 'field' => 'vid',
1021 'operator' => 'AND',
1022 'options' => '',
1023 'value' => array (
1024 0 => '11',
1025 ),
1026 ),
1027 array (
1028 'tablename' => 'spaces',
1029 'field' => 'type',
1030 'operator' => 'active',
1031 'options' => '',
1032 'value' => 'all',
1033 ),
1034 );
1035 $view->argument = array ();
1036 $view->field = array (
1037 array (
1038 'tablename' => 'term_node',
1039 'field' => 'name',
1040 'label' => '',
1041 'options' => 'link',
1042 ),
1043 );
1044 $view->exposed_filter = array();
1045 $view->requires = array(term_node, node, term_data);
1046 return $view;
1047 }

  ViewVC Help
Powered by ViewVC 1.1.2