Offline Server  1.6
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
off_popupdocfolder.php
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * Context menu view in folder list for a document
5  *
6  * @author Anakeen 2006
7  * @version $Id: ws_popupdocfolder.php,v 1.11 2007/02/12 10:52:00 eric Exp $
8  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
9  * @package OFFLINE
10  * @subpackage
11  */
12 /**
13  */
14 
15 /** @noinspection PhpIncludeInspection */
16 include_once ("FDL/popupdoc.php");
17 /** @noinspection PhpIncludeInspection */
18 include_once ("FDL/popupdocdetail.php");
19 
20 
21 function off_popupdocfolder(Action &$action)
22 {
23  $usage = new ActionUsage($action);
24  $docid = $usage->addNeeded("id", "id");
25  $usage->verify();
26 
27  $doc = new_Doc("", $docid);
28 
29  $tsubmenu = array();
30  $tlink = array();
31  addOfflinePopup($tlink, $doc, $target = "nresume", "");
32 
33  unset($tlink[""]);
34 
35  popupdoc($action, $tlink, $tsubmenu);
36 }
37 
38 function addOfflinePopup(&$tlink, Doc &$doc, $target = "_self", $menu = 'offline')
39 {
40  /** @noinspection PhpIncludeInspection */
41  include_once ("OFFLINE/Class.DomainManager.php");
42  $allDomains = DomainManager::getDomains();
43  $canDownload = false;
44  foreach ($allDomains as $domain) {
45  /* @var $domain _OFFLINEDOMAIN */
46  if ($domain->isAlive() && $domain->hasManagePrivilege(Doc::getSystemUserId())) {
47  $families = $domain->getFamilies();
48  if (!in_array($doc->fromid, $families)) {
49  continue;
50  }
51  if ($domain->isMember($doc->getSystemUserId())) {
52  $canDownload = true;
53  $tlink["dom" . $domain->id] = array(
54  "descr" => sprintf(_("Domain %s"), $domain->getTitle()),
55  "url" => "",
56  "separator" => true,
57  "confirm" => "false",
58  "control" => "false",
59  "tconfirm" => "",
60  "target" => "$target",
61  "visibility" => POPUP_ACTIVE,
62  "submenu" => $menu,
63  "barmenu" => "false"
64  );
65 
66  $ufolder = $domain->getUserFolder();
67  if ($domain->getUserMode($doc->getSystemUserId()) == 'advanced') {
68  $tlink["book" . $domain->id] = array(
69  "descr" => _("Book in my space"),
70  "title" => _("book the document to modify it with offline application"),
71  "url" => "?app=OFFLINE&action=OFF_DOMAINAPI&htmlRedirect=" . $doc->initid . "&docid=" . $doc->initid . "&id=" . $domain->initid . '&method=bookDocument',
72  "confirm" => "false",
73  "control" => "false",
74  "color" => $domain->getValue("gui_color"),
75  "tconfirm" => "",
76  "target" => "$target",
77  "visibility" => ((($doc->CanLockFile() == '') && ($doc->lockdomainid == 0)) ? POPUP_ACTIVE : POPUP_INACTIVE),
78  "submenu" => $menu,
79  "barmenu" => "false"
80  );
81  $docDomainsId = $doc->getDomainIds(false, true);
82  $inDomain = in_array($ufolder->name, $docDomainsId);
83  $tlink["bookread" . $domain->id] = array(
84  "descr" => _("Set in my space to read it"),
85  "title" => _("insert the document to see it with offline application"),
86  "url" => "?app=OFFLINE&action=OFF_DOMAINAPI&htmlRedirect=" . $doc->initid . "&docid=" . $doc->initid . "&id=" . $domain->initid . '&method=insertUserDocument',
87  "confirm" => "false",
88  "control" => "false",
89  "color" => $domain->getValue("gui_color"),
90  "tconfirm" => "",
91  "target" => "$target",
92  "visibility" => ($inDomain) ? POPUP_INACTIVE : POPUP_ACTIVE,
93  "submenu" => $menu,
94  "barmenu" => "false"
95  );
96 
97  $tlink["unset" . $domain->id] = array(
98  "descr" => _("remove from my space"),
99  "title" => _("remove the document from my space"),
100  "url" => "?app=OFFLINE&action=OFF_DOMAINAPI&htmlRedirect=" . $doc->initid . "&docid=" . $doc->initid . "&id=" . $domain->initid . '&method=removeUserDocument',
101  "confirm" => "false",
102  "control" => "false",
103  "color" => $domain->getValue("gui_color"),
104  "tconfirm" => "",
105  "target" => "$target",
106  "visibility" => ($inDomain) ? POPUP_ACTIVE : POPUP_INACTIVE,
107  "submenu" => $menu,
108  "barmenu" => "false"
109  );
110 
111  if (($domain->getValue("off_sharepolicy") == "admin") || ($domain->getValue("off_sharepolicy") == "users")) {
112  $share = $domain->getSharedFolder();
113  if ($share->canModify() == "") {
114  $inDomain = in_array($share->name, $docDomainsId);
115  $tlink["sharebookread" . $domain->id] = array(
116  "descr" => sprintf(_("Set in %s"), $share->getHtmlTitle()),
117  "title" => _("Share the document to see it with offline application"),
118  "url" => "?app=OFFLINE&action=OFF_DOMAINAPI&htmlRedirect=" . $doc->initid . "&docid=" . $doc->initid . "&id=" . $domain->initid . '&method=insertSharedDocument',
119  "confirm" => "false",
120  "control" => "false",
121  "color" => $domain->getValue("gui_color"),
122  "tconfirm" => "",
123  "target" => "$target",
124  "visibility" => ($inDomain) ? POPUP_INACTIVE : POPUP_ACTIVE,
125  "submenu" => $menu,
126  "barmenu" => "false"
127  );
128 
129  $tlink["shareunset" . $domain->id] = array(
130  "descr" => sprintf(_("Remove from %s"), $share->getHtmlTitle()),
131  "title" => _("Remove the document from share space"),
132  "url" => "?app=OFFLINE&action=OFF_DOMAINAPI&htmlRedirect=" . $doc->initid . "&docid=" . $doc->initid . "&id=" . $domain->initid . '&method=removeSharedDocument',
133  "confirm" => "false",
134  "control" => "false",
135  "color" => $domain->getValue("gui_color"),
136  "tconfirm" => "",
137  "target" => "$target",
138  "visibility" => ($inDomain) ? POPUP_ACTIVE : POPUP_INACTIVE,
139  "submenu" => $menu,
140  "barmenu" => "false"
141  );
142  }
143  }
144  }
145  $tlink["access" . $domain->id] = array(
146  "descr" => _("view my space"),
147  "title" => _("access to documents of my space"),
148  "url" => "?app=OFFLINE&action=OFF_ORGANIZER&domain=0&dirid=" . $ufolder->initid,
149  "confirm" => "false",
150  "control" => "false",
151  "color" => $domain->getValue("gui_color"),
152  "tconfirm" => "",
153  "target" => "",
154  "visibility" => POPUP_ACTIVE,
155  "submenu" => $menu,
156  "barmenu" => "false"
157  );
158  }
159  }
160  }
161 
162  if ($canDownload) {
163  $tlink["offdownload"] = array(
164  "descr" => sprintf(_("Download offline client application")),
165  "url" => "?app=OFFLINE&action=OFF_DLCLIENT",
166  "separator" => true,
167  "confirm" => "false",
168  "control" => "false",
169  "tconfirm" => "",
170  "target" => "_offdl",
171  "visibility" => POPUP_ACTIVE,
172  "submenu" => $menu,
173  "barmenu" => "false"
174  );
175  }
176 }
177 
off_popupdocfolder(Action &$action)
addOfflinePopup(&$tlink, Doc &$doc, $target="_self", $menu= 'offline')
← centre documentaire © anakeen - published under CC License - Dynacase