This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-03-03 15:17:43 -04:00
parent 207c7a9cf4
commit b7d37ca3fb
4 changed files with 28 additions and 17 deletions

View File

@@ -230,7 +230,8 @@ def buildMafe(homeDir, targetDir, mode)
"#{homeDir}/build/js/designer.js" => "#{mafeDir}/designer.min.js", "#{homeDir}/build/js/designer.js" => "#{mafeDir}/designer.min.js",
"#{homeDir}/build/js/mafe.js" => "#{mafeDir}/mafe.min.js", "#{homeDir}/build/js/mafe.js" => "#{mafeDir}/mafe.min.js",
"#{homeDir}/build/css/mafe.css" => "#{mafeDir}/mafe.min.css", "#{homeDir}/build/css/mafe.css" => "#{mafeDir}/mafe.min.css",
"#{homeDir}/img/*.*" => "#{imgTargetDir}" "#{homeDir}/img/*.*" => "#{imgTargetDir}",
"#{targetDir}/../lib-dev/pmUI/images/*.*" => "#{imgTargetDir}"
}) })
puts "\nCopying lib files into: #{jsTargetDir}".bold puts "\nCopying lib files into: #{jsTargetDir}".bold

View File

@@ -87,21 +87,8 @@ class pmDynaform
$json->$key = $this->app_data[$triggerValue]; $json->$key = $this->app_data[$triggerValue];
} }
} }
//data
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown")) {
$json->data = array(
"value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "",
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : ""
);
}
if ($key === "type" && ($value === "suggets")) {
$json->data = array(
"value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "",
"label" => isset($this->data[$json->name]) ? $this->data[$json->name] : ""
);
}
//query & options //query & options
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest")) { if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest" || $value === "checkbox" || $value === "radio")) {
if (!isset($json->dbConnection)) if (!isset($json->dbConnection))
$json->dbConnection = "none"; $json->dbConnection = "none";
if (!isset($json->sql)) if (!isset($json->sql))
@@ -120,9 +107,24 @@ class pmDynaform
); );
array_push($json->options, $option); array_push($json->options, $option);
} }
$json->data = isset($json->options[0]) ? $json->options[0] : $json->data; if (isset($json->options[0])) {
$json->data = $json->options[0];
}
} }
} }
//data
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "checkbox" || $value === "radio")) {
$json->data = array(
"value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "",
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : ""
);
}
if ($key === "type" && ($value === "suggest")) {
$json->data = array(
"value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "",
"label" => isset($this->data[$json->name]) ? $this->data[$json->name] : ""
);
}
//grid //grid
if ($key === "type" && ($value === "grid")) { if ($key === "type" && ($value === "grid")) {
if (isset($this->data[$json->name])) { if (isset($this->data[$json->name])) {
@@ -191,6 +193,7 @@ class pmDynaform
"var credentials = " . G::json_encode($clientToken) . ";\n" . "var credentials = " . G::json_encode($clientToken) . ";\n" .
"var filePost = null;\n" . "var filePost = null;\n" .
"var fieldsRequired = null;\n" . "var fieldsRequired = null;\n" .
"var triggerDebug = null;\n" .
"$(window).load(function () {\n" . "$(window).load(function () {\n" .
" var data = jsondata;\n" . " var data = jsondata;\n" .
" data.items[0].mode = 'view';\n" . " data.items[0].mode = 'view';\n" .
@@ -221,6 +224,7 @@ class pmDynaform
public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT') public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT')
{ {
error_log(print_r($this->app_data, true));
ob_clean(); ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]); $json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json); $this->jsonr($json);
@@ -242,6 +246,7 @@ class pmDynaform
"var credentials = " . G::json_encode($this->credentials) . ";\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" .
"var filePost = null;\n" . "var filePost = null;\n" .
"var fieldsRequired = null;\n" . "var fieldsRequired = null;\n" .
"var triggerDebug = " . ($this->app_data["TRIGGER_DEBUG"] === 1 ? "true" : "false") . ";\n" .
"</script>\n" . "</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" . "<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" . "<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
@@ -282,6 +287,7 @@ class pmDynaform
"var credentials = " . G::json_encode($this->credentials) . ";\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" .
"var filePost = '" . $filename . "';\n" . "var filePost = '" . $filename . "';\n" .
"var fieldsRequired = " . G::json_encode($this->arrayFieldRequired) . ";\n" . "var fieldsRequired = " . G::json_encode($this->arrayFieldRequired) . ";\n" .
"var triggerDebug = null;\n" .
"</script>\n" . "</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" . "<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
"<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" . "<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
@@ -387,7 +393,7 @@ class pmDynaform
{ {
if ($this->debugMode) { if ($this->debugMode) {
echo "<pre>"; echo "<pre>";
echo G::json_encode($json); echo G::json_encode(array($this->app_data, $this->data));
echo "</pre>"; echo "</pre>";
} }
} }

View File

@@ -75,4 +75,7 @@ $(window).load(function () {
form.submit(); form.submit();
return false; return false;
}; };
if (triggerDebug === true) {
showdebug();
}
}); });

View File

@@ -272,6 +272,7 @@ try {
$a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']); $a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']);
if ($a->isResponsive()) { if ($a->isResponsive()) {
$a->app_data["PRO_SHOW_MESSAGE"] = $noShowTitle; $a->app_data["PRO_SHOW_MESSAGE"] = $noShowTitle;
$a->app_data["TRIGGER_DEBUG"] = $_SESSION['TRIGGER_DEBUG']['ISSET'];
$a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array, $oStep->getStepMode()); $a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array, $oStep->getStepMode());
} else { } else {
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : '')); $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));