Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
expandfld.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: expandfld.php,v 1.18 2005/09/27 16:16:50 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage GED
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: expandfld.php,v 1.18 2005/09/27 16:16:50 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Freedom/expandfld.php,v $
21 // ---------------------------------------------------------------
22 
23 include_once ("FREEDOM/folders.php");
24 // -----------------------------------
25 function expandfld(&$action)
26 {
27  // -----------------------------------
28  $dbaccess = $action->GetParam("FREEDOM_DB");
29  $dirid = GetHttpVars("dirid", 9); // root directory
30  $inavmode = GetHttpVars("inavmode"); // root directory
31  $dir = new_Doc($dbaccess, $dirid);
32  $navigate = $action->getParam('FREEDOM_VIEWFRAME'); // standard navigation
33  $action->lay->Set("dirid", $dirid);
34  $action->lay->Set("reptitle", $dir->title);
35 
36  $action->lay->Set("navmode", $navigate);
37  if ($inavmode == 'inverse') {
38  if ($navigate == 'navigator') $action->lay->Set("navmode", "folder");
39  else if ($navigate == 'folder') $action->lay->Set("navmode", "navigator");
40  }
41 
42  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FREEDOM/Layout/expandfld.js");
43  // get export permission
44  $appfld = new Application();
45  $appfld->Set("FDL", $action->parent->parent);
46  $pexport = $appfld->HasPermission("EXPORT");
47  // ------------------------------------------------------
48  // definition of popup menu
49  include_once ("FDL/popup_util.php");
50  popupInit("popfld", array(
51  'vprop',
52  'mkdir',
53  'export',
54  'refresh',
55  'cancel'
56  ));
57  popupInit("poppaste", array(
58  'staticpaste',
59  'pastelatest',
60  'cancel2'
61  ));
62  $ldir = getChildDir($dbaccess, $action->user->id, $dir->id, false, "TABLE");
63  $stree = "";
64  if (count($ldir) > 0) {
65  $nbfolders = 1;
66  while (list($k, $doc) = each($ldir)) {
67 
68  popupActive("popfld", $nbfolders, 'cancel');
69  popupActive("popfld", $nbfolders, 'vprop');
70 
71  if ($pexport) popupActive("popfld", $nbfolders, 'export');
72  else popupInvisible("popfld", $nbfolders, 'export');
73 
74  if ($doc["doctype"] == 'D') {
75  popupActive("popfld", $nbfolders, 'mkdir');
76  popupActive("popfld", $nbfolders, 'refresh');
77  } else {
78  popupInvisible("popfld", $nbfolders, 'mkdir');
79  popupInvisible("popfld", $nbfolders, 'refresh');
80  }
81  popupActive("poppaste", $nbfolders, 'staticpaste');
82  popupActive("poppaste", $nbfolders, 'pastelatest');
83  popupActive("poppaste", $nbfolders, 'cancel2');
84  $nbfolders++;
85 
86  if ($doc["owner"] < 0) $ftype = 3;
87  else if ($doc["doctype"] == 'D') $ftype = 1;
88  else if ($doc["doctype"] == 'S') $ftype = 2;
89  else continue; // it 'is not a folder
90  $hasChild = 'false';
91  // no child for a search
92  if (hasChildFld($dbaccess, $doc["initid"], ($doc["doctype"] == 'S'))) $hasChild = 'true';
93 
94  $ftype = $dir->getIcon($doc["icon"]);
95  $stree.= "ffolder.insFld(fldtop, ffolder.gFld(\"" . str_replace('"', '\"', $doc["title"]) . "\", \"#\"," . $doc["initid"] . ",\"$ftype\",$hasChild))\n";
96  }
97  }
98  // define icon from style
99  $iconfolder = $action->GetImageUrl("ftv2folderopen1.gif");
100  $pathicon = explode("/", $iconfolder);
101  if (count($pathicon) == 4) $action->lay->set("iconFolderPath", $pathicon[0] . "/" . $pathicon[1]);
102  else $action->lay->set("iconFolderPath", "FREEDOM");
103 
104  $action->lay->Set("subtree", $stree);
105  // display popup js
106  popupGen($nbfolders);
107 }
108 ?>
← centre documentaire © anakeen - published under CC License - Dynacase