Refresh Adjustments, change in DropDown, save the code to javascript

This commit is contained in:
Hector Cortez
2011-02-24 15:25:45 +00:00
parent a9c4f70337
commit 6dd45989b5
6 changed files with 49 additions and 18 deletions

View File

@@ -263,12 +263,12 @@ class DBTable
$iskey = in_array( $field, $this->table_keys ) && strtoupper(substr(trim($val),0,7) ) == "NEXTVAL";
$dbcType = isset ( $this->_dbc->type ) ? $this->_dbc->type : $DBEngine;
// Commented by new format of textarea
if( ! $iskey )
$val = "'" . G::sqlEscape( $val , $dbcType ) . "'";
$strValues .= " $val ,";
$val = "'" . $val . "'";
///-- $val = "'" . G::sqlEscape( $val , $dbcType ) . "'";
$strValues .= $val .", ";
}
$strFields = substr( $strFields , 0, strlen($strFields)-1 );
$strValues = substr( $strValues , 0, strlen($strValues)-1 );

View File

@@ -249,7 +249,7 @@ var dynaformEditor={
if( ! jsEditor )
{
clientWinSize = getClientWindowSize();
//startJSCodePress(); //
startJSCodePress();
jsEditor = CodeMirror.fromTextArea('form[JS]', {
height: (clientWinSize.height - 120) + "px",
width: (_BROWSER.name == 'msie' ? '100%' : '98%'),
@@ -293,7 +293,8 @@ var dynaformEditor={
case "htmlcode":this.refresh_htmlcode();break;
case "xmlcode":this.refresh_xmlcode();break;
case "fieldslist":this.refreshFieldsList();break;
case "javascripts":this.refreshJavascripts();break;
case "javascripts": this.changeJavascriptCode();
this.refreshJavascripts();break;
case "properties":this.refreshProperties();break;
}
},
@@ -398,7 +399,9 @@ var dynaformEditor={
}
else
{
if (xmlEditor) {
xmlEditor.save();
}
return getField("JS","dynaforms_JSEditor").value;
}
},
@@ -449,7 +452,6 @@ var dynaformEditor={
field.remove(j);
}
}
this.currentJS=field.value;
var res=this.ajax.get_javascripts(this.A,field.value);
if(field.value == ''){
@@ -489,10 +491,10 @@ var dynaformEditor={
hideRowById('JS_TITLE');
showRowById('JS');
showRowById('JS_LIST');
//if (this.loadPressLoaded && !JSCodePress)
//{
//startJSCodePress();
//}
if (this.loadPressLoaded && !JSCodePress)
{
startJSCodePress();
}
}else{
showRowById('JS_TITLE');hideRowById('JS_LIST');hideRowById('JS');}

View File

@@ -59,6 +59,13 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
$_POST['form']['PME_SAVELABEL'] = 0;
}
if (isset($_POST['form']['PME_SAVELABEL'])){
$pmeCode = $_POST['form']['PME_CODE'];
$pmeCode = str_replace("'", "''", $pmeCode);
$pmeCode = str_replace('"', '""', $pmeCode);
$_POST['form']['PME_CODE'] = $pmeCode;
}
$file = G::decrypt( $_POST['form']['PME_A'] , URL_KEY );
define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' );
define('DB_XMLDB_USER','');

View File

@@ -33,11 +33,13 @@ resizeJSEditor();
var JSCodePress=false;
function startJSCodePress()
{
/*
var code=getField("JS").value;
getField("JS").className="codepress javascript linenumbers-on";
JSCodePress=new CodePress(getField("JS"));
getField("JS").parentNode.insertBefore(JSCodePress,getField("JS"));
JSCodePress.edit(code,'javascript');
*/
getField("JS_LIST").onchange=function(){
dynaformEditor.changeJavascriptCode();
};

View File

@@ -27,10 +27,12 @@
<tr style="display: none">
<td colspan="2">{$form.PME_VALIDATE_NAME}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$PME_CODE}</td>
<tr >
<td class='FormLabel' width="90%" align="left" colspan="2">{$PME_CODE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.PME_CODE} </td> //-->
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.PME_CODE}</td>
</tr>
<tr>
<td width='90%' colspan="2">{$form.PME_CODE}</td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center"> {$form.PME_ACCEPT} &nbsp; {$form.BTN_CANCEL} </td>

View File

@@ -2,6 +2,7 @@
<dynaForm name="javascript" type="xmlform" width="100%" enableTemplate="1">
<PME_A type="hidden"/>
<PME_TYPE type="hidden"/>
<A type="hidden" showInTable="0"/>
<PME_TITLE type="title" enableHTML="1">
<en>Properties</en>
</PME_TITLE>
@@ -21,7 +22,7 @@ SELECT XMLNODE_NAME, TYPE FROM dynaForm WHERE XMLNODE_NAME = @@PME_XMLNODE_NAME
<en>Cancel</en>
</BTN_CANCEL>
<PME_ACCEPT type="button" onclick="fieldsSave( this.form );">
<PME_ACCEPT type="button" onclick="saveJavascript(); fieldsSave( this.form );">
<en>Save</en>
</PME_ACCEPT>
@@ -38,5 +39,22 @@ leimnud.event.add(fieldName, 'change', {method:dynaformVerifyFieldName, instance
function cancel(){
currentPopupWindow.remove();
}
var jsEditorPrompt = CodeMirror.fromTextArea('form[PME_CODE]', {
height: "200px",
width: "440px",
parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
stylesheet: ["css/jscolors.css"],
path: "js/",
lineNumbers: true,
continuousScanning: 500
});
function saveJavascript()
{
jsEditorPrompt.setCode(jsEditorPrompt.getCode());
jsEditorPrompt.save();
}
]]></PME_JS>
</dynaForm>