7 include_once (
"FDL/Class.Dir.php");
8 include_once (
"FDL/editutil.php");
18 $parameterid =
$usage->addRequiredParameter(
"parameterId", _(
"Parameter's id"));
19 $appid =
$usage->addOptionalParameter(
"appId", _(
"Application Id"));
20 $default =
$usage->addOptionalParameter(
"emptyValue", _(
"value for empty field"));
21 $value =
$usage->addOptionalParameter(
"value", _(
"value in field"));
22 $onChange =
$usage->addOptionalParameter(
"submitOnChange", _(
"Sending input on change?"));
23 $localSubmit =
$usage->addOptionalParameter(
"localSubmit", _(
"Adding button to submit")) ==
"yes" ?
true :
false;
24 $submitLabel =
$usage->addOptionalParameter(
"submitLabel", _(
"Label of submit button") , array() , _(
"Submit"));
28 $action->lay->eset(
"parameterid", $parameterid);
31 $err =
simpleQuery($action->dbaccess, sprintf(
"SELECT * from paramdef where name='%s'", pg_escape_string($parameterid)) , $paramdef);
33 $action->AddWarningMsg(sprintf(_(
"Parameter [%s] not found. Error message: [%s]") , $parameterid,
$err));
34 $action->lay->template = htmlspecialchars(sprintf(_(
"Parameter [%s] not found. Error message: [%s]") , $parameterid,
$err) , ENT_QUOTES);
35 $action->lay->noparse =
true;
38 $action->lay->set(
"type_text", ($paramdef[0][
"kind"] ==
"text"));
39 $enum = substr($paramdef[0][
"kind"], 0, 4) ==
"enum";
40 $action->lay->set(
"type_enum", $enum);
43 $action->lay->set(
"type",
$type);
47 $action->AddWarningMsg(sprintf(_(
"Parameter [%s] is not global, an apllication muste be given") , $parameterid));
48 $action->lay->template = htmlspecialchars(sprintf(_(
"Parameter [%s] is not global, an apllication muste be given") , $parameterid) , ENT_QUOTES);
49 $action->lay->noparse =
true;
52 $appid = $paramdef[0][
"appid"];
58 $action->AddWarningMsg(sprintf(_(
"Application [%s] not found. Error message: [%s]") ,
$appid,
$err));
59 $action->lay->template = htmlspecialchars(sprintf(_(
"Application [%s] not found. Error message: [%s]") ,
$appid,
$err) , ENT_QUOTES);
60 $action->lay->noparse =
true;
68 $query = sprintf(
"SELECT * from paramv where name='%s' and appid='%s' and type='%s'", pg_escape_string($parameterid) , pg_escape_string(
$appid) , pg_escape_string(
$type));
71 $action->AddWarningMsg(sprintf(_(
"Parameter [%s] not found. Error message: [%s]") , $parameterid,
$err));
72 $action->lay->template = htmlspecialchars(sprintf(_(
"Parameter [%s] not found. Error message: [%s]") , $parameterid,
$err));
73 $action->lay->noparse =
true;
77 if ($default !== null) {
84 if ($onChange ==
"no") {
86 } elseif ($onChange ==
"yes" || (!$onChange && !$localSubmit)) {
90 $action->lay->set(
"local_submit", (
bool)$localSubmit);
91 $action->lay->eset(
"submit_label", $submitLabel);
92 $action->lay->set(
"on_change",
"");
93 $action->lay->set(
"change", ($onChange !=
""));
96 preg_match(
'/enum\(([^.]*)\)/', $paramdef[0][
"kind"], $matches);
97 $valuestmp = explode(
"|", $matches[1]);
99 foreach ($valuestmp as $v) {
102 "selected" =>
'selected="selected"',
112 $action->lay->eSetBlockData(
"options", $values);
114 $action->lay->eset(
"value",
$value);
116 $label = $paramdef[0][
"descr"] ? _($paramdef[0][
"descr"]) :
"";
117 $action->lay->set(
"label", $label);
119 $action->parent->addJsRef(
"lib/jquery/jquery.js");
120 $action->parent->addJsRef(
"FDL/Layout/editparameter.js");
126 if (is_array($cache) && array_key_exists(
'app', $cache)) {
127 if (array_key_exists($id, $cache[
'app'])) {
128 return $cache[
'app'][$id];
133 $query->addQuery(sprintf(
"id = %s", pg_escape_string($id)));
134 $res =
$query->query(0, 0,
"TABLE");
135 if (!is_array($res)) {
139 $name = $res[0][
'name'];
140 if (is_array($cache) && array_key_exists(
'app', $cache)) {
141 $cache[
'app'][$id] = $name;
getApplicationNameFromId($dbaccess, $id, &$cache=null)
Verify arguments for action function.
editapplicationparameter(Action &$action)
if(($docid!==0)&&(!is_numeric($docid))) $query
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err