20 include_once (
"FDL/Class.Doc.php");
21 include_once (
"FDL/Class.DocAttr.php");
22 include_once (
"VAULT/Class.VaultFile.php");
37 $attrtype = $oattr->type;
39 $alone = $oattr->isAlone;
42 $attrin =
'_' . $oattr->id;
43 if ($index !==
"") $attridk = $oattr->id .
'_' . $index;
44 else $attridk = $oattr->id . $index;
45 if ($oattr->inArray()) {
48 $attridk = $oattr->id .
'__1x_';
49 }
else $attrin.=
"[$index]";
51 if (isset($oattr->mvisibility)) $visibility = $oattr->mvisibility;
52 else $visibility = $oattr->visibility;
53 if ($visibility ==
"I")
return "";
54 $idisabled =
" disabled readonly=1 title=\"" . _(
"read only") .
"\" ";
57 if (!$notd) $classname =
"class=\"fullresize\"";
60 if (($visibility ==
"H") || ($visibility ==
"R")) {
61 $input =
"<input type=\"hidden\" name=\"" . $attrin .
"\" value=\"" . chop(htmlentities(stripslashes(
$value) , ENT_COMPAT,
"UTF-8")) .
"\"";
62 $input.=
" id=\"" . $attridk .
"\" ";
64 if (!$notd) $input.=
'</td><td class="hiddenAttribute">';
68 $oc =
"$jsevent onchange=\"document.isChanged=true\" ";
71 $iopt =
'&phpfile=' . $oattr->phpfile .
'&phpfunc=' . $oattr->phpfunc .
'&label=' . ($oattr->getLabel());
73 if (($oattr->type !=
"array") && ($oattr->type !=
"htmltext") && ($oattr->type !=
"docid")) {
74 if ($visibility !=
"S") {
75 if ($usephpfunc && ($oattr->phpfunc !=
"") && ($oattr->phpfile !=
"") && ($oattr->type !=
"enum") && ($oattr->type !=
"enumlist")) {
76 if ($oattr->getOption(
"autosuggest",
"yes") !=
"no") {
77 $autocomplete =
" autocomplete=\"off\" autoinput=\"1\" onfocus=\"activeAuto(event," .
$docid .
",this,'$iopt','$attrid','$index')\" ";
94 if (
$vf->Show($reg[2], $info) ==
"") {
96 $fname =
"<A target=\"_self\" href=\"" . GetParam(
"CORE_BASEURL") .
"app=FDL&action=EXPORTFILE&vid=$vid&docid=$docid&attrid=$attrid&index=$index\" title=\"{$info->name}\">";
98 $fname.=
"<IMG id=\"img_$attridk\" style=\"vertical-align:bottom;border:none;width:30px\" SRC=\"";
99 $fname.= GetParam(
"CORE_BASEURL") .
"app=FDL&action=EXPORTFILE&width=30&vid=$vid&docid=" .
$docid .
"&attrid=" . $attrid .
"&index=$index";
103 if ($oattr->getOption(
"preventfilechange") ==
"yes") {
104 include_once (
"FDL/Lib.Vault.php");
106 $originalname =
"<input id=\"IFORI$attridk\" name=\"IFORI$attrin\" type=\"hidden\" orivalue=\"" .
$doc->vault_filename($attrid,
false, ($index ? $index : -1)) .
"\">";
108 }
else $fname = _(
"error in filename");
111 $fname.=
"<img id=\"img_$attridk\" style=\"vertical-align:bottom;width:30px\" SRC=\"";
112 $fname.= $action->getImageUrl(
$value);
116 $fname = $action->GetIcon($oattr->getOption(
"defaultimage",
"noimage.png") , _(
"no image") , 30);
117 $fname = str_replace(
"<img",
'<img id="img_' . $attridk .
'" style="vertical-align:bottom"', $fname);
123 $input =
"<span id=\"IFERR" . $attridk .
"\" class=\"Error\"></span><span class=\"FREEDOMText\">" . $fname .
"</span><br/>";
124 $input.= $originalname;
126 $input.=
"<input name=\"" . $attrin .
"\" type=\"hidden\" value=\"" .
$value .
"\" id=\"" . $attridk .
"\">";
127 $input.=
"<input type=\"hidden\" value=\"" .
$value .
"\" id=\"INIV" . $attridk .
"\">";
129 if (($visibility ==
"W") || ($visibility ==
"O")) {
130 $input.=
"<span><input onchange=\"document.isChanged=true;changeFile(this,'$attridk','$check')\" $classname accept=\"image/*\" size=15 type=\"file\" id=\"IF_$attridk\" name=\"_UPL" . $attrin .
"\"";
131 $input.=
" ></span> ";
140 $dbaccess = $action->GetParam(
"FREEDOM_DB");
142 if (
$vf->Show($reg[2], $info) ==
"") {
144 $DAV =
getParam(
"FREEDAV_SERVEUR",
false);
148 $action->parent->AddJsRef($action->GetParam(
"CORE_PUBURL") .
"/DAV/Layout/getsessionid.js");
149 $oc = sprintf(
" onclick='this.href=getPrivateDavHref(\"%s\",\"%s\",\"%s\",this.getAttribute(\"filename\"))' filename=\"%s\"",
$docid, $vid, $DAV, str_replace(
'"',
'%22', $info->name));
151 $fname =
"<A title=\"" . _(
"open file with your editor") .
"\" href=\"#\" $oc><img style=\"border:none\" src=\"Images/davedit.png\">";
153 $fname =
"<A target=\"_self\" title=\"" . _(
"download file") .
"\" href=\"" . $action->GetParam(
"CORE_BASEURL") .
"app=FDL&action=EXPORTFILE&vid=$vid&docid=$docid&attrid=$attrid&index=$index\">";
155 $fname.= $info->name;
157 if ($oattr->getOption(
"preventfilechange") ==
"yes") {
158 include_once (
"FDL/Lib.Vault.php");
160 $originalname =
"<input id=\"IFORI$attridk\" name=\"IFORI$attrin\" type=\"hidden\" orivalue=\"" .
$doc->vault_filename($attrid,
false, ($index ? $index : -1)) .
"\">";
162 }
else $fname = _(
"error in filename");
163 }
else $fname = _(
"no filename");
165 $input =
"<span id=\"IFERR" . $attridk .
"\" class=\"Error\"></span><span class=\"FREEDOMText\">" . $fname .
"</span><br/>";
166 $input.= $originalname;
168 $input.=
"<input name=\"" . $attrin .
"\" type=\"hidden\" value=\"" .
$value .
"\" id=\"" . $attridk .
"\">";
169 $input.=
"<input type=\"hidden\" value=\"" .
$value .
"\" id=\"INIV" . $attridk .
"\">";
170 $input.=
"<span><input onchange=\"document.isChanged=true;changeFile(this,'$attridk','$check')\" class=\"\" size=15 type=\"file\" id=\"IF_$attridk\" name=\"_UPL" . $attrin .
"\" value=\"" . chop(htmlentities(
$value, ENT_COMPAT,
"UTF-8")) .
"\"";
172 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
173 $input.=
" ></span> ";
179 $lh = $oattr->getOption(
"editheight",
"2em");
180 $elabel = $oattr->getOption(
"elabel");
181 if ($elabel !=
"") $oc.=
" title=\"$elabel\"";
183 $input =
"<textarea $oc wrap=\"virtual\" onkeyup=\"textautovsize(event,this)\" onclick=\"textautovsize(event,this)\" class=\"autoresize\" style=\"height:$lh\" name=\"" . $attrin .
"\" ";
184 $input.=
" id=\"" . $attridk .
"\" ";
185 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
186 $input.=
" >" . str_replace(array(
192 ) , htmlentities(stripslashes(str_replace(
"<BR>",
"\n",
$value)) , ENT_COMPAT,
"UTF-8")) .
"</textarea>";
199 if (($visibility ==
"H") || ($visibility ==
"R")) {
200 $input =
"<textarea name=\"$attrin\">$value</textarea>";
201 } elseif ($visibility ==
"S") {
204 $input =
"<div class=\"static\" name=\"$attrin\">$value</div>";
206 $lay =
new Layout(
"FDL/Layout/fckeditor.xml", $action);
207 $lay->set(
"Value", str_replace(array(
222 $lay->set(
"label", ucFirst($oattr->getLabel()));
223 $lay->set(
"need", $oattr->needed);
224 $lay->set(
"height", $oattr->getOption(
"editheight",
"150px"));
225 $lay->set(
"toolbar", $oattr->getOption(
"toolbar",
"Simple"));
226 $lay->set(
"toolbarexpand", (strtolower($oattr->getOption(
"toolbarexpand")) ==
"no") ?
"false" :
"true");
227 $lay->set(
"aid", $attridk);
228 $lay->set(
"aname", $attrin);
229 if (($visibility ==
"R") || ($visibility ==
"S")) $lay->set(
"disabled", $idisabled);
230 else $lay->set(
"disabled",
"");
231 $input = $lay->gen();
246 $lay =
new Layout(
"FDL/Layout/editarray.xml", $action);
247 $rn = $oattr->getOption(
"roweditzone");
251 $input = $lay->gen();
255 $multi = $oattr->getOption(
"multiple");
258 $lay =
new Layout(
"THESAURUS/Layout/editmultiinputthconcept.xml");
259 $lay->set(
"atitle",
false);
260 $lay->set(
"elabel", $oattr->getOption(
"elabel", _(
"Display available choices")));
263 $thids = explode(
"<BR>", str_replace(
"\n",
"<BR>",
$value));
264 foreach ($thids as $kth => $vth) {
265 $th = new_doc(
$doc->dbaccess, trim($vth));
266 if ($th->isAlive()) {
267 $thtitle = $th->getLangTitle();
269 "ltitle" => substr($thtitle, 0, 100) ,
274 $lay->setBlockData(
"options", $top);
275 $lay->set(
"size", count($top));
276 }
else $lay->set(
"size", 1);
277 $lay->set(
"empty", count($top) == 0);
279 $lay =
new Layout(
"THESAURUS/Layout/editinputthconcept.xml");
282 $thtitle = $th->getLangTitle();
283 $lay->set(
"atitle", $thtitle);
284 }
else $lay->set(
"atitle",
false);
286 $lay->set(
"value",
$value);
287 $lay->set(
"aname", $attrin);
288 $lay->set(
"aid", $attridk);
289 $idth = $oattr->format;
291 $thid =
$doc->getValue($idth);
292 if (!$thid) $thid = $idth;
293 $lay->set(
"thesaurus", $thid);
295 $input = $lay->gen();
301 $lay =
new Layout(
"FDL/Layout/editadoc.xml", $action);
304 if (($visibility ==
"R") || ($visibility ==
"S")) $lay->set(
"disabled", $idisabled);
305 else $lay->set(
"disabled",
"");
306 $input = $lay->gen();
314 $needLatest = ($oattr->getOption(
"docrev",
"latest") ==
"latest");
316 $multi = $oattr->getOption(
"multiple");
318 $linkprefix =
"ilink_";
319 if ($multi ==
"yes") {
320 $lay =
new Layout(
"FDL/Layout/editmdoc.xml", $action);
324 if (($visibility ==
"R") || ($visibility ==
"S")) $lay->set(
"disabled", $idisabled);
325 else $lay->set(
"disabled",
"");
326 $lay->set(
"cible",
$cible);
328 $input2 = $lay->gen();
332 if (
$doc->usefor ==
"D") $input =
"<input type=\"text\" title=\"" . _(
"real value to set") .
"\" name=\"" . $attrin .
"\"";
333 else $input =
"<input type=\"hidden\" name=\"" . $attrin .
"\"";
334 $input.=
" id=\"" . $attridk .
"\" value=\"$value\">";
336 $textvalue =
$doc->getTitle(trim(
$value) ,
'', $needLatest);
339 if (!$oattr->phpfile) {
340 $oattr->phpfile =
"fdl.php";
341 $oattr->phpfunc =
"lfamily(D,$famid,${linkprefix}${attrid}):${cible}$attrid,${linkprefix}${attrid}";
343 $phpfunc = preg_replace(
'/([\s|,|:])CT([\s|,|\)]|$)/',
'$1' . $linkprefix . $attrid .
'$2', $oattr->phpfunc);
344 $phpfunc = str_replace(
"):$attrid,",
"):${cible}${attrid},", $phpfunc);
345 $phpfunc = str_replace(
"):" . strtoupper($attrid) .
",",
"):${cible}${attrid},", $phpfunc);
346 $oattr->phpfunc = $phpfunc;
350 $iopt =
'&phpfile=' . $oattr->phpfile .
'&phpfunc=' . $oattr->phpfunc .
'&label=' . ($oattr->getLabel());
352 $autocomplete =
" autocomplete=\"off\" autoinput=\"1\" onfocus=\"activeAuto(event," .
$docid .
",this,'$iopt','$attrid','$index')\" ";
356 $input.=
"<input $classname $autocomplete $jsevent onchange=\"addmdocs('$attrin');document.isChanged=true\" type=\"text\" name=\"_${linkprefix}" . substr($attrin, 1) .
"\"";
357 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
358 $input.=
" id=\"${linkprefix}" . $attridk .
"\" value=\"" . $textvalue .
"\">";
361 $doc->addparamrefresh($attrid, $linkprefix . $attrid);
363 $input = $input2 . $input;
366 $input =
"<input $oc $classname type=\"text\" name=\"" . $attrin .
"\" value=\"" .
$value .
"\"";
367 $input.=
" id=\"" . $attridk .
"\" ";
368 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
374 if ($oattr->eformat ==
"") $oattr->eformat = $oattr->getOption(
"eformat");
375 if (($oattr->repeat) && (!$oattr->inArray())) {
376 switch ($oattr->eformat) {
378 $lay =
new Layout(
"FDL/Layout/editenumlistvcheck.xml", $action);
382 $lay =
new Layout(
"FDL/Layout/editenumlisthcheck.xml", $action);
386 $lay =
new Layout(
"FDL/Layout/editenumlistauto.xml", $action);
390 $lay =
new Layout(
"FDL/Layout/editenumlist.xml", $action);
393 $enuml = $oattr->getenumlabel();
394 $lunset = current($enuml);
396 if (($oattr->eformat ==
'bool') || ($oattr->getOption(
"eunset") !=
"yes"))
$value = key($enuml);
399 switch ($oattr->eformat) {
401 $lay =
new Layout(
"FDL/Layout/editenumvcheck.xml", $action);
405 $lay =
new Layout(
"FDL/Layout/editenumhcheck.xml", $action);
409 $lay =
new Layout(
"FDL/Layout/editenumauto.xml", $action);
414 $lay =
new Layout(
"FDL/Layout/editenumbool.xml", $action);
416 $lset = next($enuml);
417 $boolkeys = array_keys($enuml);
418 if (
$value == key($enuml)) $lay->set(
"checkedyesno",
"checked");
419 else $lay->set(
"checkedyesno",
"");
420 $lay->set(
"tyesno", sprintf(_(
"set for %s, unset for %s") , $lset, $lunset));
421 $lay->set(
"val1", $boolkeys[0]);
422 $lay->set(
"val2", $boolkeys[1]);
426 $lay =
new Layout(
"FDL/Layout/editenum.xml", $action);
431 $lay->set(
"msize", $oattr->getOption(
"mselectsize", 3));
432 if (($visibility ==
"R") || ($visibility ==
"S")) $lay->set(
"disabled", $idisabled);
433 else $lay->set(
"disabled",
"");
435 $lay->set(
"NOTD", $notd);
436 $input = $lay->gen();
442 $elabel = $oattr->getOption(
"elabel");
443 if ($elabel !=
"") $eopt.=
" title=\"$elabel\"";
444 $input =
"<input size=7 $eopt style=\"background-color:$value\" type=\"text\" name=\"" . $attrin .
"\" value=\"" . chop(htmlentities(
$value, ENT_COMPAT,
"UTF-8")) .
"\"";
445 $input.=
" id=\"" . $attridk .
"\" ";
447 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
448 else if (
$doc->usefor !=
'D') $input.=
" disabled ";
449 $input.=
" class=\"color {pickerOnfocus:false,pickerClosable:true,pickerCloseText:'" . _(
"Close") .
"',hash:true,required:false}\" ";
452 if (!(($visibility ==
"R") || ($visibility ==
"S"))) {
453 $input.=
"<input id=\"ic_$attridk\" type=\"button\" value=\"…\"" .
" title=\"" . _(
"color picker") .
"\" onclick=\"jscolor.init(); document.getElementById('$attridk').color.showPicker()\"" .
">";
460 $lay =
new Layout(
"FDL/Layout/editdate.xml", $action);
463 $lay->set(
"disabled",
"");
464 if (($visibility ==
"R") || ($visibility ==
"S")) {
465 $lay->set(
"disabled", $idisabled);
466 }
else if (
$doc->usefor !=
'D') $lay->set(
"disabled",
"disabled");
468 if (!(($visibility ==
"R") || ($visibility ==
"S"))) {
469 $lay->setBlockData(
"VIEWCALSEL", array(
475 if ((
$doc->usefor !=
'D') && (
$doc->usefor !=
'Q')) $lay->setBlockData(
"CONTROLCAL", array(
480 $input = trim($lay->gen());
486 $lay =
new Layout(
"FDL/Layout/edittimestamp.xml", $action);
489 $lay->set(
"readonly",
false);
490 $lay->set(
"disabled",
"");
491 if (($visibility ==
"R") || ($visibility ==
"S")) {
492 $lay->set(
"disabled", $idisabled);
493 $lay->set(
"readonly",
true);
494 }
else if (
$doc->usefor !=
'D') $lay->set(
"disabled",
"disabled");
496 $input = $lay->gen();
503 if (($visibility ==
"R") || ($visibility ==
"S")) $isDisabled = $idisabled;
504 list($hh, $mm, $ss) = explode(
":",
$value);
505 $input =
"<input $isDisabled size=2 maxlength=2 onchange=\"chtime('$attridk')\" type=\"text\" value=\"" . $hh .
"\" id=\"hh" . $attridk .
"\">:";
507 $input.=
"<input $isDisabled size=2 maxlength=2 onchange=\"chtime('$attridk')\" type=\"text\" value=\"" . $mm .
"\"id=\"mm" . $attridk .
"\">";
509 $input.=
"<input type=\"hidden\" onchange=\"displayTime(this)\" name=\"" . $attrin .
"\" id=\"" . $attridk .
"\" value=\"" .
$value .
"\">";
516 $eopt =
"$classname ";
517 $esize = $oattr->getOption(
"esize");
518 if ($esize > 0) $eopt =
"size=$esize";
519 $input =
"<input $oc $eopt type=\"password\" name=\"" . $attrin .
"\" value=\"" .
"\"";
520 $input.=
" id=\"" . $attridk .
"\" ";
522 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
530 $lay =
new Layout(
"FDL/Layout/editdocoption.xml", $action);
532 if (($visibility ==
"R") || ($visibility ==
"S")) $lay->set(
"disabled", $idisabled);
533 else $lay->set(
"disabled",
"");
534 $input = $lay->gen();
540 if (($oattr->repeat) && (!$oattr->inArray())) {
541 $input =
"<textarea $oc $classname rows=2 name=\"" . $attrin .
"\" ";
542 $input.=
" id=\"" . $attridk .
"\" ";
543 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
544 $input.=
" >\n" . htmlentities(stripslashes(str_replace(
"<BR>",
"\n",
$value)) , ENT_COMPAT,
"UTF-8") .
"</textarea>";
546 $hvalue = str_replace(array(
552 ) , chop(htmlentities(stripslashes(
$value) , ENT_COMPAT,
"UTF-8")));
554 if ($oattr->eformat !=
"") {
556 $lay =
new Layout(
"FDL/Layout/edittextlist.xml", $action);
558 if (($visibility ==
"R") || ($visibility ==
"S")) $lay->set(
"disabled", $idisabled);
559 else $lay->set(
"disabled",
"");
560 $lay->set(
"adisabled", $idisabled);
561 $lay->set(
"oc", $jsevent);
563 if ($oattr->eformat ==
"hlist") $lay->set(
"atype",
"hidden");
564 else $lay->set(
"atype",
"text");
565 $input = $lay->gen();
569 $oattr->eformat =
"";
573 if ($oattr->eformat ==
"") {
575 $eopt =
"$classname ";
576 $esize = $oattr->getOption(
"esize");
577 if ($esize > 0) $eopt =
"size=$esize";
578 $elabel = $oattr->getOption(
"elabel");
579 if ($elabel !=
"") $eopt.=
" title=\"$elabel\"";
580 $ecolor = $oattr->getOption(
"color");
582 if ($ecolor !=
"") $estyle =
"color:$ecolor;";
583 $ealign = $oattr->getOption(
"align");
584 if ($ealign !=
"") $estyle.=
"text-align:$ealign";
585 if ($estyle) $estyle =
"style=\"$estyle\"";
587 $input =
"<input $oc $eopt $estyle type=\"text\" name=\"" . $attrin .
"\" value=\"" . $hvalue .
"\"";
588 $input.=
" id=\"" . $attridk .
"\" ";
589 if (($visibility ==
"R") || ($visibility ==
"S")) $input.= $idisabled;
596 if (($oattr->type !=
"array")) {
597 if ($visibility !=
"S") {
598 if ($usephpfunc && ($oattr->phpfunc !=
"") && ($oattr->phpfile !=
"") && ($oattr->type !=
"enum") && ($oattr->type !=
"enumlist")) {
599 $phpfunc = $oattr->phpfunc;
601 $linkprefixCT =
"ilink_";
602 $phpfunc = preg_replace(
'/([\s|,|:])CT\[([^]]+)\]/e',
"'\\1'.$linkprefixCT.strtolower('\\2')", $phpfunc);
605 $ititle = sprintf(_(
"choose inputs for %s") , ($oattr->getLabel()));
606 if ($oattr->getOption(
"ititle") !=
"") $ititle = str_replace(
"\"",
"'", $oattr->getOption(
"ititle"));
608 if ($phpfunc[0] ==
"[") {
609 if (preg_match(
'/\[(.*)\](.*)/', $phpfunc, $reg)) {
611 $ititle = addslashes($reg[1]);
614 if (!$notd) $input.=
"</td><td class=\"editbutton\">";
615 if (preg_match(
"/list/", $attrtype, $reg)) $ctype =
"multiple";
616 else $ctype =
"single";
618 if ($alone) $ctype.=
"-alone";
623 if (preg_match(
'/[A-Z_\-0-9]+:[A-Z_\-0-9]+\(/i', $phpfunc)) {
624 $mheight = $oattr->getOption(
'mheight', 30);
625 $mwidth = $oattr->getOption(
'mwidth', 290);
626 $input.=
"<input id=\"ic_${linkprefix}$attridk\" type=\"button\" value=\"Z\"" .
" title=\"" . $ititle .
"\"" .
" onclick=\"sendSpecialChoice(event,'${linkprefix}${attridk}'," .
$docid .
",'$attrid','$index','$mheight','$mwidth')\">";
628 $ib =
"<input id=\"ic_${linkprefix}$attridk\" type=\"button\" value=\"…\"" .
" title=\"" . $ititle .
"\"" .
" onclick=\"sendAutoChoice(event," .
$docid .
",this,'${linkprefix}${attridk}','$iopt','$attrid','$index')\">";
632 if (($oattr->type ==
"docid") && ($oattr->getOption(
"multiple") ==
"yes")) {
633 $ib =
"<input id=\"ix_$attridk\" type=\"button\" value=\"×\"" .
" title=\"" . _(
"clear selected inputs") .
"\" disabled " .
" onclick=\"clearDocIdInputs('$attridk','mdocid_isel_$attridk',this)\">";
636 } elseif (preg_match(
'/(.*)\((.*)\)\:(.*)/', $phpfunc, $reg)) {
637 if ($alone && $oattr->type !=
"docid") {
642 $argids = explode(
",", $reg[3]);
644 $outsideArg = array();
645 foreach ($argids as $k => $v) {
646 $linkprefix =
"ilink_";
648 $attrId = $argids[$k];
649 if (substr($attrId, 0, strlen($linkprefix)) == $linkprefix) {
650 $attrId = substr($attrId, strlen($linkprefix));
653 $docAttr =
$doc->getAttribute($attrId);
654 if (is_object($docAttr) && !$docAttr->inArray()) {
655 $targid = trim(strtolower($attrId));
657 $targid = $linkprefix . $targid;
659 $outsideArg[] = $targid;
661 $targid = strtolower(trim($attrId));
663 $targid = $linkprefix . $targid;
665 if (strlen($attrId) > 1)
$arg[$targid] = $targid;
669 if (count(
$arg) > 0 || count($outsideArg) > 0) {
670 if (count(
$arg) == 0) {
671 $jarg =
"'" . implode(
"','", $outsideArg) .
"'";
673 $jarg =
"'" . implode(
"','",
$arg) .
"'";
675 if (count($outsideArg) > 0) {
676 $jOutsideArg =
"'" . implode(
"','", $outsideArg) .
"'";
678 if (!empty($jOutsideArg)) {
679 $jOutsideArg =
",[$jOutsideArg]";
683 $input.=
"<input id=\"ix_$attridk\" type=\"button\" value=\"×\"" .
" title=\"" . _(
"clear inputs") .
"\"" .
" onclick=\"clearInputs([$jarg],'$index','$attridk' $jOutsideArg)\">";
686 }
else if (($oattr->type ==
"date") || ($oattr->type ==
"timestamp")) {
687 $input.=
"<input id=\"ix_$attridk\" type=\"button\" value=\"×\"" .
" title=\"" . _(
"clear inputs") .
"\"" .
" onclick=\"clearInputs(['$attrid'],'$index')\">";
688 if (!$notd) $input.=
"</td><td class=\"nowrap\">";
689 }
else if ($oattr->type ==
"color") {
690 $input.=
"<input id=\"ix_$attridk\" type=\"button\" value=\"×\"" .
" title=\"" . _(
"clear inputs") .
"\"" .
" onclick=\"clearInputs(['$attrid'],'$index')\">";
691 $input.=
"</td><td class=\"nowrap\">";
692 }
else if ($oattr->type ==
"time") {
693 $input.=
"<input id=\"ix_$attridk\" type=\"button\" value=\"×\"" .
" title=\"" . _(
"clear inputs") .
"\"" .
" onclick=\"clearTime('$attridk')\">";
694 if (!$notd) $input.=
"</td><td class=\"nowrap\">";
695 }
else if (($oattr->type ==
"file") || ($oattr->type ==
"image")) {
696 $input.=
"<input id=\"ix_$attridk\" type=\"button\" style=\"vertical-align:baseline\" value=\"×\"" .
" title=\"" . _(
"clear file") .
"\"" .
" title1=\"" . _(
"clear file") .
"\"" .
" value1=\"×\"" .
" title2=\"" . _(
"restore original file") .
"\"" .
" value2=\"−\"" .
" onclick=\"clearFile(this,'$attridk')\">";
697 if (!$notd) $input.=
"</td><td class=\"nowrap\">";
699 if (!$notd) $input.=
"</td><td class=\"nowrap\">";
702 if (!$notd) $input.=
"</td><td class=\"nowrap\">";
705 $input.= addDocidCreate($oattr,
$doc, $attridk,
$value, $index);
706 if ($oattr->elink !=
"" && (!$alone)) {
707 if (substr($oattr->elink, 0, 3) ==
"JS:") {
709 $url =
elinkEncode(
$doc, $attridk, substr($oattr->elink, 3) , $index, $ititle, $isymbol);
713 $url =
elinkEncode(
$doc, $attridk, $oattr->elink, $index, $ititle, $isymbol);
715 $target = $oattr->getOption(
"eltarget", $attrid);
717 $jsfunc =
"subwindow(300,500,'$target','$url');";
720 if ($oattr->getOption(
"elsymbol") !=
"") $isymbol = $oattr->getOption(
"elsymbol");
721 if ($oattr->getOption(
"eltitle") !=
"") $ititle = str_replace(
"\"",
"'", $oattr->getOption(
"eltitle"));
722 $input.=
"<input type=\"button\" value=\"$isymbol\"" .
" title=\"" . $ititle .
"\"" .
" onclick=\"$jsfunc;";
727 if (($oattr->phpconstraint !=
"") && ($index !=
"__1x_")) {
728 $res =
$doc->verifyConstraint($oattr->id, ($index ==
"") ? -1 : $index);
729 if (($res[
"err"] ==
"") && (count($res[
"sug"]) == 0)) $color =
'mediumaquamarine';
730 if (($res[
"err"] ==
"") && (count($res[
"sug"]) > 0)) $color =
'orange';
731 if (($res[
"err"] !=
"")) $color =
'tomato';
733 $input.=
"<input style=\"background-color:$color;\"type=\"button\" class=\"constraint\" id=\"co_$attridk\" value=\"C\"" .
" onclick=\"vconstraint(this," .
$doc->fromid .
",'$attrid');\">";
736 } elseif ($oattr->type ==
"htmltext") {
737 if (!$notd) $input.=
"</td><td class=\"nowrap\">";
746 $linkprefix =
"ilink_";
747 $ititle = _(
"add inputs");
751 if ($link[0] ==
"[") {
752 if (preg_match(
'/\[(.*)\|(.*)\](.*)/', $link, $reg)) {
759 for ($i = 0; $i < strlen($link); $i++) {
764 while (($link[$i] !=
"%") && ($i <= strlen($link))) {
765 $sattrid.= $link[$i];
771 $urllink.= GetParam(
"CORE_BASEURL");
775 $urllink.= GetParam(
"CORE_STANDURL");
787 $urllink.=
$doc->fromid;
795 $urllink.=
"'+elinkvalue('${linkprefix}${attrik}')+'";
799 $prop =
$doc->getProperty($sattrid);
800 if ($prop !==
false) {
803 $sattrid = strtolower($sattrid);
805 $attr =
$doc->getAttribute($sattrid);
808 $action->exitError(sprintf(_(
"elinkEncode::attribute not found %s in %s : %s") , $sattrid, $attrik, $link));
810 if ($attr->inArray()) $sattrid.=
'_' . $index;
812 $urllink.=
"'+elinkvalue('$sattrid')+'";
821 while ($link[$i] !=
'}') {
822 $sattrid.= $link[$i];
826 $ovalue = GetParam($sattrid,
getFamIdFromName(GetParam(
"FREEDOM_DB") , $sattrid));
833 $urllink.= $link[$i];
844 $attrid = $oattr->id;
845 $ta =
$doc->attributes->getArrayElements($attrid);
847 $height = $oattr->getOption(
"height",
false);
848 $lay->set(
"tableheight", $height);
849 $tableStyle = $oattr->getOption(
"tstyle",
'');
850 $lay->set(
"tableStyle", $tableStyle);
851 $lay->set(
"thspan",
"2");
860 foreach (
$ta as $k => $v) {
864 if ($max0 < 0) $max0 =
$c;
870 foreach (
$ta as $k => $v) {
874 $t = array_pad(
$t, $max,
"");
881 $ddoc->setDefaultValues($ddoc->getFamDoc()->getDefValues() ,
true,
true);
883 $tad = $ddoc->attributes->getArrayElements($attrid);
886 $autoWidthAttr =
false;
887 foreach (
$ta as $k => $v) {
888 if ($v->mvisibility ==
"R") {
889 $v->mvisibility =
"H";
890 $ta[$k]->mvisibility =
"H";
892 $visible = ($v->mvisibility !=
"H");
893 $width = $v->getOption(
"cwidth",
"auto");
895 "alabel" => (!$visible) ?
"" : $v->getLabel() ,
896 "elabel" => $v->getOption(
"elabel") ,
897 "astyle" => $v->getOption(
"cellheadstyle") ,
898 "ahclass" => (!$visible) ?
"hiddenAttribute" :
"visibleAttribute"
901 "ilabel" =>
getHtmlInput(
$doc, $v, $ddoc->getValue($tad[$k]->id) ,
'__1x_') ,
902 "ihw" => (!$visible) ?
"0px" : $width,
903 "bgcolor" => $v->getOption(
"bgcolor",
"inherit") ,
904 "tdstyle" => $v->getOption(
"cellbodystyle") ,
905 "cellatype" => $v->type,
906 "cellattrid" => $v->id,
907 "cellmultiple" => ($v->getOption(
"multiple") ==
"yes") ?
"true" :
"false",
908 "ihclass" => (!$visible) ?
"hiddenAttribute" :
"visibleAttribute"
911 if ($visible) $nbcolattr++;
912 $tval[$k] =
$doc->getTValue($k);
913 $nbitem = count($tval[$k]);
915 if (($visible) && ($width ==
"auto")) {
916 $autoWidthAttr =
true;
921 if ($oattr->format !=
"empty" && $oattr->getOption(
"empty") !=
"yes") {
956 if (($row >= 0) && ($oattr->mvisibility ==
"W" || $oattr->mvisibility ==
"O" || $oattr->mvisibility ==
"U")) {
957 $oattr->mvisibility =
"U";
961 $tableWidth = $oattr->getOption(
"twidth",
'100%');
963 if ((!$autoWidthAttr) && ($tableWidth !=
'auto')) {
965 $tableWidth =
'auto';
967 $lay->set(
"tableWidth", $tableWidth);
969 $lay->setBlockData(
"TATTR", $talabel);
970 $lay->setBlockData(
"IATTR", $tilabel);
971 $lay->set(
"attrid", $attrid);
972 if ($oattr->getOption(
"vlabel",
"up") ==
"up") $lay->set(
"caption", $oattr->getLabel());
973 else $lay->set(
"caption",
"");
974 $lay->set(
"footspan", count(
$ta) * 2);
977 $nbitem = count(current($tval));
980 for ($k = 0; $k < $nbitem; $k++) {
981 if (($row >= 0) && ($k != $row))
continue;
983 "bevalue" =>
"bevalue_$k",
989 foreach (
$ta as $ka => $va) {
991 $visible = ($va->mvisibility !=
"H");
995 "bgcolor" => $va->getOption(
"bgcolor",
"inherit") ,
996 "cellatype" => $va->type,
997 "cellattrid" => $va->id,
998 "cellmultiple" => ($va->getOption(
"multiple") ==
"yes") ?
"true" :
"false",
999 "tdstyle" => $va->getOption(
"cellbodystyle") ,
1000 "vhw" => (!$visible) ?
"0px" : $va->getOption(
"cwidth",
"auto") ,
1001 "eiclass" => (!$visible) ?
"hiddenAttribute" :
"visibleAttribute"
1005 $lay->setBlockData(
"bevalue_$k", $tivalue);
1007 $lay->set(
"addfunc",
false);
1008 if (($oattr->phpfunc !=
"") && ($oattr->phpfile !=
"")) {
1009 if (preg_match(
'/[A-Z_\-0-9]+:[A-Z_\-0-9]+\(/i', $oattr->phpfunc)) {
1010 $mheight = $oattr->getOption(
'mheight', 30);
1011 $mwidth = $oattr->getOption(
'mwidth', 290);
1012 $lay->set(
"addtitle", $oattr->getOption(
"ltitle", _(
"Modify table")));
1013 $lay->set(
"addsymbol", $oattr->getOption(
"lsymbol"));
1014 $lay->set(
"addfunc",
"sendSpecialChoice(event,'{$oattr->id}'," . (
$doc->id ?
$doc->id :
$doc->fromid) .
",'" . $oattr->id .
"','" . $row .
"','" . $mheight .
"','" . $mwidth .
"')");
1018 $lay->set(
"useadd", ($oattr->getOption(
"userowadd") !=
"no"));
1019 $lay->set(
"readonly", ($oattr->mvisibility ==
'U'));
1020 if (count($tvattr) > 0) $lay->setBlockData(
"EATTR", $tvattr);
1027 $height = $oattr->getOption(
"height",
false);
1028 $lay->set(
"tableheight", $height);
1029 $lay->set(
"readonly", ($oattr->mvisibility ==
'U'));
1030 $lay->set(
"thspan",
"1");
1032 if (($zone !=
"") && preg_match(
"/([A-Z_-]+):([^:]+):{0,1}[A-Z]{0,1}/", $zone, $reg)) {
1033 $attrid = $oattr->id;
1034 $ta =
$doc->attributes->getArrayElements($attrid);
1036 $dxml =
new DomDocument();
1038 if (!@$dxml->load($rowlayfile)) {
1039 AddwarningMsg(sprintf(_(
"cannot open %s layout file") ,
DEFAULT_PUBDIR .
"/$rowlayfile"));
1042 $theads = $dxml->getElementsByTagName(
'table-head');
1043 if ($theads->length > 0) {
1044 $thead = $theads->item(0);
1045 $theadcells = $thead->getElementsByTagName(
'cell');
1047 for ($i = 0; $i < $theadcells->length; $i++) {
1049 $thstyle = $theadcells->item($i)->getAttribute(
"style");
1054 "astyle" => $thstyle,
1056 "ahvis" =>
"visible"
1059 $lay->setBlockData(
"TATTR", $talabel);
1062 $tbodies = $dxml->getElementsByTagName(
'table-body');
1063 if ($tbodies->length > 0) {
1064 $tbody = $tbodies->item(0);
1065 $tbodycells = $tbody->getElementsByTagName(
'cell');
1066 for ($i = 0; $i < $tbodycells->length; $i++) {
1068 $tcellstyle[] = $tbodycells->item($i)->getAttribute(
"style");
1074 foreach (
$ta as $k => $v) {
1075 $tval[$k] =
$doc->getTValue($k);
1076 $nbitem = max($nbitem, count($tval[$k]));
1077 $lay->set(
"L_" . strtoupper($v->id) , ucfirst($v->getLabel()));
1080 $lay->set(
"attrid", $attrid);
1082 if ($oattr->getOption(
"vlabel",
"up") ==
"up") $lay->set(
"caption", $oattr->getLabel());
1083 else $lay->set(
"caption",
"");
1084 $lay->set(
"footspan", count(
$ta) * 2);
1085 $lay->set(
"eiclass",
'');
1086 $lay->set(
"tableWidth", $oattr->getOption(
"twidth",
'100%'));
1087 $lay->set(
"tableStyle", $oattr->getOption(
"tstyle",
''));
1090 $defval =
$fdoc->getDefValues();
1093 for ($k = 0; $k < $nbitem; $k++) {
1095 "bevalue" =>
"bevalue_$k"
1099 foreach ($tr as $kd => $td) {
1100 $val = preg_replace(
'/\[([^\]]*)\]/e',
"rowattrReplace(\$doc,'\\1',$k)", $td);
1103 "ehvis" =>
"visible",
1104 "tdstyle" => $tcellstyle[$kd],
1105 "bgcolor" =>
"inherit",
1109 $lay->setBlockData(
"bevalue_$k", $tivalue);
1112 foreach ($tr as $kd => $td) {
1113 $dval = preg_replace(
'/\[([^\]]*)\]/e',
"rowattrReplace(\$doc,'\\1','__1x_',\$defval)", $td);
1117 "tdstyle" => $tcellstyle[$kd],
1118 "bgcolor" =>
"inherit",
1119 "ihvis" =>
"visible"
1122 $lay->set(
"addfunc",
false);
1123 if (($oattr->phpfunc !=
"") && ($oattr->phpfile !=
"")) {
1124 if (preg_match(
'/[A-Z_\-0-9]+:[A-Z_\-0-9]+\(/i', $oattr->phpfunc)) {
1126 $mheight = $oattr->getOption(
'mheight', 30);
1127 $mwidth = $oattr->getOption(
'mwidth', 290);
1129 $lay->set(
"addtitle", $oattr->getOption(
"ltitle", _(
"Modify table")));
1130 $lay->set(
"addsymbol", $oattr->getOption(
"lsymbol"));
1131 $lay->set(
"addfunc",
"sendSpecialChoice(event,'{$oattr->id}',$docid,'{$oattr->id}','$row','$mheight','$mwidth')");
1134 $lay->setBlockData(
"IATTR", $tilabel);
1135 $lay->set(
"readonly", ($oattr->mvisibility ==
'U'));
1136 $lay->set(
"useadd", ($oattr->getOption(
"userowadd") !=
"no"));
1137 if (count($tvattr) > 0) $lay->setBlockData(
"EATTR", $tvattr);
1143 if (substr(
$s, 0, 2) ==
"L_")
return "[$s]";
1144 if (substr(
$s, 0, 2) ==
"V_") {
1146 if ($index != - 1)
$value =
$doc->getTValue(
$s,
"", $index);
1147 else $value = $defval[strtolower(
$s) ];
1148 $oattr =
$doc->getAttribute(
$s);
1149 if (!$oattr)
return sprintf(_(
"unknow attribute %s") ,
$s);
1152 $sl = strtolower(
$s);
1153 if (!isset(
$doc->$sl))
return "[$s]";
1154 if ($index == - 1) $v =
$doc->getValue($sl);
1155 else $v =
$doc->getTValue($sl,
"", $index);
1171 $idocid = $oattr->format . $index;
1172 $lay->set(
"name", $aname);
1173 $lay->set(
"id", $oattr->id . $index);
1174 $lay->set(
"idocid", strtolower($idocid));
1175 $lay->set(
"value",
$value);
1189 if ($index !==
"") $idocid = $oattr->id .
'_' . $index;
1190 else $idocid = $oattr->id;
1191 $needLatest = ($oattr->getOption(
"docrev",
"latest") ==
"latest");
1193 $lay->set(
"name", $aname);
1194 $lay->set(
"aid", $idocid);
1195 $lay->set(
"value",
$value);
1196 $lay->set(
"docid", (
$doc->id == 0) ?
$doc->fromid :
$doc->id);
1199 $lay->set(
"size", 1);
1201 $tval = explode(
"<BR>",
$value);
1202 foreach ($tval as $k => $v) {
1204 "ltitle" =>
$doc->getTitle($v,
'', $needLatest) ,
1208 $lay->set(
"size", min(count($topt) , 6));
1210 $lay->setBlockData(
"options", $topt);
1224 if ($index !==
"") $idocid = $oattr->format .
'_' . $index;
1225 else $idocid = $oattr->format;
1226 $lay->set(
"name", $aname);
1229 if ($localeconfig !=
false) {
1230 $lay->set(
"dateformat", $localeconfig[
'dateFormat']);
1231 $lay->set(
"datetimeformat", $localeconfig[
'dateTimeFormat']);
1234 $lay->set(
"dateformat",
'');
1235 $lay->set(
"datetimeformat",
'');
1238 if ($index !==
"") $lay->set(
"id", $oattr->id .
'_' . $index);
1239 else $lay->set(
"id", $oattr->id);
1240 $lay->set(
"idocid", strtolower($idocid));
1241 $lay->set(
"value",
$value);
1255 if ($index !==
"") $idocid = $oattr->format .
'_' . $index;
1256 else $idocid = $oattr->format;
1257 $lay->set(
"name", $aname);
1258 if ($index !==
"") $idx = $oattr->id .
'_' . $index;
1259 else $idx = $oattr->id;
1261 $lay->set(
"id", $idx);
1262 $lay->set(
"idi", $oattr->id);
1263 $etype = $oattr->getOption(
"etype");
1264 $eformat = $oattr->getOption(
"eformat");
1265 $multiple = $oattr->getOption(
"multiple");
1266 if (($eformat ==
"auto") && ($multiple !=
"yes"))
$doc->addParamRefresh($oattr->id,
"li_" . $oattr->id);
1268 $lay->set(
"isopen", ($etype ==
"open"));
1269 $lay->set(
"isfreeselected",
false);
1270 $lay->set(
"isfree", ($etype ==
"free"));
1273 $lay->set(
"lvalue",
$value);
1274 $enuml = $oattr->getenumlabel();
1276 $enumk = array_keys($enuml);
1277 if (($etype ==
"free") && ($eformat !=
"auto")) {
1278 $enuml[
'...'] = _(
"Other...");
1281 if (($eformat ==
"") && (
$value ==
" ") && ($oattr->getOption(
"eunset") ==
"yes")) {
1282 $enuml[
' '] = _(
"Do choice");
1289 foreach ($enuml as $k => $v) {
1290 if (in_array($k, $tvalue)) {
1291 $topt[$k][
"selected"] =
"selected";
1292 $topt[$k][
"checked"] =
"checked";
1293 $lay->set(
"lvalue", $v);
1296 if ($eformat !=
"auto") {
1297 $topt[$k][
"selected"] =
"";
1298 $topt[$k][
"checked"] =
"nochecked";
1301 if (($eformat !=
"auto") || ($topt[$k][
"selected"] ==
"selected")) {
1302 if ($k ==
"...") $topt[$k][
"optid"] = $idx .
'___';
1303 else $topt[$k][
"optid"] = $idx .
'_' . $ki;
1304 $topt[$k][
"fvalue"] = $v;
1305 $topt[$k][
"kvalue"] = $k;
1306 $topt[$k][
"ki"] = $ki;
1307 $topt[$k][
"other"] =
false;
1311 if (($eformat ==
"auto") && ($multiple ==
"yes")) $lay->set(
"isopen",
false);
1312 if ($noselect && ($etype ==
"free")) {
1314 if ($eformat !=
"auto") {
1315 $topt[
'...'][
"fvalue"] =
"";
1316 $topt[
'...'][
"kvalue"] =
"";
1317 $topt[
'...'][
"selected"] =
"selected";
1318 $topt[
'...'][
"checked"] =
"checked";
1320 $lay->set(
"isfreeselected",
true);
1321 $lay->set(
"lvalue", $lay->get(
"lvalue") .
' ' . _(
"(Other)"));
1323 if ($multiple !=
"yes") {
1324 $topt[
'.sel.'] = $topt[
'...'];
1325 $topt[
'.sel.'][
"fvalue"] =
$value .
' ' . _(
"(Other input)");
1326 $topt[
'.sel.'][
"kvalue"] =
$value;
1328 $topt[
'...'][
"selected"] =
"";
1329 $topt[
'...'][
"checked"] =
"";
1330 $lay->set(
"isfreeselected",
false);
1337 if ($multiple && ($etype ==
"free")) {
1338 $lay->set(
"freevalue",
"");
1339 if ($eformat !=
"auto") $topt[
'...'][
"other"] =
true;
1340 foreach ($tvalue as $kv) {
1341 if (trim($kv) && (!in_array($kv, $enumk))) {
1342 if (($eformat ==
"auto") || ($eformat ==
"")) {
1343 $topt[$kv][
"fvalue"] = $kv .
' ' . _(
"(Other)");
1344 $topt[$kv][
"kvalue"] = $kv;
1345 $topt[$kv][
"ki"] = $ki++;
1346 $topt[$kv][
"selected"] =
"selected";
1349 $topt[
'...'][
"selected"] =
"selected";
1350 $topt[
'...'][
"checked"] =
"checked";
1351 $lay->set(
"isfreeselected",
true);
1352 $lay->set(
"freevalue", $kv);
1358 $lay->setBlockData(
"OPTIONS", $topt);
1359 $lay->set(
"value",
$value);
1360 $lay->set(
"docid", (
$doc->id == 0) ?
$doc->fromid :
$doc->id);
1361 $lay->set(
"index", $index);
1375 if ($index !==
"") $idocid = $oattr->format .
'_' . $index;
1376 else $idocid = $oattr->format;
1377 $lay->set(
"name", $aname);
1378 $idx = $oattr->id . $index;
1379 $lay->set(
"id", $idx);
1380 $lay->set(
"didx", $index);
1381 $lay->set(
"di", trim(strtolower($oattr->format)));
1382 if ($index !==
"") $lay->set(
"said",
$doc->getTValue($oattr->format,
"", $index));
1383 else $lay->set(
"said",
$doc->getValue($oattr->format));
1385 $lay->set(
"value",
$value);
1386 $lay->set(
"uuvalue", urlencode(
$value));
1400 include_once (
"FDL/enum_choice.php");
1401 if ($index !==
"") $idocid = $oattr->format .
'_' . $index;
1402 else $idocid = $oattr->format;
1403 $lay->set(
"name", $aname);
1404 $idx = $oattr->id . $index;
1405 $lay->set(
"id", $idx);
1409 if ($res ===
false)
return false;
1411 if (is_array($rargids)) $sattrid.= strtolower(
"'" . implode(
"','", $rargids) .
"'");
1413 $lay->Set(
"attrid", $sattrid);
1415 if (is_array($tselect)) {
1416 foreach ($tselect as $k => $v) {
1417 if ($v[
"choice"] ==
$value) $tselect[$k][
"selected"] =
"selected";
1418 else $tselect[$k][
"selected"] =
"";
1420 $lay->SetBlockData(
"SELECTENUM", $tselect);
1423 $lay->SetBlockData(
"ATTRVAL", $tval);
1425 $lay->set(
"value",
$value);
1438 $idocfamid = $oattr->format;
1440 $temp = base64_decode(
$value);
1441 $entete =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\" ?>";
1447 $famname =
$doc->getTitle($idocfamid);
1448 $title = sprintf(_(
"create new %s") , $famname);
1450 $input =
"<INPUT id=\"_" . $attridk .
"\" TYPE=\"hidden\" name=$attrin value=\"" .
$value .
" \"><a id='iti_$attridk' " .
" oncontextmenu=\"viewidoc_in_popdoc(event,'$attridk','_$attridk','$idocfamid')\"" .
" onclick=\"editidoc('_$attridk','_$attridk','$idocfamid','$zone');\">$title</a> ";
1458 $action->parent->AddJsRef(sprintf(
"%sapp=FDL&action=ALLEDITJS&wv=%s",
$action->GetParam(
"CORE_SSTANDURL") ,
$action->GetParam(
"WVERSION")));
1459 $action->parent->AddCssRef(sprintf(
"%sapp=FDL&action=ALLEDITCSS&wv=%s",
$action->GetParam(
"CORE_SSTANDURL") ,
$action->GetParam(
"WVERSION")));
1468 if ($oattr->type ==
"docid") {
1469 $creation = $oattr->
getOption(
"creation");
1470 if ($creation && ($creation !=
"no")) {
1472 $reldoc = new_doc($doc->dbaccess, $oattr->format);
1473 if ($reldoc->control(
'icreate') !=
"")
return '';
1476 if ($creation !=
"yes") {
1477 $create = str_replace(
'"',
'"e;', $creation);
1478 $create = str_replace(array(
1490 $jscreate = json_decode($create);
1491 if ($jscreate === null) {
1492 addWarningMsg(sprintf(
"creation option syntax error:%s [%s] ", $oattr->id, $creation));
1494 foreach ($jscreate as $k => $v) {
1495 $kl = trim(strtolower($k));
1496 $v = str_replace(
'"e;',
'"', $v);
1499 $urlcreate.= sprintf(
"&%s=%s", $kl, urlencode(trim($v,
'"')));
1501 $urlcreate.= sprintf(
"&%s=%s", $kl, elinkencode($doc, $attridk,
"%$v%", $index));
1506 $esymbol =
' ';
1507 if (!$attridk) $attridk = $oattr->id;
1508 $ectitle = sprintf(_(
"create a %s document") , $reldoc->getTitle());
1510 $emtitle = sprintf(_(
"modify document"));
1512 $jsfunc = sprintf(
"editRelation('%s',elinkvalue('%s'),'%s','%s')", $oattr->format, $attridk, $attridk, ($urlcreate));
1513 $input = sprintf(
"<input id=\"icr_%s\" class=\"%s\" type=\"button\" value=\"%s\" titleedit=\"%s\" titleview=\"%s\" onclick=\"%s\">", $attridk,
"add-doc", $esymbol, $ectitle, $emtitle, $jsfunc);