7 include_once (
"FDL/Class.Doc.php");
8 include_once (
"FDL/editutil.php");
15 $family = new_doc(
"",
$value);
16 if ($family->doctype !==
"C") {
17 return "Must be a family identifier";
24 $family = new_doc(
"",
$famid);
25 $attrid =
$usage->addRequiredParameter(
"attrid",
"Attribute identifier",
function (
$value) use ($family)
27 $oa = $family->getAttribute(
$value);
29 return sprintf(
"Attribute \"%s\" not found in family \"%s\"",
$value, $family->name);
33 $value =
$usage->addOptionalParameter(
"value",
"New default value");
40 $err = $e->getDcpMessage();
44 $err = $family->control(
"edit");
49 $oa = $family->getAttribute($attrid);
51 if ($oa->type ===
"file" || $oa->type ===
"image") {
52 if (isset($_FILES[
"defaultFile"])) {
53 $file = $_FILES[
"defaultFile"];
54 if (
$file[
"error"] === 0) {
58 $err = sprintf(
"Error file transfer : [code %s]",
$file[
"error"]);
67 $err = $family->modify();
76 header(
'HTTP/1.0 400 Error');
78 $defval = $family->getDefValue($oa->id);
81 "message" => ($defval ===
"") ? sprintf(_(
"Default value erased")) : sprintf(_(
"Default value recorded")) ,
82 "value" => $family->getDefValue($oa->id)
85 header(
'Content-Type: application/json');
86 $action->lay->template = json_encode(
$out);
87 $action->lay->noparse =
true;
modonedefaultvalue(Action $action)
exitError($texterr, $exit=true, $code="")
Verify arguments for action function.
if($file) if($subject==""&&$file) if($subject=="") $err
static storeFile($filepath, $ftitle="", $public_access=false)
Verify arguments for wsh programs.