Causa : Esto fue debido a que no se tenia una validacion de perdida de session. Solució Aplica a secciórocess Files Manager) para el antiguo diseñr, a la cual se considera todos los posibles casos de perdida de session haciendo una validacióara todo estas situaciones.
359 lines
12 KiB
XML
Executable File
359 lines
12 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
|
<dynaForm type="xmlmenu">
|
|
<MNU_NEWEMPTY type="link" value="" link="#" onclick="showCreateEmptyOptions(event, @QMAIN_DIRECTORY);return false;" colAlign="left" colWidth="100">
|
|
<en><![CDATA[New]]></en>
|
|
</MNU_NEWEMPTY>
|
|
<MNU_UPLOAD type="link" value="" link="#" onclick="uploadFilesScreen(@QPRO_UID, @QMAIN_DIRECTORY, @QCURRENT_DIRECTORY);return false;" colAlign="left" colWidth="100">
|
|
<en><![CDATA[Upload]]></en>
|
|
</MNU_UPLOAD>
|
|
<PRO_UID type="private"/>
|
|
<MAIN_DIRECTORY type="private"/>
|
|
<CURRENT_DIRECTORY type="private"/>
|
|
<JS type="javascript"><![CDATA[
|
|
|
|
var CURRENT_PRO_UID = @QPRO_UID;
|
|
var CURRENT_MAIN_DIRECTORY;
|
|
var CURRENT_CURRENT_DIRECTORY;
|
|
var oUploadFilesPanel;
|
|
var oUploadFilesPanel;
|
|
var showPromptLogin = function(lastAction, pro_uid, fileName, fc64) {
|
|
lastActionPerformed = lastAction;
|
|
prouid = pro_uid;
|
|
filename = fileName;
|
|
fcont = fc64;
|
|
promptPanel = new leimnud.module.panel();
|
|
promptPanel.options={
|
|
statusBarButtons:[{value: _('LOGIN')}],
|
|
position:{center:true},
|
|
size:{w:370,h:160},
|
|
control:{
|
|
close:false,
|
|
resize:false
|
|
},
|
|
fx:{
|
|
modal:true
|
|
}
|
|
};
|
|
promptPanel.setStyle={
|
|
content:{
|
|
padding:10,
|
|
paddingBottom:2,
|
|
textAlign:'left',
|
|
paddingLeft:24,
|
|
backgroundRepeat:'no-repeat',
|
|
backgroundPosition:'10 50%',
|
|
backgroundColor:'transparent',
|
|
borderWidth:0
|
|
}
|
|
};
|
|
promptPanel.make();
|
|
promptPanel.addContent(_('ID_FILES_MANAGER_EDITOR_LOGIN_AGAIN'));
|
|
promptPanel.addContent('<br />');
|
|
var label = document.createElement("label");
|
|
var theUser = document.createElement("input");
|
|
theUser.title = 'Username';
|
|
theUser.id = 'theUser';
|
|
leimnud.dom.setStyle(theUser,{
|
|
font:'normal 10pt Tahoma,MiscFixed',
|
|
color:'#000',
|
|
width:'75%',
|
|
marginTop:3,
|
|
backgroundColor:'white',
|
|
border:'1px solid #919B9C',
|
|
});
|
|
label.appendChild(theUser);
|
|
label.innerHTML = (_('ID_USERNAME')) + ': ';
|
|
promptPanel.addContent(label);
|
|
promptPanel.addContent(theUser);
|
|
theUser.focus();
|
|
var labelpass = document.createElement("label");
|
|
var thePassword = document.createElement("input");
|
|
thePassword.type = 'password';
|
|
thePassword.id = 'thePassword';
|
|
leimnud.dom.setStyle(thePassword,{
|
|
font:'normal 10pt Tahoma,MiscFixed',
|
|
color:'#000',
|
|
width:'76%',
|
|
marginTop:3,
|
|
backgroundColor:'white',
|
|
border:'1px solid #919B9C'
|
|
});
|
|
labelpass.appendChild(thePassword);
|
|
labelpass.innerHTML = (_('ID_FIELD_DYNAFORM_PASSWORD')) +': ';
|
|
promptPanel.addContent(labelpass);
|
|
promptPanel.addContent(thePassword);
|
|
thePassword.onkeyup=function(evt)
|
|
{
|
|
var evt = (window.event)?window.event:evt;
|
|
var key = (evt.which)?evt.which:evt.keyCode;
|
|
if(key == 13) {
|
|
verifyLogin();
|
|
}
|
|
}.extend(this);
|
|
promptPanel.fixContent();
|
|
promptPanel.elements.statusBarButtons[0].onmouseup = verifyLogin;
|
|
};
|
|
var verifyLogin = function() {
|
|
if (document.getElementById('thePassword').value.trim() == '') {
|
|
new leimnud.module.app.alert().make({
|
|
label: (_('ID_WRONG_USER_PASS'))
|
|
});
|
|
return;
|
|
}
|
|
var rpc = new leimnud.module.rpc.xmlhttp({
|
|
url : '../login/authentication',
|
|
args: 'form[USR_USERNAME]=' + document.getElementById('theUser').value.trim() + '&form[USR_PASSWORD]=' + document.getElementById('thePassword').value.trim() + '&form[USR_LANG]=' + window.location.href.split("/")[4]
|
|
});
|
|
rpc.callback = function(rpc) {
|
|
if (rpc.xmlhttp.responseText.indexOf('form[USR_USERNAME]') == -1) {
|
|
promptPanel.remove();
|
|
if(lastActionPerformed=='save'){
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=saveFile&filename='+filename+'&pro_uid='+prouid+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='+fcont
|
|
});
|
|
oRPC.callback = function(rpc) {
|
|
};
|
|
oRPC.make();
|
|
}
|
|
lastActionPerformed = '';
|
|
} else {
|
|
new leimnud.module.app.alert().make({
|
|
label: (_('ID_WRONG_USER_PASS'))
|
|
});
|
|
}
|
|
}.extend(this);
|
|
rpc.make();
|
|
};
|
|
var uploadFilesScreen = function(PRO_UID, MAIN_DIRECTORY, CURRENT_DIRECTORY) {
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=getSessid&filename=filename'
|
|
});
|
|
|
|
oRPC.callback = function(rpc) {
|
|
if(rpc.xmlhttp.response==0){
|
|
showPromptLogin('upload','','','');
|
|
}else{
|
|
var swNavigator;
|
|
if(navigator.appName=='Microsoft Internet Explorer'){
|
|
var rv = '';
|
|
if (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navigator.userAgent) != null) {
|
|
rv = parseFloat(RegExp.$1);
|
|
}
|
|
|
|
if (rv >= 9) {
|
|
swNavigator='ie9+';
|
|
}
|
|
else {
|
|
swNavigator='ie';
|
|
}
|
|
|
|
wd = 420;
|
|
hg = 170;
|
|
} else {
|
|
swNavigator='wknormal';
|
|
wd=420;
|
|
hg=100;
|
|
}
|
|
|
|
CURRENT_MAIN_DIRECTORY = MAIN_DIRECTORY;
|
|
CURRENT_CURRENT_DIRECTORY = CURRENT_DIRECTORY;
|
|
|
|
Pm.tmp.processFilesManagerPanel.events = {
|
|
remove: function() { oUploadFilesPanel.remove(); }.extend(this)
|
|
};
|
|
|
|
oUploadFilesPanel = new leimnud.module.panel();
|
|
oUploadFilesPanel.options={
|
|
limit : true,
|
|
size : {w:wd,h:hg},
|
|
position : {x:Pm.tmp.processFilesManagerPanel.options.position.x,y:Pm.tmp.processFilesManagerPanel.options.position.y-90,center:false},
|
|
title : '',
|
|
control : {close:true,resize:false},fx:{modal:true},
|
|
fx : {shadow:true,modal:true}
|
|
};
|
|
oUploadFilesPanel.make();
|
|
oIFrame = window.document.createElement('iframe');
|
|
oIFrame.style.border = '0';
|
|
oIFrame.style.width = '100%';
|
|
oIFrame.style.height = '100%';
|
|
oIFrame.src = 'processes_UploadFilesForm?PRO_UID=' + PRO_UID + '&MAIN_DIRECTORY=' + MAIN_DIRECTORY + '&CURRENT_DIRECTORY=' + CURRENT_DIRECTORY+'&NAVIGATOR='+swNavigator;
|
|
oUploadFilesPanel.addContent(oIFrame);
|
|
}
|
|
}.extend(this);
|
|
oRPC.make();
|
|
};
|
|
|
|
var oPanel;
|
|
function editFile(pro_uid, fileName){
|
|
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=getSessid&filename='+fileName
|
|
});
|
|
|
|
oRPC.callback = function(rpc) {
|
|
if(rpc.xmlhttp.response==0){
|
|
showPromptLogin('edit','','','');
|
|
}
|
|
}.extend(this);
|
|
oRPC.make();
|
|
|
|
var typofile = fileName.split(".");
|
|
if( typofile[typofile.length-1].toLowerCase() != 'txt' && typofile[typofile.length-1].toLowerCase() != 'html' ){
|
|
msgBox(G_STRINGS.HTML_FILES,"alert");return;
|
|
}
|
|
|
|
oPanel = new leimnud.module.panel();
|
|
oPanel.options={
|
|
limit: true,
|
|
size: {w: 820, h: 500},
|
|
position: {x: 50, y: 50, center: true},
|
|
title: "",
|
|
control: {close: true, resize: false},
|
|
statusBar: true,
|
|
fx: {shadow: true, modal: true}
|
|
};
|
|
oPanel.make();
|
|
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=editFile&filename='+fileName+'&pro_uid='+pro_uid
|
|
});
|
|
|
|
oPanel.loader.show();
|
|
oRPC.callback = function(rpc) {
|
|
oPanel.loader.hide();
|
|
oPanel.addContent(rpc.xmlhttp.responseText);
|
|
var scs=rpc.xmlhttp.responseText.extractScript();
|
|
scs.evalScript();
|
|
}.extend(this);
|
|
oRPC.make();
|
|
}
|
|
|
|
/*refresh content tiny*/
|
|
|
|
function saveFile(pro_uid, fileName){
|
|
|
|
var fc64 = base64_encode(getField('fcontent').value);
|
|
tinyMCE.execCommand('mceRemoveControl',false,'form[fcontent]');
|
|
fc64 = fc64.replace(/&/g, "@amp@");
|
|
fc64 = fc64.replace(/\+/g, '%2B');
|
|
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=getSessid&filename='+fileName
|
|
});
|
|
|
|
oPanel.loader.show();
|
|
oRPC.callback = function(rpc) {
|
|
if(rpc.xmlhttp.response==0){
|
|
showPromptLogin('save',pro_uid, fileName, fc64);
|
|
}
|
|
}.extend(this);
|
|
oRPC.make();
|
|
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=saveFile&filename='+fileName+'&pro_uid='+pro_uid+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='+fc64
|
|
});
|
|
|
|
oPanel.loader.show();
|
|
oRPC.callback = function(rpc) {
|
|
oPanel.remove();
|
|
}.extend(this);
|
|
oRPC.make();
|
|
}
|
|
|
|
var showCreateEmptyOptionsPanel;
|
|
function showCreateEmptyOptions(e, MAIN_DIRECTORY){
|
|
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=getSessid&filename=filename'
|
|
});
|
|
|
|
oRPC.callback = function(rpc) {
|
|
if(rpc.xmlhttp.response==0){
|
|
showPromptLogin('createEmty','','','');
|
|
}
|
|
}.extend(this);
|
|
oRPC.make();
|
|
|
|
CURRENT_MAIN_DIRECTORY = MAIN_DIRECTORY;
|
|
oPanel = new leimnud.module.panel();
|
|
oPanel.options={
|
|
limit : true,
|
|
size : {w:400,h:100},
|
|
position : {x:e.clientX,y:e.clientY,center:false},
|
|
title : '',
|
|
control : {close:true,resize:false},fx:{modal:true},
|
|
fx : {shadow:true,modal:true}
|
|
};
|
|
oPanel.make();
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({url : 'processes_Ajax', args: 'action=emptyFileOptions&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY });
|
|
oPanel.loader.show();
|
|
oRPC.callback = function(rpc) {
|
|
oPanel.loader.hide();
|
|
oPanel.addContent(rpc.xmlhttp.responseText);
|
|
var scs=rpc.xmlhttp.responseText.extractScript();
|
|
scs.evalScript();
|
|
}.extend(this);
|
|
oRPC.make();
|
|
showCreateEmptyOptionsPanel = oPanel;
|
|
}
|
|
|
|
function saveEmptyFile(){
|
|
var fileName = getField("emptyfilename").value.trim();
|
|
|
|
if(fileName != "") {
|
|
fileName = fileName + ".html";
|
|
fileName = fileName.trim();
|
|
|
|
var rpcAjax = new leimnud.module.rpc.xmlhttp({
|
|
url: "processes_Ajax",
|
|
method: "POST",
|
|
args: "action=verifyNameFile&filename=" + fileName + "&pro_uid=" + CURRENT_PRO_UID + "&MAIN_DIRECTORY=" + CURRENT_MAIN_DIRECTORY + "&fcontent="
|
|
});
|
|
|
|
rpcAjax.callback = function (rpc)
|
|
{
|
|
var response = rpc.xmlhttp.responseText.parseJSON();
|
|
var status = response.status;
|
|
|
|
if (status == "OK") {
|
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
|
url : 'processes_Ajax',
|
|
args: 'action=saveFile&filename='+fileName+'&pro_uid='+CURRENT_PRO_UID+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='
|
|
});
|
|
|
|
oRPC.callback = function(rpc){
|
|
showCreateEmptyOptionsPanel.remove();
|
|
/// goToDirectory(CURRENT_PRO_UID, 'mailTemplates', '');
|
|
if(typeof(CURRENT_MAIN_DIRECTORY) != "undefined" ) {
|
|
goToDirectory(CURRENT_PRO_UID, CURRENT_MAIN_DIRECTORY, '');
|
|
} else {
|
|
goToDirectory(CURRENT_PRO_UID, 'mailTemplates', '');
|
|
}
|
|
editFile(CURRENT_PRO_UID, fileName)
|
|
}.extend(this);
|
|
oRPC.make();
|
|
} else {
|
|
new leimnud.module.app.alert().make({label: _("ID_EXISTS_FILES")});
|
|
}
|
|
}.extend(this);
|
|
rpcAjax.make();
|
|
} else {
|
|
new leimnud.module.app.alert().make({label: _("ID_FILENAME_REQUIRED")});
|
|
}
|
|
}
|
|
|
|
function xReaload(){
|
|
goToDirectory(CURRENT_PRO_UID, CURRENT_MAIN_DIRECTORY, CURRENT_CURRENT_DIRECTORY);
|
|
}
|
|
|
|
|
|
]]></JS>
|
|
</dynaForm>
|