17 include_once (
"FDL/popupdoc.php");
18 include_once (
"FDL/Class.SearchDoc.php");
21 $docid = GetHttpVars(
"id");
30 $zone = GetHttpVars(
"zone");
37 $surl = $action->
getParam(
"CORE_STANDURL");
42 "url" =>
"$surl&app=FDL&action=IMPCARD&zone=FDL:VIEWPROPERTIES:T&id=$docid",
46 "target" =>
"prop$docid",
53 "url" =>
"$surl&app=FDL&action=FDL_CARD&latest=Y&id=$docid",
64 "url" =>
"$surl&app=GENERIC&action=GENERIC_EDIT&rzone=$zone&id=$docid",
75 addCvPopup($tlink,
$doc);
77 $tlink = array_merge($tlink, array(
80 "url" =>
"$surl&app=GENERIC&action=GENERIC_DEL&id=$docid",
83 "tconfirm" => sprintf(_(
"Sure delete %s ?") ,
$doc->getTitle()) ,
91 "url" =>
"$surl&app=FDL&action=RESTOREDOC&id=$docid",
101 "url" =>
"$surl&app=FREEDOM&action=FREEDOM_EDITSTATE&id=$docid",
102 "confirm" =>
"false",
103 "control" =>
"false",
112 "url" =>
"$surl&app=FDL&action=LOCKFILE&id=$docid",
113 "confirm" =>
"false",
114 "control" =>
"false",
118 "submenu" =>
N_(
"Security") ,
121 "unlockdoc" => array(
123 "url" =>
"$surl&app=FDL&action=UNLOCKFILE&id=$docid",
124 "confirm" =>
"false",
125 "control" =>
"false",
129 "submenu" =>
"Security",
134 "url" =>
"$surl&app=FREEDOM&action=REVCOMMENT&id=$docid",
135 "confirm" =>
"false",
136 "control" =>
"false",
145 "url" =>
"$surl&app=FREEDOM&action=EDITPROF&id=$docid",
146 "confirm" =>
"false",
147 "control" =>
"false",
151 "submenu" =>
"Security",
154 "privateprof" => array(
156 "url" =>
"$surl&app=FREEDOM&action=MODPROF&docid=$docid&profid=private",
157 "confirm" =>
"false",
158 "control" =>
"false",
162 "submenu" =>
"Security",
166 "descr" =>
mb_ucfirst(_(
"Set autonome profil")) ,
167 "url" =>
"$surl&app=FREEDOM&action=MODPROF&docid=$docid&profid=$docid",
168 "confirm" =>
"false",
169 "control" =>
"false",
173 "submenu" =>
"Security",
176 "publicprof" => array(
178 "url" =>
"$surl&app=FREEDOM&action=MODPROF&docid=$docid&profid=0",
179 "confirm" =>
"false",
180 "control" =>
"false",
184 "submenu" =>
"Security",
189 "url" =>
"$surl&app=FREEDOM&action=HISTO&id=$docid",
190 "confirm" =>
"false",
191 "control" =>
"false",
193 "target" =>
"histo" .
$doc->initid,
201 "jsfunction" =>
"popdoc(null,'$surl&app=FDL&action=EDITAFFECT&id=$docid')",
202 "confirm" =>
"false",
203 "control" =>
"false",
210 "duplicate" => array(
212 "url" =>
"$surl&app=GENERIC&action=GENERIC_DUPLICATE&id=$docid",
214 "control" =>
"false",
215 "tconfirm" => _(
"Sure duplicate ?") ,
223 "url" =>
"$surl&app=FREEDOM&action=FREEDOM_GACCESS&id=" .
$doc->id,
224 "confirm" =>
"false",
225 "control" =>
"false",
231 "submenu" =>
"Security",
236 "url" =>
"$surl&app=FREEDOM&action=ADDDIRFILE&docid=$docid&dirid=" . $action->
getParam(
"FREEDOM_IDBASKET") ,
237 "confirm" =>
"false",
238 "control" =>
"false",
247 "url" =>
"$surl&app=FDL&action=EDITICON&id=$docid",
248 "confirm" =>
"false",
249 "control" =>
"false",
256 "addpostit" => array(
258 "jsfunction" =>
"postit('$surl&app=GENERIC&action=GENERIC_EDIT&classid=27&pit_title=&pit_idadoc=$docid',50,50,300,200)",
259 "confirm" =>
"false",
260 "control" =>
"false",
269 "jsfunction" =>
"viewwask('$surl&app=FDL&action=VIEWWASK&docid=$docid',50,50,300,200)",
270 "confirm" =>
"false",
271 "control" =>
"false",
278 "viewanswers" => array(
280 "url" =>
"$surl&app=FDL&action=IMPCARD&zone=FDL:VIEWANSWERS&id=$docid",
281 "confirm" =>
"false",
282 "control" =>
"false",
284 "target" =>
"wask" .
$doc->id,
292 "url" =>
"$surl&app=FDL&action=VIEWXML&id=$docid",
293 "confirm" =>
"false",
294 "control" =>
"false",
301 "relations" => array(
302 "descr" =>
mb_ucfirst(_(
"Document relations")) ,
303 "url" =>
"$surl&app=FREEDOM&action=RNAVIGATE&id=$docid",
304 "confirm" =>
"false",
305 "control" =>
"false",
313 "descr" =>
mb_ucfirst(_(
"Access path list")) ,
314 "url" =>
"$surl&app=FREEDOM&action=FREEDOM_IFLD&id=$docid",
315 "confirm" =>
"false",
316 "control" =>
"false",
323 "reference" => array(
324 "descr" =>
mb_ucfirst(_(
"Search linked documents")) ,
325 "url" =>
"$surl&app=GENERIC&action=GENERIC_ISEARCH&id=$docid",
326 "confirm" =>
"false",
327 "control" =>
"false",
349 if ($doc->fromname ==
"ARCHIVING")
return;
350 if ($doc->archiveid > 0)
return;
352 $s->setObjectReturn();
353 $s->addFilter(
"arc_status = 'O'");
356 if (
$s->count() > 0) {
358 if (
$archive->control(
"modify") ==
"") {
359 $tlink[
"arch" .
$archive->id] = array(
360 "descr" => sprintf(_(
"Insert in %s") ,
$archive->getHTMLTitle()) ,
361 "url" =>
"?app=FREEDOM&action=ADDDIRFILE&docid=" . $doc->initid .
"&dirid=" .
$archive->initid,
362 "confirm" =>
"false",
363 "control" =>
"false",
367 "submenu" => _(
"Archive menu") ,
371 if (($doc->defDoctype ==
"S") || ($doc->defDoctype ==
"D")) {
372 $tlink[
"farch" .
$archive->id] = array(
373 "descr" => sprintf(_(
"Insert the content in %s") ,
$archive->getHTMLTitle()) ,
374 "url" =>
"?app=FREEDOM&action=FREEDOM_INSERTFLD&dirid=" . $doc->initid .
"&id=" .
$archive->initid,
376 "control" =>
"false",
377 "tconfirm" => sprintf(
"Sure insert the content of %s n archive ?", $doc->
getTitle()) ,
380 "submenu" => _(
"Archive menu") ,
394 function addCvPopup(&$tlink,
Doc &
$doc, $target =
"_self")
398 if ($doc->cvid > 0) {
401 $cud = ($doc->CanEdit() ==
"");
406 $cvdoc =
new_Doc($doc->dbaccess, $doc->cvid);
407 $cvdoc = clone $cvdoc;
413 $views = $cvdoc->getDisplayableViews();
414 if (count($views) > 0) {
415 foreach ($views as $k => $viewInfo) {
416 $v = $viewInfo[
"cv_kview"];
417 if ($viewInfo[
"cv_displayed"] !=
"no") {
418 if ($viewInfo[
"cv_idview"] ==
"") $cvk =
"CV$k";
419 else $cvk = $viewInfo[
"cv_idview"];
422 if ($cvdoc->control($cvk) ==
"") {
424 "typeview" =>
N_(
"specialedit") , #
N_(
"specialedit %s")
426 "menu" => $cvdoc->getLocaleViewMenu($cvk) ,
427 "zoneview" => $viewInfo[
"cv_zview"],
428 "txtview" => $cvdoc->getLocaleViewLabel($cvk)
433 if ($cvdoc->control($cvk) ==
"") {
435 "typeview" =>
N_(
"specialview") , #
N_(
"specialview %s")
437 "menu" => $cvdoc->getLocaleViewMenu($cvk) ,
438 "zoneview" => $viewInfo[
"cv_zview"],
439 "txtview" => $cvdoc->getLocaleViewLabel($cvk)
446 $defaultview = $doc->getDefaultView(
true);
447 if ($defaultview !== 0) {
448 $tlink[
"editdoc"][
"descr"] = $cvdoc->getLocaleViewLabel($defaultview[
'cv_idview']);
451 $count[
"specialedit"] = $count[
"specialview"] = 0;
452 foreach ($tv as $v) {
453 if ($defaultview && $defaultview[
"cv_idview"] !== $v[
"idview"]) {
454 $count[$v[
"typeview"]]++;
458 foreach ($tv as $v) {
460 $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";
462 $js =
"popdoc(null,'$url')";
467 if ($v[
"menu"] !=
"") {
468 if ($v[
"menu"] ==
"-") $submenu =
"";
469 else $submenu = $v[
"menu"];
471 $submenu = (isset($count[$v[
"typeview"]]) && $count[$v[
"typeview"]] > 1) ? $v[
"typeview"] :
"";
473 $mtitle = $v[
"txtview"];
474 $target = $cvdoc->getZoneOption($v[
"zoneview"]) ===
"B" ?
"_download" : $target;
475 if ((!$defaultview) || $defaultview[
"cv_idview"] !== $v[
"idview"]) {
476 $tlink[$v[
"idview"]] = array(
480 "confirm" =>
"false",
481 "control" =>
"false",
485 "submenu" => $submenu,
504 $wdoc =
new_Doc($doc->dbaccess, $doc->wid);
505 $wdoc->Set($doc,
true);
506 $fstate = $wdoc->GetFollowingStates();
511 foreach ($fstate as $v) {
512 $tr = $wdoc->getTransition($doc->state, $v);
515 if ((empty($tr[
"nr"])) || ((!empty($tr[
"ask"])) && is_array($tr[
"ask"]) && (count($tr[
"ask"]) > 0))) {
516 $jsf = sprintf(
"popdoc(null,'$surl&app=FDL&action=EDITCHANGESTATE&id=$docid&nstate=$v','%s',0,40,400,250)", (str_replace(
"'",
"’", sprintf(_(
"Steps")))));
520 $jsf = sprintf(
"subwindow(100,100,'_self','$surl&app=FREEDOM&action=MODSTATE&newstate=$v&id=$docid');");
523 $tooltip = $wdoc->getActivity($v,
mb_ucfirst(_($v)));
525 $icon = (!$tr) ?
"Images/noaccess.png" :
"";
526 if ($tr && (!empty($tr[
"m0"]))) {
528 $err = call_user_func(array(
531 ) , $v, $wdoc->doc->state);
541 "descr" => $tr[
'id'] ? _($tr[
'id']) : $wdoc->getActivity($v,
mb_ucfirst(_($v))) ,
542 "jsfunction" => $jsf,
543 "confirm" =>
"false",
544 "control" =>
"false",
545 "color" => $wdoc->getColor($v) ,
549 "visibility" => $visibility,
550 "submenu" =>
"chgstates", #_(
"chgstates")
563 $lmenu = $doc->GetMenuAttributes(
true);
564 foreach ($lmenu as $k => $v) {
567 if (($v->getOption(
"onlyglobal") ==
"yes") && ($doc->doctype !=
"C"))
continue;
568 if (($v->getOption(
"global") !=
"yes") && ($doc->doctype ==
"C"))
continue;
569 if (isset($v->link[0]) && $v->link[0] ==
'?') {
570 $v->link = substr($v->link, 1);
573 if ($v->getOption(
"lconfirm") ==
"yes") $confirm =
true;
574 if (isset($v->link[0]) && $v->link[0] ==
'C') {
575 $v->link = substr($v->link, 1);
578 if ($v->getOption(
"lcontrol") ==
"yes") $control =
true;
579 if (preg_match(
'/\[(.*)\](.*)/', $v->link, $reg)) {
581 $tlink[$k][
"target"] = $reg[1];
583 $tlink[$k][
"target"] = $v->id .
"_" . $doc->id;
585 if ($v->getOption(
"ltarget") !=
"") {
586 $tlink[$k][
"target"] = $v->getOption(
"ltarget");
587 }
else if ($v->getOption(
"mtarget") !=
"") $tlink[$k][
"target"] = $v->getOption(
"mtarget");
588 $tlink[$k][
"idlink"] = $v->id;
589 $tlink[$k][
"descr"] = $v->
getLabel();
590 $tlink[$k][
"title"] = $v->getOption(
"ltitle");
591 $tlink[$k][
"url"] = addslashes($doc->
urlWhatEncode($v->link));
592 $tlink[$k][
"confirm"] = $confirm ?
"true" :
"false";
593 $tlink[$k][
"control"] = $control;
594 $tlink[$k][
"mwidth"] = $v->getOption(
"mwidth");
595 $tlink[$k][
"mheight"] = $v->getOption(
"mheight");
596 $tlink[$k][
"tconfirm"] = $v->getOption(
"tconfirm", sprintf(_(
"Sure %s ?") , $v->getLabel()));
599 $tlink[$k][
"submenu"] = $v->getOption(
"submenu");
600 $tlink[$k][
"barmenu"] = ($v->getOption(
"barmenu") ==
"yes") ?
"true" :
"false";
601 if ($v->precond !=
"" && $tlink[$k][
"url"]) {
602 $tlink[$k][
"visibility"] = $doc->ApplyMethod($v->precond,
POPUP_ACTIVE);
603 if ($tlink[$k][
"visibility"] ===
false) $tlink[$k][
"visibility"] =
POPUP_INVISIBLE;
604 elseif ($tlink[$k][
"visibility"] ===
true) $tlink[$k][
"visibility"] =
POPUP_ACTIVE;
609 $lactions = $doc->GetActionAttributes();
610 foreach ($lactions as $k => $v) {
614 $alink = $v->getLink($doc->id);
615 if ($v->getOption(
"lconfirm") ==
"yes") $confirm =
true;
616 if ($v->getOption(
"lcontrol") ==
"yes") $control =
true;
618 if (preg_match(
'/\[(.*)\](.*)/', $alink, $reg)) {
620 $tlink[$k][
"target"] = $reg[1];
622 $tlink[$k][
"target"] = $v->id .
"_" . $doc->id;
624 if ($v->getOption(
"ltarget") !=
"") {
625 $tlink[$k][
"target"] = $v->getOption(
"ltarget");
626 }
else if ($v->getOption(
"mtarget") !=
"") $tlink[$k][
"target"] = $v->getOption(
"mtarget");
627 $tlink[$k][
"barmenu"] = ($v->getOption(
"barmenu") ==
"yes") ?
"true" :
"false";
628 $tlink[$k][
"idlink"] = $v->id;
629 $tlink[$k][
"descr"] = $v->
getLabel();
631 $tlink[$k][
"confirm"] = $confirm ?
"true" :
"false";
632 $tlink[$k][
"control"] = $control;
633 $tlink[$k][
"mwidth"] = $v->getOption(
"mwidth");
634 $tlink[$k][
"mheight"] = $v->getOption(
"mheight");
635 $tlink[$k][
"tconfirm"] = sprintf(_(
"Sure %s ?") , $v->getLabel());
638 $tlink[$k][
"submenu"] = $v->getOption(
"submenu");
639 if ($v->precond !=
"") $tlink[$k][
"visibility"] = $doc->ApplyMethod($v->precond,
POPUP_ACTIVE);
651 if (file_exists(
"OFFLINE/off_popupdocfolder.php")) {
652 include_once (
"OFFLINE/off_popupdocfolder.php");
654 addOfflinePopup($tlink, $doc, $target,
$menu);
666 $cud = ($doc->CanEdit() ==
"");
669 if (
getParam(
"FREEDOM_IDBASKET") == 0 && $action->user->id == 1) {
671 $homefld =
new Dir($action->dbaccess);
674 if (
getParam(
"FREEDOM_IDBASKET") == 0) {
678 if ($doc->locked == $doc->userid) $tlink[
"lockdoc"][
"visibility"] =
POPUP_INVISIBLE;
679 else if (($doc->locked != $doc->userid) && $cud) $tlink[
"lockdoc"][
"visibility"] =
POPUP_CTRLACTIVE;
683 if ($cuf) $tlink[
"unlockdoc"][
"visibility"] =
POPUP_ACTIVE;
688 else if ((($doc->lmodify ==
'Y') || ($doc->revision == 0)) && ($cud)) $tlink[
"revise"][
"visibility"] =
POPUP_CTRLACTIVE;
691 if ($doc->IsControlled() && ($doc->profid > 0) && ($doc->Control(
"viewacl") ==
"")) {
697 if (($doc->Control(
"modifyacl") ==
"") && (!$doc->
isLocked(
true))) {
700 if (($doc->doctype !=
'P') && ($doc->doctype !=
'W') && ($doc->fromname !=
'WASK')) {
701 if ($doc->profid != 0) $tlink[
"publicprof"][
"visibility"] =
POPUP_CTRLACTIVE;
702 if ($doc->profid == 0) $tlink[
"privateprof"][
"visibility"] =
POPUP_CTRLACTIVE;
703 } elseif (($doc->doctype ==
'P') || ($doc->doctype ==
'W') || ($doc->fromname ==
'WASK')) {
704 if (($doc->profid == 0) || ($doc->profid != $doc->id) || ($doc->profid != $doc->initid)) $tlink[
"specprof"][
"visibility"] =
POPUP_CTRLACTIVE;
705 if ($doc->profid != 0) $tlink[
"publicprof"][
"visibility"] =
POPUP_CTRLACTIVE;
706 if (($doc->profid == 0) || ($doc->profid == $doc->id) || ($doc->profid == $doc->initid)) $tlink[
"editprof"][
"visibility"] =
POPUP_INVISIBLE;
713 if ($fdoc->Control(
"icreate") !=
"") $tlink[
"duplicate"][
"visibility"] =
POPUP_INVISIBLE;
721 if ($doc->allocated > 0) $tlink[
"reaffect"][
"visibility"] =
POPUP_ACTIVE;
726 if ($doc->locked == - 1) {
727 if ($doc->doctype !=
'Z') {
728 $tmpdoc =
new_Doc($doc->dbaccess, $doc->initid,
true);
729 if ($tmpdoc->Control(
"view") ==
"") {
730 if (!$tmpdoc->preUndelete()) $tlink[
"latest"][
"visibility"] =
POPUP_ACTIVE;
732 } elseif ($doc->lmodify ===
"D") {
759 $waskes = $doc->getWasks(
false);
760 if (count($waskes) > 0) {
762 $waskes = $doc->getWasks(
true);
763 if (count($waskes) > 0) $tlink[
"viewask"][
"visibility"] =
POPUP_ACTIVE;
766 if (($doc->
control(
"wask") ==
"") && ($doc->wid > 0)) {
770 $tlink[
"viewanswers"][
"url"].=
"&id=$latestwaskid";
775 if ($doc->doctype ==
"F") $tlink[
"chgicon"][
"visibility"] =
POPUP_INVISIBLE;
777 if (($doc->postitid > 0) || ($doc->locked == - 1)) $tlink[
"addpostit"][
"visibility"] =
POPUP_INVISIBLE;
778 else if ($doc->fromid == 27) $tlink[
"addpostit"][
"visibility"] =
POPUP_INVISIBLE;
780 $fnote = new_doc($doc->dbaccess, 27);
781 if ($fnote->control(
"icreate") !=
"") $tlink[
"addpostit"][
"visibility"] =
POPUP_INVISIBLE;
784 if (!$action->parent->Haspermission(
"FREEDOM",
"FREEDOM")) {
792 if ($action->parent->Haspermission(
"FREEDOM_HISTO",
"FREEDOM")) {
urlWhatEncode($link, $k=-1)
exitError($texterr, $exit=true, $code="")
getParam($name, $def="")
must be in core or global type
getHttpVars($name, $def="", $scope="all")
getTitle($id="-1", $def="", $latest=false)
new_Doc($dbaccess, $id= '', $latest=false)
getZoneTransform($zone="")
if($file) if($subject==""&&$file) if($subject=="") $err
control($aclname, $strict=false)
if(!isset($query[$parms['q']])) if($parms['desc']!= 'desc'&&$parms['desc']!= 'asc') $menu