19 include_once (
"FDL/popupdoc.php");
20 include_once (
"FDL/Class.SearchDoc.php");
39 $surl =
$action->getParam(
"CORE_STANDURL");
43 "descr" => _(
"Properties") ,
44 "url" =>
"$surl&app=FDL&action=IMPCARD&zone=FDL:VIEWPROPERTIES:T&id=$docid",
48 "target" =>
"prop$docid",
54 "descr" => _(
"View latest") ,
55 "url" =>
"$surl&app=FDL&action=FDL_CARD&latest=Y&id=$docid",
65 "descr" => _(
"Modify") ,
66 "url" =>
"$surl&app=GENERIC&action=GENERIC_EDIT&rzone=$zone&id=$docid",
79 $tlink = array_merge($tlink, array(
81 "descr" => _(
"Delete") ,
82 "url" =>
"$surl&app=GENERIC&action=GENERIC_DEL&id=$docid",
85 "tconfirm" => sprintf(_(
"Sure delete %s ?") , str_replace(
"'",
"’",
$doc->title)) ,
92 "descr" => _(
"restore") ,
93 "url" =>
"$surl&app=FDL&action=RESTOREDOC&id=$docid",
101 "editstate" => array(
102 "descr" => _(
"Change state") ,
103 "url" =>
"$surl&app=FREEDOM&action=FREEDOM_EDITSTATE&id=$docid",
104 "confirm" =>
"false",
105 "control" =>
"false",
113 "descr" => _(
"Lock") ,
114 "url" =>
"$surl&app=FDL&action=LOCKFILE&id=$docid",
115 "confirm" =>
"false",
116 "control" =>
"false",
120 "submenu" =>
N_(
"security") ,
123 "unlockdoc" => array(
124 "descr" => _(
"Unlock") ,
125 "url" =>
"$surl&app=FDL&action=UNLOCKFILE&id=$docid",
126 "confirm" =>
"false",
127 "control" =>
"false",
131 "submenu" =>
"security",
135 "descr" => _(
"Revise") ,
136 "url" =>
"$surl&app=FREEDOM&action=REVCOMMENT&id=$docid",
137 "confirm" =>
"false",
138 "control" =>
"false",
146 "descr" => _(
"Change profile") ,
147 "url" =>
"$surl&app=FREEDOM&action=EDITPROF&id=$docid",
148 "confirm" =>
"false",
149 "control" =>
"false",
153 "submenu" =>
"security",
156 "privateprof" => array(
157 "descr" => _(
"Set private") ,
158 "url" =>
"$surl&app=FREEDOM&action=MODPROF&docid=$docid&profid=private",
159 "confirm" =>
"false",
160 "control" =>
"false",
164 "submenu" =>
"security",
168 "descr" => _(
"Set autonome profil") ,
169 "url" =>
"$surl&app=FREEDOM&action=MODPROF&docid=$docid&profid=$docid",
170 "confirm" =>
"false",
171 "control" =>
"false",
175 "submenu" =>
"security",
178 "publicprof" => array(
179 "descr" => _(
"Set public") ,
180 "url" =>
"$surl&app=FREEDOM&action=MODPROF&docid=$docid&profid=0",
181 "confirm" =>
"false",
182 "control" =>
"false",
186 "submenu" =>
"security",
190 "descr" => _(
"History") ,
191 "url" =>
"$surl&app=FREEDOM&action=HISTO&id=$docid",
192 "confirm" =>
"false",
193 "control" =>
"false",
195 "target" =>
"histo" .
$doc->initid,
201 "descr" => _(
"Reaffect") ,
203 "jsfunction" =>
"popdoc(null,'$surl&app=FDL&action=EDITAFFECT&id=$docid')",
204 "confirm" =>
"false",
205 "control" =>
"false",
212 "duplicate" => array(
213 "descr" => _(
"Duplicate") ,
214 "url" =>
"$surl&app=GENERIC&action=GENERIC_DUPLICATE&id=$docid",
216 "control" =>
"false",
217 "tconfirm" => _(
"Sure duplicate ?") ,
224 "descr" => _(
"goaccess") ,
225 "url" =>
"$surl&app=FREEDOM&action=FREEDOM_GACCESS&id=" .
$doc->profid,
226 "confirm" =>
"false",
227 "control" =>
"false",
233 "submenu" =>
"security",
237 "descr" => _(
"Add to basket") ,
238 "url" =>
"$surl&app=FREEDOM&action=ADDDIRFILE&docid=$docid&dirid=" .
$action->getParam(
"FREEDOM_IDBASKET") ,
239 "confirm" =>
"false",
240 "control" =>
"false",
248 "descr" => _(
"Change icon") ,
249 "url" =>
"$surl&app=FDL&action=EDITICON&id=$docid",
250 "confirm" =>
"false",
251 "control" =>
"false",
258 "addpostit" => array(
259 "descr" => _(
"Add postit") ,
260 "jsfunction" =>
"postit('$surl&app=GENERIC&action=GENERIC_EDIT&classid=27&pit_title=&pit_idadoc=$docid',50,50,300,200)",
261 "confirm" =>
"false",
262 "control" =>
"false",
270 "descr" => _(
"View my ask") ,
271 "jsfunction" =>
"viewwask('$surl&app=FDL&action=VIEWWASK&docid=$docid',50,50,300,200)",
272 "confirm" =>
"false",
273 "control" =>
"false",
280 "viewanswers" => array(
281 "descr" => _(
"View answers") ,
282 "url" =>
"$surl&app=FDL&action=IMPCARD&zone=FDL:VIEWANSWERS&id=$docid",
283 "confirm" =>
"false",
284 "control" =>
"false",
286 "target" =>
"wask" .
$doc->id,
291 "createforum" => array(
292 "descr" => _(
"create forum") ,
293 "url" =>
"$surl&app=FDL&action=FDL_FORUMCREATE&docid=$docid",
294 "confirm" =>
"false",
295 "control" =>
"false",
302 "openforum" => array(
303 "descr" => _(
"open forum") ,
304 "url" =>
"$surl&app=FDL&action=FDL_FORUMOPEN&docid=$docid",
305 "confirm" =>
"false",
306 "control" =>
"false",
313 "closeforum" => array(
314 "descr" => _(
"close forum") ,
315 "url" =>
"$surl&app=FDL&action=FDL_FORUMCLOSE&docid=$docid",
316 "confirm" =>
"false",
317 "control" =>
"false",
325 "descr" => _(
"View XML") ,
326 "url" =>
"$surl&app=FDL&action=VIEWXML&id=$docid",
327 "confirm" =>
"false",
328 "control" =>
"false",
335 "relations" => array(
336 "descr" => _(
"Document relations") ,
337 "url" =>
"$surl&app=FREEDOM&action=RNAVIGATE&id=$docid",
338 "confirm" =>
"false",
339 "control" =>
"false",
347 "descr" => _(
"Access path list") ,
348 "url" =>
"$surl&app=FREEDOM&action=FREEDOM_IFLD&id=$docid",
349 "confirm" =>
"false",
350 "control" =>
"false",
357 "reference" => array(
358 "descr" => _(
"Search linked documents") ,
359 "url" =>
"$surl&app=GENERIC&action=GENERIC_ISEARCH&id=$docid",
360 "confirm" =>
"false",
361 "control" =>
"false",
383 if (
$doc->fromname ==
"ARCHIVING")
return;
384 if (
$doc->archiveid > 0)
return;
386 $s->setObjectReturn();
387 $s->addFilter(
"arc_status = 'O'");
390 if (
$s->count() > 0) {
392 if (
$archive->control(
"modify") ==
"") {
393 $tlink[
"arch" .
$archive->id] = array(
394 "descr" => sprintf(_(
"Insert in %s") ,
$archive->getTitle()) ,
395 "url" =>
"?app=FREEDOM&action=ADDDIRFILE&docid=" .
$doc->initid .
"&dirid=" .
$archive->initid,
396 "confirm" =>
"false",
397 "control" =>
"false",
401 "submenu" => _(
"Archive menu") ,
405 if ((
$doc->defDoctype ==
"S") || (
$doc->defDoctype ==
"D")) {
406 $tlink[
"farch" .
$archive->id] = array(
407 "descr" => sprintf(_(
"Insert the content in %s") ,
$archive->getTitle()) ,
408 "url" =>
"?app=FREEDOM&action=FREEDOM_INSERTFLD&dirid=" .
$doc->initid .
"&id=" .
$archive->initid,
410 "control" =>
"false",
411 "tconfirm" => sprintf(
"Sure insert the content of %s n archive ?",
$doc->getTitle()) ,
414 "submenu" => _(
"Archive menu") ,
428 $rvid = getHttpVars(
"vid");
429 if (
$doc->cvid > 0) {
432 $cud = (
$doc->CanEdit() ==
"");
436 $ti = $cvdoc->getTValue(
"CV_IDVIEW");
437 $tl = $cvdoc->getTValue(
"CV_LVIEW");
438 $tz = $cvdoc->getTValue(
"CV_ZVIEW");
439 $tk = $cvdoc->getTValue(
"CV_KVIEW");
440 $tm = $cvdoc->getTValue(
"CV_MSKID");
441 $td = $cvdoc->getTValue(
"CV_DISPLAYED");
442 $tmenu = $cvdoc->getTValue(
"CV_MENU");
447 if (count($tk) > 0) {
448 foreach ($tk as $k => $v) {
449 if ($td[$k] !=
"no") {
451 if ($ti[$k] ==
"") $cvk =
"CV$k";
455 if ($cvdoc->control($cvk) ==
"") {
457 "typeview" =>
N_(
"specialedit") , #
N_(
"specialedit %s")
459 "menu" => $tmenu[$k],
460 "zoneview" => $tz[$k],
466 if ($cvdoc->control($cvk) ==
"") {
468 "typeview" =>
N_(
"specialview") , #
N_(
"specialview %s")
470 "menu" => $tmenu[$k],
471 "zoneview" => $tz[$k],
481 foreach ($tv as $v) {
482 $count[$v[
"typeview"]]++;
485 foreach ($tv as $v) {
486 $engine = $cvdoc->getZoneTransform($v[
"zoneview"]);
487 $url = ($v[
"typeview"] ==
'specialview') ?
"$surl&app=FDL&action=FDL_CARD&vid=" . $v[
"idview"] .
"&id=$docid" :
"$surl&app=GENERIC&action=GENERIC_EDIT&rvid=$rvid&vid=" . $v[
"idview"] .
"&id=$docid";
489 $js =
"popdoc(null,'$url')";
494 if ($v[
"menu"] !=
"") {
495 if ($v[
"menu"] ==
"-") $submenu =
"";
496 else $submenu = $v[
"menu"];
497 $mtitle = $v[
"txtview"];
499 $submenu = ($count[$v[
"typeview"]] > 1) ? $v[
"typeview"] :
"";
500 $mtitle = ($count[$v[
"typeview"]] > 1) ? $v[
"txtview"] : sprintf(_($v[
"typeview"] .
" %s") , $v[
"txtview"]);
502 $tlink[$v[
"idview"]] = array(
506 "confirm" =>
"false",
507 "control" =>
"false",
511 "submenu" => $submenu,
526 $fstate = $wdoc->GetFollowingStates();
531 foreach ($fstate as $v) {
532 $tr = $wdoc->getTransition(
$doc->state, $v);
535 if ((!$tr[
"nr"]) || (is_array($tr[
"ask"]) && (count($tr[
"ask"]) > 0))) {
536 $jsf = sprintf(
"popdoc(null,'$surl&app=FDL&action=EDITCHANGESTATE&id=$docid&nstate=$v','%s',0,40,400,250)", (str_replace(
"'",
"’", sprintf(_(
"Change state %s") , _($v)))));
538 $jsf = sprintf(
"subwindow(100,100,'_self','$surl&app=FREEDOM&action=MODSTATE&newstate=$v&id=$docid');");
542 "title" => $wdoc->getActivity($v, ucfirst(_($v))) ,
543 "descr" => $tr[
'id'] ? _($tr[
'id']) : $wdoc->getActivity($v, ucfirst(_($v))) ,
544 "jsfunction" => $jsf,
545 "confirm" =>
"false",
546 "control" =>
"false",
547 "color" => $wdoc->getColor($v) ,
549 "icon" => (!$tr) ?
"Images/noaccess.png" : ((is_array($tr[
"ask"])) ?
"Images/miniask.png" :
"") ,
552 "submenu" =>
"chgstates", #_(
"chgstates")
560 $lmenu =
$doc->GetMenuAttributes(
true);
562 foreach ($lmenu as $k => $v) {
566 if (($v->getOption(
"onlyglobal") ==
"yes") && (
$doc->doctype !=
"C"))
continue;
567 if (($v->getOption(
"global") !=
"yes") && (
$doc->doctype ==
"C"))
continue;
568 if ($v->link[0] ==
'?') {
569 $v->link = substr($v->link, 1);
572 if ($v->getOption(
"lconfirm") ==
"yes") $confirm =
true;
573 if ($v->link[0] ==
'C') {
574 $v->link = substr($v->link, 1);
577 if ($v->getOption(
"lcontrol") ==
"yes") $control =
true;
578 if (preg_match(
'/\[(.*)\](.*)/', $v->link, $reg)) {
580 $tlink[$k][
"target"] = $reg[1];
582 $tlink[$k][
"target"] = $v->id .
"_" .
$doc->id;
584 if ($v->getOption(
"ltarget") !=
"") $tlink[$k][
"target"] = $v->getOption(
"ltarget");
585 $tlink[$k][
"idlink"] = $v->id;
586 $tlink[$k][
"descr"] = $v->getLabel();
587 $tlink[$k][
"title"] = $v->getOption(
"ltitle");
588 $tlink[$k][
"url"] = addslashes(
$doc->urlWhatEncode($v->link));
589 $tlink[$k][
"confirm"] = $confirm ?
"true" :
"false";
590 $tlink[$k][
"control"] = $control;
591 $tlink[$k][
"mwidth"] = $v->getOption(
"mwidth");
592 $tlink[$k][
"mheight"] = $v->getOption(
"mheight");
593 $tlink[$k][
"tconfirm"] = $v->getOption(
"tconfirm", sprintf(_(
"Sure %s ?") , addslashes($v->getLabel())));
596 $tlink[$k][
"submenu"] = $v->getOption(
"submenu");
597 $tlink[$k][
"barmenu"] = ($v->getOption(
"barmenu") ==
"yes") ?
"true" :
"false";
598 if ($v->precond !=
"") {
600 if ($tlink[$k][
"visibility"] ===
false) $tlink[$k][
"visibility"] =
POPUP_INVISIBLE;
601 elseif ($tlink[$k][
"visibility"] ===
true) $tlink[$k][
"visibility"] =
POPUP_ACTIVE;
605 $lactions =
$doc->GetActionAttributes();
606 foreach ($lactions as $k => $v) {
610 $v->link = $v->getLink(
$doc->id);
611 if ($v->getOption(
"lconfirm") ==
"yes") $confirm =
true;
612 if ($v->getOption(
"lcontrol") ==
"yes") $control =
true;
614 if (preg_match(
'/\[(.*)\](.*)/', $v->link, $reg)) {
616 $tlink[$k][
"target"] = $reg[1];
618 $tlink[$k][
"target"] = $v->id .
"_" .
$doc->id;;
620 if ($v->getOption(
"ltarget") !=
"") $tlink[$k][
"target"] = $v->getOption(
"ltarget");
621 $tlink[$k][
"barmenu"] = ($v->getOption(
"barmenu") ==
"yes") ?
"true" :
"false";
622 $tlink[$k][
"idlink"] = $v->id;
623 $tlink[$k][
"descr"] = $v->getLabel();
624 $tlink[$k][
"url"] = addslashes(
$doc->urlWhatEncode($v->link));
625 $tlink[$k][
"confirm"] = $confirm ?
"true" :
"false";
626 $tlink[$k][
"control"] = $control;
627 $tlink[$k][
"mwidth"] = $v->getOption(
"mwidth");
628 $tlink[$k][
"mheight"] = $v->getOption(
"mheight");
629 $tlink[$k][
"tconfirm"] = sprintf(_(
"Sure %s ?") , addslashes($v->getLabel()));
632 $tlink[$k][
"submenu"] = $v->getOption(
"submenu");
633 if ($v->precond !=
"") $tlink[$k][
"visibility"] =
$doc->ApplyMethod($v->precond,
POPUP_ACTIVE);
639 if (file_exists(
"OFFLINE/off_popupdocfolder.php")) {
640 include_once (
"OFFLINE/off_popupdocfolder.php");
649 $cuf = (
$doc->CanUnLockFile() ==
"");
650 $cud = (
$doc->CanEdit() ==
"");
659 if (
$doc->isLocked()) {
660 if ($cuf) $tlink[
"unlockdoc"][
"visibility"] =
POPUP_ACTIVE;
665 else if (((
$doc->lmodify ==
'Y') || (
$doc->revision == 0)) && ($cud)) $tlink[
"revise"][
"visibility"] =
POPUP_CTRLACTIVE;
668 if (
$doc->IsControlled() && (
$doc->profid > 0) && (
$doc->Control(
"viewacl") ==
"")) {
674 if ((
$doc->Control(
"modifyacl") ==
"") && (!
$doc->isLocked(
true))) {
677 if ((
$doc->doctype !=
'P') && (
$doc->doctype !=
'W') && (
$doc->fromname !=
'WASK')) {
680 } elseif ((
$doc->doctype ==
'P') || (
$doc->doctype ==
'W') || (
$doc->fromname ==
'WASK')) {
692 if (
$doc->PreDocDelete() ==
"") {
706 if (
$doc->locked == - 1) {
707 if (
$doc->doctype !=
'Z') {
709 if ($tmpdoc->Control(
"view") ==
"") {
734 $waskes =
$doc->getWasks(
false);
735 if (count($waskes) > 0) {
736 if (
$doc->control(
"wask") ==
"") $tlink[
"viewanswers"][
"visibility"] =
POPUP_ACTIVE;
737 $waskes =
$doc->getWasks(
true);
738 if (count($waskes) > 0) $tlink[
"viewask"][
"visibility"] =
POPUP_ACTIVE;
741 if ((
$doc->control(
"wask") ==
"") && (
$doc->wid > 0)) {
742 $latestwaskid =
$doc->getLatestIdWithAsk();
745 $tlink[
"viewanswers"][
"url"].=
"&id=$latestwaskid";
755 $fnote = new_doc(
$doc->dbaccess, 27);
756 if ($fnote->control(
"icreate") !=
"") $tlink[
"addpostit"][
"visibility"] =
POPUP_INVISIBLE;
759 if (!
$action->parent->Haspermission(
"FREEDOM",
"FREEDOM")) {
767 if (!
$action->parent->Haspermission(
"FREEDOM_READ",
"FREEDOM")) {
774 $ff =
$fdoc->forumid;
775 if ($ff !=
"" &&
$doc->Control(
"edit") ==
"") {