/[pkg-tikiwiki]/tags/feature/1.9.5/external-libs/tiki-sheets.php
ViewVC logotype

Contents of /tags/feature/1.9.5/external-libs/tiki-sheets.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 124 - (show annotations) (download)
Tue Nov 7 12:14:33 2006 UTC (6 years, 7 months ago) by marcusb-guest
File size: 7111 byte(s)
Tag and move branch.
1 <?php
2
3 // $Header: /cvsroot/tikiwiki/tiki/tiki-sheets.php,v 1.6.2.4 2005/04/30 14:56:53 lphuberdeau Exp $
4
5 // Based on tiki-galleries.php
6 // Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
7 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
8 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9
10 // Initialization
11 require_once ('tiki-setup.php');
12 require_once ('lib/sheet/grid.php');
13
14 // Now check permissions to access this page
15 /*
16 if($tiki_p_view != 'y') {
17 $smarty->assign('msg',tra("Permission denied you cannot view pages like this page"));
18 $smarty->display("error.tpl");
19 die;
20 }
21 */
22 if ($feature_sheet != 'y') {
23 $smarty->assign('msg', tra("This feature is disabled").": feature_sheets");
24
25 $smarty->display("error.tpl");
26 die;
27 }
28
29 if ($tiki_p_view_sheet != 'y' && $tiki_p_admin != 'y' && $tiki_p_admin_sheet != 'y') {
30 $smarty->assign('msg', tra("Access Denied").": feature_sheets");
31
32 $smarty->display("error.tpl");
33 die;
34 }
35
36 if (isset($_REQUEST["find"])) {
37 $find = $_REQUEST["find"];
38 } else {
39 $find = '';
40 }
41
42 $smarty->assign('find', $find);
43
44 if (!isset($_REQUEST["sheetId"])) {
45 $_REQUEST["sheetId"] = 0;
46 }
47
48 $smarty->assign('sheetId', $_REQUEST["sheetId"]);
49
50 // Individual permissions are checked because we may be trying to edit the gallery
51
52 // Check here for indivdual permissions the objectType is 'image galleries' and the id is galleryId
53 /*
54 $smarty->assign('individual', 'n');
55
56 if ($userlib->object_has_one_permission($_REQUEST["sheetId"], 'image gallery')) {
57 $smarty->assign('individual', 'y');
58
59 if ($tiki_p_admin != 'y') {
60 // Now get all the permissions that are set for this type of permissions 'image gallery'
61 $perms = $userlib->get_permissions(0, -1, 'permName_desc', '', 'image galleries');
62
63 foreach ($perms["data"] as $perm) {
64 $permName = $perm["permName"];
65
66 if ($userlib->object_has_permission($user, $_REQUEST["sheetId"], 'image gallery', $permName)) {
67 $$permName = 'y';
68
69 $smarty->assign("$permName", 'y');
70 } else {
71 $$permName = 'n';
72
73 $smarty->assign("$permName", 'n');
74 }
75 }
76 }
77 }
78 */
79
80 // Init smarty variables to blank values
81 //$smarty->assign('theme','');
82 $smarty->assign('title', '');
83 $smarty->assign('description', '');
84 $smarty->assign('edit_mode', 'n');
85 $smarty->assign('chart_enabled', (function_exists('imagepng') || function_exists('pdf_new')) ? 'y' : 'n');
86
87 // If we are editing an existing gallery prepare smarty variables
88 if (isset($_REQUEST["edit_mode"]) && $_REQUEST["edit_mode"]) {
89 check_ticket('sheet');
90
91 // Get information about this galleryID and fill smarty variables
92 $smarty->assign('edit_mode', 'y');
93
94 if ($_REQUEST["sheetId"] > 0) {
95 $info = $sheetlib->get_sheet_info($_REQUEST["sheetId"]);
96
97 $smarty->assign('title', $info["title"]);
98 $smarty->assign('description', $info["description"]);
99
100 $info = $sheetlib->get_sheet_layout($_REQUEST["sheetId"]);
101
102 $smarty->assign('className', $info["className"]);
103 $smarty->assign('headerRow', $info["headerRow"]);
104 $smarty->assign('footerRow', $info["footerRow"]);
105 }
106 else
107 {
108 $smarty->assign('className', 'default');
109 $smarty->assign('headerRow', '0');
110 $smarty->assign('footerRow', '0');
111 }
112 }
113
114 // Process the insertion or modification of a gallery here
115 if (isset($_REQUEST["edit"])) {
116 check_ticket('sheet');
117 // Saving information
118 // If the user is not gallery admin
119 if ($tiki_p_admin_sheet != 'y' && $tiki_p_admin != 'y') {
120 if ($tiki_p_edit_sheet != 'y') {
121 // If you can't create a gallery then you can't edit a gallery because you can't have a gallery
122 $smarty->assign('msg', tra("Permission denied you cannot create galleries and so you cant edit them"));
123
124 $smarty->display("error.tpl");
125 die;
126 }
127
128 /* No direct permission yet
129 // If the user can create a gallery then check if he can edit THIS gallery
130 if ($_REQUEST["sheetId"] > 0) {
131 $info = $imagegallib->get_gallery_info($_REQUEST["galleryId"]);
132
133 if (!$user || $info["user"] != $user) {
134 $smarty->assign('msg', tra("Permission denied you cannot edit this gallery"));
135
136 $smarty->display("error.tpl");
137 die;
138 }
139 }*/
140 }
141
142 // Everything is ok so we proceed to edit the gallery
143 $smarty->assign('edit_mode', 'y');
144 //$smarty->assign_by_ref('theme',$_REQUEST["theme"]);
145 $smarty->assign_by_ref('title', $_REQUEST["title"]);
146 $smarty->assign_by_ref('description', $_REQUEST["description"]);
147
148 $smarty->assign_by_ref('className', $_REQUEST["className"]);
149 $smarty->assign_by_ref('headerRow', $_REQUEST["headerRow"]);
150 $smarty->assign_by_ref('footerRow', $_REQUEST["footerRow"]);
151
152 $gid = $sheetlib->replace_sheet($_REQUEST["sheetId"], $_REQUEST["title"], $_REQUEST["description"], $user );
153 $sheetlib->replace_layout($gid, $_REQUEST["className"], $_REQUEST["headerRow"], $_REQUEST["footerRow"] );
154
155 $cat_type = 'sheet';
156 $cat_objid = $gid;
157 $cat_desc = substr($_REQUEST["description"], 0, 200);
158 $cat_name = $_REQUEST["title"];
159 $cat_href = "tiki-view_sheets.php?sheetId=" . $cat_objid;
160 include_once ("categorize.php");
161
162 $smarty->assign('edit_mode', 'n');
163 }
164
165 if (isset($_REQUEST["removesheet"])) {
166 if ($tiki_p_admin_sheet != 'y' && $tiki_p_admin != 'y') {
167
168 $smarty->assign('msg', tra("Permission denied you cannot remove this gallery"));
169
170 $smarty->display("error.tpl");
171 die;
172 }
173 $area = 'delsheet';
174 if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
175 key_check($area);
176 $sheetlib->remove_sheet($_REQUEST["removesheet"]);
177 } else {
178 key_get($area);
179 }
180 }
181
182 if (!isset($_REQUEST["sort_mode"])) {
183 $sort_mode = 'title_desc';
184 } else {
185 $sort_mode = $_REQUEST["sort_mode"];
186 }
187
188 $smarty->assign_by_ref('sort_mode', $sort_mode);
189
190 // If offset is set use it if not then use offset =0
191 // use the maxRecords php variable to set the limit
192 // if sortMode is not set then use lastModif_desc
193 if (!isset($_REQUEST["offset"])) {
194 $offset = 0;
195 } else {
196 $offset = $_REQUEST["offset"];
197 }
198
199 $smarty->assign_by_ref('offset', $offset);
200
201 // Get the list of libraries available for this user (or public galleries)
202 // GET ALL GALLERIES SINCE ALL GALLERIES ARE BROWSEABLE
203 $sheets = $sheetlib->list_sheets($offset, $maxRecords, $sort_mode, $find);
204
205 // If there're more records then assign next_offset
206 $cant_pages = ceil($sheets["cant"] / $maxRecords);
207 $smarty->assign_by_ref('cant_pages', $cant_pages);
208 $smarty->assign('actual_page', 1 + ($offset / $maxRecords));
209
210 if ($sheets["cant"] > ($offset + $maxRecords)) {
211 $smarty->assign('next_offset', $offset + $maxRecords);
212 } else {
213 $smarty->assign('next_offset', -1);
214 }
215
216 // If offset is > 0 then prev_offset
217 if ($offset > 0) {
218 $smarty->assign('prev_offset', $offset - $maxRecords);
219 } else {
220 $smarty->assign('prev_offset', -1);
221 }
222
223 $smarty->assign_by_ref('sheets', $sheets["data"]);
224 //print_r($galleries["data"]);
225 $cat_type = 'sheet';
226 $cat_objid = $_REQUEST["sheetId"];
227 include_once ("categorize_list.php");
228
229 $section = 'sheet';
230 include_once ('tiki-section_options.php');
231 ask_ticket('sheet');
232
233 // Display the template
234 $smarty->assign('mid', 'tiki-sheets.tpl');
235 $smarty->display("tiki.tpl");
236
237 ?>

  ViewVC Help
Powered by ViewVC 1.1.5