9 include_once (
"FDL/Class.Doc.php");
10 include_once (
"FDL/Class.DocAttr.php");
11 include_once (
"FDL/editutil.php");
15 $docid = GetHttpVars(
"id", 0);
16 $classid = GetHttpVars(
"classid", 0);
17 $zonebodycard = GetHttpVars(
"zone");
18 $usefor = GetHttpVars(
"usefor");
19 $vid = GetHttpVars(
"vid");
20 $mskid = GetHttpVars(
"mskid");
23 $temporaryMode = $action->
getParam(
"overrideICreate") ==
"true";
27 if (($usefor ==
"D") && ($zonebodycard ==
"")) $zonebodycard =
"FDL:EDITBODYCARD";
32 if (!
$doc) $action->
exitError(sprintf(_(
"no privilege to create this kind (%d) of document") , $classid));
34 if (!$temporaryMode) {
35 if ($fdoc->control(
'icreate') !=
"") $action->
exitError(sprintf(_(
"no privilege to create interactivaly this kind (%s) of document") , $fdoc->title));
42 if (
$doc->isConfidential()) {
43 redirect($action,
"FDL",
"FDL_CONFIDENTIAL&&id=" .
$doc->id);
45 $classid =
$doc->fromid;
49 if (($usefor ==
"D") || ($usefor ==
"Q")) {
51 $zonebodycard =
"FDL:EDITBODYCARD";
55 $doc->setDefaultValues($fdoc->getDefValues() ,
false);
61 $doc->setDefaultValues($fdoc->getParams() ,
false);
64 $action->parent->addJsRef(
"FDL:editfamilyparam.js",
true);
92 if (!$cvdoc->isAlive()) {
93 $err =
"document not alive";
98 $err = $cvdoc->control(trim($vid));
103 $tview = $cvdoc->getView($vid);
104 if (isset($tview[
'CV_MSKID']) && $tview[
'CV_MSKID'] !=
'') {
105 $err =
$doc->setMask($tview[
"CV_MSKID"]);
110 if ($zonebodycard ==
"") {
111 $zonebodycard = $tview[
"CV_ZVIEW"];
114 $vid =
$doc->getDefaultView(
true,
"id");
115 setHttpVar(
"vid", $vid);
116 if ($vid && $zonebodycard ==
"") {
117 $tview = $cvdoc->getView($vid);
118 $zonebodycard = $tview[
"CV_ZVIEW"];
128 if ($mask->isAlive() && $mask->control(
'view') ==
'') {
149 if ($mask->isAlive() && $mask->control(
'view') ==
'') {
161 if (GetHttpVars(
"viewconstraint") ==
"Y") {
162 include_once (
"FDL/modcard.php");
167 $msg =
$doc->preEdition();
168 if ($zonebodycard ==
"") {
169 if ((!
$docid) &&
$doc->defaultcreate !=
"") $zonebodycard =
$doc->defaultcreate;
170 else $zonebodycard =
$doc->defaultedit;
173 if ($zonebodycard ==
"") $zonebodycard =
"FDL:EDITBODYCARD";
174 $action->lay->eSet(
"classid", $classid);
175 $action->lay->eSet(
"usefor", $usefor);
177 if ($usefor ==
"D") {
180 $jsfile = $action->GetLayoutFile(
"editcard.js");
181 $jslay =
new Layout($jsfile, $action);
182 $jslay->Set(
"attrnid",
'[]');
183 $jslay->Set(
"attrntitle",
'[]');
184 $jslay->SetBlockData(
"RATTR", array());
185 $action->parent->AddJsCode($jslay->gen());
186 $action->lay->
Set(
"ZONEBODYCARD",
$doc->viewDoc($zonebodycard));
191 if ($usefor ===
"Q") {
195 $action->lay->
Set(
"ZONEBODYCARD",
$doc->viewDoc($zonebodycard));
198 $action->lay->set(
"maxFileUpload", ini_get(
"max_file_uploads"));
199 $action->lay->
Set(
"NOFORM", (preg_match(
"/[A-Z]+:[^:]+:U/", $zonebodycard, $reg)));
210 if (is_a($doc,
"DocFam")) {
217 foreach ($listattr as $aid => $attr) {
221 $defParamValue = $fam->getDefValue($aid);
222 if ($attr->type !==
"array" && $expertMode) {
223 if ($attr->type ===
"htmltext" || $attr->type ===
"longtext") {
224 $attr->type =
"longtext";
226 $attr->type =
"text";
232 if ($defParamValue) {
233 $attr->setOption(
"elabel", _(
"default value") .
": \n" . $defParamValue);
239 $defVal = $fam->getOwnParams();
240 foreach ($defVal as $aid =>
$value) {
244 if ($oa->type ===
"htmltext" || $oa->type ===
"longtext") {
245 $oa->type =
"longtext";
249 $oa->mvisibility =
"W";
264 $listattr = $doc->GetAttributes();
265 foreach ($listattr as $aid => $attr) {
266 $attr->setVisibility(
"W");
268 if (is_a($attr,
"NormalAttribute")) {
272 if ($attr->type ==
"enum") {
273 $attr->setOption(
"eunset",
"yes");
274 $attr->setOption(
"eformat",
"auto");
275 $attr->setOption(
"etype",
"free");
276 } elseif ($attr->type ==
"array") {
277 $attr->setOption(
"empty",
"yes");
283 if (is_a($doc,
"DocFam")) {
287 $defVal = $doc->getOwnDefValues();
290 $defVal = $fam->getOwnDefValues();
292 foreach ($defVal as $aid =>
$value) {
300 if ($doc->usefor ==
'Q') {
303 $attrn = $doc->GetNeededAttributes($doc->usefor ==
'Q');
306 if (count($attrn) == 0) {
310 $attrNid = $attrNtitle = array();
314 foreach ($attrn as $v) {
316 $attrNtitle[] = addslashes($v->getLabel());
318 $sattrNid =
"['" . implode(
"','", $attrNid) .
"']";
319 $sattrNtitle =
"['" . implode(
"','", $attrNtitle) .
"']";
323 if ($doc->usefor !=
"D") {
332 foreach ($doc->paramRefresh as $k => $v) {
334 "jstain" =>
"['" . implode(
"','", $v[
"in"]) .
"']",
335 "jstaout" =>
"['" . implode(
"','", $v[
"out"]) .
"']",
342 $jsfile = $action->GetLayoutFile(
"editcard.js");
343 $jslay =
new Layout($jsfile, $action);
344 $jslay->Set(
"attrnid", $sattrNid);
345 $jslay->Set(
"attrntitle", $sattrNtitle);
346 $jslay->SetBlockData(
"RATTR", $tjsa);
347 $action->parent->AddJsCode($jslay->gen());
352 if ($doc->usefor !=
"D") {
353 if ($doc->usefor ==
"Q") {
355 $doc->SpecRefreshGen(
true);
364 return (strlen($v) > 1);
369 if (
$a[
"cv_order"] == $b[
"cv_order"]) {
372 return (
$a[
"cv_order"] < $b[
"cv_order"]) ? -1 : 1;
386 foreach ($_POST as $k => $v) {
389 foreach ($_GET as $k => $v) {
392 if (is_array($ZONE_ARGS)) {
393 foreach ($ZONE_ARGS as $k => $v) {
398 foreach ($http as $k => $v) {
399 $oa =
$doc->getAttribute($k);
401 $curVal =
$doc->getRawValue($k);
402 if (($curVal ===
"") || ($oa->inArray() && trim($curVal) ===
"")) {
403 if ($oa->inArray() && (!is_array($v))) $v =
$doc->rawValueToArray(str_replace(
'\n',
"\n", $v));
404 $doc->setValue($k, $v);
Layout is a template generator.
& getAttribute($idAttr, &$oa=null, $useMask=true)
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
setNeededAttributes(Action &$action, Doc &$doc)
static seemsMethod($method)
setDocDefaultValues(Doc &$doc)
setPostVars(Doc &$doc, &$info=array())
setRefreshAttributes(Action &$action, Doc &$doc)
exitError($texterr, $exit=true, $code="")
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getHttpVars($name, $def="", $scope="all")
getFamIdFromName($dbaccess, $name)
new_Doc($dbaccess, $id= '', $latest=false)
useOwnParamters(Doc &$doc)
editmode(Action &$action)
if($file) if($subject==""&&$file) if($subject=="") $err