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,10 +301,13 @@ try {
$oProcessMap->caseTrackerObjects($oData->pro_uid);
break;
case 'processFilesManager':
$_SESSION['PFMDirectory'] = '';
$oProcessMap->processFilesManager($oData->pro_uid);
break;
case 'exploreDirectory':
$oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory);
$objData = json_decode($_POST['data']);
$_SESSION['PFMDirectory'] = $objData->{'main_directory'};
$oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory);
break;
case 'deleteFile':
$oProcessMap->deleteFile($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file);
@@ -421,8 +424,19 @@ try {
//echo $_POST['filename'];
global $G_PUBLISH;
$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);
$extion=explode(".",$_POST['filename']);
@@ -443,8 +457,17 @@ try {
case 'saveFile':
global $G_PUBLISH;
$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');
$content = stripslashes($_POST['fcontent']);
$content = str_replace("@amp@", "&", $content);
@@ -455,7 +478,7 @@ try {
case 'events':
$oProcessMap->eventsList($oData->pro_uid, $oData->type);
break;
/*
case 'saveFile':
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
@@ -468,7 +491,7 @@ try {
fclose($fp);
echo 'saved: '. $sDirectory;
break;
*/
case 'emptyFileOptions':
global $G_PUBLISH;
$G_PUBLISH = new Publisher();

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
</MNU_NEWEMPTY>
@@ -89,7 +89,7 @@ function saveFile(pro_uid, fileName){
fc = fc.replace(/\+/g, '%2B');
var oRPC = new leimnud.module.rpc.xmlhttp({
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();
oRPC.callback = function(rpc) {
@@ -99,7 +99,8 @@ function saveFile(pro_uid, fileName){
}
var showCreateEmptyOptionsPanel;
function showCreateEmptyOptions(e){
function showCreateEmptyOptions(e, MAIN_DIRECTORY){
CURRENT_MAIN_DIRECTORY = MAIN_DIRECTORY;
oPanel = new leimnud.module.panel();
oPanel.options={
limit : true,
@@ -110,7 +111,7 @@ function showCreateEmptyOptions(e){
fx : {shadow:true,modal:true}
};
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();
oRPC.callback = function(rpc) {
oPanel.loader.hide();
@@ -123,18 +124,22 @@ function showCreateEmptyOptions(e){
}
function saveEmptyFile(){
var fileName = getField('emptyfilename').value + ".html";
fileName = fileName.trim();
var oRPC = new leimnud.module.rpc.xmlhttp({
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){
showCreateEmptyOptionsPanel.remove();
goToDirectory(CURRENT_PRO_UID, 'mailTemplates', '');
/// 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();