Correction of the recording in the correct directory.

This commit is contained in:
Hector Cortez
2011-02-03 16:38:19 +00:00
parent 208739ab72
commit 42f4beb2f7
2 changed files with 41 additions and 13 deletions

View File

@@ -301,9 +301,12 @@ try {
$oProcessMap->caseTrackerObjects($oData->pro_uid); $oProcessMap->caseTrackerObjects($oData->pro_uid);
break; break;
case 'processFilesManager': case 'processFilesManager':
$_SESSION['PFMDirectory'] = '';
$oProcessMap->processFilesManager($oData->pro_uid); $oProcessMap->processFilesManager($oData->pro_uid);
break; break;
case 'exploreDirectory': case 'exploreDirectory':
$objData = json_decode($_POST['data']);
$_SESSION['PFMDirectory'] = $objData->{'main_directory'};
$oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory); $oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory);
break; break;
case 'deleteFile': case 'deleteFile':
@@ -421,8 +424,19 @@ try {
//echo $_POST['filename']; //echo $_POST['filename'];
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename']; ///-- $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
$sDir = "";
if(isset($_SESSION['PFMDirectory']))
$sDir = $_SESSION['PFMDirectory'];
switch($sDir){
case 'mailTemplates' : $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
break;
case 'public' : $sDirectory = PATH_DATA_PUBLIC . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
break;
default : $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
break;
}
$fcontent = file_get_contents($sDirectory); $fcontent = file_get_contents($sDirectory);
$extion=explode(".",$_POST['filename']); $extion=explode(".",$_POST['filename']);
@@ -443,8 +457,17 @@ try {
case 'saveFile': case 'saveFile':
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename']; $sDir = "";
if(isset($_POST['MAIN_DIRECTORY']))
$sDir = $_POST['MAIN_DIRECTORY'];
switch($sDir){
case 'mailTemplates' : $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
break;
case 'public' : $sDirectory = PATH_DATA_PUBLIC . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
break;
default : $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['pro_uid'] . PATH_SEP . $_POST['filename'];
break;
}
$fp = fopen($sDirectory, 'w'); $fp = fopen($sDirectory, 'w');
$content = stripslashes($_POST['fcontent']); $content = stripslashes($_POST['fcontent']);
$content = str_replace("@amp@", "&", $content); $content = str_replace("@amp@", "&", $content);
@@ -455,7 +478,7 @@ try {
case 'events': case 'events':
$oProcessMap->eventsList($oData->pro_uid, $oData->type); $oProcessMap->eventsList($oData->pro_uid, $oData->type);
break; break;
/*
case 'saveFile': case 'saveFile':
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
@@ -468,7 +491,7 @@ try {
fclose($fp); fclose($fp);
echo 'saved: '. $sDirectory; echo 'saved: '. $sDirectory;
break; break;
*/
case 'emptyFileOptions': case 'emptyFileOptions':
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlmenu"> <dynaForm type="xmlmenu">
<MNU_NEWEMPTY type="link" value="" link="#" onclick="showCreateEmptyOptions(event);return false;" colAlign="left" colWidth="100px"> <MNU_NEWEMPTY type="link" value="" link="#" onclick="showCreateEmptyOptions(event, @QMAIN_DIRECTORY);return false;" colAlign="left" colWidth="100px">
<en>New</en> <en>New</en>
</MNU_NEWEMPTY> </MNU_NEWEMPTY>
@@ -89,7 +89,7 @@ function saveFile(pro_uid, fileName){
fc = fc.replace(/\+/g, '%2B'); fc = fc.replace(/\+/g, '%2B');
var oRPC = new leimnud.module.rpc.xmlhttp({ var oRPC = new leimnud.module.rpc.xmlhttp({
url : 'processes_Ajax', url : 'processes_Ajax',
args: 'action=saveFile&filename='+fileName+'&pro_uid='+pro_uid+'&fcontent='+addslashes(fc) args: 'action=saveFile&filename='+fileName+'&pro_uid='+pro_uid+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='+addslashes(fc)
}); });
oPanel.loader.show(); oPanel.loader.show();
oRPC.callback = function(rpc) { oRPC.callback = function(rpc) {
@@ -99,7 +99,8 @@ function saveFile(pro_uid, fileName){
} }
var showCreateEmptyOptionsPanel; var showCreateEmptyOptionsPanel;
function showCreateEmptyOptions(e){ function showCreateEmptyOptions(e, MAIN_DIRECTORY){
CURRENT_MAIN_DIRECTORY = MAIN_DIRECTORY;
oPanel = new leimnud.module.panel(); oPanel = new leimnud.module.panel();
oPanel.options={ oPanel.options={
limit : true, limit : true,
@@ -110,7 +111,7 @@ function showCreateEmptyOptions(e){
fx : {shadow:true,modal:true} fx : {shadow:true,modal:true}
}; };
oPanel.make(); oPanel.make();
var oRPC = new leimnud.module.rpc.xmlhttp({url : 'processes_Ajax', args: 'action=emptyFileOptions'}); var oRPC = new leimnud.module.rpc.xmlhttp({url : 'processes_Ajax', args: 'action=emptyFileOptions&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY });
oPanel.loader.show(); oPanel.loader.show();
oRPC.callback = function(rpc) { oRPC.callback = function(rpc) {
oPanel.loader.hide(); oPanel.loader.hide();
@@ -123,18 +124,22 @@ function showCreateEmptyOptions(e){
} }
function saveEmptyFile(){ function saveEmptyFile(){
var fileName = getField('emptyfilename').value + ".html"; var fileName = getField('emptyfilename').value + ".html";
fileName = fileName.trim(); fileName = fileName.trim();
var oRPC = new leimnud.module.rpc.xmlhttp({ var oRPC = new leimnud.module.rpc.xmlhttp({
url : 'processes_Ajax', url : 'processes_Ajax',
args: 'action=saveFile&filename='+fileName+'&pro_uid='+CURRENT_PRO_UID+'&fcontent=' args: 'action=saveFile&filename='+fileName+'&pro_uid='+CURRENT_PRO_UID+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='
}); });
oRPC.callback = function(rpc){ oRPC.callback = function(rpc){
showCreateEmptyOptionsPanel.remove(); 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', ''); goToDirectory(CURRENT_PRO_UID, 'mailTemplates', '');
}
editFile(CURRENT_PRO_UID, fileName) editFile(CURRENT_PRO_UID, fileName)
}.extend(this); }.extend(this);
oRPC.make(); oRPC.make();