Merge pull request #2130 from gproly/BUG-12604-12174-13122

Bug 12604 12174 13122
This commit is contained in:
julceslauhub
2013-11-12 11:46:03 -08:00
12 changed files with 52 additions and 105 deletions

View File

@@ -37,6 +37,7 @@ class headPublisher
public static $instance = null;
public $scriptFiles = array();
public $cssFiles = array();
public $leimnudLoad = array();
/* extJsSkin init coreLoad flag */
@@ -134,6 +135,11 @@ class headPublisher
}
}
public function addCssFile($url)
{
$this->cssFiles[$url] = $url;
}
/**
* Function addInstanceModule
*
@@ -214,6 +220,10 @@ class headPublisher
$head = '';
$head .= '<TITLE>' . $this->title . "</TITLE>\n";
foreach ($this->cssFiles as $file) {
$head = $head . " <link rel=\"stylesheet\" href=\"" . G::browserCacheFilesUrl($file) . "\">\n";
}
$head = $head . "
<script type=\"text/javascript\">
var BROWSER_CACHE_FILES_UID = \"" . G::browserCacheFilesGetUid() . "\";

View File

@@ -0,0 +1,8 @@
<?php
G::LoadThirdParty('geshi', 'geshi');
$geshi = new GeSHi($_POST["code"], 'php');
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
$geshi->set_line_style('background: #f0f0f0;');
echo $geshi->parse_code();
?>

View File

@@ -68,6 +68,8 @@ $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, $xmlform_action );
$oHeadPublisher =& headPublisher::getSingleton();
//$oHeadPublisher->addScriptFile('/js/codemirror/js/codemirror.js', 1);
$oHeadPublisher->addCssFile('/js/codemirror/lib/codemirror.css', 1);
$oHeadPublisher->addCssFile('/js/codemirror/addon/hint/show-hint.css', 1);
$oHeadPublisher->addScriptFile('/js/codemirror/lib/codemirror.js', 1);
$oHeadPublisher->addScriptFile("/js/codemirror/addon/edit/matchbrackets.js",1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/htmlmixed/htmlmixed.js",1);
@@ -79,5 +81,11 @@ $oHeadPublisher->addScriptFile("/js/codemirror/addon/hint/show-hint.js",1);
$oHeadPublisher->addScriptFile("/js/codemirror/addon/hint/php-hint.js",1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/php/php.js",1);
G::RenderPage( 'publish', 'raw' );
//Hack: CodeMirror needed to run Internet Explorer
$ie = (strrpos($_SERVER['HTTP_USER_AGENT'], "MSIE") === false ) ? false : true;
if ($ie) {
echo "<!DOCTYPE html>\n";
}
G::RenderPage( 'publish', 'blank' );

View File

@@ -74,7 +74,7 @@
// Additional functions required in triggers
function triggerEditWizardSource (sUID){
popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID=' + sUID +'&BYPASS=1' , 770, 510);
window.open('@G::encryptlink(@#triggersEdit)?TRI_UID=' + sUID +'&BYPASS=1','@G::LoadTranslation(ID_EDIT_TRIGGERS)'.replace(/\s/g,'_'),'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+screen.width+',height='+screen.height);
}
function triggerSave(form)

View File

@@ -13,7 +13,7 @@
<triggersEdit type="hidden" defaultValue="../triggers/triggers_Edit"/>
<EDIT type="link" colWidth="" value="@G::LoadTranslation(ID_EDIT)" link="#" onclick="popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID=' + @QTRI_UID , 930, 600); return false;"/>
<EDIT type="link" colWidth="" value="@G::LoadTranslation(ID_EDIT)" link="#" onclick="window.open('@G::encryptlink(@#triggersEdit)?TRI_UID=' + @QTRI_UID,'@G::LoadTranslation(ID_EDIT_TRIGGERS)'.replace(/\s/g,'_'),'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+screen.width+',height='+screen.height); return false;"/>
<CONDITION type="link" colWidth="" value="@G::LoadTranslation(ID_CONDITION)" link="#" onclick="editTriggerCondition(@QSTEP_UID, @QTRI_UID, &#039;AFTER&#039;);return false;"/>

View File

@@ -13,7 +13,7 @@
<triggersEdit type="hidden" defaultValue="../triggers/triggers_Edit"/>
<EDIT type="link" colWidth="" value="@G::LoadTranslation(ID_EDIT)" link="#" onclick="popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID=' + @QTRI_UID , 930, 600); return false;"/>
<EDIT type="link" colWidth="" value="@G::LoadTranslation(ID_EDIT)" link="#" onclick="window.open('@G::encryptlink(@#triggersEdit)?TRI_UID=' + @QTRI_UID,'@G::LoadTranslation(ID_EDIT_TRIGGERS)'.replace(/\s/g,'_'),'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+screen.width+',height='+screen.height); return false;"/>
<CONDITION type="link" colWidth="" value="@G::LoadTranslation(ID_CONDITION)" link="#" onclick="editTriggerCondition(@QSTEP_UID, @QTRI_UID, &#039;BEFORE&#039;);return false;"/>

View File

@@ -46,7 +46,7 @@
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_WEBBOT}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_WEBBOT}<label class="FormRequiredTextMessage"><font color="red">*</font>{php} echo " ".(G::LoadTranslation('ID_TRIGGER_EDITOR_HINT_ADVISE_MESSAGE')); {/php}</label></td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_WEBBOT}<div id="code"></div></td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.BTNCOPYSAVE}&nbsp;{$form.BTNCANCEL}</td>

View File

@@ -74,7 +74,7 @@
<en>Script</en>
</TRI_WEBBOT>
<BTNCOPYSAVE type="button" onclick="document.getElementById('form[TRI_WEBBOT]').value = triggerEditor.getValue(); triggerSave1(this.form);">
<BTNCOPYSAVE type="button" onclick="triggerSave1(this.form);">
<en>Copy/Import and Save</en>
</BTNCOPYSAVE>
@@ -84,25 +84,6 @@
<JS type="javascript">
<![CDATA[
/*var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
height: "200px",
width: "90%",
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
"../contrib/php/js/tokenizephp.js", "../contrib/php/js/parsephp.js",
"../contrib/php/js/parsephphtmlmixed.js"],
stylesheet: ["css/xmlcolors.css", "css/jscolors.css", "css/csscolors.css", "css/phpcolors.css" ],
path: "js/", lineNumbers: true, continuousScanning: 500, readOnly:true, parserConfig: { phpOnly:true} });
*/
var triggerEditor = CodeMirror.fromTextArea(document.getElementById("form[TRI_WEBBOT]"), {
lineNumbers: true,
matchBrackets: true,
mode: "application/x-httpd-php",
PMEnabled: true,
indentUnit: 2,
indentWithTabs: false,
readOnly: true
});
triggerEditor.setSize(400,200);
function cancel()
{
@@ -114,8 +95,17 @@
var triUid = getField("TRIGGER_UID_AUX").value;
if (triUid != triUidPrev) {
triggerEditor.setValue(document.getElementById("form[TRI_WEBBOT]").value);
triUidPrev = triUid;
var oRPC = new leimnud.module.rpc.xmlhttp({
url : 'processes_TriggersFormatCode',
args : 'code='+document.getElementById("form[TRI_WEBBOT]").value
});
oRPC.callback = function(rpc) {
document.getElementById("form[TRI_WEBBOT]").style.display="none";
document.getElementById("code").innerHTML = rpc.xmlhttp.responseText;
};
oRPC.make();
} else {
setTimeout("triggerCheckWebbotTimer()", 100);
}
@@ -131,7 +121,6 @@
function ()
{
txtTgrTitle.value = "";
triggerEditor.setValue("");
triUidPrev= "";
}
);
@@ -146,7 +135,6 @@
setTimeout("triggerCheckWebbotTimer()", 100);
} else {
txtTgrTitle.value = "";
triggerEditor.setValue("");
triUidPrev= "";
}
}

View File

@@ -31,11 +31,6 @@
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_DESCRIPTION}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.TRI_DESCRIPTION} </td> //-->
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_DESCRIPTION}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_WEBBOT}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.TRI_WEBBOT} </td> //-->
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_WEBBOT}<label class="FormRequiredTextMessage"><font color="red">*</font>{php} echo " ".(G::LoadTranslation('ID_TRIGGER_EDITOR_HINT_ADVISE_MESSAGE'));{/php}</label></td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.SAVE}&nbsp;{$form.BTN_CANCEL}</td>

View File

@@ -19,9 +19,9 @@
<en>Description</en>
</TRI_DESCRIPTION>
<TRI_WEBBOT type="textareapm" class="formLabel" cols="55" rows="13" width="100%" height="380px" showVars="1" process="@#PRO_UID">
<TRI_WEBBOT type="textareapm" class="formLabel" cols="55" rows="13" width="100%" height="380px" showVars="1" process="@#PRO_UID" style="display:none">
</TRI_WEBBOT>
<SAVE type="button" onclick="document.getElementById('form[TRI_WEBBOT]').value = triggerEditor.getValue(); triggerSave1(this.form);">
<SAVE type="button" onclick="triggerSave1(this.form);">
<en>Save</en>
</SAVE>
<PARTNER_FLAG type="private"/>
@@ -31,29 +31,6 @@
<JS type="JavaScript"><![CDATA[
/*var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
height: "220px",
width: "80%",
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
"../contrib/php/js/tokenizephp.js", "../contrib/php/js/parsephp.js",
"../contrib/php/js/parsephphtmlmixed.js"],
stylesheet: ["css/xmlcolors.css", "css/jscolors.css", "css/csscolors.css", "css/phpcolors.css" ],
path: "js/", lineNumbers: true, continuousScanning: 500, parserConfig: { phpOnly:true} });*/
CodeMirror.commands.autocomplete = function(cm) {
CodeMirror.showHint(cm, CodeMirror.phpHint);
}
var triggerEditor = CodeMirror.fromTextArea(document.getElementById("form[TRI_WEBBOT]"), {
lineNumbers: true,
matchBrackets: true,
mode: "application/x-httpd-php",
PMEnabled: true,
indentUnit: 2,
indentWithTabs: false,
extraKeys: {"Ctrl-Space": "autocomplete"}
});
triggerEditor.setSize(450,245);
getField('TRI_TITLE').form.onsubmit = function() {return false;};
var _oVarsPanel_;
@@ -90,16 +67,6 @@ var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol)
oRPC.make();
};
var insertFormVar = function(sFieldName, sValue) {
if (triggerEditor.getSelection() == "") {
triggerEditor.replaceRange(sValue, triggerEditor.getCursor());
} else {
triggerEditor.replaceSelection(sValue);
}
_oVarsPanel_.remove();
triggerEditor.focus();
};
function cancel(){
currentPopupWindow.remove();
}

View File

@@ -20,16 +20,6 @@
</SAVE>
<JS type="JavaScript"><![CDATA[
/*var triggerEditor = CodeMirror.fromTextArea('form[TRI_WEBBOT]', {
height: "380px",
width: "90%",
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
"../contrib/php/js/tokenizephp.js", "../contrib/php/js/parsephp.js",
"../contrib/php/js/parsephphtmlmixed.js"],
stylesheet: ["css/xmlcolors.css", "css/jscolors.css", "css/csscolors.css", "css/phpcolors.css" ],
path: "js/", lineNumbers: true, continuousScanning: 500, parserConfig: { phpOnly:true} });
*/
CodeMirror.commands.autocomplete = function(cm) {
CodeMirror.showHint(cm, CodeMirror.phpHint);
}
@@ -90,8 +80,13 @@ var insertFormVar = function(sFieldName, sValue) {
};
function cancel(){
currentPopupWindow.remove();
window.close();
}
function triggerSave1(form){
window.close();
ajax_post(form.action, form, 'POST');
}
]]></JS>
</dynaForm>

View File

@@ -37,30 +37,6 @@
<JS type="javascript" replaceTags="1">
<![CDATA[
/*
document.onkeypress=function(e){
var esIE=(document.all);
var esNS=(document.layers);
tecla=(esIE) ? event.keyCode : e.which;
if(tecla==13){
return false;
}
}
*/
//Add css Codemirror
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('link');
s.setAttribute('href', '/js/codemirror/lib/codemirror.css');
s.setAttribute('type', 'text/css');
s.setAttribute('rel', 'stylesheet');
head.appendChild(s);
var s = document.createElement('link');
s.setAttribute('href', '/js/codemirror/addon/hint/show-hint.css');
s.setAttribute('type', 'text/css');
s.setAttribute('rel', 'stylesheet');
head.appendChild(s);
var windowWidth = 600;
var windowHeight = 460;
@@ -79,7 +55,7 @@
function triggerCopy()
{
popupWindow("@G::LoadTranslation(ID_TRIGGER_COPY_TITLE)", "@G::encryptlink(@#triggerCopy)?PRO_UID=@%PRO_UID" , windowWidth, windowHeight);
popupWindow("@G::LoadTranslation(ID_TRIGGER_COPY_TITLE)", "@G::encryptlink(@#triggerCopy)?PRO_UID=@%PRO_UID" , 900, 460);
}
function triggerFromLibrary() {
@@ -96,7 +72,7 @@
}
function triggerEdit(sUID) {
popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID='+ sUID , 930, 600);
window.open('@G::encryptlink(@#triggersEdit)?TRI_UID='+ sUID,'@G::LoadTranslation(ID_EDIT_TRIGGERS)'.replace(/\s/g,'_'),'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+screen.width+',height='+screen.height);
}
function triggerProperties( sUID ) {