solved the problem of incompatibility between TemplatePower.php and BackBone

This commit is contained in:
Roly Rudy Gutierrez Pinto
2014-07-23 11:23:29 -04:00
parent 89338a7759
commit 2a3e8e79cc
3 changed files with 102 additions and 68 deletions

View File

@@ -258,20 +258,24 @@ try {
$_SESSION['CURRENT_DYN_UID'] = $_GET['UID'];
/*
* Checks the type of Dynaform.
* DYN_VERSION: 1 is classic Dynaform, 2 is Pmdynaform (responsive form).
* PMDynaform
* DYN_VERSION is 1: classic Dynaform,
* DYN_VERSION is 2: responsive form, Pmdynaform.
*/
$a = new Criteria("workflow");
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
$a->addSelectColumn(DynaformPeer::PRO_UID);
$a->addSelectColumn(DynaformPeer::DYN_UID);
$a->add(DynaformPeer::DYN_UID, $_GET['UID'], Criteria::EQUAL);
$ds = ProcessPeer::doSelectRS($a);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$ds->next();
$row = $ds->getRow();
$file = "";
if (isset($row) && $row["DYN_VERSION"] == 2) {
//$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step_Pmdynaform.html');
$oTemplatePower = new TemplatePower(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
/*$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step_Pmdynaform.html');
$oTemplatePower = new TemplatePower(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html', T_BYVAR);
$oTemplatePower->prepare();
$oTemplatePower->assign("JSON_DATA", $row["DYN_CONTENT"]);
$oTemplatePower->assign("CASE", $array["CASE"]);
@@ -280,6 +284,21 @@ try {
$oTemplatePower->assign("APP_TITLE", $array["APP_TITLE"]);
$oTemplatePower->assign("PM_RUN_OUTSIDE_MAIN_APP", (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false");
$oTemplatePower->assign("DYN_UID", $_GET['UID']);
$oTemplatePower->assign("DYNAFORMNAME", $row["PRO_UID"] . "_" . $row["DYN_UID"]);
$oTemplatePower->assign("APP_UID", $_SESSION['APPLICATION']);
$oTemplatePower->printToScreen();*/
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
$file = str_replace("{JSON_DATA}", $row["DYN_CONTENT"], $file);
$file = str_replace("{CASE}", $array["CASE"], $file);
$file = str_replace("{APP_NUMBER}", $array["APP_NUMBER"], $file);
$file = str_replace("{TITLE}", $array["TITLE"], $file);
$file = str_replace("{APP_TITLE}", $array["APP_TITLE"], $file);
$file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $file);
$file = str_replace("{DYN_UID}", $_GET['UID'], $file);
$file = str_replace("{DYNAFORMNAME}", $row["PRO_UID"] . "_" . $row["DYN_UID"], $file);
$file = str_replace("{APP_UID}", $_SESSION['APPLICATION'], $file);
echo $file;
exit();
} 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()) : ''));
}
@@ -1044,36 +1063,29 @@ try {
die();
}
/*
* Checks the type of Dynaform.
* DYN_VERSION: 1 is classic Dynaform, 2 is Pmdynaform (responsive form).
*/
if (isset($row) && $row["DYN_VERSION"] == 2) {
$oTemplatePower->printToScreen();
} else {
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( "/jscore/cases/core/cases_Step.js" );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( "/jscore/cases/core/cases_Step.js" );
if (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) {
$oHeadPublisher->addScriptCode( "
if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) {
parent.showCaseNavigatorPanel('$sStatus');
}
if (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) {
$oHeadPublisher->addScriptCode( "
if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) {
parent.showCaseNavigatorPanel('$sStatus');
}
if (parent.setCurrent) {
parent.setCurrent('" . $_GET['UID'] . "');
}
}" );
if (parent.setCurrent) {
parent.setCurrent('" . $_GET['UID'] . "');
}
}" );
}
G::RenderPage( 'publish', 'blank' );
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
G::evalJScript( '
if (typeof showdebug != \'undefined\') {
showdebug();
}' );
}
}
G::RenderPage( 'publish', 'blank' );
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
G::evalJScript( '
if (typeof showdebug != \'undefined\') {
showdebug();
}' );
}