/[eiffelstudio]/trunk/Documentation/tools/web/trunk/drupal/sites/all/modules/isedoc/isedoc.module
ViewVC logotype

Contents of /trunk/Documentation/tools/web/trunk/drupal/sites/all/modules/isedoc/isedoc.module

Parent Directory Parent Directory | Revision Log Revision Log


Revision 74747 - (show annotations)
Fri Sep 19 07:54:46 2008 UTC (11 years, 4 months ago) by jfiat
File size: 4231 byte(s)
manage permission for isedoc
1 <?php
2 // $Id$
3
4 /*
5 * Help
6 */
7 function isedoc_help($path, $arg) {
8 $output = '';
9 switch ($path) {
10 case "admin/help#isedoc":
11 $output = '<p>'.t("Import/Export books").'</p>';
12 break;
13 }
14 return $output;
15 } // function isedoc_help
16
17 /**
18 * Implementation of hook_perm().
19 */
20 function isedoc_perm() {
21 return array('admin isedoc');
22 }
23
24
25 /*
26 * Block
27 */
28 function isedoc_block($op = 'list', $delta = 0) {
29 if ($op == 'list') {
30 $block[0]["info"] = t('ISE docs');
31 return $block;
32 } else if ($op == 'view') {
33 $block_content = '';
34 $links = array();
35 if (user_access('import isedoc')) {
36 if (module_exists('isedoc_import')) {
37 $links[] = l('Import into...','admin/content/isedoc_import');
38 } else {
39 $links[] = l('Enabled Import ...','admin/build/modules');
40 }
41 }
42 if (user_access('export isedoc')) {
43 if (module_exists('isedoc_export')) {
44 $links[] = l('Export from ...','admin/content/isedoc_export');
45 } else {
46 $links[] = l('Enabled Export ...','admin/build/modules');
47 }
48 }
49 $n = menu_get_object();
50 if ($n) {
51 $links[] = l('What links here','node/'.$n->nid.'/whatlinkshere');
52 }
53 if (user_access('admin isedoc')) {
54 $links[] = l('Update All','isedoc/update/all');
55 }
56
57 $block_content .= theme('item_list', $links);
58 if ($block_content == '') {
59 return;
60 }
61 $block['subject'] = 'Doc Control';
62 $block['content'] = $block_content;
63 return $block;
64 }
65 } // function isedoc_block
66
67 /**
68 * Implementation of hook_nodeapi().
69 */
70 function isedoc_nodeapi(&$node, $op, $form = NULL, $a4 = NULL) {
71 switch ($op) {
72 case 'prepare':
73 if (is_callable(array($node, 'field_uuid'), TRUE)) {
74 $l_uuid = $node->field_uuid[0]['value'];
75 //drupal_set_message("uuid=[$l_uuid]");
76 if ($l_uuid === NULL) {
77 $l_uuid = isedoc_uuid();
78 $node->field_uuid[0]['value'] = $l_uuid;
79 drupal_set_message(t("Set the UUID value to [$l_uuid]"));
80 }
81 }
82 break;
83 }
84 }
85
86 /*
87 * Menu
88 */
89
90 function isedoc_menu() {
91 $items = array();
92 $items['isedoc/update/%'] = array(
93 'title' => t('Update documentation pages'),
94 'page callback' => 'isedoc_update_pages',
95 'page arguments' => array(2),
96 'access arguments' => array('admin isedoc'),
97 'file' => 'isedoc.update.inc',
98 'type' => MENU_NORMAL_ITEM,
99 );
100 $items['admin/settings/isedoc'] = array(
101 'title' => 'IseDoc',
102 'description' => 'ISE Documentation settings.',
103 'page callback' => 'drupal_get_form',
104 'page arguments' => array('isedoc_admin_settings'),
105 'access arguments' => array('administer site configuration'),
106 'type' => MENU_NORMAL_ITEM,
107 'file' => 'isedoc.admin.inc',
108 );
109 $items['admin/settings/isedoc/nodes'] = array(
110 'title' => 'General',
111 'description' => 'General Settings.',
112 'page callback' => 'drupal_get_form',
113 'page arguments' => array('isedoc_admin_settings'),
114 'access arguments' => array('administer site configuration'),
115 'type' => MENU_DEFAULT_LOCAL_TASK,
116 'file' => 'isedoc.admin.inc',
117 'weight' => '-10',
118 );
119 $items['node/%node/whatlinkshere'] = array(
120 'title' => t('References'),
121 'page callback' => 'isedoc_whatlinkshere',
122 'page arguments' => array(1),
123 'access arguments' => array('access content'),
124 'file' => 'isedoc.whatlinkshere.inc',
125 'weight' => 1,
126 'type' => MENU_LOCAL_TASK,
127 );
128 $items['isedoc/static/%'] = array(
129 'title' => t('Redirect to static content'),
130 'page callback' => 'isedoc_static_query',
131 'page arguments' => array(1),
132 'access arguments' => array('access content'),
133 'file' => 'isedoc.static.inc',
134 'type' => MENU_CALLBACK,
135 );
136 $items['isedoc/uuid/%'] = array(
137 'title' => t('Redirect using UUID'),
138 'page callback' => 'isedoc_uuid_query',
139 'page arguments' => array(2,3),
140 'access arguments' => array('access content'),
141 'file' => 'isedoc.uuid_query.inc',
142 'type' => MENU_CALLBACK,
143 );
144
145 return $items;
146 }
147
148 /*
149 * Lib
150 */
151
152 function isedoc_uuid($prefix = '') {
153 $chars = uniqid(md5(rand()));
154 $uuid = substr($chars,0,8) . '-';
155 $uuid .= substr($chars,8,4) . '-';
156 $uuid .= substr($chars,12,4) . '-';
157 $uuid .= substr($chars,16,4) . '-';
158 $uuid .= substr($chars,20,12);
159 return $prefix . $uuid;
160 }
161
162 ?>

  ViewVC Help
Powered by ViewVC 1.1.23