17 include_once (
"FDL/Class.Doc.php");
19 include_once (
"FDL/family_help.php");
20 include_once (
"Class.QueryDb.php");
21 include_once (
"GENERIC/generic_util.php");
44 $rtarget = $action->
getArgument(
"rtarget",
"_self");
45 $updateAttrid = $action->
getArgument(
"updateAttrid");
46 if (
$docid == 0) setHttpVar(
"classid", $classid);
50 $recallhelper = $action->
getArgument(
"recallhelper");
51 $action->lay->eSet(
"vid", $vid);
52 $action->lay->eSet(
"ezone", $zonebodycard);
53 $action->lay->eSet(
"rzone", $rzone);
54 $action->lay->eSet(
"rvid", $rvid);
55 $action->lay->eSet(
"rtarget", $rtarget);
56 $action->lay->eSet(
"autoclose", $autoclose);
57 $action->lay->eSet(
"recallhelper", $recallhelper);
58 $action->lay->eSet(
"updateAttrid", $updateAttrid);
59 $action->lay->
Set(
"SELFTARGET", ($rtarget ==
"_self"));
64 if ($classid ==
"") $action->
exitError(sprintf(_(
"Creation aborded : no family specified")));
66 if ($classid ==
"") $action->
exitError(sprintf(_(
"Creation aborded : unknow family %s") , GetHttpVars(
"classid",
getDefFam($action))));
69 $errc = $cdoc->control(
'create');
70 $erric = $cdoc->control(
'icreate');
71 if ($errc || $erric) {
74 if ($errc !=
"") $action->
exitError(sprintf(_(
"no privilege to create this kind (%s) of document") , $cdoc->gettitle()));
75 if ($erric !=
"") $action->
exitError(sprintf(_(
"no privilege to create interactivaly this kind (%s) of document") , $cdoc->gettitle()));
76 $action->lay->
Set(
"title", mb_convert_case(sprintf(_(
"creation %s") , $cdoc->getHTMLTitle()) , MB_CASE_TITLE,
'UTF-8'));
78 $action->lay->
Set(
"title", _(
"new card"));
80 if ($usefor ==
"D") $action->lay->eSet(
"title", _(
"default values"));
81 if ($usefor ==
"Q") $action->lay->eSet(
"title", _(
"parameters values"));
83 $action->lay->eSet(
"editaction", $action->
text(
"Create"));
85 if (!
$doc) $action->
exitError(sprintf(_(
"no privilege to create this kind (%d) of document") , $classid));
86 if ($usefor ==
'D' || $usefor ==
'Q')
$doc->state =
'';
87 if ($usefor !=
"")
$doc->doctype =
'T';
92 setHttpVar(
"id",
$doc->id);
96 $action->ExitError(
$err);
98 $action->AddActionDone(
"LOCKFILE",
$doc->id);
101 $classid =
$doc->fromid;
102 if (!
$doc->isAlive()) $action->ExitError(_(
"document not referenced"));
103 if (GetHttpVars(
"viewconstraint") !=
"Y") {
107 $doc->modify(
true, array(
112 $action->lay->
Set(
"title",
$doc->getHTMLtitle());
115 if ($action->read(
"navigator") ==
"EXPLORER") $action->lay->
Set(
"shorticon",
getParam(
"DYNACASE_FAVICO"));
116 else $action->lay->
Set(
"shorticon",
$doc->getIcon());
117 $action->lay->
Set(
"docicon",
$doc->getIcon(
'', 16));
118 $param_zone_footer = json_decode($action->
getParam(
"FOOTER_ZONE_EDIT") ,
true);
119 $zone_footer = array();
120 foreach ($param_zone_footer as $zone) {
121 $zone_footer[] = array(
125 $action->lay->SetBlockData(
"ZONE_FOOTER", $zone_footer);
127 if ($zonebodycard ==
"") {
128 if (
$doc->cvid > 0) {
136 $vid =
$doc->getDefaultView(
true,
"id");
137 if ($vid) setHttpVar(
"vid", $vid);
142 $err = $cvdoc->control($vid);
144 $tview = $cvdoc->getView($vid);
145 $doc->setMask($tview[
"CV_MSKID"]);
146 if ($zonebodycard ==
"") $zonebodycard = $tview[
"CV_ZVIEW"];
150 if (($vid ==
"") && ($mskid !=
"")) {
152 if ($mdoc->isAlive() && ($mdoc->control(
'view') ==
""))
$doc->setMask($mdoc->id);
155 if ($zonebodycard ==
"") {
156 if ((!
$docid) &&
$doc->defaultcreate !=
"") $zonebodycard =
$doc->defaultcreate;
157 else $zonebodycard =
$doc->defaultedit;
160 $action->lay->set(
"emblem",
$doc->getEmblem());
161 $action->lay->
Set(
"HEAD", (!preg_match(
"/[A-Z]+:[^:]+:[T|S|U|V]/", $zonebodycard, $reg)));
162 $action->lay->
Set(
"FOOT", (!preg_match(
"/[A-Z]+:[^:]+:[S|U]/", $zonebodycard, $reg)));
163 $action->lay->
Set(
"NOFORM", (preg_match(
"/[A-Z]+:[^:]+:U/", $zonebodycard, $reg)));
164 $action->lay->
Set(
"NOSAVE", (preg_match(
"/[A-Z]+:[^:]+:V/", $zonebodycard, $reg)));
165 if (
getHttpVars(
"forcehead") ==
"yes") $action->lay->
Set(
"HEAD",
true);
166 $action->lay->
Set(
"iconsrc",
$doc->geticon());
167 $action->lay->
Set(
"viewstate",
"none");
168 $action->lay->
Set(
"dhelp",
"none");
170 $action->lay->
Set(
"dhelp",
"");
171 $action->lay->
Set(
"helpid",
$doc->fromid);
173 $action->lay->
Set(
"state",
"");
175 $state =
$doc->getState();
176 $action->lay->
Set(
"statecolor",
$doc->getStateColor(
"transparent"));
177 $action->lay->
Set(
"wid",
false);
178 if (
$doc->fromid > 0) {
179 $fdoc =
$doc->getFamilyDocument();
180 $action->lay->
Set(
"wid", ($fdoc->schar ==
'R'));
181 $action->lay->eSet(
"FTITLE", $fdoc->gettitle());
183 $action->lay->eSet(
"FTITLE", _(
"no family"));
186 if (
$doc->locked == - 1) $action->lay->
Set(
"state", $action->
text($state));
189 $action->lay->eSet(
"state", $action->Text(
$doc->getStateActivity(
$doc->getState())));
191 $action->lay->
Set(
"viewstate",
"inherit");
194 $action->lay->eSet(
"version",
$doc->version);
196 $action->lay->
Set(
"initid", (
$doc->initid !=
'') ?
$doc->initid : 0);
197 $action->lay->eSet(
"id",
$doc->id);
199 $action->lay->set(
"VALTERN", ($action->GetParam(
"FDL_VIEWALTERN",
"yes") ==
"yes"));
201 $action->lay->eSet(
"classid", $classid);
202 $action->lay->eSet(
"dirid",
$dirid);
204 $help =
$doc->getHelpPage();
205 $action->lay->
Set(
"helpurl", ($help->isAlive()) ? $help->getAttributeHelpUrl() :
false);
206 $action->lay->
Set(
"helpid", ($help->isAlive()) ? $help->id :
false);
211 if (
$a[
"cv_order"] == $b[
"cv_order"]) {
214 return (
$a[
"cv_order"] < $b[
"cv_order"]) ? -1 : 1;
fixMultipleAliveDocument(Doc &$doc)
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
redirectAsGuest(Action &$action)
getDefFam(Action &$action)
exitError($texterr, $exit=true, $code="")
getFamilyHelpFile(Action &$action, $docid)
getParam($name, $def="")
must be in core or global type
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getHttpVars($name, $def="", $scope="all")
getFamIdFromName($dbaccess, $name)
new_Doc($dbaccess, $id= '', $latest=false)
static getArgument($k, $def= '')
if($file) if($subject==""&&$file) if($subject=="") $err
generic_edit(Action &$action)