17 include_once (
"FDL/Lib.Dir.php");
18 include_once (
"FDL/editutil.php");
19 include_once (
"FDL/editcard.php");
28 $docid = GetHttpVars(
"id");
29 $nextstate = GetHttpVars(
"nstate");
30 $viewext = GetHttpVars(
"viewext");
40 if (
$err ==
"") $action->AddActionDone(
"LOCKDOC",
$doc->id);
46 $action->lay->set(
"noreason",
false);
47 $action->lay->set(
"realtransition",
true);
48 $fstate = $wdoc->GetFollowingStates();
50 foreach ($fstate as $k => $v) {
51 if ($v == $nextstate) {
52 $tr = $wdoc->getTransition(
$doc->state, $v);
54 if (!empty($tr[
"ask"]) && is_array($tr[
"ask"])) {
55 foreach ($tr[
"ask"] as $ka => $va) {
59 $oa = $wdoc->getAttribute($va);
61 if ($oa->needed) $tneed[$oa->id] = $oa->getLabel();
62 if ($oa->usefor ==
'Q') {
63 $wval = $wdoc->getFamilyParameterValue($oa->id);
64 $wval = $wdoc->getValueMethod($wval);
66 $wval = $wdoc->getRawValue($oa->id);
68 if ($edittpl = $oa->getOption(
"edittemplate")) {
69 $input = sprintf(
"[ZONE FDL:EDITTPL?id=%d&famid=%d&wiid=%d&zone=%s]", $wdoc->id, $wdoc->fromid,
$doc->id, $edittpl);
74 "alabel" => $oa->getLabel() ,
75 "labelclass" => ($oa->needed) ?
"FREEDOMLabelNeeded" :
"FREEDOMLabel",
79 "idisplay" => ($oa->visibility ==
"H") ?
"none" :
""
81 if ($oa->needed) $tneed[$oa->id] = $oa->getLabel();
85 $action->lay->set(
"noreason", ((!empty($tr[
"nr"]) && $tr[
"nr"] ==
true)));
86 $action->lay->eSet(
"viewext", $viewext);
87 $action->lay->setBlockData(
"FINPUTS", $tinputs);
92 $activity = $wdoc->getActivity($nextstate);
95 $action->lay->set(
"tonewstate", sprintf(_(
"to the %s activity") , $action->
text($activity)));
97 $action->lay->set(
"tonewstate", sprintf(_(
"to the %s state") , $action->
text($nextstate)));
100 if (_($tr[
"id"]) == $tr[
"id"]) {
102 $transitionLabel = sprintf(_(
"to %s") , $action->
text($activity));
104 $transitionLabel = sprintf(_(
"to %s") , _($nextstate));
106 }
else $transitionLabel = _($tr[
"id"]);
108 $action->lay->set(
"realtransition",
false);
109 if ($activity) $transitionLabel = sprintf(_(
"to %s") , $action->
text($activity));
110 else $transitionLabel = sprintf(_(
"to %s") , $action->
text($nextstate));
113 $action->lay->set(
"tostate",
mb_ucfirst($transitionLabel));
114 $action->lay->set(
"wcolor", $wdoc->getColor($nextstate));
115 $action->lay->
Set(
"Wattrntitle", json_encode(array_values($tneed)));
116 $action->lay->
Set(
"Wattrnid", json_encode(array_keys($tneed)));
117 $action->lay->set(
"docid",
$doc->id);
118 $currentActivity = $wdoc->getActivity(
$doc->state);
119 if ($currentActivity) {
120 $explanation[] = sprintf(_(
"The current activity is \"%s\".") , _($currentActivity));
122 $explanation[] = sprintf(_(
"The current state is \"%s\".") , _(
$doc->getState()));
126 $explanation[] = sprintf(_(
"The document will be stored with \"%s\" state.") , _($nextstate));
130 $explanation[] = sprintf(_(
"The next activity will be \"%s\".") , $action->
text($activity));
132 $explanation[] = sprintf(_(
"The next state will be \"%s\".") , _($nextstate));
135 $action->lay->eset(
"thetitle", $thetitle);
136 $action->lay->set(
"thetitle_url", urlencode($thetitle));
137 $action->lay->eset(
"nextstate", $nextstate);
138 $action->lay->set(
"Explanations", nl2br(implode(
"\n", $explanation)));
140 $style = $action->parent->
getParam(
"STYLE");
142 $action->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-SYSTEM.css");
143 if (file_exists(
DEFAULT_PUBDIR .
"/STYLE/$style/Layout/EXT-ADAPTER-USER.css")) {
144 $action->parent->AddCssRef(
"STYLE/$style/Layout/EXT-ADAPTER-USER.css");
146 $action->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-USER.css");
setNeededAttributes(Action &$action, Doc &$doc)
exitError($texterr, $exit=true, $code="")
getHtmlInput(&$doc, &$oattr, $value, $index="", $jsevent="", $notd=false)
editchangestate(Action &$action)
new_Doc($dbaccess, $id= '', $latest=false)
editmode(Action &$action)
if($file) if($subject==""&&$file) if($subject=="") $err