/[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 74850 - (show annotations)
Fri Sep 26 17:38:58 2008 UTC (11 years, 3 months ago) by jfiat
File size: 5155 byte(s)
added a way to reorganize the images galleries
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', 'query 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 books','isedoc/update/_');
55 }
56 if (user_access('query isedoc')) {
57 $links[] = l('Check/report','isedoc/report/doc/_');
58 }
59 if (isedoc_user_can_edit()) {
60 $links[] = l('List Templates','isedoc/templates');
61 }
62
63 $block_content .= theme('item_list', $links);
64 if ($block_content == '') {
65 return;
66 }
67 $block['subject'] = 'Doc Control';
68 $block['content'] = $block_content;
69 return $block;
70 }
71 } // function isedoc_block
72
73 /**
74 * Implementation of hook_nodeapi().
75 */
76 function isedoc_nodeapi(&$node, $op, $form = NULL, $a4 = NULL) {
77 switch ($op) {
78 case 'prepare':
79 if ($node->type == 'doc' and is_callable(array($node, 'field_uuid'), TRUE)) {
80 $l_uuid = $node->field_uuid[0]['value'];
81 //drupal_set_message("uuid=[$l_uuid]");
82 if ($l_uuid === NULL) {
83 $l_uuid = isedoc_uuid();
84 $node->field_uuid[0]['value'] = $l_uuid;
85 drupal_set_message(t("Set the UUID value to [$l_uuid]"));
86 }
87 }
88 break;
89 }
90 }
91
92 /*
93 * Menu
94 */
95
96 function isedoc_menu() {
97 $items = array();
98 $items['isedoc/update/%'] = array(
99 'title' => t('Update documentation pages'),
100 'page callback' => 'isedoc_update_pages',
101 'page arguments' => array(2,3),
102 'access arguments' => array('admin isedoc'),
103 'file' => 'isedoc.update.inc',
104 'type' => MENU_NORMAL_ITEM,
105 );
106 $items['isedoc/report/%/%'] = array(
107 'title' => t('Check documentation pages and report'),
108 'page callback' => 'isedoc_report',
109 'page arguments' => array(2,3,4),
110 'access arguments' => array('query isedoc'),
111 'file' => 'isedoc.report.inc',
112 'type' => MENU_NORMAL_ITEM,
113 );
114 $items['admin/settings/isedoc'] = array(
115 'title' => 'IseDoc',
116 'description' => 'ISE Documentation settings.',
117 'page callback' => 'drupal_get_form',
118 'page arguments' => array('isedoc_admin_settings'),
119 'access arguments' => array('administer site configuration'),
120 'type' => MENU_NORMAL_ITEM,
121 'file' => 'isedoc.admin.inc',
122 );
123 $items['admin/settings/isedoc/nodes'] = array(
124 'title' => 'General',
125 'description' => 'General Settings.',
126 'page callback' => 'drupal_get_form',
127 'page arguments' => array('isedoc_admin_settings'),
128 'access arguments' => array('administer site configuration'),
129 'type' => MENU_DEFAULT_LOCAL_TASK,
130 'file' => 'isedoc.admin.inc',
131 'weight' => '-10',
132 );
133 $items['node/%node/whatlinkshere'] = array(
134 'title' => t('References'),
135 'page callback' => 'isedoc_whatlinkshere',
136 'page arguments' => array(1),
137 'access arguments' => array('access content'),
138 'file' => 'isedoc.whatlinkshere.inc',
139 'weight' => 1,
140 'type' => MENU_LOCAL_TASK,
141 );
142 $items['isedoc/templates'] = array(
143 'title' => t('Templates'),
144 'page callback' => 'isedoc_list_templates',
145 'page arguments' => array(2),
146 'access arguments' => array('edit any doc content'),
147 'file' => 'isedoc.queries.inc',
148 'weight' => 1,
149 'type' => MENU_NORMAL_ITEM,
150 );
151 $items['isedoc/static/%'] = array(
152 'title' => t('Redirect to static content'),
153 'page callback' => 'isedoc_static_query',
154 'page arguments' => array(1),
155 'access arguments' => array('access content'),
156 'file' => 'isedoc.static.inc',
157 'type' => MENU_CALLBACK,
158 );
159 $items['isedoc/uuid/%'] = array(
160 'title' => t('Redirect using UUID'),
161 'page callback' => 'isedoc_uuid_query',
162 'page arguments' => array(2,3),
163 'access arguments' => array('access content'),
164 'file' => 'isedoc.uuid_query.inc',
165 'type' => MENU_CALLBACK,
166 );
167
168 return $items;
169 }
170
171 /*
172 * Lib
173 */
174
175 function isedoc_uuid($prefix = '') {
176 $chars = uniqid(md5(rand()));
177 $uuid = substr($chars,0,8) . '-';
178 $uuid .= substr($chars,8,4) . '-';
179 $uuid .= substr($chars,12,4) . '-';
180 $uuid .= substr($chars,16,4) . '-';
181 $uuid .= substr($chars,20,12);
182 return $prefix . $uuid;
183 }
184
185 function isedoc_user_can_edit($type='doc') {
186 return user_access('edit any '.$type.' content');
187 }
188
189 ?>

  ViewVC Help
Powered by ViewVC 1.1.23