[3526] | 1 | <?php |
---|
| 2 | /***************************************************************************\ |
---|
| 3 | * eGroupWare - mydms * |
---|
| 4 | * http://www.linux-at-work.de * |
---|
| 5 | * http://www.phpgw.de * |
---|
| 6 | * http://www.egroupware.org * |
---|
| 7 | * Written by : Lars Kneschke [lkneschke@linux-at-work.de] * |
---|
| 8 | * ------------------------------------------------- * |
---|
| 9 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 10 | * under the terms of the GNU General Public License as published by the * |
---|
| 11 | * Free Software Foundation; version 2 of the License. * |
---|
| 12 | \***************************************************************************/ |
---|
| 13 | |
---|
| 14 | /* $Id: class.uimydms.inc.php 22794 2006-11-06 05:53:11Z lkneschke $ */ |
---|
[4362] | 15 | define('PHPGW_SERVER_ROOT','/var/www/expresso'); |
---|
[3526] | 16 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php'); |
---|
| 17 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php'); |
---|
| 18 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php'); |
---|
| 19 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassAccess.php'); |
---|
| 20 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php'); |
---|
| 21 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassGroup.php'); |
---|
| 22 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php'); |
---|
| 23 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php'); |
---|
| 24 | |
---|
| 25 | class uimydms |
---|
| 26 | { |
---|
| 27 | var $icons = array( |
---|
| 28 | 'txt' => 'txt.png', |
---|
| 29 | 'doc' => 'word.png', |
---|
| 30 | 'rtf' => 'document.png', |
---|
| 31 | 'xls' => 'excel.png', |
---|
| 32 | 'ppt' => 'powerpoint.png', |
---|
| 33 | 'exe' => 'binary.png', |
---|
| 34 | 'html' => 'html.png', |
---|
| 35 | 'htm' => 'html.png', |
---|
| 36 | 'gif' => 'image.png', |
---|
| 37 | 'jpg' => 'image.png', |
---|
| 38 | 'bmp' => 'image.png', |
---|
| 39 | 'png' => 'image.png', |
---|
| 40 | 'log' => 'log.png', |
---|
| 41 | 'midi' => 'midi.png', |
---|
| 42 | 'pdf' => 'pdf.png', |
---|
| 43 | 'wav' => 'sound.png', |
---|
| 44 | 'mp3' => 'sound.png', |
---|
| 45 | 'c' => 'source_c.png', |
---|
| 46 | 'cpp' => 'source_cpp.png', |
---|
| 47 | 'h' => 'source_h.png', |
---|
| 48 | 'java' => 'source_java.png', |
---|
| 49 | 'py' => 'source_py.png', |
---|
| 50 | 'tar' => 'tar.png', |
---|
| 51 | 'gz' => 'gz.png', |
---|
| 52 | 'zip' => 'gz.png', |
---|
| 53 | 'mpg' => 'video.png', |
---|
| 54 | 'avi' => 'video.png', |
---|
| 55 | 'tex' => 'tex.png', |
---|
| 56 | 'default' => 'default.png', |
---|
| 57 | ); |
---|
| 58 | |
---|
| 59 | var $public_functions = array |
---|
| 60 | ( |
---|
| 61 | 'addACL' => 'true', |
---|
| 62 | 'addNotification' => 'true', |
---|
| 63 | 'deleteACL' => 'true', |
---|
| 64 | 'deleteDocument' => 'true', |
---|
| 65 | 'deleteFile' => 'true', |
---|
| 66 | 'deleteNotification' => 'true', |
---|
| 67 | 'folderChooser' => 'true', |
---|
| 68 | 'inheritACL' => 'true', |
---|
| 69 | 'setDefaultAccess' => 'true', |
---|
| 70 | 'updateACL' => 'true', |
---|
| 71 | 'updateDocument' => 'true', |
---|
| 72 | 'updateFile' => 'true', |
---|
| 73 | 'setOwner' => 'true', |
---|
| 74 | 'viewDocument' => 'true', |
---|
| 75 | ); |
---|
| 76 | |
---|
| 77 | function uimydms() |
---|
| 78 | { |
---|
| 79 | $this->t =& CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 80 | $this->bomydms =& CreateObject('mydms.bomydms'); |
---|
| 81 | |
---|
| 82 | if (!is_object($GLOBALS['phpgw']->jscalendar)) |
---|
| 83 | { |
---|
| 84 | $GLOBALS['phpgw']->jscalendar = CreateObject('phpgwapi.jscalendar'); |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | function addACL() |
---|
| 89 | { |
---|
| 90 | $userID = (int)$_POST['userid']; |
---|
| 91 | $groupID = (int)$_POST['groupid']; |
---|
| 92 | $access = (int)$_POST['access']; |
---|
| 93 | |
---|
| 94 | $documentID = (int)$_GET['documentid']; |
---|
| 95 | |
---|
| 96 | if($documentID) |
---|
| 97 | { |
---|
| 98 | $this->bomydms->addACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID), $access); |
---|
| 99 | $this->viewDocument($documentID); |
---|
| 100 | } |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | function addNotification() |
---|
| 104 | { |
---|
| 105 | $userID = $_POST['userid']; |
---|
| 106 | $groupID = $_POST['groupid']; |
---|
| 107 | |
---|
| 108 | $documentID = (int)$_GET['documentid']; |
---|
| 109 | |
---|
| 110 | if($documentID) |
---|
| 111 | { |
---|
| 112 | $this->bomydms->addNotification($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID)); |
---|
| 113 | $this->viewDocument($documentID); |
---|
| 114 | } |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | function folderChooser($_folderID=false) |
---|
| 118 | { |
---|
| 119 | $folderID = ($_folderID === false ? (int)$_GET['folderid'] : $_folderID); |
---|
| 120 | $formName = $_GET['form']; |
---|
| 121 | |
---|
| 122 | $folder = getFolder($folderID); |
---|
| 123 | |
---|
| 124 | $this->display_app_header(); |
---|
| 125 | |
---|
| 126 | $this->t->set_file(array("folderChooser" => "folderChooser.tpl")); |
---|
| 127 | $this->t->set_block('folderChooser', 'main', 'main'); |
---|
| 128 | |
---|
| 129 | $this->t->set_var('folderTree',$this->getFolderTree($folder->getPathNew(), 0, $folder, true)); |
---|
| 130 | $this->t->set_var('formName',$formName); |
---|
| 131 | |
---|
| 132 | $this->t->parse("out","main"); |
---|
| 133 | |
---|
| 134 | print $this->t->get('out','main'); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | /** |
---|
| 138 | * create a folder tree |
---|
| 139 | * |
---|
| 140 | * this function will create a foldertree based on javascript |
---|
| 141 | * on click the sorounding form gets submitted |
---|
| 142 | * |
---|
| 143 | * @param _folders array containing the list of folders |
---|
| 144 | * @param _selected string containing the selected folder |
---|
| 145 | * @param _topFolderName string containing the top folder name |
---|
| 146 | * @param _topFolderDescription string containing the description for the top folder |
---|
| 147 | * @param _formName string name of the sorounding form |
---|
| 148 | * @param _hiddenVar string hidden form value, transports the selected folder |
---|
| 149 | * |
---|
| 150 | * @return string the html code, to be added into the template |
---|
| 151 | */ |
---|
| 152 | function createHTMLFolder($_folders, $_selected, $_divName, $_displayCheckBox=false) |
---|
| 153 | { |
---|
| 154 | |
---|
| 155 | |
---|
| 156 | ?> |
---|
| 157 | <table border=0 padding=0 valign=top width=250px><tr><td valign=top> |
---|
| 158 | <div id=NAVTREE style="position:static">NAVTREE</div> |
---|
| 159 | </td></tr></table> |
---|
| 160 | <style>.navs_action {font-size: 8pt; font-family: Arial, Helvetica}.navs_tree {font-size: 8pt; font-family: Arial, Helvetica}.navs_content {border: 2 groove; padding: 5; font-size: 8pt; font-family: Arial, Helvetica}</style> |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | <script language="JavaScript" type="text/javascript"> |
---|
| 164 | |
---|
| 165 | // variables |
---|
| 166 | var nodes_array = new Array(); |
---|
| 167 | var current_document = -1; |
---|
| 168 | |
---|
| 169 | var nav_div_id='NAVTREE'; |
---|
| 170 | var nav_root = 0; |
---|
| 171 | var nav_tree = new Array(); // nav_tree |
---|
| 172 | var nav_type = new Array(); |
---|
| 173 | |
---|
| 174 | var outmsg=""; |
---|
| 175 | // var indentation |
---|
| 176 | var indent_width = 20; |
---|
| 177 | var indent_height = 10 |
---|
| 178 | // image file |
---|
| 179 | var img_hsize = 40; |
---|
| 180 | var img_vsize = 20; |
---|
| 181 | var img_plus = "../images/nav_plus.gif"; |
---|
| 182 | var img_minus = "../images/nav_minus.gif"; |
---|
| 183 | var img_spacer = "../images/nav_spacer.gif"; |
---|
| 184 | var img_box = "../images/nav_box.gif"; |
---|
| 185 | |
---|
| 186 | //-------------------------------------------------------------- |
---|
| 187 | // Define type of node |
---|
| 188 | |
---|
| 189 | function DefineType(tname, img_prefix) |
---|
| 190 | { this.name = tname; |
---|
| 191 | this.img_prefix = img_prefix; |
---|
| 192 | // preload image |
---|
| 193 | var temp_image = new Image(img_hsize, img_vsize); |
---|
| 194 | temp_image.src = img_prefix + "_collapse.gif"; |
---|
| 195 | var temp_image = new Image(img_hsize, img_vsize); |
---|
| 196 | temp_image.src = img_prefix + "_expand.gif"; |
---|
| 197 | var temp_image = new Image(img_hsize, img_vsize); |
---|
| 198 | temp_image.src = img_prefix + "_open.gif"; |
---|
| 199 | var temp_image = new Image(img_hsize, img_vsize); |
---|
| 200 | temp_image.src = img_prefix + "_close.gif"; |
---|
| 201 | |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | function CreateType(tname, img_prefix) |
---|
| 205 | { var tid = nav_type.length; |
---|
| 206 | nav_type[tid] = new DefineType(tname, img_prefix); |
---|
| 207 | return tid; |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | //-------------------------------------------------------------- |
---|
| 211 | // This function creates a node in the tree with the following arguments: |
---|
| 212 | // parent - parent node number |
---|
| 213 | // Type - F: folder D: document |
---|
| 214 | // state - O: Open C: Close |
---|
| 215 | // header - header to be displayed when closed |
---|
| 216 | // content - detail data to be displayed when opened |
---|
| 217 | function DefineNode(parent, type, state, header, content) |
---|
| 218 | { this.parent = parent; |
---|
| 219 | this.state = state; |
---|
| 220 | this.type = type; |
---|
| 221 | this.header = header; |
---|
| 222 | this.content = content; |
---|
| 223 | this.child = 0; |
---|
| 224 | } |
---|
| 225 | |
---|
| 226 | function CreateNode(parent, type, state, header, content) |
---|
| 227 | { var id = nav_tree.length; |
---|
| 228 | nav_tree[id] = new DefineNode(parent, type, state, header, content); |
---|
| 229 | if ( parent >= 0) |
---|
| 230 | nav_tree[parent].child ++; |
---|
| 231 | return id; |
---|
| 232 | } |
---|
| 233 | |
---|
| 234 | //-------------------------------------------------------------- |
---|
| 235 | function output(msg) |
---|
| 236 | { outmsg += msg; |
---|
| 237 | } |
---|
| 238 | |
---|
| 239 | //-------------------------------------------------------------- |
---|
| 240 | function WriteActionAll(nav_root, nav_root_level, nav_div_id) |
---|
| 241 | { |
---|
| 242 | outmsg=""; |
---|
| 243 | // Display collapse all, expand all icon |
---|
| 244 | output('<span class=navs_action>'); |
---|
| 245 | output('<a href=\'javascript:change_all("open",' |
---|
| 246 | + nav_root+ ',' + nav_root_level + ',"'+nav_div_id+'")\'>'); |
---|
| 247 | output('<img src='+img_plus+' border="0"></a>Expand All '); |
---|
| 248 | output('<a href=\'javascript:change_all("close",' |
---|
| 249 | + nav_root+ ',' + nav_root_level + ',"'+nav_div_id+'")\'>'); |
---|
| 250 | output('<img src='+img_minus+' border="0"></a>Collapse All<p>'); |
---|
| 251 | output('<\/span>'); |
---|
| 252 | // now print it out |
---|
| 253 | element = document.all[nav_div_id]; |
---|
| 254 | element.innerHTML = outmsg; |
---|
| 255 | } |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | //-------------------------------------------------------------- |
---|
| 260 | function WriteMenu(nav_root, nav_root_level, nav_div_id) |
---|
| 261 | { |
---|
| 262 | outmsg=""; |
---|
| 263 | // Create a table for each node |
---|
| 264 | WriteSubTree(nav_root, nav_root_level, nav_root, nav_root_level, nav_div_id); |
---|
| 265 | // now print it out |
---|
| 266 | element = document.all[nav_div_id]; |
---|
| 267 | |
---|
| 268 | element.innerHTML = outmsg; |
---|
| 269 | } |
---|
| 270 | |
---|
| 271 | //---------------------------------------------------------------- |
---|
| 272 | // This function writes all the child node for whatever |
---|
| 273 | // parent node is specified as the argument. Note that |
---|
| 274 | // this function is called recursively whenever any |
---|
| 275 | // child node has children of its own. |
---|
| 276 | function WriteSubTree(id, level, nav_root, nav_root_level, nav_div_id) |
---|
| 277 | { |
---|
| 278 | var child_id; |
---|
| 279 | var indent_space; |
---|
| 280 | |
---|
| 281 | // Write this node data first, don't write main node |
---|
| 282 | if ( level >= 0 ) |
---|
| 283 | { // use table for breaking up column |
---|
| 284 | output('<table class=navs_tree border="0" cellspacing="0" cellpadding="0" width=100%>'); |
---|
| 285 | //--- determine indentation level |
---|
| 286 | indent = level* indent_width + 1; |
---|
| 287 | output('<tr><td width='+indent+'><img src='+img_spacer+ |
---|
| 288 | ' width=' +indent + |
---|
| 289 | ' height='+indent_height+'>'); |
---|
| 290 | //--- display open/collapse action icon |
---|
| 291 | output('<td width='+indent_width+'>'); |
---|
| 292 | if ( nav_tree[id].child == 0 ) |
---|
| 293 | { output('<img src='+img_spacer+ |
---|
| 294 | ' width=' + indent_width + |
---|
| 295 | ' height='+indent_height+'>'); |
---|
| 296 | } |
---|
| 297 | else |
---|
| 298 | { // determine action |
---|
| 299 | if (nav_tree[id].state == "open") |
---|
| 300 | img_src = "_collapse.gif"; |
---|
| 301 | else |
---|
| 302 | img_src = "_expand.gif"; |
---|
| 303 | // extract image node type |
---|
| 304 | node_type = nav_tree[id].type; |
---|
| 305 | img_src = nav_type[node_type].img_prefix + img_src; |
---|
| 306 | // display it |
---|
| 307 | output('<a href=\'javascript:toggle_state(' |
---|
| 308 | + id + ',' + nav_root + "," + nav_root_level + |
---|
| 309 | ',"' + nav_div_id+ '")\'>'); |
---|
| 310 | output('<img src="'+img_src+'" border=0><\/a>') |
---|
| 311 | } |
---|
| 312 | //--- display item state |
---|
| 313 | output('<td width='+indent_width+'>'); |
---|
| 314 | node_type = nav_tree[id].type; |
---|
| 315 | img_src=nav_type[node_type].img_prefix + "_"+nav_tree[id].state+".gif"; |
---|
| 316 | output('<a href=\'javascript:toggle_state(' |
---|
| 317 | + id + ',' + nav_root + "," + nav_root_level + |
---|
| 318 | ',"' + nav_div_id+ '")\'>'); |
---|
| 319 | output('<img src="'+img_src+'" border=0><\/a>') |
---|
| 320 | //--- display header and detail |
---|
| 321 | output("<td><b>"+nav_tree[id].header+"<\/b>"); |
---|
| 322 | if (nav_tree[id].state == "open" && nav_tree[id].content != "") |
---|
| 323 | { output("<tr><td colspan=3><td class=navs_content>"+nav_tree[id].content); |
---|
| 324 | } |
---|
| 325 | output("<\/table>"); |
---|
| 326 | } |
---|
| 327 | //--- Run through all of the parent's child nodes |
---|
| 328 | if (nav_tree[id].state == "open" || level < 0) |
---|
| 329 | { for (child_id = 0; child_id < nav_tree.length; child_id++) |
---|
| 330 | { // skip if the parent is different > |
---|
| 331 | if ( nav_tree[child_id].parent == id && child_id != id ) |
---|
| 332 | WriteSubTree(child_id, level+1, nav_root, nav_root_level, nav_div_id); |
---|
| 333 | } // for each node |
---|
| 334 | } |
---|
| 335 | } // function WriteSubTree |
---|
| 336 | |
---|
| 337 | function toggle_state(id, root, root_level, nav_div_id) |
---|
| 338 | { // toggle the state |
---|
| 339 | current_state = nav_tree[id].state; |
---|
| 340 | if (current_state == "open") |
---|
| 341 | nav_tree[id].state = "close"; |
---|
| 342 | else |
---|
| 343 | nav_tree[id].state = "open"; |
---|
| 344 | // Rewrite the menu |
---|
| 345 | timeout_id = setTimeout('WriteMenu('+root+','+root_level+',"'+nav_div_id+'")', 50) |
---|
| 346 | } |
---|
| 347 | |
---|
| 348 | function change_all(new_state, root, root_level, nav_div_id) |
---|
| 349 | { var current_node; |
---|
| 350 | // change current nod |
---|
| 351 | nav_tree[root].state = new_state; |
---|
| 352 | // Run through the global nodes_array |
---|
| 353 | for (counter = 0; counter < nav_tree.length; counter++) |
---|
| 354 | { if (nav_tree[counter].parent == root) |
---|
| 355 | change_all(new_state, counter, 0, "") |
---|
| 356 | } |
---|
| 357 | // Rewrite the menu |
---|
| 358 | if ( nav_div_id != "") |
---|
| 359 | timeout_id = setTimeout('WriteMenu('+root+','+root_level+',"'+nav_div_id+'")', 50) |
---|
| 360 | } |
---|
| 361 | |
---|
| 362 | </script> |
---|
| 363 | |
---|
| 364 | |
---|
| 365 | |
---|
| 366 | <?php
|
---|
| 367 |
|
---|
| 368 | // Menu01 -- This is from the original example
|
---|
| 369 |
|
---|
| 370 | $this->db = clone($GLOBALS['phpgw']->db); |
---|
| 371 | $this->db->set_app('mydms'); |
---|
| 372 | |
---|
| 373 | |
---|
| 374 | //$queryStr0 = "SELECT distinct parent FROM phpgw_mydms_Folders"; |
---|
| 375 | $queryStr0 ="select parent,id,SEQUENCE,name FROM phpgw_mydms_Folders ORDER BY parent,sequence"; |
---|
| 376 | |
---|
| 377 | |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | $resArr0 = $GLOBALS['mydms']->db->getResultArray($queryStr0); |
---|
| 381 | |
---|
| 382 | //$node0 = new HTML_TreeNode($resArr[$i]["name"], "mydms/out/out.ViewFolder.php?menuaction=dummy&folderid=1", $icon); |
---|
| 383 | |
---|
| 384 | |
---|
| 385 | $txt="<script language=\"JavaScript\" type=\"text/javascript\">nav_type0=CreateType('Folder', '../images/folder');"; |
---|
| 386 | |
---|
| 387 | $txt=$txt." "."nav_type1=CreateType('Document', '../images/document');"; |
---|
| 388 | |
---|
| 389 | |
---|
| 390 | //$txt=$txt." "."nav_tree0=CreateNode(-1, 0, 'close', 'Carpetas Compartidas', '');"; |
---|
| 391 | |
---|
| 392 | for ($i = 0; $i < count($resArr0); $i++) |
---|
| 393 | { |
---|
| 394 | |
---|
| 395 | //$n=$i-1; |
---|
| 396 | //$defaultpos[$i]=$n; |
---|
| 397 | $defaultposicion=$i; |
---|
| 398 | $defaultparent[$resArr0[$i]["id"]]=$resArr0[$i]["parent"]; |
---|
| 399 | $defaultid[$resArr0[$i]["id"]]=$resArr0[$i]["id"]; |
---|
| 400 | $defaultnombre[$resArr0[$i]["id"]]=$defaultposicion; |
---|
| 401 | if($i==0){ |
---|
| 402 | $defaultvalor[$resArr0[$i]["id"]]="-1"; |
---|
| 403 | }else{ |
---|
| 404 | |
---|
| 405 | $defaultvalor[$resArr0[$i]["id"]]=$defaultnombre[$resArr0[$i]["parent"]]; |
---|
| 406 | } |
---|
| 407 | |
---|
| 408 | //echo $resArr0[$i]["name"]." , ".$defaultvalor[$i]." , ".$defaultparent[$i]." , ".$defaultid[$i]." ".$defaultvalor[$resArr0[$i]["id"]]."<br>"; |
---|
| 409 | |
---|
| 410 | } |
---|
| 411 | |
---|
| 412 | |
---|
| 413 | |
---|
| 414 | $queryStr0 = "SELECT distinct parent FROM phpgw_mydms_Folders"; |
---|
| 415 | |
---|
| 416 | |
---|
| 417 | $resArr0 = $GLOBALS['mydms']->db->getResultArray($queryStr0); |
---|
| 418 | |
---|
| 419 | //$node0 = new HTML_TreeNode($resArr[$i]["name"], "mydms/out/out.ViewFolder.php?menuaction=dummy&folderid=1", $icon); |
---|
| 420 | |
---|
| 421 | |
---|
| 422 | $txt="<script language=\"JavaScript\" type=\"text/javascript\">nav_type0=CreateType('Folder', '../images/folder');"; |
---|
| 423 | |
---|
| 424 | $txt=$txt." "."nav_type1=CreateType('Document', '../images/document');"; |
---|
| 425 | |
---|
| 426 | |
---|
| 427 | //$txt=$txt." "."nav_tree0=CreateNode(-1, 0, 'close', 'Carpetas Compartidas', '');"; |
---|
| 428 | |
---|
| 429 | for ($i = 0; $i < count($resArr0); $i++) |
---|
| 430 | { |
---|
| 431 | |
---|
| 432 | |
---|
| 433 | if($valores=='') |
---|
| 434 | { |
---|
| 435 | $valores=$resArr0[$i]["parent"]; |
---|
| 436 | }else |
---|
| 437 | { |
---|
| 438 | $valores=$valores.",".$resArr0[$i]["parent"]; |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | } |
---|
| 442 | |
---|
| 443 | //$txt=$txt." "."nav_tree0=CreateNode(".$n.", 0, 'close', '".$resArr[$i]["name"]."', '');"; |
---|
| 444 | //echo $resArr[$i]["parent"]."<br>"; |
---|
| 445 | |
---|
| 446 | $queryStr = "SELECT * FROM phpgw_mydms_Folders WHERE parent in (".$valores.") ORDER BY parent,sequence"; |
---|
| 447 | |
---|
| 448 | |
---|
| 449 | $resArr = $GLOBALS['mydms']->db->getResultArray($queryStr); |
---|
| 450 | |
---|
| 451 | |
---|
| 452 | |
---|
| 453 | //$this->_subFolders = array(); |
---|
| 454 | for ($ii = 0; $ii < count($resArr); $ii++) |
---|
| 455 | { |
---|
| 456 | |
---|
| 457 | $valor0=$ii+1; |
---|
| 458 | |
---|
| 459 | $valor1="node"; |
---|
| 460 | |
---|
| 461 | |
---|
| 462 | |
---|
| 463 | $valor2=$valor1.$ii; |
---|
| 464 | |
---|
| 465 | |
---|
| 466 | //echo "JJJJJJ".$_GET['folderid']."<br>"; |
---|
| 467 | |
---|
| 468 | |
---|
| 469 | $Activo="close"; |
---|
| 470 | if(($resArr[$ii]["id"]==$_GET['folderid'] )||($resArr[$ii]["id"]==1)) |
---|
| 471 | { |
---|
| 472 | $Activo="open"; |
---|
| 473 | } |
---|
| 474 | $ver=$_GET['folderid']; |
---|
| 475 | while ($ver!=''&&$ver!=1){ |
---|
| 476 | |
---|
| 477 | //echo $ver."<br>"; |
---|
| 478 | if($resArr[$ii]["id"]==$defaultparent[$ver]){ |
---|
| 479 | $Activo="open"; |
---|
| 480 | } |
---|
| 481 | $ver=$defaultparent[$ver]; |
---|
| 482 | |
---|
| 483 | } |
---|
| 484 | |
---|
| 485 | |
---|
| 486 | |
---|
| 487 | $txt=$txt." "."nav_tree1=CreateNode(".$defaultvalor[$resArr[$ii]["id"]].",0, '".$Activo."', '<a href=out.ViewFolder.php?menuaction=dummy&folderid=".$resArr[$ii]["id"]." >".$resArr[$ii]["name"]."</a>', '');"; |
---|
| 488 | |
---|
| 489 | |
---|
| 490 | |
---|
| 491 | |
---|
| 492 | //$txt=$txt." $".$valor1.$valor0."= $".$valor2."->addItem(new HTML_TreeNode(\"".$resArr[$ii]["name"]."\",\"mydms/out///out.ViewFolder.php?menuaction=dummy&folderid=".$resArr[$ii]["id"]."\",\"".$icon."\"));"; |
---|
| 493 | |
---|
| 494 | |
---|
| 495 | |
---|
| 496 | //$valor2=$node0->addItem(new HTML_TreeNode($resArr[$ii]["name"], "mydms/out/out.ViewFolder.php?menuaction=dummy&folderid=".$resArr[$ii]["id"], $icon)); |
---|
| 497 | //echo $resArr[$ii]["id"]." ".$resArr[$ii]["name"]." ". $n."_".$i. "<br> "; |
---|
| 498 | |
---|
| 499 | |
---|
| 500 | } |
---|
| 501 | |
---|
| 502 | |
---|
| 503 | //} |
---|
| 504 | //$txt=$txt." "."$menu02 = new HTML_TreeMenu(\"menuLayer02\", '../imagesAlt', '_self');"; |
---|
| 505 | |
---|
| 506 |
|
---|
| 507 | /* $node1 = new HTML_TreeNode("INBOX", "test.php", $icon);
|
---|
| 508 | $foo = &$node1->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
|
---|
| 509 | $bar = &$foo->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
|
---|
| 510 | $blaat = &$bar->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon)); |
---|
| 511 | $blaat1 = $blaat->addItem(new HTML_TreeNode("deleted-itemswww", "test.php", $icon));
|
---|
| 512 | $blaat1->addItem(new HTML_TreeNode("deleted-items", "test.php", $icon));
|
---|
| 513 |
|
---|
| 514 | $node1->addItem(new HTML_TreeNode("sent-items", "test.php", $icon));
|
---|
| 515 | $node1->addItem(new HTML_TreeNode("drafts", "test.php", $icon)); */
|
---|
| 516 |
|
---|
| 517 |
|
---|
| 518 | // Menu02 -- This uses the "alternate" image directory |
---|
| 519 | |
---|
| 520 | //echo "<script language=\"JavaScript\">.$txt."</script>"; |
---|
| 521 |
|
---|
| 522 | |
---|
| 523 | |
---|
| 524 | $txt=$txt." "."</script><script language=\"JavaScript\" type=\"text/javascript\">WriteMenu(0, 0, 'NAVTREE');</script>"; |
---|
| 525 | //$txt=$txt." "."</script><script language=\"JavaScript\" type=\"text/javascript\">WriteMenu(7, 0, 'NAVDATA');
|
---|
| 526 |
|
---|
| 527 | echo $txt; |
---|
| 528 | |
---|
| 529 | ?> |
---|
| 530 | |
---|
| 531 | |
---|
| 532 | |
---|
| 533 | |
---|
| 534 | <?php |
---|
| 535 | return ""; |
---|
| 536 | |
---|
| 537 | |
---|
| 538 | } |
---|
| 539 | |
---|
| 540 | /* function createHTMLFolder_old($_folders, $_selected, $_divName, $_displayCheckBox=false) |
---|
| 541 | { |
---|
| 542 | $allFolders = $_folders; |
---|
| 543 | |
---|
| 544 | $folderImageDir = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/templates/default/images/'; |
---|
| 545 | |
---|
| 546 | $folder_tree_new = '<link rel="STYLESHEET" type="text/css" href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js/dhtmlxtree/css/dhtmlXTree.css">'; |
---|
| 547 | $folder_tree_new .= "<script type='text/javascript'>"; |
---|
| 548 | $folder_tree_new .= "tree=new dhtmlXTreeObject('$_divName','100%','100%',0);"; |
---|
| 549 | $folder_tree_new .= "tree.setImagePath('$folderImageDir/dhtmlxtree/');"; |
---|
| 550 | $folder_tree_new .= "tree.setOnClickHandler('onNodeSelect');"; |
---|
| 551 | |
---|
| 552 | $linkData = array |
---|
| 553 | ( |
---|
| 554 | 'menuaction' => 'mydms.uifolder.getSubFolder', |
---|
| 555 | ); |
---|
| 556 | $xmlAutoLoadURL = $GLOBALS['phpgw']->link('/index.php',$linkData); |
---|
| 557 | |
---|
| 558 | $folder_tree_new .= "tree.setXMLAutoLoading('$xmlAutoLoadURL');"; |
---|
| 559 | if($_displayCheckBox) |
---|
| 560 | { |
---|
| 561 | $folder_tree_new .= "tree.enableCheckBoxes(1);"; |
---|
| 562 | $folder_tree_new .= "tree.setOnCheckHandler('onCheckHandler');"; |
---|
| 563 | } |
---|
| 564 | |
---|
| 565 | #foreach($allFolders as $folderID => $folderObject) |
---|
| 566 | #{ |
---|
| 567 | $folderObject = array_shift($allFolders); |
---|
| 568 | $image1 = "'folderClosed.gif'"; |
---|
| 569 | $image2 = "0"; |
---|
| 570 | $image3 = "0"; |
---|
| 571 | |
---|
| 572 | $linkData = array |
---|
| 573 | ( |
---|
| 574 | 'menuaction' => 'mydms.uifolder.getInitialFolderView', |
---|
| 575 | 'id' => $folderObject->getID(), |
---|
| 576 | ); |
---|
| 577 | $xmlAutoLoadURL = $GLOBALS['phpgw']->link('/index.php',$linkData); |
---|
| 578 | |
---|
| 579 | if(empty($parentName)) $parentName = '--topfolder--'; |
---|
| 580 | |
---|
| 581 | $entryOptions = 'CHILD,CHECKED'; |
---|
| 582 | |
---|
| 583 | // highlight currently selected mailbox |
---|
| 584 | if ($folderObject->getID() == $_selected->getID()) |
---|
| 585 | { |
---|
| 586 | $entryOptions .= ',SELECT'; |
---|
| 587 | } |
---|
| 588 | |
---|
| 589 | $folderID = $folderObject->getID(); |
---|
| 590 | $folderName = $folderObject->getName(); |
---|
| 591 | $parentID = ($folderObject->_parentID ? $folderObject->_parentID : 0); |
---|
| 592 | |
---|
| 593 | $folder_tree_new .= "tree.insertNewItem('$parentID','$folderID','$folderName',onNodeSelect,$image1,$image2,$image3,'$entryOptions');\n"; |
---|
| 594 | $folder_tree_new .= "tree.openItem('$folderID');"; |
---|
| 595 | $folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=1');"; |
---|
| 596 | $folder_tree_new .= "tree.openItem(1);"; |
---|
| 597 | #$folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=6');"; |
---|
| 598 | #if($_displayCheckBox) |
---|
| 599 | # $folder_tree_new .= "tree.setCheck('$longName','".(int)$obj->subscribed."');"; |
---|
| 600 | #} |
---|
| 601 | |
---|
| 602 | |
---|
| 603 | # foreach($allFolders as $folderID => $folderObject) |
---|
| 604 | # { |
---|
| 605 | # $folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=".$folderObject->getID()."');"; |
---|
| 606 | # $folder_tree_new .= "tree.openItem('".$folderObject->getID()."');"; |
---|
| 607 | # } |
---|
| 608 | |
---|
| 609 | |
---|
| 610 | #$selectedID = $_selected->getID(); |
---|
| 611 | #$folder_tree_new.= "tree.closeAllItems(0);tree.openItem('$selectedID');" |
---|
| 612 | $folder_tree_new.= '</script><a href="#" onclick="javascript:tree.openItem(1); return false;">test</a><a href="#" onclick="javascript:tree.closeItem(1); return false;">test b</a>'; |
---|
| 613 | |
---|
| 614 | return $folder_tree_new; |
---|
| 615 | } |
---|
| 616 | */ |
---|
| 617 | function deleteACL() |
---|
| 618 | { |
---|
| 619 | $userID = (int)$_GET['userid']; |
---|
| 620 | $groupID = (int)$_GET['groupid']; |
---|
| 621 | |
---|
| 622 | $documentID = (int)$_GET['documentid']; |
---|
| 623 | |
---|
| 624 | if($documentID) |
---|
| 625 | { |
---|
| 626 | $this->bomydms->deleteACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID)); |
---|
| 627 | $this->viewDocument($documentID); |
---|
| 628 | } |
---|
| 629 | } |
---|
| 630 | |
---|
| 631 | function deleteDocument() |
---|
| 632 | { |
---|
| 633 | $documentID = (int)$_GET['documentid']; |
---|
| 634 | |
---|
| 635 | if($documentID) |
---|
| 636 | { |
---|
| 637 | $this->bomydms->deleteDocument($documentID); |
---|
| 638 | } |
---|
| 639 | print '<script language="JavaScript">window.close();</script>'; |
---|
| 640 | } |
---|
| 641 | |
---|
| 642 | function deleteFile() |
---|
| 643 | { |
---|
| 644 | $documentID = (int)$_GET['documentid']; |
---|
| 645 | $version = (int)$_GET['version']; |
---|
| 646 | |
---|
| 647 | if($documentID && $version) |
---|
| 648 | { |
---|
| 649 | $this->bomydms->deleteFile($documentID, $version); |
---|
| 650 | $this->viewDocument($documentID); |
---|
| 651 | } |
---|
| 652 | } |
---|
| 653 | |
---|
| 654 | function deleteNotification() |
---|
| 655 | { |
---|
| 656 | $documentID = (int)$_GET['documentid']; |
---|
| 657 | $userID = (int)$_GET['userid']; |
---|
| 658 | $groupID = (int)$_GET['groupid']; |
---|
| 659 | |
---|
| 660 | if($documentID && ($userID || $groupID)) |
---|
| 661 | { |
---|
| 662 | $this->bomydms->deleteNotification($documentID, (!$userID ? false : $userID), (!$groupID ? false : $groupID)); |
---|
| 663 | $this->viewDocument($documentID); |
---|
| 664 | } |
---|
| 665 | } |
---|
| 666 | |
---|
| 667 | function display_app_header() |
---|
| 668 | { |
---|
| 669 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
| 670 | { |
---|
| 671 | $GLOBALS['phpgw']->js =& CreateObject('phpgwapi.javascript'); |
---|
| 672 | } |
---|
| 673 | if (!is_object($GLOBALS['phpgw']->jscalendar)) |
---|
| 674 | { |
---|
| 675 | $GLOBALS['phpgw']->jscalendar = CreateObject('phpgwapi.jscalendar'); |
---|
| 676 | } |
---|
| 677 | $GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon'); |
---|
| 678 | $GLOBALS['phpgw']->js->validate_file('dhtmlxtree','js/dhtmlXTree'); |
---|
| 679 | switch($_GET['menuaction']) |
---|
| 680 | { |
---|
| 681 | case 'mydms.uimydms.addACL': |
---|
| 682 | case 'mydms.uimydms.addNotification': |
---|
| 683 | case 'mydms.uimydms.deleteACL': |
---|
| 684 | case 'mydms.uimydms.deleteFile': |
---|
| 685 | case 'mydms.uimydms.deleteNotification': |
---|
| 686 | case 'mydms.uimydms.setDefaultAccess': |
---|
| 687 | case 'mydms.uimydms.setOwner': |
---|
| 688 | case 'mydms.uimydms.updateACL': |
---|
| 689 | case 'mydms.uimydms.updateFile': |
---|
| 690 | case 'mydms.uimydms.viewDocument': |
---|
| 691 | case 'mydms.uimydms.inheritACL': |
---|
| 692 | $GLOBALS['phpgw']->js->validate_file('tabs','tabs'); |
---|
| 693 | $GLOBALS['phpgw']->js->validate_file('jscode','viewDocument','mydms'); |
---|
| 694 | $GLOBALS['phpgw']->js->validate_file('jscode','mydms','mydms'); |
---|
| 695 | |
---|
| 696 | $GLOBALS['phpgw']->js->set_onload('javascript:initTabs();'); |
---|
| 697 | break; |
---|
| 698 | case 'mydms.uimydms.folderChooser': |
---|
| 699 | $GLOBALS['phpgw']->js->validate_file('jscode','mydms','mydms'); |
---|
| 700 | $GLOBALS['phpgw']->js->validate_file('jscode','folderChooser','mydms'); |
---|
| 701 | break; |
---|
| 702 | } |
---|
| 703 | |
---|
| 704 | $GLOBALS['phpgw_info']['flags']['include_xajax'] = True; |
---|
| 705 | |
---|
| 706 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 707 | #if(!$this->mailPreferences['messageNewWindow']) |
---|
| 708 | # echo parse_navbar(); |
---|
| 709 | } |
---|
| 710 | |
---|
| 711 | function getFolderTree($path, $level = 0, $_activeObj, $isFolder) |
---|
| 712 | { |
---|
| 713 | return $this->createHTMLFolder($path, $_activeObj, 'mydmstreebox'); |
---|
| 714 | } |
---|
| 715 | |
---|
| 716 | function inheritACL() |
---|
| 717 | { |
---|
| 718 | $documentID = (int)$_GET['documentid']; |
---|
| 719 | $action = $_GET['action']; |
---|
| 720 | $mode = $_GET['mode']; |
---|
| 721 | |
---|
| 722 | if($documentID && $action) |
---|
| 723 | { |
---|
| 724 | $this->bomydms->inheritACL($documentID, $action, $mode); |
---|
| 725 | $this->viewDocument($documentID); |
---|
| 726 | } |
---|
| 727 | } |
---|
| 728 | |
---|
| 729 | function setDefaultAccess() |
---|
| 730 | { |
---|
| 731 | $documentID = (int)$_GET['documentid']; |
---|
| 732 | $mode = $_POST['defaultAccess']; |
---|
| 733 | |
---|
| 734 | if($documentID && $mode) |
---|
| 735 | { |
---|
| 736 | $this->bomydms->setDefaultAccess($documentID, $mode); |
---|
| 737 | $this->viewDocument($documentID); |
---|
| 738 | } |
---|
| 739 | } |
---|
| 740 | |
---|
| 741 | function setOwner() |
---|
| 742 | { |
---|
| 743 | $documentID = (int)$_GET['documentid']; |
---|
| 744 | $owner = (int)$_POST['owner']; |
---|
| 745 | |
---|
| 746 | if($documentID && $owner) |
---|
| 747 | { |
---|
| 748 | $this->bomydms->setOwner($documentID, $owner); |
---|
| 749 | $this->viewDocument($documentID); |
---|
| 750 | } |
---|
| 751 | } |
---|
| 752 | |
---|
| 753 | function translate() |
---|
| 754 | { |
---|
| 755 | $this->t->set_var('lang_informations',lang('informations')); |
---|
| 756 | $this->t->set_var('lang_all_versions',lang('all versions')); |
---|
| 757 | $this->t->set_var('lang_linked_documents',lang('linked documents')); |
---|
| 758 | $this->t->set_var('lang_owner',lang('owner')); |
---|
| 759 | $this->t->set_var('lang_comment',lang('comment')); |
---|
| 760 | $this->t->set_var('lang_keywords',lang('keywords')); |
---|
[4362] | 761 | $this->t->set_var('lang_download',lang('Descargar Archivo')); |
---|
[3526] | 762 | $this->t->set_var('lang_last_update',lang('last update')); |
---|
| 763 | $this->t->set_var('lang_current_version',lang('current version')); |
---|
| 764 | $this->t->set_var('lang_uploaded_by',lang('uploaded by')); |
---|
| 765 | $this->t->set_var('lang_file_size',lang('file size')); |
---|
| 766 | $this->t->set_var('lang_filename',lang('filename')); |
---|
| 767 | $this->t->set_var('lang_mime_type',lang('mime type')); |
---|
| 768 | $this->t->set_var('lang_comment_for_current_version',lang('comment for current version')); |
---|
| 769 | $this->t->set_var('lang_creation_date',lang('creation date')); |
---|
| 770 | $this->t->set_var('lang_lock_status',lang('lock status')); |
---|
| 771 | $this->t->set_var('lang_expires',lang('expires')); |
---|
| 772 | $this->t->set_var('lang_version',lang('version')); |
---|
| 773 | $this->t->set_var('lang_upload_date',lang('upload date')); |
---|
| 774 | $this->t->set_var('lang_save',lang('save')); |
---|
| 775 | $this->t->set_var('lang_cancel',lang('cancel')); |
---|
| 776 | $this->t->set_var('lang_delete',lang('delete')); |
---|
| 777 | $this->t->set_var('lang_view_online',lang('view online')); |
---|
[4362] | 778 | $this->t->set_var('lang_confirm_delete',lang('Relmente quiere borrar el documento?')); |
---|
[3526] | 779 | $this->t->set_var('lang_update_document',lang('update document')); |
---|
| 780 | $this->t->set_var('lang_update',lang('update')); |
---|
| 781 | $this->t->set_var('lang_acl',lang('acl')); |
---|
| 782 | $this->t->set_var('lang_name',lang('name')); |
---|
| 783 | $this->t->set_var('lang_move_document',lang('move document')); |
---|
| 784 | $this->t->set_var('lang_folder',lang('folder')); |
---|
| 785 | $this->t->set_var('lang_user',lang('user')); |
---|
| 786 | $this->t->set_var('lang_group',lang('group')); |
---|
| 787 | $this->t->set_var('lang_acl',lang('acl')); |
---|
| 788 | $this->t->set_var('lang_acl_get_inherited',lang('acl get inherited')); |
---|
| 789 | $this->t->set_var('lang_notifications',lang('notifications')); |
---|
| 790 | $this->t->set_var('lang_file_gets_unlocked',lang('this document gets unlocked by you.')); |
---|
| 791 | $this->t->set_var('lang_file_gets_locked',lang('this document gets locked by you!')); |
---|
| 792 | $this->t->set_var('lang_delete_this_notification',lang('delete this notification')); |
---|
| 793 | $this->t->set_var('lang_add_notification',lang('add notification')); |
---|
| 794 | $this->t->set_var('lang_information_about_last_update',lang('information about last update')); |
---|
| 795 | $this->t->set_var('lang_general_information',lang('general information')); |
---|
| 796 | $this->t->set_var('lang_copy_acl',lang('copy acl')); |
---|
| 797 | $this->t->set_var('lang_create_empty_acl',lang('create empty acl')); |
---|
| 798 | $this->t->set_var('lang_inherit_acl_again',lang('inherit acl again')); |
---|
| 799 | $this->t->set_var('lang_default_access',lang('default access')); |
---|
| 800 | $this->t->set_var('lang_permission',lang('permission')); |
---|
| 801 | $this->t->set_var('lang_add_acl',lang('add acl')); |
---|
| 802 | $this->t->set_var('lang_current_acl',lang('current acl')); |
---|
| 803 | $this->t->set_var('lang_access_mode',lang('access mode')); |
---|
| 804 | $this->t->set_var('lang_confirm_acl_delete',lang('Do you really want to delete this acl?')); |
---|
| 805 | } |
---|
| 806 | |
---|
| 807 | function updateACL() |
---|
| 808 | { |
---|
| 809 | $userID = (int)$_GET['userid']; |
---|
| 810 | $groupID = (int)$_GET['groupid']; |
---|
| 811 | $access = (int)$_POST['mode']; |
---|
| 812 | |
---|
| 813 | $documentID = (int)$_GET['documentid']; |
---|
| 814 | |
---|
| 815 | if($documentID) |
---|
| 816 | { |
---|
| 817 | $this->bomydms->updateACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID), $access); |
---|
| 818 | $this->viewDocument($documentID); |
---|
| 819 | } |
---|
| 820 | } |
---|
| 821 | |
---|
| 822 | function updateDocument() |
---|
| 823 | { |
---|
| 824 | $fileName = $_POST['fname']; |
---|
| 825 | $comment = $_POST['comment']; |
---|
| 826 | $keywords = $_POST['keywords']; |
---|
| 827 | $expire = $_POST['expire']; |
---|
| 828 | $expire_date = $GLOBALS['phpgw']->jscalendar->input2date($_POST['expire_date']); |
---|
| 829 | $lockStatus = $_POST['lockStatus']; |
---|
| 830 | $targetID = $_POST['targetid']; |
---|
| 831 | |
---|
| 832 | $documentID = (int)$_GET['documentid']; |
---|
| 833 | |
---|
| 834 | if($documentID) |
---|
| 835 | { |
---|
| 836 | $this->bomydms->updateDocument($documentID,$fileName,$comment,$keywords,($expire ? $expire_date['raw'] : 0)); |
---|
| 837 | if($lockStatus != 'unchanged') |
---|
| 838 | { |
---|
| 839 | $this->bomydms->updateLockStatus($documentID, $lockStatus); |
---|
| 840 | } |
---|
| 841 | if($targetID != 'unchanged') |
---|
| 842 | { |
---|
| 843 | $this->bomydms->moveDocument($documentID, (int)$targetID); |
---|
| 844 | } |
---|
| 845 | } |
---|
| 846 | print '<script language="JavaScript">window.close();</script>'; |
---|
| 847 | } |
---|
| 848 | |
---|
| 849 | function updateFile() |
---|
| 850 | { |
---|
| 851 | $comment = $_POST['comment']; |
---|
| 852 | $expire = $_POST['expire']; |
---|
| 853 | $expire_date = $GLOBALS['phpgw']->jscalendar->input2date($_POST['expire_date_update']); |
---|
| 854 | $documentID = (int)$_GET['documentid']; |
---|
| 855 | $userfile = $_FILES['userfile']; |
---|
| 856 | |
---|
| 857 | if($documentID && is_uploaded_file($userfile['tmp_name'])) |
---|
| 858 | { |
---|
| 859 | $this->bomydms->updateFile($documentID, $userfile, $comment, ($expire ? $expire_date['raw'] : 0)); |
---|
| 860 | $this->viewDocument($documentID); |
---|
| 861 | } |
---|
| 862 | } |
---|
| 863 | |
---|
| 864 | function viewDocument($_documentID=false) |
---|
| 865 | { |
---|
| 866 | $documentID = ($_documentID === false ? (int)$_GET['documentid'] : $_documentID); |
---|
[4362] | 867 | |
---|
| 868 | //echo "documento".$documentID; |
---|
[3526] | 869 | if(!$document = getDocument($documentID)) |
---|
| 870 | { |
---|
| 871 | print "Access denied!"; exit; |
---|
| 872 | } |
---|
[4362] | 873 | |
---|
| 874 | |
---|
[3526] | 875 | $user = getUser($GLOBALS['phpgw_info']['user']['account_id']); |
---|
| 876 | $accessMode = $document->getAccessMode($user); |
---|
| 877 | $owner = $document->getOwner(); |
---|
| 878 | $folder = $document->getFolder(); |
---|
| 879 | $latestContent = $document->getLatestContent(); |
---|
| 880 | $versions = $document->getContent(); |
---|
| 881 | $notifyList = $document->getNotifyList(); |
---|
| 882 | $accessList = $document->getAccessList(); |
---|
| 883 | $updatingUser = $latestContent->getUser(); |
---|
| 884 | |
---|
| 885 | #_debug_array($document); |
---|
| 886 | |
---|
| 887 | $this->display_app_header(); |
---|
| 888 | |
---|
| 889 | $this->t->set_file(array("viewDocument" => "viewDocument.tpl")); |
---|
| 890 | $this->t->set_block('viewDocument', 'main', 'main'); |
---|
| 891 | $this->t->set_block('viewDocument', 'acl_row', 'acl_row'); |
---|
| 892 | $this->t->set_block('viewDocument', 'lock_row', 'lock_row'); |
---|
| 893 | $this->t->set_block('viewDocument', 'version_row', 'version_row'); |
---|
| 894 | $this->t->set_block('viewDocument', 'notification_row', 'notification_row'); |
---|
| 895 | $this->t->set_block('viewDocument', 'information_ro', 'information_ro'); |
---|
| 896 | $this->t->set_block('viewDocument', 'information_rw', 'information_rw'); |
---|
| 897 | $this->t->set_block('viewDocument', 'block_download', 'block_download'); |
---|
| 898 | $this->t->set_block('viewDocument', 'block_view_online', 'block_view_online'); |
---|
| 899 | $this->t->set_block('viewDocument', 'block_delete', 'block_delete'); |
---|
| 900 | $this->t->set_block('viewDocument', 'block_change_owner', 'block_change_owner'); |
---|
| 901 | $this->t->set_block('viewDocument', 'block_acl_inherite', 'block_acl_inherite'); |
---|
| 902 | $this->t->set_block('viewDocument', 'block_acl_notinherite', 'block_acl_notinherite'); |
---|
| 903 | |
---|
| 904 | $downloadImage = $GLOBALS['phpgw']->common->image('mydms','download'); |
---|
| 905 | $viewImage = $GLOBALS['phpgw']->common->image('mydms','view'); |
---|
| 906 | $deleteImage = $GLOBALS['phpgw']->common->image('mydms','del'); |
---|
| 907 | $groupImage = $GLOBALS['phpgw']->common->image('mydms','groupicon'); |
---|
| 908 | $userImage = $GLOBALS['phpgw']->common->image('mydms','usericon'); |
---|
| 909 | $saveImage = $GLOBALS['phpgw']->common->image('mydms','save'); |
---|
| 910 | $this->t->set_var('download_image',$downloadImage); |
---|
| 911 | $this->t->set_var('view_image',$viewImage); |
---|
| 912 | $this->t->set_var('delete_image',$deleteImage); |
---|
| 913 | $this->t->set_var('save_image',$saveImage); |
---|
| 914 | |
---|
| 915 | |
---|
| 916 | $this->translate(); |
---|
| 917 | |
---|
| 918 | $linkData = array |
---|
| 919 | ( |
---|
| 920 | 'menuaction' => 'mydms.uimydms.folderChooser', |
---|
| 921 | ); |
---|
| 922 | $this->t->set_var('folderChooserURL', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 923 | |
---|
| 924 | $linkData = array |
---|
| 925 | ( |
---|
| 926 | 'menuaction' => 'mydms.uimydms.updateDocument', |
---|
| 927 | 'documentid' => $documentID, |
---|
| 928 | ); |
---|
| 929 | $this->t->set_var('action_informations', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 930 | |
---|
| 931 | // download link |
---|
| 932 | $linkData = array |
---|
| 933 | ( |
---|
| 934 | 'documentid' => $documentID, |
---|
| 935 | 'version' => $latestContent->getVersion(), |
---|
| 936 | ); |
---|
| 937 | $this->t->set_var('download_link', $GLOBALS['phpgw']->link('/mydms/op/op.Download.php',$linkData)); |
---|
| 938 | $this->t->parse('download','block_download',True); |
---|
| 939 | |
---|
| 940 | // view Online |
---|
| 941 | if ($latestContent->viewOnline()) |
---|
| 942 | { |
---|
| 943 | $linkData = array |
---|
| 944 | ( |
---|
| 945 | 'documentid' => $documentID, |
---|
| 946 | 'version' => $latestContent->getVersion() |
---|
| 947 | ); |
---|
| 948 | $this->t->set_var('view_link', $GLOBALS['phpgw']->link('/mydms/op/op.ViewOnline.php',$linkData)); |
---|
| 949 | $this->t->parse('view_online','block_view_online',True); |
---|
| 950 | } |
---|
| 951 | |
---|
| 952 | // delete link |
---|
| 953 | if ($accessMode == M_ALL) |
---|
| 954 | { |
---|
| 955 | $linkData = array |
---|
| 956 | ( |
---|
| 957 | 'menuaction' => 'mydms.uimydms.deleteDocument', |
---|
| 958 | 'documentid' => $documentID, |
---|
| 959 | ); |
---|
| 960 | $this->t->set_var('delete_link', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 961 | $this->t->parse('delete','block_delete',True); |
---|
| 962 | } |
---|
| 963 | |
---|
| 964 | $this->t->set_var('owner_fullname', $owner->getFullName()); |
---|
| 965 | $this->t->set_var('owner_email', $owner->getEmail()); |
---|
| 966 | |
---|
| 967 | $this->t->set_var('updater_fullname', $updatingUser->getFullName()); |
---|
| 968 | $this->t->set_var('updater_email', $updatingUser->getEmail()); |
---|
| 969 | |
---|
| 970 | $this->t->set_var('filename', $document->getName()); |
---|
| 971 | $this->t->set_var('comment', $document->getComment()); |
---|
| 972 | $this->t->set_var('keywords', $document->getKeywords()); |
---|
| 973 | $this->t->set_var('creation_date', date("d.m.Y - H:i:s",$document->getDate())); |
---|
| 974 | |
---|
| 975 | $this->t->set_var('foldername', $folder->getName()); |
---|
| 976 | $this->t->set_var('current_folder_id', $folder->getID()); |
---|
| 977 | |
---|
| 978 | // lock status |
---|
| 979 | // lock select box |
---|
| 980 | |
---|
| 981 | if ($document->isLocked()) |
---|
| 982 | { |
---|
| 983 | $lockingUser = $document->getLockingUser(); |
---|
| 984 | |
---|
| 985 | $this->t->set_var('lang_current_status', lang('this document is locked by <a href="mailto:%1">%2</a>.',$lockingUser->getEmail(),$lockingUser->getFullName())); |
---|
| 986 | $this->t->set_var('checked_lock_status', 'checked'); |
---|
| 987 | $this->t->parse('locking','lock_row',True); |
---|
| 988 | } |
---|
| 989 | else |
---|
| 990 | { |
---|
| 991 | $this->t->set_var('lang_current_status', lang('this document is currently not locked.')); |
---|
| 992 | |
---|
| 993 | $this->t->parse('locking','lock_row', True); |
---|
| 994 | } |
---|
| 995 | |
---|
| 996 | if (!is_object($GLOBALS['phpgw']->html)) |
---|
| 997 | { |
---|
| 998 | $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); |
---|
| 999 | } |
---|
| 1000 | |
---|
| 1001 | |
---|
| 1002 | // expire select box |
---|
| 1003 | $selectOptions = array('0' => lang('does not expire'), '1' => lang('expires after')); |
---|
| 1004 | $this->t->set_var('select_expire',$GLOBALS['phpgw']->html->select('expire',(!$document->getExpires() ? 0 : 1),$selectOptions,true,"onchange=\"toggleJSCal(this);\"")); |
---|
| 1005 | #$this->t->set_var('select_expire',$GLOBALS['phpgw']->html->select('expire',(!$document->getExpires() ? 0 : 1),$selectOptions,true,"onchange=\"alert('test')\"")); |
---|
| 1006 | |
---|
| 1007 | if (!$document->getExpires()) |
---|
| 1008 | { |
---|
| 1009 | $this->t->set_var('expire_date_ro',lang('does not expire')); |
---|
| 1010 | $this->t->set_var('expire_date',$GLOBALS['phpgw']->jscalendar->input('expire_date','')); |
---|
| 1011 | $this->t->set_var('expire_class', 'inactive'); |
---|
| 1012 | } |
---|
| 1013 | else |
---|
| 1014 | { |
---|
| 1015 | $this->t->set_var('expire_date_ro',lang('expires after').' '.date("d.m.Y",$document->getExpires())); |
---|
| 1016 | $this->t->set_var('expire_date',$GLOBALS['phpgw']->jscalendar->input('expire_date',$document->getExpires())); |
---|
| 1017 | $this->t->set_var('expire_class', 'active'); |
---|
| 1018 | } |
---|
| 1019 | |
---|
| 1020 | $this->t->set_var('current_version', $latestContent->getVersion()); |
---|
| 1021 | $this->t->set_var('current_comment', $latestContent->getComment()); |
---|
| 1022 | $this->t->set_var('mime_type', $latestContent->getMimeType()); |
---|
| 1023 | $this->t->set_var('file_size', filesize($GLOBALS['phpgw_info']['server']['files_dir'] . '/mydms/' . $latestContent->getPath())); |
---|
| 1024 | $this->t->set_var('last_update', date("d.m.Y - H:i:s",$latestContent->getDate())); |
---|
| 1025 | |
---|
| 1026 | $this->t->set_var('rownum', count($versions)+1); |
---|
| 1027 | |
---|
| 1028 | if (($accessMode >= M_READWRITE)) |
---|
| 1029 | { |
---|
| 1030 | $this->t->parse('informations','information_rw',True); |
---|
| 1031 | } |
---|
| 1032 | else |
---|
| 1033 | { |
---|
| 1034 | $this->t->parse('informations','information_ro',True); |
---|
| 1035 | } |
---|
| 1036 | |
---|
| 1037 | for ($i = count($versions)-1; $i >= 0; $i--) |
---|
| 1038 | { |
---|
| 1039 | $version = $versions[$i]; |
---|
| 1040 | $uploadingUser = $version->getUser(); |
---|
| 1041 | $comment = $version->getComment(); |
---|
| 1042 | //if (strlen($comment) > 25) $comment = substr($comment, 0, 22) . "..."; |
---|
| 1043 | |
---|
| 1044 | $this->t->set_var('version_version', $version->getVersion()); |
---|
| 1045 | $this->t->set_var('version_comment', $version->getComment()); |
---|
| 1046 | $this->t->set_var('version_uploadingUser', $uploadingUser->getFullName()); |
---|
| 1047 | $this->t->set_var('version_date', date("d.m.Y - H:i:s",$version->getDate())); |
---|
| 1048 | if ($version->viewOnline()) |
---|
| 1049 | $this->t->set_var('url_view_online', "<a target=\"_blank\" href=\"../op/viewonline" . $version->getURL()."\"><img src=\"images/view.gif\" width=18 height=18 border=0 title=\"".lang('view online')."\"></a>"); |
---|
| 1050 | else |
---|
| 1051 | $this->t->set_var('url_view_online', ''); |
---|
| 1052 | |
---|
| 1053 | $linkData = array |
---|
| 1054 | ( |
---|
| 1055 | 'documentid' => $documentID, |
---|
| 1056 | 'version' => $version->getVersion() |
---|
| 1057 | ); |
---|
| 1058 | $this->t->set_var('url_download_file', $GLOBALS['phpgw']->link('/mydms/op/op.Download.php',$linkData)); |
---|
| 1059 | |
---|
| 1060 | if (($accessMode == M_ALL) && (count($versions) > 1)) |
---|
| 1061 | { |
---|
| 1062 | $linkData = array |
---|
| 1063 | ( |
---|
| 1064 | 'menuaction' => 'mydms.uimydms.deleteFile', |
---|
| 1065 | 'documentid' => $documentID, |
---|
| 1066 | 'version' => $version->getVersion(), |
---|
| 1067 | 'tabpage' => 2, |
---|
| 1068 | ); |
---|
| 1069 | $this->t->set_var('url_delete_file', |
---|
| 1070 | "<a href=\"".$GLOBALS['phpgw']->link('/index.php',$linkData). |
---|
| 1071 | "\" onClick=\"return confirm('".lang('do you really want to delete this version of the document?'). |
---|
| 1072 | "');\"><img src=\"$deleteImage\" width=15 height=15 border=0 title=\"". |
---|
| 1073 | lang("delete")."\"></a>"); |
---|
| 1074 | } |
---|
| 1075 | |
---|
| 1076 | $this->t->parse('versions','version_row',True); |
---|
| 1077 | } |
---|
| 1078 | |
---|
| 1079 | // div 4 notifications |
---|
| 1080 | $linkData = array |
---|
| 1081 | ( |
---|
| 1082 | 'menuaction' => 'mydms.uimydms.addNotification', |
---|
| 1083 | 'documentid' => $documentID, |
---|
| 1084 | 'tabpage' => 4, |
---|
| 1085 | ); |
---|
| 1086 | $this->t->set_var('notify_form_action', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1087 | |
---|
| 1088 | foreach ((array)$notifyList["users"] as $userNotify) |
---|
| 1089 | { |
---|
| 1090 | $this->t->set_var('notify_username',$userNotify->getFullName()); |
---|
| 1091 | $this->t->set_var('notify_image',$userImage); |
---|
| 1092 | |
---|
| 1093 | $linkData = array |
---|
| 1094 | ( |
---|
| 1095 | 'menuaction' => 'mydms.uimydms.deleteNotification', |
---|
| 1096 | 'documentid' => $documentID, |
---|
| 1097 | 'userid' => $userNotify->getID(), |
---|
| 1098 | 'tabpage' => 4, |
---|
| 1099 | ); |
---|
| 1100 | $this->t->set_var('link_notify_delete', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1101 | |
---|
| 1102 | $this->t->parse('notifications','notification_row',True); |
---|
| 1103 | } |
---|
| 1104 | |
---|
| 1105 | foreach ((array)$notifyList["groups"] as $groupNotify) |
---|
| 1106 | { |
---|
| 1107 | $this->t->set_var('notify_username',$groupNotify->getName()); |
---|
| 1108 | $this->t->set_var('notify_image',$groupImage); |
---|
| 1109 | |
---|
| 1110 | $linkData = array |
---|
| 1111 | ( |
---|
| 1112 | 'menuaction' => 'mydms.uimydms.deleteNotification', |
---|
| 1113 | 'documentid' => $documentID, |
---|
| 1114 | 'groupid' => $groupNotify->getID(), |
---|
| 1115 | 'tabpage' => 4, |
---|
| 1116 | ); |
---|
| 1117 | $this->t->set_var('link_notify_delete', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1118 | |
---|
| 1119 | $this->t->parse('notifications','notification_row',True); |
---|
| 1120 | } |
---|
| 1121 | |
---|
| 1122 | $allUsers = getAllUsers(); |
---|
| 1123 | $allUsersOptions = array('unselected' => lang('please select').'...'); |
---|
| 1124 | foreach ($allUsers as $userObj) |
---|
| 1125 | { |
---|
| 1126 | $allUsersOptions[$userObj->getID()] = $userObj->getFullName(); |
---|
| 1127 | } |
---|
| 1128 | $this->t->set_var('select_userid',$GLOBALS['phpgw']->html->select('userid',0,$allUsersOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.notify_form.submit();\"")); |
---|
| 1129 | |
---|
| 1130 | $allGroups = getAllGroups(); |
---|
| 1131 | $allGroupsOptions = array('unselected' => lang('please select').'...'); |
---|
| 1132 | foreach ($allGroups as $groupObj) |
---|
| 1133 | { |
---|
| 1134 | $allGroupsOptions[$groupObj->getID()] = $groupObj->getName(); |
---|
| 1135 | } |
---|
| 1136 | $this->t->set_var('select_groupid',$GLOBALS['phpgw']->html->select('groupid',0,$allGroupsOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.notify_form.submit();\"")); |
---|
| 1137 | |
---|
| 1138 | // div 5 ACL |
---|
| 1139 | if ($accessMode == M_ALL) |
---|
| 1140 | { |
---|
| 1141 | if ($user->isAdmin()) |
---|
| 1142 | { |
---|
| 1143 | $linkData = array |
---|
| 1144 | ( |
---|
| 1145 | 'menuaction' => 'mydms.uimydms.setOwner', |
---|
| 1146 | 'documentid' => $documentID, |
---|
| 1147 | 'tabpage' => 5, |
---|
| 1148 | ); |
---|
| 1149 | $this->t->set_var('action_change_owner', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1150 | |
---|
| 1151 | $allUsers = getAllUsers(); |
---|
| 1152 | $allUsersOptions = array(); |
---|
| 1153 | foreach ($allUsers as $userObj) |
---|
| 1154 | { |
---|
| 1155 | $allUsersOptions[$userObj->getID()] = $userObj->getFullName(); |
---|
| 1156 | } |
---|
| 1157 | $this->t->set_var('select_ownerid',$GLOBALS['phpgw']->html->select('owner',$owner->getID(),$allUsersOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.change_owner.submit();\"")); |
---|
| 1158 | |
---|
| 1159 | $this->t->parse('change_owner','block_change_owner',True); |
---|
| 1160 | } |
---|
| 1161 | |
---|
| 1162 | if ($document->inheritsAccess()) |
---|
| 1163 | { |
---|
| 1164 | $linkData = array |
---|
| 1165 | ( |
---|
| 1166 | 'menuaction' => 'mydms.uimydms.inheritACL', |
---|
| 1167 | 'documentid' => $documentID, |
---|
| 1168 | 'action' => 'notinherit', |
---|
| 1169 | 'mode' => 'copy', |
---|
| 1170 | 'tabpage' => 5, |
---|
| 1171 | ); |
---|
| 1172 | $this->t->set_var('link_acl_copy', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1173 | |
---|
| 1174 | $linkData = array |
---|
| 1175 | ( |
---|
| 1176 | 'menuaction' => 'mydms.uimydms.inheritACL', |
---|
| 1177 | 'documentid' => $documentID, |
---|
| 1178 | 'action' => 'notinherit', |
---|
| 1179 | 'mode' => 'empty', |
---|
| 1180 | 'tabpage' => 5, |
---|
| 1181 | ); |
---|
| 1182 | $this->t->set_var('link_acl_empty', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1183 | |
---|
| 1184 | $this->t->parse('display_acl','block_acl_inherite',True); |
---|
| 1185 | } |
---|
| 1186 | else |
---|
| 1187 | { |
---|
| 1188 | $linkData = array |
---|
| 1189 | ( |
---|
| 1190 | 'menuaction' => 'mydms.uimydms.inheritACL', |
---|
| 1191 | 'documentid' => $documentID, |
---|
| 1192 | 'action' => 'inherit', |
---|
| 1193 | 'tabpage' => 5, |
---|
| 1194 | ); |
---|
| 1195 | $this->t->set_var('link_acl_inherit_again', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1196 | |
---|
| 1197 | $linkData = array |
---|
| 1198 | ( |
---|
| 1199 | 'menuaction' => 'mydms.uimydms.setDefaultAccess', |
---|
| 1200 | 'documentid' => $documentID, |
---|
| 1201 | 'tabpage' => 5, |
---|
| 1202 | ); |
---|
| 1203 | $this->t->set_var('action_change_default_access', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1204 | |
---|
| 1205 | $linkData = array |
---|
| 1206 | ( |
---|
| 1207 | 'menuaction' => 'mydms.uimydms.addACL', |
---|
| 1208 | 'documentid' => $documentID, |
---|
| 1209 | 'tabpage' => 5, |
---|
| 1210 | ); |
---|
| 1211 | $this->t->set_var('action_add_acl', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1212 | |
---|
| 1213 | |
---|
| 1214 | $defaultACL = array |
---|
| 1215 | ( |
---|
| 1216 | M_NONE => 'access_mode_none', |
---|
| 1217 | M_READ => 'access_mode_read', |
---|
| 1218 | M_READWRITE => 'access_mode_readwrite', |
---|
| 1219 | M_ALL => 'access_mode_all', |
---|
| 1220 | ); |
---|
| 1221 | $this->t->set_var('select_default_access',$GLOBALS['phpgw']->html->select('defaultAccess',$document->getDefaultAccess(),$defaultACL,false,"style=\"width: 300px;\" onchange=\"javascript:document.change_default_access.submit();\"")); |
---|
| 1222 | |
---|
| 1223 | foreach ((array)$accessList["users"] as $userAccess) |
---|
| 1224 | { |
---|
| 1225 | $userObj = $userAccess->getUser(); |
---|
| 1226 | $userMode = $userAccess->getMode(); |
---|
| 1227 | |
---|
| 1228 | $this->t->set_var('acl_username',$userObj->getFullName()); |
---|
| 1229 | $this->t->set_var('acl_image',$userImage); |
---|
| 1230 | |
---|
| 1231 | $linkData = array |
---|
| 1232 | ( |
---|
| 1233 | 'menuaction' => 'mydms.uimydms.updateACL', |
---|
| 1234 | 'documentid' => $documentID, |
---|
| 1235 | 'userid' => $userObj->getID(), |
---|
| 1236 | 'tabpage' => 5, |
---|
| 1237 | ); |
---|
| 1238 | $this->t->set_var('action_acl_row', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1239 | |
---|
| 1240 | $linkData = array |
---|
| 1241 | ( |
---|
| 1242 | 'menuaction' => 'mydms.uimydms.deleteACL', |
---|
| 1243 | 'documentid' => $documentID, |
---|
| 1244 | 'userid' => $userObj->getID(), |
---|
| 1245 | 'tabpage' => 5, |
---|
| 1246 | ); |
---|
| 1247 | $this->t->set_var('link_acl_delete', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1248 | |
---|
| 1249 | $this->t->set_var('acl_selectbox',$GLOBALS['phpgw']->html->select('mode',$userAccess->getMode(),$defaultACL,false,"style=\"width: 300px;\"")); |
---|
| 1250 | |
---|
| 1251 | $this->t->parse('acls','acl_row',True); |
---|
| 1252 | } |
---|
| 1253 | |
---|
| 1254 | foreach ((array)$accessList["groups"] as $groupAccess) |
---|
| 1255 | { |
---|
| 1256 | $groupObj = $groupAccess->getGroup(); |
---|
| 1257 | $groupMode = $groupAccess->getMode(); |
---|
| 1258 | |
---|
| 1259 | $this->t->set_var('acl_username',$groupObj->getName()); |
---|
| 1260 | $this->t->set_var('acl_image',$groupImage); |
---|
| 1261 | |
---|
| 1262 | $linkData = array |
---|
| 1263 | ( |
---|
| 1264 | 'menuaction' => 'mydms.uimydms.updateACL', |
---|
| 1265 | 'documentid' => $documentID, |
---|
| 1266 | 'groupid' => $groupObj->getID(), |
---|
| 1267 | 'tabpage' => 5, |
---|
| 1268 | ); |
---|
| 1269 | $this->t->set_var('action_acl_row', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1270 | |
---|
| 1271 | $linkData = array |
---|
| 1272 | ( |
---|
| 1273 | 'menuaction' => 'mydms.uimydms.deleteACL', |
---|
| 1274 | 'documentid' => $documentID, |
---|
| 1275 | 'groupid' => $groupObj->getID(), |
---|
| 1276 | 'tabpage' => 5, |
---|
| 1277 | ); |
---|
| 1278 | $this->t->set_var('link_acl_delete', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1279 | |
---|
| 1280 | $this->t->set_var('acl_selectbox',$GLOBALS['phpgw']->html->select('mode',$groupAccess->getMode(),$defaultACL,false,"style=\"width: 300px;\"")); |
---|
| 1281 | |
---|
| 1282 | $this->t->parse('acls','acl_row',True); |
---|
| 1283 | } |
---|
| 1284 | |
---|
| 1285 | |
---|
| 1286 | $allUsers = getAllUsers(); |
---|
| 1287 | $allUsersOptions = array('unselected' => lang('please select').'...'); |
---|
| 1288 | foreach ($allUsers as $userObj) |
---|
| 1289 | { |
---|
| 1290 | $allUsersOptions[$userObj->getID()] = $userObj->getFullName(); |
---|
| 1291 | } |
---|
| 1292 | $this->t->set_var('select_add_acl_userid',$GLOBALS['phpgw']->html->select('userid',0,$allUsersOptions,true,"style=\"width: 300px;\" oonchange=\"javascript:document.notify_form.submit();\"")); |
---|
| 1293 | |
---|
| 1294 | $allGroups = getAllGroups(); |
---|
| 1295 | $allGroupsOptions = array('unselected' => lang('please select').'...'); |
---|
| 1296 | foreach ($allGroups as $groupObj) |
---|
| 1297 | { |
---|
| 1298 | $allGroupsOptions[$groupObj->getID()] = $groupObj->getName(); |
---|
| 1299 | } |
---|
| 1300 | $this->t->set_var('select_add_acl_groupid',$GLOBALS['phpgw']->html->select('groupid',0,$allGroupsOptions,true,"style=\"width: 300px;\" oonchange=\"javascript:document.notify_form.submit();\"")); |
---|
| 1301 | |
---|
| 1302 | $this->t->set_var('select_add_acl_permission',$GLOBALS['phpgw']->html->select('access',M_READ,$defaultACL,false,"style=\"width: 300px;\" oonchange=\"javascript:document.change_default_access.submit();\"")); |
---|
| 1303 | |
---|
| 1304 | $this->t->parse('display_acl','block_acl_notinherite',True); |
---|
| 1305 | } |
---|
| 1306 | } |
---|
| 1307 | |
---|
| 1308 | // div 6 update file |
---|
| 1309 | |
---|
| 1310 | $linkData = array |
---|
| 1311 | ( |
---|
| 1312 | 'menuaction' => 'mydms.uimydms.updateFile', |
---|
| 1313 | 'documentid' => $documentID, |
---|
| 1314 | ); |
---|
| 1315 | $this->t->set_var('action_update_file', $GLOBALS['phpgw']->link('/index.php',$linkData)); |
---|
| 1316 | |
---|
| 1317 | // expire select box |
---|
| 1318 | $this->t->set_var('select_expire_update',$GLOBALS['phpgw']->html->select('expire',0,$selectOptions,true,"onchange=\"toggleJSCalUpdate(this);\"")); |
---|
| 1319 | |
---|
| 1320 | $this->t->set_var('expire_date_update',$GLOBALS['phpgw']->jscalendar->input('expire_date_update','')); |
---|
| 1321 | $this->t->set_var('expire_class_update', 'inactive'); |
---|
| 1322 | |
---|
| 1323 | |
---|
| 1324 | $this->t->parse("out","main"); |
---|
| 1325 | |
---|
| 1326 | print $this->t->get('out','main'); |
---|
| 1327 | } |
---|
| 1328 | |
---|
| 1329 | } |
---|
| 1330 | |
---|
| 1331 | ?> |
---|