BUG 0000 improving the documents option (add, delete folders and docuemnts)
improving Code add, remove folder and documents
This commit is contained in:
@@ -585,4 +585,37 @@ class AppDocument extends BaseAppDocument {
|
||||
return $oDataset->getRow();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* get all docuemnts for a folder
|
||||
* created by carlos pacha carlos@colosa.com, pckrlos@gmail.com
|
||||
* @param array $sFolderUid
|
||||
* @return array
|
||||
**/
|
||||
public function getDocumentsinFolders($sFolderUid)
|
||||
{
|
||||
try {
|
||||
$arrayDocumentsToDelete=array();
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(AppDocumentPeer::FOLDER_UID, $sFolderUid);
|
||||
$oDataset = AppDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$arrayDocumentsToDelete[]=array('sAppDocUid'=>$aRow['APP_DOC_UID'],'iVersion'=>$aRow['DOC_VERSION']);
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
return ($arrayDocumentsToDelete);
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // AppDocument
|
||||
|
||||
@@ -17,7 +17,61 @@ $functionName = $_REQUEST ['action'];
|
||||
$functionParams = isset ( $_REQUEST ['params'] ) ? $_REQUEST ['params'] : array ();
|
||||
|
||||
$functionName ( $functionParams );
|
||||
/////////////////////////////////////////////
|
||||
/**
|
||||
* delete folders and documents
|
||||
* created by carlos pacha carlos@colosa.com, pckrlos@gmail.com
|
||||
* @param void
|
||||
* @return true
|
||||
**/
|
||||
function delete() {
|
||||
include_once ("classes/model/AppDocument.php");
|
||||
include_once ("classes/model/AppFolder.php");
|
||||
|
||||
switch($_REQUEST['option']){
|
||||
case 'documents':
|
||||
deleteDocuments($_REQUEST['selitems'], $_REQUEST['option']);
|
||||
break;
|
||||
case 'directory':
|
||||
$oAppFoder = new AppFolder ( );
|
||||
$oAppDocument = new AppDocument ( );
|
||||
$aDocuments = $oAppDocument->getDocumentsinFolders($_REQUEST['item']);
|
||||
|
||||
if(count($aDocuments)>0){
|
||||
deleteDocuments($aDocuments, $_REQUEST['option']);
|
||||
}
|
||||
|
||||
$oAppFoder->remove($_REQUEST['item'],'');
|
||||
break;
|
||||
}
|
||||
$msgLabel= G::LoadTranslation ( 'ID_DELETED_SUCCESSFULLY' );
|
||||
echo "{action: '', error:'error',message: '$msgLabel', success: 'success',folderUID: 'root'}";
|
||||
}
|
||||
|
||||
/**
|
||||
* delete docuements
|
||||
* created by carlos pacha carlos@colosa.com, pckrlos@gmail.com
|
||||
* @param array $aDocuments
|
||||
* @param string $opt
|
||||
* @return true
|
||||
**/
|
||||
function deleteDocuments($aDocuments, $opt){
|
||||
include_once ("classes/model/AppDocument.php");
|
||||
$oAppDocument = new AppDocument ( );
|
||||
foreach($aDocuments as $key => $val){
|
||||
|
||||
if($opt=='documents'){
|
||||
list($sFileUID,$docVersion) = explode('_',$val);
|
||||
} else {
|
||||
$sFileUID = $val['sAppDocUid'];
|
||||
$docVersion = $val['iVersion'];
|
||||
}
|
||||
|
||||
$oAppDocument->remove($sFileUID,$docVersion);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////
|
||||
function getExtJSParams() {
|
||||
$validParams = array('callback' => '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '', 'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => "");
|
||||
$result = array();
|
||||
@@ -44,9 +98,10 @@ function expandNode(){
|
||||
$oPMFolder = new AppFolder ( );
|
||||
|
||||
$rootFolder = "/";
|
||||
|
||||
|
||||
if($_POST ['node']=="") $_POST ['node'] ="/";
|
||||
if($_POST ['node']=="root") $_POST ['node'] ="/";
|
||||
|
||||
if(!(isset($_POST['sendWhat']))) $_POST['sendWhat']="both";
|
||||
$totalItems=0;
|
||||
$totalFolders=0;
|
||||
@@ -58,7 +113,7 @@ function expandNode(){
|
||||
$totalFolders=$folderListObj['totalFoldersCount'];
|
||||
$totalItems+=count($folderList);
|
||||
|
||||
//G::pr($folderList);
|
||||
// G::pr($folderListObj);
|
||||
}
|
||||
if(($_POST['sendWhat']=="files")||($_POST['sendWhat']=="both")){
|
||||
$folderContentObj = $oPMFolder->getFolderContent ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, array(), NULL, NULL, $limit, $start );
|
||||
@@ -69,10 +124,13 @@ function expandNode(){
|
||||
|
||||
//G::pr($folderContent);
|
||||
}
|
||||
//G::pr($folderContent);
|
||||
// G::pr($folderList);
|
||||
//var_dump(isset($folderList));
|
||||
$processListTree=array();
|
||||
if(isset($folderList)){
|
||||
$tempTree=array();
|
||||
$tempTree=array();
|
||||
if(isset($folderList) && sizeof($folderList)>0){
|
||||
// print'krlos';
|
||||
// $tempTree=array();
|
||||
foreach ( $folderList as $key => $obj ) {
|
||||
//$tempTree ['all-obj'] = $obj;
|
||||
$tempTree ['text'] = $obj['FOLDER_NAME'];
|
||||
@@ -115,7 +173,7 @@ function expandNode(){
|
||||
$tempTree ['id'] = "NA";
|
||||
$tempTree ['folderID'] = "NA";
|
||||
$tempTree ['cls'] = 'folder';
|
||||
$tempTree ['draggable'] = true;
|
||||
$tempTree ['draggable' ] = true;
|
||||
$tempTree ['name'] = $notInFolderLabel;
|
||||
$tempTree ['type'] = "Directory";
|
||||
$tempTree ['is_file'] = false;
|
||||
@@ -144,6 +202,14 @@ function expandNode(){
|
||||
$tempTree=array();
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if($_POST ['node'] == '/'){
|
||||
// $tempTree=array();
|
||||
// $processListTree [] = array();
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($folderContent)){
|
||||
@@ -271,13 +337,14 @@ function expandNode(){
|
||||
$tempTree=array();
|
||||
}
|
||||
}
|
||||
// G::pr($processListTree);
|
||||
if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
|
||||
$processListTreeTemp['totalCount']=$totalFolders+$totalDocuments;//count($processListTree);
|
||||
|
||||
$processListTreeTemp['msg']='correct reload';
|
||||
$processListTreeTemp['items']=$processListTree;
|
||||
$processListTree = $processListTreeTemp;
|
||||
}
|
||||
|
||||
// G::pr ( $processListTree );die;
|
||||
print G::json_encode ( $processListTree );
|
||||
}
|
||||
|
||||
@@ -1122,11 +1189,10 @@ function newFolder(){
|
||||
$formNewFolder["buttons"]= array();
|
||||
|
||||
|
||||
|
||||
$button=array();
|
||||
$button["text"]= "Create";
|
||||
$button["handler"]= 'handlerCreate';
|
||||
$formNewFolder["buttons"][]= $button;
|
||||
$button = array();
|
||||
$button["text"] = "Create";
|
||||
$button["handler"] = 'handlerCreate';
|
||||
$formNewFolder["buttons"][] = $button;
|
||||
|
||||
$button=array();
|
||||
$button["text"]= "Cancel";
|
||||
|
||||
@@ -9,7 +9,7 @@ if(isset($_GET['action'])){
|
||||
}
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
|
||||
global $RBAC;
|
||||
switch($page){
|
||||
case "startCase":
|
||||
|
||||
@@ -30,7 +30,10 @@ switch($page){
|
||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
||||
$oHeadPublisher->assign('CONFIG', $Config);
|
||||
$oHeadPublisher->assign('FORMATS',$c->getFormats());
|
||||
|
||||
|
||||
$oHeadPublisher->assign('permitodelete' ,$RBAC->userCanAccess('PM_FOLDERS_DELETE') );
|
||||
$oHeadPublisher->assign('permitoaddfile' ,$RBAC->userCanAccess('PM_FOLDERS_ADD_FILE') );
|
||||
$oHeadPublisher->assign('permitoaddfolder',$RBAC->userCanAccess('PM_FOLDERS_ADD_FOLDER'));
|
||||
|
||||
$oHeadPublisher->usingExtJs('ux.locationbar/Ext.ux.LocationBar');
|
||||
$oHeadPublisher->usingExtJs('ux.statusbar/ext-statusbar');
|
||||
@@ -46,4 +49,4 @@ switch($page){
|
||||
}
|
||||
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user