19 include_once (
"FDL/Lib.Dir.php");
20 include_once (
"FDL/editutil.php");
21 include_once (
"FDL/editcard.php");
38 if (!
$doc->isAlive())
$action->exitError(sprintf(_(
"Document %s is not alive") ,
$docid));
46 $action->lay->set(
"noreason",
false);
47 $action->lay->set(
"realtransition",
true);
48 $fstate = $wdoc->GetFollowingStates();
49 foreach ($fstate as $k => $v) {
50 if ($v == $nextstate) {
51 $tr = $wdoc->getTransition(
$doc->state, $v);
53 if (is_array($tr[
"ask"])) {
54 foreach ($tr[
"ask"] as $ka => $va) {
55 $oa = $wdoc->getAttribute($va);
57 if ($oa->needed) $tneed[$oa->id] = $oa->getLabel();
58 if ($oa->usefor ==
'Q') {
59 $wval = $wdoc->getParamValue($oa->id);
60 $wval = $wdoc->getValueMethod($wval);
62 $wval = $wdoc->getValue($oa->id);
64 if ($edittpl = $oa->getOption(
"edittemplate")) {
65 $input = sprintf(
"[ZONE FDL:EDITTPL?id=%d&famid=%d&wiid=%d&zone=%s]", $wdoc->id, $wdoc->fromid,
$doc->id, $edittpl);
70 "alabel" => $oa->getLabel() ,
71 "labelclass" => ($oa->needed) ?
"FREEDOMLabelNeeded" :
"FREEDOMLabel",
74 "idisplay" => ($oa->visibility ==
"H") ?
"none" :
""
76 if ($oa->needed) $tneed[$oa->id] = $oa->getLabel();
80 $action->lay->set(
"noreason", ($tr[
"nr"] ==
true));
81 $action->lay->set(
"viewext", $viewext);
82 $action->lay->setBlockData(
"FINPUTS", $tinputs);
87 $action->lay->set(
"tonewstate", sprintf(_(
"to the %s state") , _($nextstate)));
89 if (_($tr[
"id"]) == $tr[
"id"]) $lnextstate = sprintf(_(
"to %s") , _($nextstate));
90 else $lnextstate = _($tr[
"id"]);
92 $action->lay->set(
"realtransition",
false);
93 $lnextstate = sprintf(_(
"to %s") , _($nextstate));
96 $action->lay->set(
"tostate", ucfirst($lnextstate));
97 $action->lay->set(
"wcolor", $wdoc->getColor($nextstate));
98 $action->lay->Set(
"Wattrntitle", json_encode(array_values($tneed)));
99 $action->lay->Set(
"Wattrnid", json_encode(array_keys($tneed)));
101 $action->lay->set(
"thetitle", sprintf(_(
"Change state to %s") , _($nextstate)));
102 $action->lay->set(
"nextstate", $nextstate);
106 $action->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-SYSTEM.css");
107 if (file_exists(
$action->parent->rootdir .
"/STYLE/$style/Layout/EXT-ADAPTER-USER.css")) {
108 $action->parent->AddCssRef(
"STYLE/$style/Layout/EXT-ADAPTER-USER.css");
110 $action->parent->AddCssRef(
"STYLE/DEFAULT/Layout/EXT-ADAPTER-USER.css");