17 include_once (
"FDL/modcard.php");
19 include_once (
"FDL/Class.DocFam.php");
20 include_once (
"FDL/Class.Dir.php");
25 $action->
exitError(sprintf(_(
"Input variables exceeded %s. To increase the limit change max_input_vars in php.ini.") , ini_get(
'max_input_vars')));
32 $retedit = ($action->
getArgument(
"retedit",
"N") ==
"Y");
33 $noredirect = ($action->
getArgument(
"noredirect") ==
"1");
34 $quicksave = ($action->
getArgument(
"quicksave") ==
"1");
37 $viewext = $action->
getArgument(
"viewext") ==
"yes";
38 $autoclose = $action->
getArgument(
"autoclose") ==
"yes";
39 $recallhelper = $action->
getArgument(
"recallhelper") ==
"yes";
40 $updateAttrid = $action->
getArgument(
"updateAttrid");
43 $action->parent->addJsRef(
"GENERIC:generic_mod.js",
true);
45 if (!$noredirect) $action->AddWarningMsg(
$err);
54 $cdoc =
$doc->getFamilyDocument();
61 if ($fld->locked == - 1) {
62 $dirid = $fld->getLatestId();
65 if (method_exists($fld,
"insertDocument")) {
66 $err = $fld->insertDocument(
$doc->id);
69 $home = $fld->getHome(
false);
70 if ($home && ($home->id > 0)) {
72 $err = $fld->insertDocument(
$doc->id);
77 $action->AddLogMsg(
$err);
79 if ((
$doc->doctype ==
'D') || (
$doc->doctype ==
'S')) $action->AddActionDone(
"ADDFOLDER", $fld->initid);
80 else $action->AddActionDone(
"ADDFILE", $fld->initid);
85 $home = $fld->getHome(
false);
86 if ($home && ($home->id > 0)) {
88 $err = $fld->insertDocument(
$doc->id);
96 if ((!
$err) && $updateAttrid &&
$doc) {
97 $action->lay->set(
"updateData", json_encode(array(
99 "title" =>
$doc->getTitle() ,
100 "attrid" => $updateAttrid,
101 "recallhelper" => $recallhelper
104 $action->lay->set(
"updateData",
"null");
107 $action->lay->set(
"autoclose", $autoclose ?
"true" :
"false");
108 $action->lay->eSet(
"id", $ndocid);
109 if (is_array(
$info)) {
110 foreach (
$info as $k => $v) {
111 $info[$k][
"prefix"] = sprintf(_(
"constraint not validated for %s attribute") , $v[
"label"]);
114 $action->lay->set(
"constraintinfo", json_encode(
$info));
115 $action->lay->set(
"quicksave", (
bool)$quicksave);
116 if ($rzone !=
"") $zone = sprintf(
"&zone=%s", urlencode($rzone));
118 if ($rvid !=
"") $zone = sprintf(
"&vid=%s", urlencode($rvid));
120 $action->lay->set(
"error", json_encode(
$err));
121 $warning = $action->parent->getWarningMsg();
122 if ($warning && count($warning) > 0) $warning = implode(
"\n", $warning);
124 $action->lay->set(
"warning", json_encode($warning));
127 if ($ract === null) {
128 $ract =
"GENERIC_EDIT&id=" . urlencode($ndocid);
130 $url = sprintf(
"?app=%s&action=%s", urlencode(
getHttpVars(
"redirect_app",
"GENERIC")) , $ract) . $zone;
131 $action->lay->set(
"url", json_encode($url));
134 $ract = str_replace(
"%ID%", $ndocid, $ract);
137 $ract =
"EUI_VIEWDOC$zone&refreshfld=Y&id=" . urlencode($ndocid);
139 $url = sprintf(
"?app=%s&action=%s", urlencode(
getHttpVars(
"redirect_app",
"EXTUI")) , $ract) . $zone;
140 $action->lay->set(
"url", json_encode($url));
143 $ract =
"FDL_CARD$zone&refreshfld=Y&id=" . urlencode($ndocid);
145 $url = sprintf(
"?app=%s&action=%s", urlencode(
getHttpVars(
"redirect_app",
"FDL")) , $ract) . $zone;
146 $action->lay->set(
"url", json_encode($url));
153 redirect($action, GetHttpVars(
"redirect_app",
"GENERIC") , GetHttpVars(
"redirect_act",
"GENERIC_LOGO") , $action->GetParam(
"CORE_STANDURL"));
156 redirect($action, GetHttpVars(
"redirect_app",
"GENERIC") , GetHttpVars(
"redirect_act",
"GENERIC_EDIT&id=" . urlencode($ndocid)) , $action->GetParam(
"CORE_STANDURL"));
159 if ($rzone !=
"") $zone = sprintf(
"&zone=%s", urlencode($rzone));
161 if ($rvid !=
"") $zone = sprintf(
"&vid=%s", urlencode($rvid));
163 redirect($action, GetHttpVars(
"redirect_app",
"FDL") , GetHttpVars(
"redirect_act",
"FDL_CARD$zone&refreshfld=Y&id=" . urlencode($ndocid)) , $action->GetParam(
"CORE_STANDURL"));
exitError($texterr, $exit=true, $code="")
generic_mod(Action &$action)
getHttpVars($name, $def="", $scope="all")
new_Doc($dbaccess, $id= '', $latest=false)
static getArgument($k, $def= '')
modcard(Action &$action, &$ndocid, &$info=array())
if($file) if($subject==""&&$file) if($subject=="") $err
check_max_input_vars(Action &$action, $inputNameValue= '__check_max_input_vars__')