BUG 5601 Documents are being loaded too slow
Fixed issue implementing pagination. Some other fixes and improvements applied in this commit: Better Refresh button for documents tree, bug 6919 fixed too
This commit is contained in:
@@ -42,7 +42,7 @@ class AppFolder extends BaseAppFolder {
|
|||||||
$oDataset->next ();
|
$oDataset->next ();
|
||||||
if ($aRow = $oDataset->getRow ()) {//Folder exist, then return the ID
|
if ($aRow = $oDataset->getRow ()) {//Folder exist, then return the ID
|
||||||
$response['success']=false;
|
$response['success']=false;
|
||||||
$response['message']=$response['error']="Can't create folder <br /> A folder with same name already exists. <br /> $folderParent$folderName";
|
$response['message']=$response['error']="Can't create folder <br /> A folder with same name already exists. <br /> $folderName";
|
||||||
$response['folderUID']=$aRow ['FOLDER_UID'];
|
$response['folderUID']=$aRow ['FOLDER_UID'];
|
||||||
//return ($aRow ['FOLDER_UID']);
|
//return ($aRow ['FOLDER_UID']);
|
||||||
return ($response);
|
return ($response);
|
||||||
@@ -58,7 +58,7 @@ class AppFolder extends BaseAppFolder {
|
|||||||
// we save it, since we get no validation errors, or do whatever else you like.
|
// we save it, since we get no validation errors, or do whatever else you like.
|
||||||
$res = $tr->save ();
|
$res = $tr->save ();
|
||||||
$response['success']=true;
|
$response['success']=true;
|
||||||
$response['message']=$response['error']="Folder successfully created. <br /> $folderParent$folderName";
|
$response['message']="Folder successfully created. <br /> $folderName";
|
||||||
$response['folderUID']=$folderUID;
|
$response['folderUID']=$folderUID;
|
||||||
return ($response);
|
return ($response);
|
||||||
//return $folderUID;
|
//return $folderUID;
|
||||||
@@ -127,7 +127,7 @@ class AppFolder extends BaseAppFolder {
|
|||||||
* @param string(32) $folderID
|
* @param string(32) $folderID
|
||||||
* @return multitype:
|
* @return multitype:
|
||||||
*/
|
*/
|
||||||
function getFolderList($folderID) {
|
function getFolderList($folderID, $limit=0, $start=0) {
|
||||||
$Criteria = new Criteria ( 'workflow' );
|
$Criteria = new Criteria ( 'workflow' );
|
||||||
$Criteria->clearSelectColumns ()->clearOrderByColumns ();
|
$Criteria->clearSelectColumns ()->clearOrderByColumns ();
|
||||||
|
|
||||||
@@ -141,15 +141,23 @@ class AppFolder extends BaseAppFolder {
|
|||||||
|
|
||||||
$Criteria->addAscendingOrderByColumn ( AppFolderPeer::FOLDER_NAME );
|
$Criteria->addAscendingOrderByColumn ( AppFolderPeer::FOLDER_NAME );
|
||||||
|
|
||||||
|
$response['totalFoldersCount'] = AppFolderPeer::doCount($Criteria);
|
||||||
|
$response['folders'] = array();
|
||||||
|
|
||||||
|
if($limit != 0){
|
||||||
|
|
||||||
|
$Criteria->setLimit($limit);
|
||||||
|
$Criteria->setOffset($start);
|
||||||
|
}
|
||||||
$rs = appFolderPeer::doSelectRS ( $Criteria );
|
$rs = appFolderPeer::doSelectRS ( $Criteria );
|
||||||
$rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
$rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||||
$rs->next ();
|
$rs->next ();
|
||||||
$folderResult = array ();
|
$folderResult = array ();
|
||||||
while ( is_array ( $row = $rs->getRow () ) ) {
|
while ( is_array ( $row = $rs->getRow () ) ) {
|
||||||
$folderResult [] = $row;
|
$response['folders'] [] = $row;
|
||||||
$rs->next ();
|
$rs->next ();
|
||||||
}
|
}
|
||||||
return ($folderResult);
|
return ($response);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param string(32) $folderUid
|
* @param string(32) $folderUid
|
||||||
@@ -190,7 +198,7 @@ class AppFolder extends BaseAppFolder {
|
|||||||
return $folderArray;
|
return $folderArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFolderContent($folderID, $docIdFilter = array(), $keyword = NULL, $searchType = NULL) {
|
function getFolderContent($folderID, $docIdFilter = array(), $keyword = NULL, $searchType = NULL, $limit=0, $start=0) {
|
||||||
require_once ("classes/model/AppDocument.php");
|
require_once ("classes/model/AppDocument.php");
|
||||||
require_once ("classes/model/InputDocument.php");
|
require_once ("classes/model/InputDocument.php");
|
||||||
require_once ("classes/model/OutputDocument.php");
|
require_once ("classes/model/OutputDocument.php");
|
||||||
@@ -213,12 +221,19 @@ class AppFolder extends BaseAppFolder {
|
|||||||
|
|
||||||
$oCase->verifyTable ();
|
$oCase->verifyTable ();
|
||||||
|
|
||||||
$oCriteria->setOffset(0);
|
|
||||||
$oCriteria->setLimit(150);
|
|
||||||
|
|
||||||
$oCriteria->addAscendingOrderByColumn ( AppDocumentPeer::APP_DOC_INDEX );
|
$oCriteria->addAscendingOrderByColumn ( AppDocumentPeer::APP_DOC_INDEX );
|
||||||
$oCriteria->addDescendingOrderByColumn ( AppDocumentPeer::DOC_VERSION );
|
$oCriteria->addDescendingOrderByColumn ( AppDocumentPeer::DOC_VERSION );
|
||||||
|
|
||||||
|
|
||||||
|
$response['totalDocumentsCount'] = AppDocumentPeer::doCount($oCriteria);
|
||||||
|
$response['documents'] = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$oCriteria->setLimit($limit);
|
||||||
|
$oCriteria->setOffset($start);
|
||||||
|
|
||||||
$rs = AppDocumentPeer::doSelectRS ( $oCriteria );
|
$rs = AppDocumentPeer::doSelectRS ( $oCriteria );
|
||||||
$rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
$rs->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||||
$rs->next ();
|
$rs->next ();
|
||||||
@@ -238,15 +253,15 @@ class AppFolder extends BaseAppFolder {
|
|||||||
if ((in_array ( $row ['APP_DOC_UID'], $completeInfo ['INPUT_DOCUMENTS'] )) || (in_array ( $row ['APP_DOC_UID'], $completeInfo ['OUTPUT_DOCUMENTS'] )) || (in_array ( $completeInfo ['USR_UID'], array ($_SESSION ['USER_LOGGED'], '-1' ) ))) {
|
if ((in_array ( $row ['APP_DOC_UID'], $completeInfo ['INPUT_DOCUMENTS'] )) || (in_array ( $row ['APP_DOC_UID'], $completeInfo ['OUTPUT_DOCUMENTS'] )) || (in_array ( $completeInfo ['USR_UID'], array ($_SESSION ['USER_LOGGED'], '-1' ) ))) {
|
||||||
if (count ( $docIdFilter ) > 0) {
|
if (count ( $docIdFilter ) > 0) {
|
||||||
if (in_array ( $row ['APP_DOC_UID'], $docIdFilter )) {
|
if (in_array ( $row ['APP_DOC_UID'], $docIdFilter )) {
|
||||||
$filesResult [] = $completeInfo;
|
$response['documents'][] = $completeInfo;
|
||||||
}
|
}
|
||||||
} elseif ($lastVersion == $row ['DOC_VERSION']) { //Only Last Document version
|
} elseif ($lastVersion == $row ['DOC_VERSION']) { //Only Last Document version
|
||||||
if ($searchType == "ALL") {// If search in name of docs is active then filter
|
if ($searchType == "ALL") {// If search in name of docs is active then filter
|
||||||
if ((stripos ( $completeInfo ['APP_DOC_FILENAME'], $keyword ) !== false) || (stripos ( $completeInfo ['APP_DOC_TAGS'], $keyword ) !== false)) {
|
if ((stripos ( $completeInfo ['APP_DOC_FILENAME'], $keyword ) !== false) || (stripos ( $completeInfo ['APP_DOC_TAGS'], $keyword ) !== false)) {
|
||||||
$filesResult [] = $completeInfo;
|
$response['documents'][] = $completeInfo;
|
||||||
}
|
}
|
||||||
} else {//No search filter active
|
} else {//No search filter active
|
||||||
$filesResult [] = $completeInfo;
|
$response['documents'][] = $completeInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +270,7 @@ class AppFolder extends BaseAppFolder {
|
|||||||
}
|
}
|
||||||
$rs->next ();
|
$rs->next ();
|
||||||
}
|
}
|
||||||
return ($filesResult);
|
return ($response);
|
||||||
}
|
}
|
||||||
function getCompleteDocumentInfo($appUid, $appDocUid, $docVersion, $docUid, $usrId) {
|
function getCompleteDocumentInfo($appUid, $appDocUid, $docVersion, $docUid, $usrId) {
|
||||||
require_once ("classes/model/AppDocument.php");
|
require_once ("classes/model/AppDocument.php");
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! isset ( $_REQUEST ['action'] )) {
|
if (! isset ( $_REQUEST ['action'] )) {
|
||||||
$res ['success'] = 'failure';
|
$res ['success'] = false;
|
||||||
$res ['message'] = 'You may request an action';
|
$res ['message'] = 'You may request an action';
|
||||||
print G::json_encode ( $res);
|
print G::json_encode ( $res);
|
||||||
die ();
|
die ();
|
||||||
}
|
}
|
||||||
if (! function_exists ( $_REQUEST ['action'] )) {
|
if (! function_exists ( $_REQUEST ['action'] )) {
|
||||||
$res ['success'] = 'failure';
|
$res ['success'] = false;
|
||||||
$res ['message'] = 'The requested action doesn\'t exists';
|
$res ['message'] = 'The requested action doesn\'t exists';
|
||||||
print G::json_encode ( $res );
|
print G::json_encode ( $res );
|
||||||
die ();
|
die ();
|
||||||
@@ -18,7 +18,27 @@ $functionParams = isset ( $_REQUEST ['params'] ) ? $_REQUEST ['params'] : array
|
|||||||
|
|
||||||
$functionName ( $functionParams );
|
$functionName ( $functionParams );
|
||||||
|
|
||||||
|
function getExtJSParams() {
|
||||||
|
$validParams = array('callback' => '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '', 'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => "");
|
||||||
|
$result = array();
|
||||||
|
foreach ($validParams as $paramName => $paramDefault) {
|
||||||
|
$result[$paramName] = isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : $paramDefault;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendJsonResultGeneric($response, $callback) {
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
$finalResponse = json_encode($response);
|
||||||
|
if ($callback != '') {
|
||||||
|
print $callback . "($finalResponse);";
|
||||||
|
} else {
|
||||||
|
print $finalResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function expandNode(){
|
function expandNode(){
|
||||||
|
extract(getExtJSParams());
|
||||||
require_once ("classes/model/AppFolder.php");
|
require_once ("classes/model/AppFolder.php");
|
||||||
|
|
||||||
$oPMFolder = new AppFolder ( );
|
$oPMFolder = new AppFolder ( );
|
||||||
@@ -28,13 +48,26 @@ function expandNode(){
|
|||||||
if($_POST ['node']=="") $_POST ['node'] ="/";
|
if($_POST ['node']=="") $_POST ['node'] ="/";
|
||||||
if($_POST ['node']=="root") $_POST ['node'] ="/";
|
if($_POST ['node']=="root") $_POST ['node'] ="/";
|
||||||
if(!(isset($_POST['sendWhat']))) $_POST['sendWhat']="both";
|
if(!(isset($_POST['sendWhat']))) $_POST['sendWhat']="both";
|
||||||
|
$totalItems=0;
|
||||||
|
$totalFolders=0;
|
||||||
|
$totalDocuments=0;
|
||||||
if(($_POST['sendWhat']=="dirs")||($_POST['sendWhat']=="both")){
|
if(($_POST['sendWhat']=="dirs")||($_POST['sendWhat']=="both")){
|
||||||
$folderList = $oPMFolder->getFolderList ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder );
|
$folderListObj = $oPMFolder->getFolderList ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, $limit, $start );
|
||||||
|
//G::pr($folderListObj);
|
||||||
|
$folderList=$folderListObj['folders'];
|
||||||
|
$totalFolders=$folderListObj['totalFoldersCount'];
|
||||||
|
$totalItems+=count($folderList);
|
||||||
|
|
||||||
//G::pr($folderList);
|
//G::pr($folderList);
|
||||||
}
|
}
|
||||||
if(($_POST['sendWhat']=="files")||($_POST['sendWhat']=="both")){
|
if(($_POST['sendWhat']=="files")||($_POST['sendWhat']=="both")){
|
||||||
$folderContent = $oPMFolder->getFolderContent ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder );
|
$folderContentObj = $oPMFolder->getFolderContent ( $_POST ['node'] != 'root' ? $_POST ['node'] == 'NA' ? "" : $_POST ['node'] : $rootFolder, array(), NULL, NULL, $limit, $start );
|
||||||
//G::pr($folderContent);
|
//G::pr($folderContentObj);
|
||||||
|
$folderContent=$folderContentObj['documents'];
|
||||||
|
$totalDocuments=$folderContentObj['totalDocumentsCount'];
|
||||||
|
$totalItems+=count($folderContent);
|
||||||
|
|
||||||
|
//G::pr($folderContent);
|
||||||
}
|
}
|
||||||
//G::pr($folderContent);
|
//G::pr($folderContent);
|
||||||
$processListTree=array();
|
$processListTree=array();
|
||||||
@@ -162,7 +195,7 @@ function expandNode(){
|
|||||||
$tempTree ['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
|
$tempTree ['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
|
||||||
$tempTree ['appDocTags'] = $obj['APP_DOC_TAGS'];
|
$tempTree ['appDocTags'] = $obj['APP_DOC_TAGS'];
|
||||||
$tempTree ['appDocTitle'] = $obj['APP_DOC_TITLE'];
|
$tempTree ['appDocTitle'] = $obj['APP_DOC_TITLE'];
|
||||||
$tempTree ['appDocComment'] = $obj['APP_DOC_COMMENT'];
|
$tempTree ['appDocComment'] = $tempTree ['qtip'] = $obj['APP_DOC_COMMENT'];
|
||||||
$tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
|
$tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
|
||||||
if(isset($obj['APP_NUMBER'])){
|
if(isset($obj['APP_NUMBER'])){
|
||||||
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
|
$tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
|
||||||
@@ -243,7 +276,8 @@ function expandNode(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
|
if((isset($_POST['option']))&&($_POST['option']=="gridDocuments")){
|
||||||
$processListTreeTemp['totalCount']=count($processListTree);
|
$processListTreeTemp['totalCount']=$totalFolders+$totalDocuments;//count($processListTree);
|
||||||
|
|
||||||
$processListTreeTemp['items']=$processListTree;
|
$processListTreeTemp['items']=$processListTree;
|
||||||
$processListTree = $processListTreeTemp;
|
$processListTree = $processListTreeTemp;
|
||||||
}
|
}
|
||||||
@@ -1028,6 +1062,7 @@ function newFolder(){
|
|||||||
$oPMFolder = new AppFolder ( );
|
$oPMFolder = new AppFolder ( );
|
||||||
//G::pr($_POST);
|
//G::pr($_POST);
|
||||||
if($_POST ['dir']=="") $_POST ['dir']="/";
|
if($_POST ['dir']=="") $_POST ['dir']="/";
|
||||||
|
if($_POST ['dir']=="root") $_POST ['dir']="/";
|
||||||
$folderStructure = $oPMFolder->getFolderStructure ( $_POST ['dir'] );
|
$folderStructure = $oPMFolder->getFolderStructure ( $_POST ['dir'] );
|
||||||
//G::pr($folderStructure);
|
//G::pr($folderStructure);
|
||||||
$folderPath = $folderStructure ['PATH'];
|
$folderPath = $folderStructure ['PATH'];
|
||||||
@@ -1206,9 +1241,11 @@ function getMime($fileName){
|
|||||||
$return['icon']="/images/documents/extension/document.png";
|
$return['icon']="/images/documents/extension/document.png";
|
||||||
if(count($fileNameA)>1){
|
if(count($fileNameA)>1){
|
||||||
$extension=$fileNameA[count($fileNameA)-1];
|
$extension=$fileNameA[count($fileNameA)-1];
|
||||||
|
if(file_exists(PATH_HTML."images/documents/extension/".strtolower($extension).".png")){
|
||||||
$return['description']=G::LoadTranslation("MIME_DES_".strtoupper($extension));
|
$return['description']=G::LoadTranslation("MIME_DES_".strtoupper($extension));
|
||||||
$return['icon']="/images/documents/extension/".strtolower($extension).".png";
|
$return['icon']="/images/documents/extension/".strtolower($extension).".png";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,15 +24,21 @@ Ext.FlashComponent.EXPRESS_INSTALL_URL = '/images/expressinstall.swf';
|
|||||||
// The Quicktips are used for the toolbar and Tree mouseover tooltips!
|
// The Quicktips are used for the toolbar and Tree mouseover tooltips!
|
||||||
Ext.QuickTips.init();
|
Ext.QuickTips.init();
|
||||||
|
|
||||||
try{rc=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$');}
|
try{
|
||||||
catch(z){rc=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/;}
|
rc=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$');
|
||||||
|
}
|
||||||
|
catch(z){
|
||||||
|
rc=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/;
|
||||||
|
}
|
||||||
|
|
||||||
var conn = new Ext.data.Connection();
|
var conn = new Ext.data.Connection();
|
||||||
|
|
||||||
streamFilefromPM=function(fileStream) {
|
streamFilefromPM=function(fileStream) {
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url:fileStream,
|
url:fileStream,
|
||||||
params: {request:true},
|
params: {
|
||||||
|
request:true
|
||||||
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
results = Ext.decode(response.responseText);
|
results = Ext.decode(response.responseText);
|
||||||
if(results.success=='success'){
|
if(results.success=='success'){
|
||||||
@@ -78,32 +84,44 @@ function chDir( directory, loadGridOnly ) {
|
|||||||
datastore.directory = directory;
|
datastore.directory = directory;
|
||||||
var conn = datastore.proxy.getConnection();
|
var conn = datastore.proxy.getConnection();
|
||||||
if( directory == '' || conn && !conn.isLoading()) {
|
if( directory == '' || conn && !conn.isLoading()) {
|
||||||
datastore.load({params:{start:0, limit:150, dir: directory, node: directory, option:'gridDocuments', action:'expandNode', sendWhat: datastore.sendWhat }});
|
datastore.load({
|
||||||
|
params:{
|
||||||
|
start:0,
|
||||||
|
limit:25,
|
||||||
|
dir: directory,
|
||||||
|
node: directory,
|
||||||
|
option:'gridDocuments',
|
||||||
|
action:'expandNode',
|
||||||
|
sendWhat: datastore.sendWhat
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
tb = ext_itemgrid.getTopToolbar();
|
tb = ext_itemgrid.getTopToolbar();
|
||||||
if(directory=="NA"){ // Disable create new folder under NA
|
if(directory=="NA"){ // Disable create new folder under NA
|
||||||
tb.items.get('tb_new').disable();
|
tb.items.get('tb_new').disable();
|
||||||
tb.items.get('tb_upload').disable();
|
tb.items.get('tb_upload').disable();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
tb.items.get('tb_new').enable();
|
tb.items.get('tb_new').enable();
|
||||||
tb.items.get('tb_upload').enable();
|
tb.items.get('tb_upload').enable();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* tb.items.get('tb_delete')[selections[0].get('is_deletable') ? 'enable' :
|
* tb.items.get('tb_delete')[selections[0].get('is_deletable') ? 'enable' :
|
||||||
* 'disable']();
|
* 'disable']();
|
||||||
*/
|
*/
|
||||||
if( !loadGridOnly ) {
|
if( !loadGridOnly ) {
|
||||||
expandTreeToDir( null, directory );
|
expandTreeToDir( null, directory );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function expandTreeToDir( node, dir ) {
|
function expandTreeToDir( node, dir ) {
|
||||||
// console.info("Expanding Tree to Dir "+node+" - "+dir);
|
// console.info("Expanding Tree to Dir "+node+" - "+dir);
|
||||||
dir = dir ? dir : new String('');
|
dir = dir ? dir : new String('');
|
||||||
var dirs = dir.split('/');
|
var dirs = dir.split('/');
|
||||||
if( dirs[0] == '') { dirs.shift(); }
|
if( dirs[0] == '') {
|
||||||
|
dirs.shift();
|
||||||
|
}
|
||||||
if( dirs.length > 0 ) {
|
if( dirs.length > 0 ) {
|
||||||
// console.log("Dir to expand... "+dirs[0]);
|
// console.log("Dir to expand... "+dirs[0]);
|
||||||
node = dirTree.getNodeById( dirs[0] );
|
node = dirTree.getNodeById( dirs[0] );
|
||||||
@@ -112,7 +130,9 @@ function expandTreeToDir( node, dir ) {
|
|||||||
expandNode( node, dir );
|
expandNode( node, dir );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node.on('load', function() { expandNode( node, dir ); } );
|
node.on('load', function() {
|
||||||
|
expandNode( node, dir );
|
||||||
|
} );
|
||||||
node.expand();
|
node.expand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +141,9 @@ function expandNode( node, dir ) {
|
|||||||
var fulldirpath, dirpath;
|
var fulldirpath, dirpath;
|
||||||
|
|
||||||
var dirs = dir.split('/');
|
var dirs = dir.split('/');
|
||||||
if( dirs[0] == '') { dirs.shift(); }
|
if( dirs[0] == '') {
|
||||||
|
dirs.shift();
|
||||||
|
}
|
||||||
if( dirs.length > 0 ) {
|
if( dirs.length > 0 ) {
|
||||||
fulldirpath = '';
|
fulldirpath = '';
|
||||||
for( i=0; i < dirs.length; i++ ) {
|
for( i=0; i < dirs.length; i++ ) {
|
||||||
@@ -143,9 +165,16 @@ function expandNode( node, dir ) {
|
|||||||
dirpath += '_RRR_'+ dirs[i];
|
dirpath += '_RRR_'+ dirs[i];
|
||||||
// dirpath = dirpath.substr( 5 );
|
// dirpath = dirpath.substr( 5 );
|
||||||
var nextnode = dirTree.getNodeById( dirpath );
|
var nextnode = dirTree.getNodeById( dirpath );
|
||||||
if( !nextnode ) { return; }
|
if( !nextnode ) {
|
||||||
if( nextnode.isExpanded() ) { expandNode( nextnode, dir ); return;}
|
return;
|
||||||
nextnode.on( 'load', function() { expandNode( nextnode, dir ); } );
|
}
|
||||||
|
if( nextnode.isExpanded() ) {
|
||||||
|
expandNode( nextnode, dir );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nextnode.on( 'load', function() {
|
||||||
|
expandNode( nextnode, dir );
|
||||||
|
} );
|
||||||
|
|
||||||
nextnode.expand();
|
nextnode.expand();
|
||||||
break;
|
break;
|
||||||
@@ -210,7 +239,11 @@ function openActionDialog( caller, action ) {
|
|||||||
selectedRows = Array( dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' ) );
|
selectedRows = Array( dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dontNeedSelection = { newFolder:1, uploadDocument:1, search:1 };
|
var dontNeedSelection = {
|
||||||
|
newFolder:1,
|
||||||
|
uploadDocument:1,
|
||||||
|
search:1
|
||||||
|
};
|
||||||
if( dontNeedSelection[action] == null && selectedRows.length < 1 ) {
|
if( dontNeedSelection[action] == null && selectedRows.length < 1 ) {
|
||||||
Ext.Msg.alert( 'Error',TRANSLATIONS.ID_NO_ITEMS_SELECTED);
|
Ext.Msg.alert( 'Error',TRANSLATIONS.ID_NO_ITEMS_SELECTED);
|
||||||
return false;
|
return false;
|
||||||
@@ -251,7 +284,8 @@ function openActionDialog( caller, action ) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Ext.Ajax.request( { url: '../appFolder/appFolderAjax.php',
|
Ext.Ajax.request( {
|
||||||
|
url: '../appFolder/appFolderAjax.php',
|
||||||
params: Ext.urlEncode( requestParams ),
|
params: Ext.urlEncode( requestParams ),
|
||||||
scripts: true,
|
scripts: true,
|
||||||
callback: function(oElement, bSuccess, oResponse) {
|
callback: function(oElement, bSuccess, oResponse) {
|
||||||
@@ -358,7 +392,9 @@ function openActionDialog( caller, action ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if( action != "edit" ) {
|
if( action != "edit" ) {
|
||||||
dialog.on( 'hide', function() { dialog.destroy(true); } );
|
dialog.on( 'hide', function() {
|
||||||
|
dialog.destroy(true);
|
||||||
|
} );
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -409,7 +445,9 @@ function handleCallback(requestParams, node) {
|
|||||||
} else {
|
} else {
|
||||||
datastore.reload();
|
datastore.reload();
|
||||||
}
|
}
|
||||||
} catch(e) { datastore.reload(); }
|
} catch(e) {
|
||||||
|
datastore.reload();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
statusBarMessage( json.message, false, false );
|
statusBarMessage( json.message, false, false );
|
||||||
}
|
}
|
||||||
@@ -424,7 +462,7 @@ function handleCallback(requestParams, node) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getRequestParams() {
|
function getRequestParams() {
|
||||||
// console.info("Get Request params ");
|
// console.info("Get Request params ");
|
||||||
var selitems, dir, node;
|
var selitems, dir, node;
|
||||||
var selectedRows = ext_itemgrid.getSelectionModel().getSelections();
|
var selectedRows = ext_itemgrid.getSelectionModel().getSelections();
|
||||||
@@ -461,28 +499,28 @@ function handleCallback(requestParams, node) {
|
|||||||
'selitems[]': selitems
|
'selitems[]': selitems
|
||||||
};
|
};
|
||||||
return requestParams;
|
return requestParams;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Function for actions, which don't require a form like download,
|
* Function for actions, which don't require a form like download,
|
||||||
* extraction, deletion etc.
|
* extraction, deletion etc.
|
||||||
*/
|
*/
|
||||||
function deleteFiles(btn) {
|
function deleteFiles(btn) {
|
||||||
if( btn != 'yes') {
|
if( btn != 'yes') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
requestParams = getRequestParams();
|
requestParams = getRequestParams();
|
||||||
requestParams.action = 'delete';
|
requestParams.action = 'delete';
|
||||||
handleCallback(requestParams);
|
handleCallback(requestParams);
|
||||||
}
|
}
|
||||||
function extractArchive(btn) {
|
function extractArchive(btn) {
|
||||||
if( btn != 'yes') {
|
if( btn != 'yes') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
requestParams = getRequestParams();
|
requestParams = getRequestParams();
|
||||||
requestParams.action = 'extract';
|
requestParams.action = 'extract';
|
||||||
handleCallback(requestParams);
|
handleCallback(requestParams);
|
||||||
}
|
}
|
||||||
function deleteDir( btn, node ) {
|
function deleteDir( btn, node ) {
|
||||||
if( btn != 'yes') {
|
if( btn != 'yes') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -491,9 +529,9 @@ function handleCallback(requestParams, node) {
|
|||||||
requestParams.selitems = Array( node.id.replace( /_RRR_/g, '/' ) );
|
requestParams.selitems = Array( node.id.replace( /_RRR_/g, '/' ) );
|
||||||
requestParams.action = 'delete';
|
requestParams.action = 'delete';
|
||||||
handleCallback(requestParams, node);
|
handleCallback(requestParams, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ext.msgBoxSlider = function(){
|
Ext.msgBoxSlider = function(){
|
||||||
var msgCt;
|
var msgCt;
|
||||||
|
|
||||||
function createBox(t, s){
|
function createBox(t, s){
|
||||||
@@ -506,11 +544,15 @@ function handleCallback(requestParams, node) {
|
|||||||
return {
|
return {
|
||||||
msg : function(title, format){
|
msg : function(title, format){
|
||||||
if(!msgCt){
|
if(!msgCt){
|
||||||
msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
|
msgCt = Ext.DomHelper.insertFirst(document.body, {
|
||||||
|
id:'msg-div'
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
msgCt.alignTo(document, 't-t');
|
msgCt.alignTo(document, 't-t');
|
||||||
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
|
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
|
||||||
var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
|
var m = Ext.DomHelper.append(msgCt, {
|
||||||
|
html:createBox(title, s)
|
||||||
|
}, true);
|
||||||
m.setWidth(400 );
|
m.setWidth(400 );
|
||||||
m.position(null, 5000 );
|
m.position(null, 5000 );
|
||||||
m.alignTo(document, 't-t');
|
m.alignTo(document, 't-t');
|
||||||
@@ -518,13 +560,15 @@ function handleCallback(requestParams, node) {
|
|||||||
Ext.get('x-box-mc-inner' ).setStyle('background-position', '5px 10px');
|
Ext.get('x-box-mc-inner' ).setStyle('background-position', '5px 10px');
|
||||||
Ext.get('x-box-mc-inner' ).setStyle('background-repeat', 'no-repeat');
|
Ext.get('x-box-mc-inner' ).setStyle('background-repeat', 'no-repeat');
|
||||||
Ext.get('x-box-mc-inner' ).setStyle('padding-left', '35px');
|
Ext.get('x-box-mc-inner' ).setStyle('padding-left', '35px');
|
||||||
m.slideIn('t').pause(3).ghost("t", {remove:true});
|
m.slideIn('t').pause(3).ghost("t", {
|
||||||
|
remove:true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
|
||||||
function statusBarMessage( msg, isLoading, success ) {
|
function statusBarMessage( msg, isLoading, success ) {
|
||||||
// console.log("Status Bar needed");
|
// console.log("Status Bar needed");
|
||||||
// console.log(msg);
|
// console.log(msg);
|
||||||
var statusBar = Ext.getCmp('statusPanel');
|
var statusBar = Ext.getCmp('statusPanel');
|
||||||
@@ -554,9 +598,9 @@ function handleCallback(requestParams, node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectFile( dir, file ) {
|
function selectFile( dir, file ) {
|
||||||
// console.log("file selected: "+dir+" - "+file);
|
// console.log("file selected: "+dir+" - "+file);
|
||||||
chDir( dir );
|
chDir( dir );
|
||||||
var conn = datastore.proxy.getConnection();
|
var conn = datastore.proxy.getConnection();
|
||||||
@@ -567,12 +611,12 @@ function handleCallback(requestParams, node) {
|
|||||||
if( idx >= 0 ) {
|
if( idx >= 0 ) {
|
||||||
ext_itemgrid.getSelectionModel().selectRow( idx );
|
ext_itemgrid.getSelectionModel().selectRow( idx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug Function, that works like print_r for Objects in Javascript
|
* Debug Function, that works like print_r for Objects in Javascript
|
||||||
*/
|
*/
|
||||||
function var_dump(obj) {
|
function var_dump(obj) {
|
||||||
var vartext = "";
|
var vartext = "";
|
||||||
for (var prop in obj) {
|
for (var prop in obj) {
|
||||||
if( isNaN( prop.toString() )) {
|
if( isNaN( prop.toString() )) {
|
||||||
@@ -584,7 +628,7 @@ function handleCallback(requestParams, node) {
|
|||||||
} else {
|
} else {
|
||||||
return "Type: "+typeof(obj)+"\n" + vartext;
|
return "Type: "+typeof(obj)+"\n" + vartext;
|
||||||
}
|
}
|
||||||
}// end function var_dump
|
}// end function var_dump
|
||||||
|
|
||||||
|
|
||||||
datastore = new Ext.data.Store({
|
datastore = new Ext.data.Store({
|
||||||
@@ -593,7 +637,7 @@ datastore = new Ext.data.Store({
|
|||||||
directory : "/",
|
directory : "/",
|
||||||
params : {
|
params : {
|
||||||
start : 0,
|
start : 0,
|
||||||
limit : 150,
|
limit : 25,
|
||||||
dir : this.directory,
|
dir : this.directory,
|
||||||
node : this.directory,
|
node : this.directory,
|
||||||
option : "gridDocuments",
|
option : "gridDocuments",
|
||||||
@@ -601,7 +645,7 @@ datastore = new Ext.data.Store({
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
directory : "/",
|
directory : "/",
|
||||||
sendWhat : "both",
|
sendWhat : "files",
|
||||||
// create reader that reads the File records
|
// create reader that reads the File records
|
||||||
reader : new Ext.data.JsonReader({
|
reader : new Ext.data.JsonReader({
|
||||||
root : "items",
|
root : "items",
|
||||||
@@ -672,7 +716,7 @@ datastore.on("beforeload",
|
|||||||
function(ds, options) {
|
function(ds, options) {
|
||||||
options.params.dir = options.params.dir ? options.params.dir
|
options.params.dir = options.params.dir ? options.params.dir
|
||||||
: ds.directory;
|
: ds.directory;
|
||||||
node = options.params.dir ? options.params.dir : ds.directory;
|
options.params.node = options.params.dir ? options.params.dir : ds.directory;
|
||||||
options.params.option = "gridDocuments";
|
options.params.option = "gridDocuments";
|
||||||
options.params.action = "expandNode";
|
options.params.action = "expandNode";
|
||||||
options.params.sendWhat = datastore.sendWhat;
|
options.params.sendWhat = datastore.sendWhat;
|
||||||
@@ -890,7 +934,7 @@ var gridtb = new Ext.Toolbar(
|
|||||||
new Ext.Toolbar.Button({
|
new Ext.Toolbar.Button({
|
||||||
text : TRANSLATIONS.ID_SHOW_DIRS,
|
text : TRANSLATIONS.ID_SHOW_DIRS,
|
||||||
enableToggle : true,
|
enableToggle : true,
|
||||||
pressed : true,
|
pressed : false,
|
||||||
handler : function(btn, e) {
|
handler : function(btn, e) {
|
||||||
if (btn.pressed) {
|
if (btn.pressed) {
|
||||||
datastore.sendWhat = 'both';
|
datastore.sendWhat = 'both';
|
||||||
@@ -979,7 +1023,7 @@ var getGrid = function( data, element) {
|
|||||||
var expander = new Ext.ux.grid.RowExpander({
|
var expander = new Ext.ux.grid.RowExpander({
|
||||||
tpl : '<div class="ux-row-expander-box" style="border: 2px solid red;"></div>',
|
tpl : '<div class="ux-row-expander-box" style="border: 2px solid red;"></div>',
|
||||||
// header:'Version',
|
// header:'Version',
|
||||||
/*
|
/*
|
||||||
* tpl : new Ext.Template( '<p><b>Company:</b> {company}</p><br>', '<p><b>Summary:</b>
|
* tpl : new Ext.Template( '<p><b>Company:</b> {company}</p><br>', '<p><b>Summary:</b>
|
||||||
* {desc}</p>' ),
|
* {desc}</p>' ),
|
||||||
*/
|
*/
|
||||||
@@ -1000,7 +1044,7 @@ var expander = new Ext.ux.grid.RowExpander({
|
|||||||
// alert( Ext.ComponentMgr.all.length);
|
// alert( Ext.ComponentMgr.all.length);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
renderer : renderVersionExpander
|
renderer : renderVersionExpander
|
||||||
});
|
});
|
||||||
|
|
||||||
// the column model has information about grid columns
|
// the column model has information about grid columns
|
||||||
@@ -1033,14 +1077,14 @@ var cm = new Ext.grid.ColumnModel([{
|
|||||||
dataIndex : 'owner',
|
dataIndex : 'owner',
|
||||||
width : 100,
|
width : 100,
|
||||||
renderer: renderFullName
|
renderer: renderFullName
|
||||||
// sortable : false
|
// sortable : false
|
||||||
}, {
|
}, {
|
||||||
header : "PM Type",
|
header : "PM Type",
|
||||||
dataIndex : 'appDocType',
|
dataIndex : 'appDocType',
|
||||||
width : 70,
|
width : 70,
|
||||||
hidden:true
|
hidden:true
|
||||||
// align : 'right'
|
// align : 'right'
|
||||||
// renderer : renderType
|
// renderer : renderType
|
||||||
}, {
|
}, {
|
||||||
header : TRANSLATIONS.ID_TYPE,
|
header : TRANSLATIONS.ID_TYPE,
|
||||||
dataIndex : 'type',
|
dataIndex : 'type',
|
||||||
@@ -1051,14 +1095,14 @@ var cm = new Ext.grid.ColumnModel([{
|
|||||||
header : TRANSLATIONS.ID_PROCESS,
|
header : TRANSLATIONS.ID_PROCESS,
|
||||||
dataIndex : 'proTitle',
|
dataIndex : 'proTitle',
|
||||||
width : 150// ,
|
width : 150// ,
|
||||||
// align : 'right'
|
// align : 'right'
|
||||||
// renderer : renderType
|
// renderer : renderType
|
||||||
}, {
|
}, {
|
||||||
header : TRANSLATIONS.ID_CASE,
|
header : TRANSLATIONS.ID_CASE,
|
||||||
dataIndex : 'appLabel',
|
dataIndex : 'appLabel',
|
||||||
width : 150// ,
|
width : 150// ,
|
||||||
// align : 'right'
|
// align : 'right'
|
||||||
// renderer : renderType
|
// renderer : renderType
|
||||||
},{
|
},{
|
||||||
header : TRANSLATIONS.ID_SIZE,
|
header : TRANSLATIONS.ID_SIZE,
|
||||||
dataIndex : 'size',
|
dataIndex : 'size',
|
||||||
@@ -1141,7 +1185,7 @@ function loadDir() {
|
|||||||
datastore.load({
|
datastore.load({
|
||||||
params : {
|
params : {
|
||||||
start : 0,
|
start : 0,
|
||||||
limit : 150,
|
limit : 25,
|
||||||
dir : datastore.directory,
|
dir : datastore.directory,
|
||||||
node : datastore.directory,
|
node : datastore.directory,
|
||||||
option : 'gridDocuments',
|
option : 'gridDocuments',
|
||||||
@@ -1286,7 +1330,7 @@ function copymove(action) {
|
|||||||
}
|
}
|
||||||
// context menus
|
// context menus
|
||||||
var dirCtxMenu = new Ext.menu.Menu(
|
var dirCtxMenu = new Ext.menu.Menu(
|
||||||
{
|
{
|
||||||
id : 'dirCtxMenu',
|
id : 'dirCtxMenu',
|
||||||
items : [
|
items : [
|
||||||
{
|
{
|
||||||
@@ -1374,7 +1418,7 @@ var dirCtxMenu = new Ext.menu.Menu(
|
|||||||
dirCtxMenu.hide();
|
dirCtxMenu.hide();
|
||||||
}
|
}
|
||||||
} ]
|
} ]
|
||||||
});
|
});
|
||||||
var copymoveCtxMenu = new Ext.menu.Menu({
|
var copymoveCtxMenu = new Ext.menu.Menu({
|
||||||
id : 'copyCtx',
|
id : 'copyCtx',
|
||||||
items : [ {
|
items : [ {
|
||||||
@@ -1430,7 +1474,7 @@ var documentsTab = {
|
|||||||
xtype : "treepanel",
|
xtype : "treepanel",
|
||||||
id : "dirTreePanel",
|
id : "dirTreePanel",
|
||||||
region : "west",
|
region : "west",
|
||||||
title : TRANSLATIONS.ID_DIRECTORY+' <img src="/images/refresh.gif" hspace="20" style="cursor:pointer;" title="reload" onclick="Ext.getCmp(\'dirTreePanel\').getRootNode().reload();" alt="Reload" align="middle" />',
|
title : TRANSLATIONS.ID_DIRECTORY,
|
||||||
closable : false,
|
closable : false,
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapseMode: 'mini',
|
collapseMode: 'mini',
|
||||||
@@ -1439,7 +1483,14 @@ var documentsTab = {
|
|||||||
titlebar : true,
|
titlebar : true,
|
||||||
autoScroll : true,
|
autoScroll : true,
|
||||||
animate : true,
|
animate : true,
|
||||||
|
tools:[
|
||||||
|
{
|
||||||
|
id:'refresh',
|
||||||
|
handler:function() {
|
||||||
|
Ext.getCmp('dirTreePanel').getRootNode().reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
// rootVisible: false,
|
// rootVisible: false,
|
||||||
loader : new Ext.tree.TreeLoader({
|
loader : new Ext.tree.TreeLoader({
|
||||||
preloadChildren : true,
|
preloadChildren : true,
|
||||||
@@ -1720,7 +1771,7 @@ Ext.onReady(function() {
|
|||||||
var viewport = new Ext.Viewport({
|
var viewport = new Ext.Viewport({
|
||||||
layout : 'border',
|
layout : 'border',
|
||||||
items : [
|
items : [
|
||||||
documentsTab ]
|
documentsTab ]
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.info("viewport -end");
|
// console.info("viewport -end");
|
||||||
|
|||||||
Reference in New Issue
Block a user