2011-02-21 13:37:24 +00:00
|
|
|
new Ext.KeyMap(document, {
|
|
|
|
|
key: Ext.EventObject.F5,
|
2011-08-09 17:33:12 -04:00
|
|
|
fn: function(keycode, e) {
|
|
|
|
|
if (! e.ctrlKey) {
|
|
|
|
|
if (Ext.isIE) {
|
|
|
|
|
// IE6 doesn't allow cancellation of the F5 key, so trick it into
|
|
|
|
|
// thinking some other key was pressed (backspace in this case)
|
|
|
|
|
e.browserEvent.keyCode = 8;
|
2011-02-21 13:37:24 +00:00
|
|
|
}
|
2011-08-09 17:33:12 -04:00
|
|
|
e.stopEvent();
|
|
|
|
|
datastore.reload();
|
|
|
|
|
// Ext.getCmp('dirTree').getRootNode().reload();
|
|
|
|
|
}else{
|
|
|
|
|
// Ext.Msg.alert(TRANSLATIONS.ID_REFRESH_LABEL,
|
|
|
|
|
// TRANSLATIONS.ID_REFRESH_MESSAGE);
|
|
|
|
|
}
|
2011-02-21 13:37:24 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2011-02-24 23:15:57 +00:00
|
|
|
// Ext.BLANK_IMAGE_URL = 'resources/s.gif';
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
Ext.chart.Chart.CHART_URL = '/images/charts.swf';
|
|
|
|
|
Ext.FlashComponent.EXPRESS_INSTALL_URL = '/images/expressinstall.swf';
|
|
|
|
|
// The Quicktips are used for the toolbar and Tree mouseover tooltips!
|
|
|
|
|
Ext.QuickTips.init();
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
try{
|
|
|
|
|
rc=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$');
|
|
|
|
|
}
|
|
|
|
|
catch(z){
|
|
|
|
|
rc=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/;
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-01-07 14:16:10 +00:00
|
|
|
var conn = new Ext.data.Connection();
|
|
|
|
|
|
2011-02-22 14:21:00 +00:00
|
|
|
streamFilefromPM=function(fileStream) {
|
2011-08-09 17:33:12 -04:00
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url:fileStream,
|
|
|
|
|
params: {
|
|
|
|
|
request:true
|
|
|
|
|
},
|
|
|
|
|
success: function(response) {
|
|
|
|
|
results = Ext.decode(response.responseText);
|
|
|
|
|
if(results.success=='success'){
|
|
|
|
|
messageText=TRANSLATIONS.ID_DOWNLOADING_FILE+" "+results.message;
|
|
|
|
|
statusBarMessage( messageText, true, true );
|
|
|
|
|
try {
|
|
|
|
|
Ext.destroy(Ext.get('downloadIframe'));
|
2011-02-22 14:21:00 +00:00
|
|
|
}
|
2011-08-09 17:33:12 -04:00
|
|
|
catch(e) {}
|
|
|
|
|
Ext.DomHelper.append(document.body, {
|
|
|
|
|
tag: 'iframe',
|
|
|
|
|
id:'downloadIframe',
|
|
|
|
|
frameBorder: 0,
|
|
|
|
|
width: 0,
|
|
|
|
|
height: 0,
|
|
|
|
|
css: 'display:none;visibility:hidden;height:0px;',
|
|
|
|
|
src: fileStream
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
msgbox = Ext.Msg.alert('Error', results.message);
|
|
|
|
|
msgbox.setIcon( Ext.MessageBox.ERROR );
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
failure: function() {
|
|
|
|
|
if (results.message) {
|
|
|
|
|
Ext.Msg.alert('Infomation',results.message);
|
|
|
|
|
}
|
2011-02-22 14:21:00 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
});
|
2011-02-22 14:21:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2011-02-04 22:05:14 +00:00
|
|
|
function chDir( directory, loadGridOnly ) {
|
2011-11-14 19:01:53 -04:00
|
|
|
// console.info("**** Changing Directory: "+directory+" --
|
|
|
|
|
// "+loadGridOnly);
|
|
|
|
|
if( datastore.directory.replace( /\//g, '' ) == directory.replace( /\//g, '' )
|
|
|
|
|
&& datastore.getTotalCount() > 0 && directory != '') {
|
|
|
|
|
// Prevent double loading
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
datastore.directory = directory;
|
|
|
|
|
var conn = datastore.proxy.getConnection();
|
|
|
|
|
if( directory == '' || conn && !conn.isLoading()) {
|
|
|
|
|
datastore.load({
|
|
|
|
|
params:{
|
|
|
|
|
start:0,
|
|
|
|
|
limit:25,
|
|
|
|
|
dir: directory,
|
|
|
|
|
node: directory,
|
|
|
|
|
option:'gridDocuments',
|
|
|
|
|
action:'expandNode',
|
|
|
|
|
sendWhat: datastore.sendWhat
|
|
|
|
|
}
|
|
|
|
|
});
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
2011-11-14 19:01:53 -04:00
|
|
|
tb = ext_itemgrid.getTopToolbar();
|
|
|
|
|
/*if(directory=="NA"){ // Disable create new folder under NA
|
|
|
|
|
tb.items.get('tb_new').disable();
|
|
|
|
|
tb.items.get('tb_upload').disable();
|
|
|
|
|
}else{
|
|
|
|
|
tb.items.get('tb_new').enable();
|
|
|
|
|
tb.items.get('tb_upload').enable();
|
|
|
|
|
}*/
|
2011-11-29 18:03:08 -04:00
|
|
|
/*if( directory!='root'){
|
2011-11-14 19:01:53 -04:00
|
|
|
if( permitodelete==1 || permitoaddfolder==1 || permitoaddfile==1) {
|
|
|
|
|
tb.items.get('tb_delete').enable();
|
2011-11-29 18:03:08 -04:00
|
|
|
// tb.items.get('tb_new').enable();
|
2011-11-14 19:01:53 -04:00
|
|
|
tb.items.get('tb_upload').enable();
|
|
|
|
|
} else {
|
|
|
|
|
tb.items.get('tb_delete').disable();
|
2011-11-29 18:03:08 -04:00
|
|
|
// tb.items.get('tb_new').disable();
|
2011-11-14 19:01:53 -04:00
|
|
|
tb.items.get('tb_upload').disable();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
tb.items.get('tb_delete').disable();
|
2011-11-29 18:03:08 -04:00
|
|
|
}*/
|
2011-11-14 19:01:53 -04:00
|
|
|
/*
|
|
|
|
|
* tb.items.get('tb_delete')[selections[0].get('is_deletable') ? 'enable' :
|
|
|
|
|
* 'disable']();
|
|
|
|
|
*/
|
|
|
|
|
if( !loadGridOnly ) {
|
|
|
|
|
expandTreeToDir( null, directory );
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-02-04 22:05:14 +00:00
|
|
|
function expandTreeToDir( node, dir ) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.info("Expanding Tree to Dir "+node+" - "+dir);
|
|
|
|
|
dir = dir ? dir : new String('');
|
|
|
|
|
var dirs = dir.split('/');
|
|
|
|
|
if( dirs[0] == '') {
|
|
|
|
|
dirs.shift();
|
|
|
|
|
}
|
|
|
|
|
if( dirs.length > 0 ) {
|
|
|
|
|
// console.log("Dir to expand... "+dirs[0]);
|
|
|
|
|
node = dirTree.getNodeById( dirs[0] );
|
|
|
|
|
if( !node ) return;
|
|
|
|
|
if( node.isExpanded() ) {
|
|
|
|
|
expandNode( node, dir );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
node.on('load', function() {
|
|
|
|
|
expandNode( node, dir );
|
|
|
|
|
} );
|
|
|
|
|
node.expand();
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
|
|
|
|
function expandNode( node, dir ) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.info("Expanding Node "+node+" - "+dir);
|
|
|
|
|
var fulldirpath, dirpath;
|
|
|
|
|
|
|
|
|
|
var dirs = dir.split('/');
|
|
|
|
|
if( dirs[0] == '') {
|
|
|
|
|
dirs.shift();
|
|
|
|
|
}
|
|
|
|
|
if( dirs.length > 0 ) {
|
|
|
|
|
fulldirpath = '';
|
|
|
|
|
for( i=0; i < dirs.length; i++ ) {
|
|
|
|
|
fulldirpath += dirs[i];
|
|
|
|
|
}
|
|
|
|
|
if( node.id.substr( 0, 5 ) != '_RRR_' ) {
|
|
|
|
|
fulldirpath = fulldirpath.substr( 5 );
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
if( node.id != fulldirpath ) {
|
|
|
|
|
dirpath = '';
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
var nodedirs = node.id.split('_RRR_');
|
|
|
|
|
if( nodedirs[0] == '' ) nodedirs.shift();
|
|
|
|
|
for( i=0; i < dirs.length; i++ ) {
|
|
|
|
|
if( nodedirs[i] ) {
|
|
|
|
|
dirpath += '_RRR_'+ dirs[i];
|
|
|
|
|
} else {
|
|
|
|
|
dirpath += '_RRR_'+ dirs[i];
|
|
|
|
|
// dirpath = dirpath.substr( 5 );
|
|
|
|
|
var nextnode = dirTree.getNodeById( dirpath );
|
|
|
|
|
if( !nextnode ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if( nextnode.isExpanded() ) {
|
|
|
|
|
expandNode( nextnode, dir );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
nextnode.on( 'load', function() {
|
|
|
|
|
expandNode( nextnode, dir );
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
nextnode.expand();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
node.select();
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
|
|
|
|
function handleNodeClick( sm, node ) {
|
2011-08-09 17:33:12 -04:00
|
|
|
if( node && node.id ) {
|
|
|
|
|
// console.log("Node Clicked: "+node);
|
|
|
|
|
chDir( node.id );
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-02-04 22:05:14 +00:00
|
|
|
function showLoadingIndicator( el, replaceContent ) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.info("showLoadingIndicator");
|
|
|
|
|
if( !el ) return;
|
|
|
|
|
var loadingimg = '/images/documents/_indicator.gif';
|
|
|
|
|
var imgtag = '<' + 'img src="'+ loadingimg + '" alt="'+TRANSLATIONS.ID_LOADING+'" border="0" name="'+TRANSLATIONS.ID_LOADING+'" align="absmiddle" />';
|
|
|
|
|
|
|
|
|
|
if( replaceContent ) {
|
|
|
|
|
el.innerHTML = imgtag;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
el.innerHTML += imgtag;
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
|
|
|
|
function getURLParam( strParamName, myWindow){
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.info("getURLParam");
|
|
|
|
|
// console.trace();
|
|
|
|
|
if( !myWindow ){
|
|
|
|
|
myWindow = window;
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
var strReturn = "";
|
|
|
|
|
var strHref = myWindow.location.href;
|
|
|
|
|
if ( strHref.indexOf("?") > -1 ){
|
|
|
|
|
var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
|
|
|
|
|
var aQueryString = strQueryString.split("&");
|
|
|
|
|
for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
|
|
|
|
|
if ( aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
|
|
|
|
|
var aParam = aQueryString[iParam].split("=");
|
|
|
|
|
strReturn = aParam[1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return strReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openActionDialog( caller, action ) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log("Dialog open: "+caller+" ->"+action);
|
|
|
|
|
var dialog;
|
|
|
|
|
var selectedRows = ext_itemgrid.getSelectionModel().getSelections();
|
|
|
|
|
if( selectedRows.length < 1 ) {
|
|
|
|
|
var selectedNode = dirTree.getSelectionModel().getSelectedNode();
|
|
|
|
|
if( selectedNode ) {
|
|
|
|
|
selectedRows = Array( dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var dontNeedSelection = {
|
|
|
|
|
newFolder:1,
|
|
|
|
|
uploadDocument:1,
|
|
|
|
|
search:1
|
|
|
|
|
};
|
|
|
|
|
if( dontNeedSelection[action] == null && selectedRows.length < 1 ) {
|
|
|
|
|
Ext.Msg.alert( 'Error',TRANSLATIONS.ID_NO_ITEMS_SELECTED);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch( action ) {
|
|
|
|
|
case 'copyAction':
|
|
|
|
|
case 'edit':
|
|
|
|
|
case 'newFolder':
|
|
|
|
|
case 'moveAction':
|
|
|
|
|
case 'rename':
|
|
|
|
|
case 'search':
|
|
|
|
|
case 'uploadDocument':
|
|
|
|
|
requestParams = getRequestParams();
|
|
|
|
|
requestParams.action = action;
|
|
|
|
|
if( action != "edit" ) {
|
|
|
|
|
dialog = new Ext.Window( {
|
|
|
|
|
id: "dialog",
|
|
|
|
|
autoCreate: true,
|
|
|
|
|
modal:true,
|
|
|
|
|
width:600,
|
2011-11-08 18:56:41 -04:00
|
|
|
autoHeight: true,
|
2011-08-09 17:33:12 -04:00
|
|
|
shadow:true,
|
|
|
|
|
minWidth:300,
|
|
|
|
|
minHeight:200,
|
|
|
|
|
proxyDrag: true,
|
|
|
|
|
resizable: true,
|
|
|
|
|
// renderTo: Ext.getBody(),
|
|
|
|
|
keys: {
|
|
|
|
|
key: 27,
|
|
|
|
|
fn : function(){
|
|
|
|
|
dialog.hide();
|
|
|
|
|
}
|
|
|
|
|
}// ,
|
|
|
|
|
// animateTarget: typeof caller.getEl == 'function'
|
|
|
|
|
// ? caller.getEl() : caller,
|
|
|
|
|
// title: 'dialog_title'
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
Ext.Ajax.request( {
|
|
|
|
|
url: '../appFolder/appFolderAjax.php',
|
|
|
|
|
params: Ext.urlEncode( requestParams ),
|
|
|
|
|
scripts: true,
|
|
|
|
|
callback: function(oElement, bSuccess, oResponse) {
|
|
|
|
|
if( !bSuccess ) {
|
|
|
|
|
msgbox = Ext.Msg.alert( TRANSLATIONS.ID_SERVER_COMMUNICATION_ERROR);
|
|
|
|
|
msgbox.setIcon( Ext.MessageBox.ERROR );
|
|
|
|
|
}
|
|
|
|
|
if( oResponse && oResponse.responseText ) {
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// Ext.Msg.alert("Debug",
|
|
|
|
|
// oResponse.responseText
|
|
|
|
|
// );
|
|
|
|
|
try{
|
|
|
|
|
json = Ext.decode( oResponse.responseText );
|
2011-02-04 22:05:14 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
if( json.error && typeof json.error != 'xml' ) {
|
|
|
|
|
Ext.Msg.alert( "error", json.error );
|
|
|
|
|
dialog.destroy();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} catch(e) {
|
|
|
|
|
msgbox = Ext.Msg.alert( "error", "JSON Decode Error: " + e.message );
|
|
|
|
|
msgbox.setIcon( Ext.MessageBox.ERROR );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if( action == "edit" ) {
|
|
|
|
|
Ext.getCmp("mainpanel").add(json);
|
|
|
|
|
Ext.getCmp("mainpanel").activate(json.id);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// we expect the
|
|
|
|
|
// returned JSON to
|
|
|
|
|
// be an object that
|
|
|
|
|
// contains an
|
|
|
|
|
// "Ext.Component"
|
|
|
|
|
// or derivative in
|
|
|
|
|
// xtype notation
|
|
|
|
|
// so we can simply
|
|
|
|
|
// add it to the
|
|
|
|
|
// Window
|
|
|
|
|
// console.log(json);
|
|
|
|
|
dialog.add(json);
|
|
|
|
|
if( json.dialogtitle ) {
|
|
|
|
|
// if the
|
|
|
|
|
// component
|
|
|
|
|
// delivers a
|
|
|
|
|
// title for our
|
|
|
|
|
// dialog we can
|
|
|
|
|
// set the title
|
|
|
|
|
// of the window
|
|
|
|
|
dialog.setTitle(json.dialogtitle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// recalculate
|
|
|
|
|
// layout
|
|
|
|
|
dialog.doLayout();
|
|
|
|
|
// recalculate
|
|
|
|
|
// dimensions,
|
|
|
|
|
// based on
|
|
|
|
|
// those of the
|
|
|
|
|
// newly added
|
|
|
|
|
// child
|
|
|
|
|
// component
|
|
|
|
|
firstComponent = dialog.getComponent(0);
|
|
|
|
|
newWidth = firstComponent.getWidth() + dialog.getFrameWidth();
|
|
|
|
|
newHeight = firstComponent.getHeight() + dialog.getFrameHeight();
|
|
|
|
|
dialog.setSize( newWidth, newHeight );
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
} catch(e) {}
|
|
|
|
|
// alert( "Before:
|
|
|
|
|
// Dialog.width: " +
|
|
|
|
|
// dialog.getWidth()
|
|
|
|
|
// + ", Client
|
|
|
|
|
// Width: "+
|
|
|
|
|
// Ext.getBody().getWidth());
|
|
|
|
|
if( dialog.getWidth() >= Ext.getBody().getWidth() ) {
|
|
|
|
|
dialog.setWidth( Ext.getBody().getWidth() * 0.8 );
|
|
|
|
|
}
|
|
|
|
|
// alert( "After:
|
|
|
|
|
// Dialog.width: " +
|
|
|
|
|
// dialog.getWidth()
|
|
|
|
|
// + ", Client
|
|
|
|
|
// Width: "+
|
|
|
|
|
// Ext.getBody().getWidth());
|
|
|
|
|
if( dialog.getHeight() >= Ext.getBody().getHeight() ) {
|
|
|
|
|
dialog.setHeight( Ext.getBody().getHeight() * 0.7 );
|
|
|
|
|
} else if( dialog.getHeight() < Ext.getBody().getHeight() * 0.3 ) {
|
|
|
|
|
dialog.setHeight( Ext.getBody().getHeight() * 0.5 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// recalculate
|
|
|
|
|
// Window size
|
|
|
|
|
dialog.syncSize();
|
|
|
|
|
// center the window
|
|
|
|
|
dialog.center();
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
2011-08-09 17:33:12 -04:00
|
|
|
} else if( !response || !oResponse.responseText) {
|
|
|
|
|
msgbox = Ext.Msg.alert( "error", "Received an empty response");
|
|
|
|
|
msgbox.setIcon( Ext.MessageBox.ERROR );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if( action != "edit" ) {
|
|
|
|
|
dialog.on( 'hide', function() {
|
|
|
|
|
dialog.destroy(true);
|
|
|
|
|
} );
|
|
|
|
|
dialog.show();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'delete':
|
|
|
|
|
var num = selectedRows.length;
|
|
|
|
|
Ext.Msg.confirm(TRANSLATIONS.ID_DELETE, String.format(TRANSLATIONS.ID_DELETE_SELECTED_ITEMS, num ), deleteFiles);
|
|
|
|
|
break;
|
2011-11-14 19:01:53 -04:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
case 'download':
|
|
|
|
|
fileName=ext_itemgrid.getSelectionModel().getSelected().get('name');
|
|
|
|
|
// alert(ext_itemgrid.getSelectionModel().getSelected().get('downloadLink'));
|
|
|
|
|
// alert(ext_itemgrid.getSelectionModel().getSelected().get('downloadLabel'));
|
|
|
|
|
streamFilefromPM(ext_itemgrid.getSelectionModel().getSelected().get('downloadLink'));
|
|
|
|
|
/*
|
2011-02-24 23:15:57 +00:00
|
|
|
* if(document.location =
|
|
|
|
|
* ext_itemgrid.getSelectionModel().getSelected().get('downloadLink')){
|
|
|
|
|
* messageText="Downloading file "+fileName; statusBarMessage(
|
|
|
|
|
* messageText, false, true ); }else{ alert("sadasd"); }
|
|
|
|
|
*/
|
2011-08-09 17:33:12 -04:00
|
|
|
break;
|
|
|
|
|
}
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-02-04 22:05:14 +00:00
|
|
|
function handleCallback(requestParams, node) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log("handleCallback "+requestParams +" -- "+node);
|
|
|
|
|
// console.trace();
|
|
|
|
|
var conn = new Ext.data.Connection();
|
|
|
|
|
|
|
|
|
|
conn.request({
|
|
|
|
|
url: '../appFolder/appFolderAjax.php',
|
|
|
|
|
params: requestParams,
|
|
|
|
|
callback: function(options, success, response ) {
|
|
|
|
|
if( success ) {
|
|
|
|
|
json = Ext.decode( response.responseText );
|
|
|
|
|
if( json.success ) {
|
|
|
|
|
if( json.success == "success"){
|
|
|
|
|
statusBarMessage( json.message, false, true );
|
|
|
|
|
try {
|
|
|
|
|
if( dropEvent) {
|
|
|
|
|
dropEvent.target.parentNode.reload();
|
|
|
|
|
dropEvent = null;
|
|
|
|
|
}
|
|
|
|
|
if( node ) {
|
|
|
|
|
if( options.params.action == 'delete' || options.params.action == 'rename' ) {
|
|
|
|
|
node.parentNode.select();
|
|
|
|
|
}
|
|
|
|
|
node.parentNode.reload();
|
|
|
|
|
} else {
|
|
|
|
|
datastore.reload();
|
|
|
|
|
}
|
|
|
|
|
} catch(e) {
|
|
|
|
|
datastore.reload();
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
statusBarMessage( json.message, false, false );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.alert( 'Failure', json.error );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Ext.Msg.alert( 'Error', 'Failed to connect to the server.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
2011-02-04 22:05:14 +00:00
|
|
|
}
|
2011-08-09 17:33:12 -04:00
|
|
|
function getRequestParams() {
|
|
|
|
|
// console.info("Get Request params ");
|
|
|
|
|
var selitems, dir, node;
|
|
|
|
|
var selectedRows = ext_itemgrid.getSelectionModel().getSelections();
|
|
|
|
|
if( selectedRows.length < 1 ) {
|
2011-11-14 19:01:53 -04:00
|
|
|
sOptiondir='directory';
|
2011-08-09 17:33:12 -04:00
|
|
|
node = dirTree.getSelectionModel().getSelectedNode();
|
|
|
|
|
if( node ) {
|
|
|
|
|
var dir = dirTree.getSelectionModel().getSelectedNode().id.replace( /_RRR_/g, '/' );
|
|
|
|
|
var lastSlash = dir.lastIndexOf( '/' );
|
|
|
|
|
if( lastSlash > 0 ) {
|
|
|
|
|
selitems = Array( dir.substring(lastSlash+1) );
|
|
|
|
|
} else {
|
|
|
|
|
selitems = Array( dir );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
selitems = {};
|
|
|
|
|
}
|
|
|
|
|
dir = datastore.directory.substring( 0, datastore.directory.lastIndexOf('/'));
|
|
|
|
|
}
|
|
|
|
|
else {
|
2011-11-14 19:01:53 -04:00
|
|
|
sOptiondir='documents';
|
2011-08-09 17:33:12 -04:00
|
|
|
selitems = Array(selectedRows.length);
|
|
|
|
|
|
|
|
|
|
if( selectedRows.length > 0 ) {
|
|
|
|
|
for( i=0; i < selectedRows.length;i++) {
|
|
|
|
|
selitems[i] = selectedRows[i].get('id');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dir = datastore.directory;
|
|
|
|
|
}
|
|
|
|
|
// Ext.Msg.alert("Debug", datastore.directory );
|
|
|
|
|
var requestParams = {
|
2011-11-14 19:01:53 -04:00
|
|
|
option: sOptiondir,//'new',
|
2011-08-09 17:33:12 -04:00
|
|
|
dir: datastore.directory,
|
|
|
|
|
item: selitems.length > 0 ? selitems[0]:'',
|
|
|
|
|
'selitems[]': selitems
|
|
|
|
|
};
|
|
|
|
|
return requestParams;
|
2011-11-14 19:01:53 -04:00
|
|
|
|
|
|
|
|
}
|
2011-08-09 17:33:12 -04:00
|
|
|
/**
|
2011-11-14 19:01:53 -04:00
|
|
|
* Function for actions, which don't require a form like download,
|
|
|
|
|
* extraction, deletion etc.
|
|
|
|
|
*/
|
2011-08-09 17:33:12 -04:00
|
|
|
function deleteFiles(btn) {
|
2011-11-14 19:01:53 -04:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
if( btn != 'yes') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
requestParams = getRequestParams();
|
|
|
|
|
requestParams.action = 'delete';
|
|
|
|
|
handleCallback(requestParams);
|
2011-11-14 19:01:53 -04:00
|
|
|
if(requestParams.option=='documents'){
|
|
|
|
|
datastore.sendWhat = 'files';
|
|
|
|
|
loadDir();
|
|
|
|
|
} else {
|
|
|
|
|
var root1 = new Ext.tree.AsyncTreeNode({
|
|
|
|
|
text : '/',
|
|
|
|
|
draggable : false,
|
|
|
|
|
expanded : true,
|
|
|
|
|
id : 'root'
|
|
|
|
|
});
|
|
|
|
|
Ext.getCmp('dirTreePanel').setRootNode(root1);
|
|
|
|
|
}
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
function extractArchive(btn) {
|
|
|
|
|
if( btn != 'yes') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
requestParams = getRequestParams();
|
|
|
|
|
requestParams.action = 'extract';
|
|
|
|
|
handleCallback(requestParams);
|
|
|
|
|
}
|
|
|
|
|
function deleteDir( btn, node ) {
|
|
|
|
|
if( btn != 'yes') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-11-14 19:01:53 -04:00
|
|
|
requestParams = getRequestParams();
|
|
|
|
|
requestParams.dir = datastore.directory.substring( 0, datastore.directory.lastIndexOf('/'));
|
2011-08-09 17:33:12 -04:00
|
|
|
requestParams.selitems = Array( node.id.replace( /_RRR_/g, '/' ) );
|
2011-11-14 19:01:53 -04:00
|
|
|
requestParams.action = 'delete';
|
2011-08-09 17:33:12 -04:00
|
|
|
handleCallback(requestParams, node);
|
2011-11-14 19:01:53 -04:00
|
|
|
|
|
|
|
|
var root1 = new Ext.tree.AsyncTreeNode({
|
|
|
|
|
text : '/',
|
|
|
|
|
draggable : false,
|
|
|
|
|
expanded : true,
|
|
|
|
|
id : 'root'
|
|
|
|
|
});
|
|
|
|
|
Ext.getCmp('dirTreePanel').setRootNode(root1);
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.msgBoxSlider = function(){
|
|
|
|
|
var msgCt;
|
|
|
|
|
|
|
|
|
|
function createBox(t, s){
|
|
|
|
|
return ['<div class="msg">',
|
|
|
|
|
'<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
|
|
|
|
|
'<div class="x-box-ml"><div class="x-box-mr"><div id="x-box-mc-inner" class="x-box-mc"><h3>', t, '</h3>', s, '</div></div></div>',
|
|
|
|
|
'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
|
|
|
|
|
'</div>'].join('');
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
msg : function(title, format){
|
|
|
|
|
if(!msgCt){
|
|
|
|
|
msgCt = Ext.DomHelper.insertFirst(document.body, {
|
|
|
|
|
id:'msg-div'
|
|
|
|
|
}, true);
|
|
|
|
|
}
|
|
|
|
|
msgCt.alignTo(document, 't-t');
|
|
|
|
|
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
|
|
|
|
|
var m = Ext.DomHelper.append(msgCt, {
|
|
|
|
|
html:createBox(title, s)
|
|
|
|
|
}, true);
|
|
|
|
|
m.setWidth(400 );
|
|
|
|
|
m.position(null, 5000 );
|
|
|
|
|
m.alignTo(document, 't-t');
|
|
|
|
|
Ext.get('x-box-mc-inner' ).setStyle('background-image', 'url("/images/documents/_accept.png")');
|
|
|
|
|
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('padding-left', '35px');
|
|
|
|
|
m.slideIn('t').pause(3).ghost("t", {
|
|
|
|
|
remove:true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function statusBarMessage( msg, isLoading, success ) {
|
|
|
|
|
// console.log("Status Bar needed");
|
|
|
|
|
// console.log(msg);
|
|
|
|
|
var statusBar = Ext.getCmp('statusPanel');
|
|
|
|
|
if( !statusBar ) return;
|
|
|
|
|
// console.log("Status bar acceced: "+msg);
|
|
|
|
|
if( isLoading ) {
|
|
|
|
|
statusBar.showBusy();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
statusBar.setStatus("Done.");
|
|
|
|
|
}
|
|
|
|
|
if( success ) {
|
|
|
|
|
statusBar.setStatus({
|
|
|
|
|
text: '' + msg,
|
|
|
|
|
iconCls: 'success',
|
|
|
|
|
clear: true
|
|
|
|
|
});
|
|
|
|
|
Ext.msgBoxSlider.msg('', msg );
|
|
|
|
|
} else {
|
|
|
|
|
statusBar.setStatus({
|
|
|
|
|
text: 'Error: ' + msg,
|
|
|
|
|
iconCls: 'error',
|
|
|
|
|
clear: true
|
|
|
|
|
});
|
|
|
|
|
Ext.msgBoxSlider.msg('Error', msg );
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function selectFile( dir, file ) {
|
|
|
|
|
// console.log("file selected: "+dir+" - "+file);
|
|
|
|
|
chDir( dir );
|
|
|
|
|
var conn = datastore.proxy.getConnection();
|
|
|
|
|
if( conn.isLoading() ) {
|
|
|
|
|
setTimeout( "selectFile(\"" + dir + "\", \""+ file + "\")", 1000 );
|
|
|
|
|
}
|
|
|
|
|
idx = datastore.find( "name", file );
|
|
|
|
|
if( idx >= 0 ) {
|
|
|
|
|
ext_itemgrid.getSelectionModel().selectRow( idx );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2011-01-07 14:16:10 +00:00
|
|
|
* Debug Function, that works like print_r for Objects in Javascript
|
|
|
|
|
*/
|
2011-08-09 17:33:12 -04:00
|
|
|
function var_dump(obj) {
|
|
|
|
|
var vartext = "";
|
|
|
|
|
for (var prop in obj) {
|
|
|
|
|
if( isNaN( prop.toString() )) {
|
|
|
|
|
vartext += "\t->"+prop+" = "+ eval( "obj."+prop.toString()) +"\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(typeof obj == "object") {
|
|
|
|
|
return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "") + "\n" + vartext;
|
|
|
|
|
} else {
|
|
|
|
|
return "Type: "+typeof(obj)+"\n" + vartext;
|
|
|
|
|
}
|
|
|
|
|
}// end function var_dump
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-11-14 19:01:53 -04:00
|
|
|
var datastore;
|
2011-01-07 14:16:10 +00:00
|
|
|
datastore = new Ext.data.Store({
|
2011-08-09 17:33:12 -04:00
|
|
|
proxy : new Ext.data.HttpProxy({
|
|
|
|
|
url : "../appFolder/appFolderAjax.php",
|
|
|
|
|
directory : "/",
|
|
|
|
|
params : {
|
|
|
|
|
start : 0,
|
|
|
|
|
limit : 25,
|
|
|
|
|
dir : this.directory,
|
|
|
|
|
node : this.directory,
|
|
|
|
|
option : "gridDocuments",
|
|
|
|
|
action : "expandNode"
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
directory : "/",
|
|
|
|
|
sendWhat : "files",
|
|
|
|
|
// create reader that reads the File records
|
|
|
|
|
reader : new Ext.data.JsonReader({
|
|
|
|
|
root : "items",
|
|
|
|
|
totalProperty : "totalCount"
|
|
|
|
|
}, Ext.data.Record.create([ {
|
|
|
|
|
name : "name"
|
|
|
|
|
}, {
|
|
|
|
|
name : "size"
|
|
|
|
|
}, {
|
|
|
|
|
name : "type"
|
|
|
|
|
}, {
|
|
|
|
|
name : "modified"
|
|
|
|
|
}, {
|
|
|
|
|
name : "perms"
|
|
|
|
|
}, {
|
|
|
|
|
name : "icon"
|
|
|
|
|
}, {
|
|
|
|
|
name : "owner"
|
|
|
|
|
}, {
|
|
|
|
|
name : "owner_firstname"
|
|
|
|
|
}, {
|
|
|
|
|
name : "owner_lastname"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_deletable"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_file"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_archive"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_writable"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_chmodable"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_readable"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_deletable"
|
|
|
|
|
}, {
|
|
|
|
|
name : "is_editable"
|
|
|
|
|
}, {
|
|
|
|
|
name : "id"
|
|
|
|
|
}, {
|
|
|
|
|
name : "docVersion"
|
|
|
|
|
}, {
|
|
|
|
|
name : "appDocType"
|
|
|
|
|
}, {
|
|
|
|
|
name : "appDocCreateDate"
|
|
|
|
|
}, {
|
|
|
|
|
name : "appLabel"
|
|
|
|
|
}, {
|
|
|
|
|
name : "proTitle"
|
|
|
|
|
}, {
|
|
|
|
|
name : "appDocVersionable"
|
|
|
|
|
},{
|
|
|
|
|
name : "downloadLink"
|
|
|
|
|
},{
|
|
|
|
|
name : "downloadLabel"
|
|
|
|
|
}
|
2011-02-21 13:37:24 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
])),
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// turn on remote sorting
|
2011-08-10 18:38:11 -04:00
|
|
|
remoteSort : false
|
2011-01-07 14:16:10 +00:00
|
|
|
});
|
|
|
|
|
datastore.paramNames["dir"] = "direction";
|
|
|
|
|
datastore.paramNames["sort"] = "order";
|
|
|
|
|
|
|
|
|
|
datastore.on("beforeload",
|
2011-08-09 17:33:12 -04:00
|
|
|
function(ds, options) {
|
|
|
|
|
options.params.dir = 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.action = "expandNode";
|
|
|
|
|
options.params.sendWhat = datastore.sendWhat;
|
|
|
|
|
});
|
2011-01-07 14:16:10 +00:00
|
|
|
// pluggable renders
|
|
|
|
|
function renderFileName(value, p, record) {
|
2011-08-09 17:33:12 -04:00
|
|
|
return String.format(
|
|
|
|
|
'<img src="{0}" alt="* " align="absmiddle" /> <b>{1}</b>',
|
|
|
|
|
record.get('icon'), value);
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
|
|
|
|
function renderType(value, p, record) {
|
2011-08-09 17:33:12 -04:00
|
|
|
if(record.get('appDocType')!=""){
|
|
|
|
|
return String.format('{1}, {0}', value,record.get('appDocType'));
|
|
|
|
|
}else{
|
|
|
|
|
return String.format('<i>{0}</i>', value);
|
|
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
|
|
|
|
function renderVersion(value, p, record) {
|
2011-08-09 17:33:12 -04:00
|
|
|
if(record.get("appDocVersionable")=="1"){
|
|
|
|
|
if(value>1){
|
|
|
|
|
// return String.format('<b>{0}</b> <a
|
|
|
|
|
// href="#"><img src="{1}" border="0" title="Upload New Version"
|
|
|
|
|
// valign="absmiddle" onClick="alert(\'{2}\');return false;"/></a>',
|
|
|
|
|
// value,'/images/documents/_up.png','Upload new Version');
|
|
|
|
|
//return String.format('<b>{0}</b><table cellspacing="0" class="x-btn x-btn-icon" id="tb_upload"><tbody class="x-btn-small x-btn-icon-small-left"><tr><td class="x-btn-tl"><i> </i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i> </i></td></tr><tr><td class="x-btn-ml"><i> </i></td><td class="x-btn-mc"><em unselectable="on" class=""><button type="button" id="ext-gen100" class=" x-btn-text button_menu_ext ss_sprite ss_page_white_get"> </button></em></td><td class="x-btn-mr"><i> </i></td></tr><tr><td class="x-btn-bl"><i> </i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i> </i></td></tr></tbody></table>', value);
|
|
|
|
|
return String.format('<b>{0}</b>', value);
|
|
|
|
|
}else{
|
|
|
|
|
// return String.format('{0} <a href="#"><img
|
|
|
|
|
// src="{1}" border="0" title="Upload New Version"
|
|
|
|
|
// valign="absmiddle" onClick="alert(\'{2}\');return false;"/></a>',
|
|
|
|
|
// value,'/images/documents/_up.png','Upload new Version');
|
|
|
|
|
//return String.format('{0}<table cellspacing="0" class="x-btn x-btn-icon" id="tb_upload"><tbody class="x-btn-small x-btn-icon-small-left"><tr><td class="x-btn-tl"><i> </i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i> </i></td></tr><tr><td class="x-btn-ml"><i> </i></td><td class="x-btn-mc"><em unselectable="on" class=""><button type="button" id="ext-gen100" class=" x-btn-text button_menu_ext ss_sprite ss_page_white_get"> </button></em></td><td class="x-btn-mr"><i> </i></td></tr><tr><td class="x-btn-bl"><i> </i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i> </i></td></tr></tbody></table>', value);
|
|
|
|
|
return String.format('{0}', value);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
2011-02-21 13:37:24 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
return String.format('<b>-</b>',value);
|
|
|
|
|
}
|
2011-02-21 13:37:24 +00:00
|
|
|
}
|
|
|
|
|
function renderVersionExpander(value, p, record) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// addcc.png
|
|
|
|
|
// system-search.png
|
|
|
|
|
p.cellAttr = 'rowspan="2"';
|
|
|
|
|
// return '<div class="x-grid3-row-expander"> </div>';
|
|
|
|
|
if(record.get("appDocVersionable")=="1"){
|
|
|
|
|
if(value>1){
|
|
|
|
|
return '<div class="x-grid3-row-expander"> </div>';
|
|
|
|
|
// return String.format('<div
|
|
|
|
|
// class="x-grid3-row-expander">{0}</div>', value);
|
|
|
|
|
}else{
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}else{
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
return String.format('',value);
|
|
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
2011-02-25 13:32:46 +00:00
|
|
|
//Render Full Name
|
|
|
|
|
renderFullName = function(value, p, record){
|
|
|
|
|
return _FNF(value, record.get('owner_firstname'), record.get('owner_lastname'));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
renderModifiedDate = function(value, p, record){
|
2011-08-09 17:33:12 -04:00
|
|
|
return _DF(value);
|
2011-02-25 13:32:46 +00:00
|
|
|
};
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
var gridtb = new Ext.Toolbar(
|
2011-08-09 17:33:12 -04:00
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_home',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_house',// icon :
|
|
|
|
|
// '/images/documents/_home.png',
|
|
|
|
|
// text : 'Root',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_ROOT_FOLDER,
|
|
|
|
|
// cls : 'x-btn-text-icon',
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
handler : function() {
|
|
|
|
|
chDir('');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_reload',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_arrow_refresh',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_reload.png',
|
|
|
|
|
// text : 'Reload',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_RELOAD,
|
|
|
|
|
// cls : 'x-btn-text-icon',
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
handler : loadDir
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_search',
|
|
|
|
|
icon : '/images/documents/_filefind.png',
|
|
|
|
|
// text : 'Search',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_SEARCH,
|
|
|
|
|
// cls : 'x-btn-text-icon',
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
disabled : true,
|
|
|
|
|
hidden: true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'search');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'-',
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_new',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_folder_add',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_filenew.png',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_NEW_FOLDER,
|
|
|
|
|
cls : 'x-btn-icon',
|
2011-11-29 18:03:08 -04:00
|
|
|
// disabled : false,
|
2011-08-09 17:33:12 -04:00
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'newFolder');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_copy',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_copy',// icon :
|
|
|
|
|
// '/images/documents/_editcopy.png',
|
|
|
|
|
|
|
|
|
|
tooltip : TRANSLATIONS.ID_COPY,
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
disabled : false,
|
|
|
|
|
hidden: true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'copyAction');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_move',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_go',// icon :
|
|
|
|
|
// '/images/documents/_move.png',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_MOVE,
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
disabled : false,
|
|
|
|
|
hidden: true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'moveAction');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_delete',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_folder_delete',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_editdelete.png',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_DELETE,
|
|
|
|
|
cls : 'x-btn-icon',
|
2011-11-14 19:01:53 -04:00
|
|
|
disabled : false,
|
|
|
|
|
// hidden: (showdelete==1)?false:true,
|
2011-08-09 17:33:12 -04:00
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'delete');
|
2011-11-14 19:01:53 -04:00
|
|
|
// openActionDialog(this, 'deleteDir');
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_rename',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_textfield_rename',// icon :
|
|
|
|
|
// '/images/documents/_fonts.png',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_RENAME,
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
disabled : true,
|
|
|
|
|
hidden: true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'rename');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'-',
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_download',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_put',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_down.png',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_DOWNLOAD,
|
|
|
|
|
cls : 'x-btn-icon',
|
2011-11-29 18:03:08 -04:00
|
|
|
// disabled : true,
|
2011-08-09 17:33:12 -04:00
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'download');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype : "tbbutton",
|
|
|
|
|
id : 'tb_upload',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_get',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_up.png',
|
|
|
|
|
tooltip : TRANSLATIONS.ID_UPLOAD,
|
|
|
|
|
cls : 'x-btn-icon',
|
|
|
|
|
disabled : false,
|
|
|
|
|
handler : function() {
|
|
|
|
|
/*
|
2011-01-07 14:16:10 +00:00
|
|
|
* Ext.ux.OnDemandLoad
|
|
|
|
|
* .load("/scripts/extjs3-ext/ux.swfupload/SwfUploadPanel.css");
|
|
|
|
|
* Ext.ux.OnDemandLoad
|
|
|
|
|
* .load("/scripts/extjs3-ext/ux.swfupload/SwfUpload.js");
|
|
|
|
|
* Ext.ux.OnDemandLoad .load(
|
|
|
|
|
* "/scripts/extjs3-ext/ux.swfupload/SwfUploadPanel.js",
|
|
|
|
|
* function(options) { openActionDialog(this, 'upload');
|
|
|
|
|
* });
|
|
|
|
|
*/
|
2011-08-09 17:33:12 -04:00
|
|
|
openActionDialog(this, 'uploadDocument');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'-',
|
|
|
|
|
new Ext.Toolbar.Button({
|
|
|
|
|
text : TRANSLATIONS.ID_SHOW_DIRS,
|
|
|
|
|
enableToggle : true,
|
|
|
|
|
pressed : false,
|
|
|
|
|
handler : function(btn, e) {
|
|
|
|
|
if (btn.pressed) {
|
|
|
|
|
datastore.sendWhat = 'both';
|
|
|
|
|
loadDir();
|
|
|
|
|
} else {
|
|
|
|
|
datastore.sendWhat = 'files';
|
|
|
|
|
loadDir();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}), '-', new Ext.form.TextField({
|
|
|
|
|
name : "filterValue",
|
|
|
|
|
id : "filterField",
|
|
|
|
|
enableKeyEvents : true,
|
|
|
|
|
title : TRANSLATIONS.ID_FILTER_CURRENT_VIEW,
|
|
|
|
|
emptyText : TRANSLATIONS.ID_FILTER_CURRENT_VIEW,
|
|
|
|
|
listeners : {
|
|
|
|
|
"keypress" : {
|
|
|
|
|
fn : function(textfield, e) {
|
|
|
|
|
if (e.getKey() == Ext.EventObject.ENTER) {
|
|
|
|
|
filterDataStore();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}), new Ext.Toolbar.Button({
|
|
|
|
|
text : ' X ',
|
|
|
|
|
handler : function() {
|
|
|
|
|
datastore.clearFilter();
|
|
|
|
|
Ext.getCmp("filterField").setValue("");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
]);
|
2011-01-07 14:16:10 +00:00
|
|
|
function filterDataStore(btn, e) {
|
2011-08-09 17:33:12 -04:00
|
|
|
var filterVal = Ext.getCmp("filterField").getValue();
|
|
|
|
|
if (filterVal.length > 1) {
|
|
|
|
|
datastore.filter('name', eval('/' + filterVal + '/gi'));
|
|
|
|
|
} else {
|
|
|
|
|
datastore.clearFilter();
|
|
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
|
|
|
|
// add a paging toolbar to the grid's footer
|
|
|
|
|
var gridbb = new Ext.PagingToolbar({
|
2011-08-09 17:33:12 -04:00
|
|
|
store : datastore,
|
|
|
|
|
pageSize : 25 ,
|
|
|
|
|
displayInfo : true,
|
|
|
|
|
// displayMsg : '% % %',
|
|
|
|
|
emptyMsg : TRANSLATIONS.ID_DISPLAY_EMPTY,
|
|
|
|
|
beforePageText : TRANSLATIONS.ID_PAGE,
|
|
|
|
|
// afterPageText : 'of %',
|
|
|
|
|
firstText : TRANSLATIONS.ID_FIRST,
|
|
|
|
|
lastText : TRANSLATIONS.ID_LAST,
|
|
|
|
|
nextText : TRANSLATIONS.ID_NEXT,
|
|
|
|
|
prevText : TRANSLATIONS.ID_PREVIOUS,
|
|
|
|
|
refreshText : TRANSLATIONS.ID_RELOAD,
|
|
|
|
|
items : [ '-', ' ', ' ', ' ', ' ', ' ', new Ext.ux.StatusBar({
|
|
|
|
|
defaultText : TRANSLATIONS.ID_DONE,
|
|
|
|
|
id : 'statusPanel'
|
|
|
|
|
}) ]
|
2011-01-07 14:16:10 +00:00
|
|
|
});
|
|
|
|
|
|
2011-11-14 19:01:53 -04:00
|
|
|
var grid;
|
2011-02-21 13:37:24 +00:00
|
|
|
var getGrid = function( data, element) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// var grid = Ext.getCmp('gridpanel');
|
2011-02-21 13:37:24 +00:00
|
|
|
|
2011-11-14 19:01:53 -04:00
|
|
|
grid = new Ext.grid.GridPanel({
|
2011-08-09 17:33:12 -04:00
|
|
|
store: datastore,
|
|
|
|
|
cm: cm,
|
|
|
|
|
stripeRows: true,
|
|
|
|
|
// autoExpandColumn: 'company',
|
|
|
|
|
autoHeight: true,
|
|
|
|
|
border: false,
|
|
|
|
|
width: '100%',
|
|
|
|
|
stateful: true,
|
|
|
|
|
stateId: 'grid',
|
|
|
|
|
header:false,
|
|
|
|
|
headerAsText:false,
|
|
|
|
|
hideHeaders:true,
|
|
|
|
|
plugins: expander
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
element && grid.render( element);
|
|
|
|
|
return grid;
|
2011-02-21 13:37:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var expander = new Ext.ux.grid.RowExpander({
|
2011-08-09 17:33:12 -04:00
|
|
|
tpl : '<div class="ux-row-expander-box" style="border: 2px solid red;"></div>',
|
|
|
|
|
// header:'Version',
|
|
|
|
|
/*
|
2011-02-24 23:15:57 +00:00
|
|
|
* tpl : new Ext.Template( '<p><b>Company:</b> {company}</p><br>', '<p><b>Summary:</b>
|
|
|
|
|
* {desc}</p>' ),
|
|
|
|
|
*/
|
2011-02-21 13:37:24 +00:00
|
|
|
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// width : 50,
|
|
|
|
|
// align : 'center',
|
|
|
|
|
expandOnEnter: false,
|
|
|
|
|
expandOnDblClick: false,
|
|
|
|
|
fixed: false,
|
|
|
|
|
dataIndex: 'docVersion',
|
|
|
|
|
actAsTree : true,
|
|
|
|
|
treeLeafProperty : 'is_leaf',
|
|
|
|
|
listeners : {
|
|
|
|
|
expand : function( expander, record, body, rowIndex) {
|
|
|
|
|
data = new Array();
|
|
|
|
|
getGrid( data, Ext.get( this.grid.getView().getRow( rowIndex)).child( '.ux-row-expander-box'));
|
|
|
|
|
// alert( Ext.ComponentMgr.all.length);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
renderer : renderVersionExpander
|
2011-02-21 13:37:24 +00:00
|
|
|
});
|
|
|
|
|
|
2011-01-07 14:16:10 +00:00
|
|
|
// the column model has information about grid columns
|
|
|
|
|
// dataIndex maps the column to the specific data field in
|
|
|
|
|
// the data store
|
2011-02-21 13:37:24 +00:00
|
|
|
var cm = new Ext.grid.ColumnModel([{
|
2011-08-09 17:33:12 -04:00
|
|
|
id : 'gridcm', // id assigned so we can apply custom css (e.g.
|
|
|
|
|
// .x-grid-col-topic b { color:#333 })
|
|
|
|
|
header : TRANSLATIONS.ID_NAME,
|
|
|
|
|
dataIndex : 'name',
|
|
|
|
|
width : 200,
|
|
|
|
|
renderer : renderFileName,
|
2011-08-10 18:38:11 -04:00
|
|
|
sortable:true,
|
|
|
|
|
groupable:true,
|
2011-08-09 17:33:12 -04:00
|
|
|
editor : new Ext.form.TextField({
|
|
|
|
|
allowBlank : false
|
|
|
|
|
}),
|
|
|
|
|
css : 'white-space:normal;'
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_VERSION,
|
|
|
|
|
dataIndex : 'docVersion',
|
|
|
|
|
width : 50,
|
|
|
|
|
align : 'center',
|
|
|
|
|
renderer : renderVersion
|
2011-02-24 23:15:57 +00:00
|
|
|
}, /* expander, */{
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_MODIFIED,
|
|
|
|
|
dataIndex : 'appDocCreateDate',
|
|
|
|
|
width : 65,
|
|
|
|
|
renderer: renderModifiedDate
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_OWNER,
|
|
|
|
|
dataIndex : 'owner',
|
|
|
|
|
width : 100,
|
2011-08-10 18:38:11 -04:00
|
|
|
sortable:true,
|
|
|
|
|
groupable:true,
|
2011-08-09 17:33:12 -04:00
|
|
|
renderer: renderFullName
|
|
|
|
|
// sortable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : "PM Type",
|
|
|
|
|
dataIndex : 'appDocType',
|
|
|
|
|
width : 70,
|
|
|
|
|
hidden:true
|
|
|
|
|
// align : 'right'
|
|
|
|
|
// renderer : renderType
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_TYPE,
|
|
|
|
|
dataIndex : 'type',
|
|
|
|
|
width : 100,
|
2011-08-10 18:38:11 -04:00
|
|
|
sortable:true,
|
|
|
|
|
groupable:true,
|
2011-08-09 17:33:12 -04:00
|
|
|
// align : 'right',
|
|
|
|
|
renderer : renderType
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_PROCESS,
|
|
|
|
|
dataIndex : 'proTitle',
|
2011-08-10 18:38:11 -04:00
|
|
|
width : 150,
|
|
|
|
|
sortable:true,
|
|
|
|
|
groupable:true
|
2011-08-09 17:33:12 -04:00
|
|
|
// align : 'right'
|
|
|
|
|
// renderer : renderType
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_CASE,
|
|
|
|
|
dataIndex : 'appLabel',
|
2011-08-10 18:38:11 -04:00
|
|
|
width : 150,
|
|
|
|
|
sortable:true,
|
|
|
|
|
groupable:true
|
2011-08-09 17:33:12 -04:00
|
|
|
// align : 'right'
|
|
|
|
|
// renderer : renderType
|
2011-01-07 14:16:10 +00:00
|
|
|
},{
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_SIZE,
|
|
|
|
|
dataIndex : 'size',
|
|
|
|
|
width : 50,
|
|
|
|
|
hidden:true
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
header : TRANSLATIONS.ID_PERMISSIONS,
|
|
|
|
|
dataIndex : 'perms',
|
|
|
|
|
width : 100,
|
|
|
|
|
hidden:true
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_deletable',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_file',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_archive',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_writable',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_chmodable',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_readable',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_deletable',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'is_editable',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
dataIndex : 'id',
|
|
|
|
|
hidden : true,
|
|
|
|
|
hideable : false
|
2011-01-07 14:16:10 +00:00
|
|
|
} ]);
|
|
|
|
|
|
|
|
|
|
// by default columns are sortable
|
|
|
|
|
cm.defaultSortable = true;
|
|
|
|
|
|
2011-11-14 19:01:53 -04:00
|
|
|
function handleRowClick(sm, rowIndex) {//alert(rowIndex);
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log("Row Clicked: "+rowIndex);
|
|
|
|
|
var selections = sm.getSelections();
|
|
|
|
|
tb = ext_itemgrid.getTopToolbar();
|
|
|
|
|
if (selections.length > 1) {
|
2011-11-14 19:01:53 -04:00
|
|
|
// tb.items.get('tb_delete').enable();
|
|
|
|
|
tb.items.get('tb_delete')[permitodelete==1 ? 'enable': 'disable']();
|
2011-08-09 17:33:12 -04:00
|
|
|
tb.items.get('tb_rename').disable();
|
2011-11-29 18:03:08 -04:00
|
|
|
tb.items.get('tb_download').hide();
|
|
|
|
|
//tb.items.get('tb_download').disable();
|
2011-08-09 17:33:12 -04:00
|
|
|
} else if (selections.length == 1) {
|
2011-11-14 19:01:53 -04:00
|
|
|
|
|
|
|
|
// tb.items.get('tb_delete')[selections[0].get('is_deletable') ? 'enable': 'disable']();
|
|
|
|
|
tb.items.get('tb_delete')[permitodelete==1 ? 'enable': 'disable']();
|
|
|
|
|
tb.items.get('tb_rename')[selections[0].get('is_deletable') ? 'disable': 'disable']();
|
2011-08-09 17:33:12 -04:00
|
|
|
tb.items.get('tb_download')[selections[0].get('is_readable')
|
2011-11-29 18:03:08 -04:00
|
|
|
&& selections[0].get('is_file') ? 'show' : 'hide']();
|
2011-08-09 17:33:12 -04:00
|
|
|
} else {
|
|
|
|
|
tb.items.get('tb_delete').disable();
|
|
|
|
|
tb.items.get('tb_rename').disable();
|
2011-11-29 18:03:08 -04:00
|
|
|
tb.items.get('tb_download').hide();
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
return true;
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// trigger the data store load
|
|
|
|
|
function loadDir() {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.info("loadDir");
|
|
|
|
|
// console.trace();
|
|
|
|
|
datastore.load({
|
|
|
|
|
params : {
|
|
|
|
|
start : 0,
|
2011-11-29 18:03:08 -04:00
|
|
|
limit : 25,
|
2011-08-09 17:33:12 -04:00
|
|
|
dir : datastore.directory,
|
|
|
|
|
node : datastore.directory,
|
|
|
|
|
option : 'gridDocuments',
|
|
|
|
|
action : 'expandNode',
|
|
|
|
|
sendWhat : datastore.sendWhat
|
|
|
|
|
}
|
|
|
|
|
});
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function rowContextMenu(grid, rowIndex, e, f) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log("Context menu: "+grid+" - "+rowIndex);
|
|
|
|
|
if (typeof e == 'object') {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
} else {
|
|
|
|
|
e = f;
|
|
|
|
|
}
|
|
|
|
|
gsm = ext_itemgrid.getSelectionModel();
|
|
|
|
|
gsm.clickedRow = rowIndex;
|
|
|
|
|
var selections = gsm.getSelections();
|
2011-11-14 19:01:53 -04:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
if (selections.length > 1) {
|
2011-11-14 19:01:53 -04:00
|
|
|
// gridCtxMenu.items.get('gc_delete').enable();
|
|
|
|
|
gridCtxMenu.items.get('gc_delete')[ permitodelete==1 ? 'enable': 'disable']();
|
2011-08-09 17:33:12 -04:00
|
|
|
gridCtxMenu.items.get('gc_rename').disable();
|
|
|
|
|
gridCtxMenu.items.get('gc_download').disable();
|
|
|
|
|
} else if (selections.length == 1) {
|
2011-11-14 19:01:53 -04:00
|
|
|
gridCtxMenu.items.get('gc_delete')[ permitodelete==1 ? 'enable': 'disable']();
|
|
|
|
|
// gridCtxMenu.items.get('gc_delete')[selections[0].get('is_deletable') ? 'enable': 'disable']();
|
|
|
|
|
gridCtxMenu.items.get('gc_rename')[selections[0].get('is_deletable') ? 'disable': 'disable']();
|
2011-08-09 17:33:12 -04:00
|
|
|
gridCtxMenu.items.get('gc_download')[selections[0].get('is_readable')
|
|
|
|
|
&& selections[0].get('is_file') ? 'enable' : 'disable']();
|
|
|
|
|
}
|
|
|
|
|
gridCtxMenu.show(e.getTarget(), 'tr-br?');
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
gridCtxMenu = new Ext.menu.Menu({
|
2011-08-09 17:33:12 -04:00
|
|
|
id : 'gridCtxMenu',
|
|
|
|
|
|
|
|
|
|
items : [ {
|
|
|
|
|
id : 'gc_rename',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_textfield_rename',// icon :
|
|
|
|
|
hidden : true, // '/images/documents/_fonts.png',
|
|
|
|
|
text : TRANSLATIONS.ID_RENAME,
|
|
|
|
|
handler : function() {
|
|
|
|
|
ext_itemgrid.onCellDblClick(ext_itemgrid, gsm.clickedRow, 0);
|
|
|
|
|
gsm.clickedRow = null;
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
id : 'gc_copy',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_copy',// icon :
|
|
|
|
|
// '/images/documents/_editcopy.png',
|
|
|
|
|
text : TRANSLATIONS.ID_COPY,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'copyAction');
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
id : 'gc_move',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_go',// icon :
|
|
|
|
|
// '/images/documents/_move.png',
|
|
|
|
|
text : TRANSLATIONS.ID_MOVE,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'moveAction');
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
id : 'gc_delete',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_delete',// icon :
|
|
|
|
|
// '/images/documents/_editdelete.png',
|
|
|
|
|
text : TRANSLATIONS.ID_DELETE,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'delete');
|
2011-11-14 19:01:53 -04:00
|
|
|
// openActionDialog(this, 'deleteDocument');
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
}, '-', {
|
|
|
|
|
id : 'gc_download',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_put',// icon :
|
|
|
|
|
// '/images/documents/_down.png',
|
|
|
|
|
text : TRANSLATIONS.ID_DOWNLOAD,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this, 'download');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'-', {
|
|
|
|
|
id : 'cancel',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_cross',// icon :
|
|
|
|
|
// '/images/documents/_cancel.png',
|
|
|
|
|
text : TRANSLATIONS.ID_CANCEL,
|
|
|
|
|
handler : function() {
|
|
|
|
|
gridCtxMenu.hide();
|
|
|
|
|
}
|
|
|
|
|
} ]
|
2011-01-07 14:16:10 +00:00
|
|
|
});
|
2011-11-29 18:03:08 -04:00
|
|
|
//function that used for measure the permissions and so assign buttons.
|
|
|
|
|
function revisePermission(){
|
|
|
|
|
|
|
|
|
|
dirCtxMenu.items.get('dirCtxMenu_reload').hide();
|
|
|
|
|
gridCtxMenu.items.get('cancel').hide();
|
|
|
|
|
dirCtxMenu.items.get('dirCtxMenu_cancel').hide();
|
|
|
|
|
if(permitoaddfolder=='1'){
|
|
|
|
|
gridtb.items.get('tb_new').show();
|
|
|
|
|
// tb.items.get('tb_new').enable();
|
|
|
|
|
//dirCtxMenu.items.get('dirCtxMenu_new').enable();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
gridtb.items.get('tb_new').hide();
|
|
|
|
|
|
|
|
|
|
// tb.items.get('tb_new').disable();
|
|
|
|
|
//dirCtxMenu.items.get('dirCtxMenu_new').disable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(permitodelete=='1') {
|
|
|
|
|
gridtb.items.get('tb_delete').show();
|
|
|
|
|
// tb.items.get('tb_delete').enable();
|
|
|
|
|
// dirCtxMenu.items.get('dirCtxMenu_remove').enable();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
gridtb.items.get('tb_delete').hide();
|
|
|
|
|
|
|
|
|
|
// tb.items.get('tb_delete').disable();
|
|
|
|
|
// dirCtxMenu.items.get('dirCtxMenu_remove').disable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(permitoaddfile=='1')
|
|
|
|
|
gridtb.items.get('tb_upload').show();
|
|
|
|
|
else
|
|
|
|
|
gridtb.items.get('tb_upload').hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
function dirContext(node, e) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log("Dir context menu: "+node);
|
|
|
|
|
// Select the node that was right clicked
|
|
|
|
|
node.select();
|
|
|
|
|
// Unselect all files in the grid
|
|
|
|
|
ext_itemgrid.getSelectionModel().clearSelections();
|
|
|
|
|
|
2011-11-14 19:01:53 -04:00
|
|
|
dirCtxMenu.items.get('dirCtxMenu_rename')[node.attributes.is_deletable ? 'disable': 'disable']();
|
|
|
|
|
// dirCtxMenu.items.get('dirCtxMenu_remove')[node.attributes.is_deletable ? 'enable':'disable']();
|
2011-11-29 18:03:08 -04:00
|
|
|
dirCtxMenu.items.get('dirCtxMenu_remove')[permitodelete==1 && node.attributes.id!='root' ? 'show':'hide']();
|
2011-11-14 19:01:53 -04:00
|
|
|
|
|
|
|
|
// dirCtxMenu.items.get('dirCtxMenu_new')[node.attributes.id!='NA' ? 'enable':'disable']();
|
2011-11-29 18:03:08 -04:00
|
|
|
dirCtxMenu.items.get('dirCtxMenu_new')[permitoaddfolder==1 ? 'show':'hide']();
|
2011-11-14 19:01:53 -04:00
|
|
|
dirCtxMenu.items.get('dirCtxMenu_copy')[node.attributes.id!='NA' ? 'enable':'disable']();
|
2011-08-09 17:33:12 -04:00
|
|
|
dirCtxMenu.items.get('dirCtxMenu_move')[node.attributes.id!='NA' ? 'enable'
|
|
|
|
|
: 'disable']();
|
2011-11-14 19:01:53 -04:00
|
|
|
// dirCtxMenu.items.get('dirCtxMenu_remove')[node.attributes.id!='NA' ? 'enable': 'disable']();
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
dirCtxMenu.node = node;
|
|
|
|
|
dirCtxMenu.show(e.getTarget(), 't-b?');
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function copymove(action) {
|
2011-08-09 17:33:12 -04:00
|
|
|
var s = dropEvent.data.selections, r = [];
|
|
|
|
|
if (s) {
|
|
|
|
|
// Dragged from the Grid
|
|
|
|
|
requestParams = getRequestParams();
|
|
|
|
|
requestParams.new_dir = dropEvent.target.id.replace(/_RRR_/g, '/');
|
|
|
|
|
requestParams.new_dir = requestParams.new_dir.replace(/ext_root/g, '');
|
|
|
|
|
requestParams.confirm = 'true';
|
|
|
|
|
requestParams.action = action;
|
|
|
|
|
handleCallback(requestParams);
|
|
|
|
|
} else {
|
|
|
|
|
// Dragged from inside the tree
|
|
|
|
|
// alert('Move ' + dropEvent.data.node.id.replace( /_RRR_/g, '/' )+' to
|
|
|
|
|
// '+ dropEvent.target.id.replace( /_RRR_/g, '/' ));
|
|
|
|
|
requestParams = getRequestParams();
|
|
|
|
|
requestParams.dir = datastore.directory.substring(0,
|
|
|
|
|
datastore.directory.lastIndexOf('/'));
|
|
|
|
|
requestParams.new_dir = dropEvent.target.id.replace(/_RRR_/g, '/');
|
|
|
|
|
requestParams.new_dir = requestParams.new_dir.replace(/ext_root/g, '');
|
|
|
|
|
requestParams.selitems = Array(dropEvent.data.node.id.replace(/_RRR_/g,
|
|
|
|
|
'/'));
|
|
|
|
|
requestParams.confirm = 'true';
|
|
|
|
|
requestParams.action = action;
|
|
|
|
|
handleCallback(requestParams);
|
|
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
2011-11-29 18:03:08 -04:00
|
|
|
// context menus
|
2011-01-07 14:16:10 +00:00
|
|
|
var dirCtxMenu = new Ext.menu.Menu(
|
2011-08-09 17:33:12 -04:00
|
|
|
{
|
|
|
|
|
id : 'dirCtxMenu',
|
|
|
|
|
items : [
|
|
|
|
|
{
|
|
|
|
|
id : 'dirCtxMenu_new',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_folder_add',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_folder_new.png',
|
|
|
|
|
text : TRANSLATIONS.ID_NEW_FOLDER,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
openActionDialog(this, 'newFolder');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id : 'dirCtxMenu_rename',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_textfield_rename',// icon
|
|
|
|
|
// :
|
|
|
|
|
hidden: true, // '/images/documents/_fonts.png',
|
|
|
|
|
text : TRANSLATIONS.ID_RENAME,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
openActionDialog(this, 'rename');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id : 'dirCtxMenu_copy',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_copy',// icon :
|
|
|
|
|
// '/images/documents/_editcopy.png',
|
|
|
|
|
|
|
|
|
|
text : TRANSLATIONS.ID_COPY,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
openActionDialog(this, 'copyAction');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id : 'dirCtxMenu_move',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_folder_go',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_move.png',
|
|
|
|
|
text : TRANSLATIONS.ID_MOVE,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
openActionDialog(this, 'moveAction');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id : 'dirCtxMenu_remove',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_folder_delete',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_editdelete.png',
|
2011-02-24 23:15:57 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
text : TRANSLATIONS.ID_DELETE,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
var num = 1;
|
|
|
|
|
Ext.Msg
|
|
|
|
|
.confirm(
|
|
|
|
|
TRANSLATIONS.ID_CONFIRM,
|
|
|
|
|
String
|
|
|
|
|
.format(
|
|
|
|
|
TRANSLATIONS.ID_DELETE_SELECTED_ITEMS,
|
|
|
|
|
num),
|
|
|
|
|
function(btn) {
|
|
|
|
|
deleteDir(btn, dirCtxMenu.node);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, '-', {
|
|
|
|
|
id : 'dirCtxMenu_reload',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_arrow_refresh',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_reload.png',
|
|
|
|
|
text : TRANSLATIONS.ID_REFRESH_LABEL,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
dirCtxMenu.node.reload();
|
|
|
|
|
}
|
2011-11-29 18:03:08 -04:00
|
|
|
}, {
|
2011-08-09 17:33:12 -04:00
|
|
|
id : 'dirCtxMenu_cancel',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_cross',// icon
|
|
|
|
|
// :
|
|
|
|
|
// '/images/documents/_cancel.png',
|
|
|
|
|
text : TRANSLATIONS.ID_CANCEL,
|
|
|
|
|
handler : function() {
|
|
|
|
|
dirCtxMenu.hide();
|
|
|
|
|
}
|
|
|
|
|
} ]
|
|
|
|
|
});
|
2011-01-07 14:16:10 +00:00
|
|
|
var copymoveCtxMenu = new Ext.menu.Menu({
|
2011-08-09 17:33:12 -04:00
|
|
|
id : 'copyCtx',
|
|
|
|
|
items : [ {
|
|
|
|
|
id : 'copymoveCtxMenu_copy',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_copy',// icon :
|
|
|
|
|
// '/images/documents/_editcopy.png',
|
|
|
|
|
text : TRANSLATIONS.ID_COPY,
|
|
|
|
|
handler : function() {
|
|
|
|
|
copymoveCtxMenu.hide();
|
|
|
|
|
copymove('copyExecute');
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
id : 'copymoveCtxMenu_move',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_page_white_go',// icon :
|
|
|
|
|
// '/images/documents/_move.png',
|
|
|
|
|
text : TRANSLATIONS.ID_MOVE,
|
|
|
|
|
handler : function() {
|
|
|
|
|
copymoveCtxMenu.hide();
|
|
|
|
|
copymove('moveExecute');
|
|
|
|
|
}
|
|
|
|
|
}, '-', {
|
|
|
|
|
id : 'copymoveCtxMenu_cancel',
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_cross',// icon :
|
|
|
|
|
// '/images/documents/_cancel.png',
|
|
|
|
|
text : TRANSLATIONS.ID_CANCEL,
|
|
|
|
|
handler : function() {
|
|
|
|
|
copymoveCtxMenu.hide();
|
|
|
|
|
}
|
|
|
|
|
} ]
|
2011-01-07 14:16:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function copymoveCtx(e) {
|
2011-08-09 17:33:12 -04:00
|
|
|
// ctxMenu.items.get('remove')[node.attributes.allowDelete ? 'enable' :
|
|
|
|
|
// 'disable']();
|
|
|
|
|
copymoveCtxMenu.showAt(e.rawEvent.getXY());
|
2011-01-07 14:16:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var documentsTab = {
|
2011-08-09 17:33:12 -04:00
|
|
|
id : 'documents',
|
|
|
|
|
// title : 'Documents',
|
|
|
|
|
iconCls : 'ICON_FOLDERS',
|
|
|
|
|
layout : 'border',
|
|
|
|
|
region: 'center',
|
|
|
|
|
defaults : {
|
|
|
|
|
split : true
|
|
|
|
|
},
|
|
|
|
|
items : [
|
|
|
|
|
{
|
|
|
|
|
xtype : "treepanel",
|
|
|
|
|
id : "dirTreePanel",
|
|
|
|
|
region : "west",
|
|
|
|
|
title : TRANSLATIONS.ID_DIRECTORY,
|
|
|
|
|
closable : false,
|
|
|
|
|
collapsible: true,
|
|
|
|
|
collapseMode: 'mini',
|
|
|
|
|
// collapsed:true,
|
|
|
|
|
width : 180,
|
|
|
|
|
titlebar : true,
|
|
|
|
|
autoScroll : true,
|
|
|
|
|
animate : true,
|
|
|
|
|
tools:[
|
|
|
|
|
{
|
|
|
|
|
id:'refresh',
|
|
|
|
|
handler:function() {
|
|
|
|
|
Ext.getCmp('dirTreePanel').getRootNode().reload();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
// rootVisible: false,
|
|
|
|
|
loader : new Ext.tree.TreeLoader({
|
|
|
|
|
preloadChildren : true,
|
|
|
|
|
dataUrl : '../appFolder/appFolderAjax.php',
|
|
|
|
|
baseParams : {
|
|
|
|
|
action : 'expandNode',
|
|
|
|
|
sendWhat : 'dirs'
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
containerScroll : true,
|
|
|
|
|
enableDD : true,
|
|
|
|
|
ddGroup : 'TreeDD',
|
|
|
|
|
listeners : {
|
|
|
|
|
// "load": { fn: function(node) { chDir( node.id.replace(
|
|
|
|
|
// /_RRR_/g, '/' ), true ); } },
|
|
|
|
|
'contextmenu' : {
|
|
|
|
|
fn : dirContext
|
|
|
|
|
},
|
|
|
|
|
'textchange' : {
|
|
|
|
|
fn : function(node, text, oldText) {
|
|
|
|
|
if (text == oldText)
|
|
|
|
|
return true;
|
|
|
|
|
var requestParams = getRequestParams();
|
|
|
|
|
var dir = node.parentNode.id.replace(/_RRR_/g, '/');
|
|
|
|
|
if (dir == 'root')
|
|
|
|
|
dir = '';
|
|
|
|
|
requestParams.dir = dir;
|
|
|
|
|
requestParams.newitemname = text;
|
|
|
|
|
requestParams.item = oldText;
|
|
|
|
|
|
|
|
|
|
requestParams.confirm = 'true';
|
|
|
|
|
requestParams.action = 'rename';
|
|
|
|
|
handleCallback(requestParams);
|
|
|
|
|
ext_itemgrid.stopEditing();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'beforenodedrop' : {
|
|
|
|
|
fn : function(e) {
|
|
|
|
|
dropEvent = e;
|
|
|
|
|
copymoveCtx(e);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'beforemove' : {
|
|
|
|
|
fn : function() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
root : new Ext.tree.AsyncTreeNode({
|
|
|
|
|
text : '/',
|
|
|
|
|
draggable : false,
|
|
|
|
|
expanded : true,
|
2011-11-14 19:01:53 -04:00
|
|
|
cls: 'folder',
|
2011-08-09 17:33:12 -04:00
|
|
|
id : 'root'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
layout : "border",
|
|
|
|
|
region : "center",
|
|
|
|
|
items : [
|
|
|
|
|
{
|
|
|
|
|
region : "north",
|
|
|
|
|
xtype : "locationbar",
|
|
|
|
|
id : "locationbarcmp",
|
|
|
|
|
height : 28,
|
|
|
|
|
tree : Ext.getCmp("dirTreePanel")
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// region : "center",
|
|
|
|
|
// layout:'fit',
|
|
|
|
|
// items : [ {
|
|
|
|
|
region : "center",
|
|
|
|
|
// xtype : "tabpanel",
|
|
|
|
|
layout:'fit',
|
|
|
|
|
id : "mainpanel",
|
|
|
|
|
// autoHeight : true,
|
|
|
|
|
// enableTabScroll : true,
|
|
|
|
|
// activeTab : 0,
|
|
|
|
|
// hideTabStripItem:0,
|
|
|
|
|
items : [ {
|
|
|
|
|
xtype : "editorgrid",
|
|
|
|
|
layout:'fit',
|
|
|
|
|
region : "center",
|
|
|
|
|
// title : "Documents",
|
|
|
|
|
// autoHeight : true,
|
|
|
|
|
// autoScroll : true,
|
|
|
|
|
// collapsible : false,
|
|
|
|
|
// closeOnTab : true,
|
|
|
|
|
id : "gridpanel",
|
|
|
|
|
ds : datastore,
|
|
|
|
|
cm : cm,
|
|
|
|
|
tbar : gridtb,
|
|
|
|
|
bbar : gridbb,
|
|
|
|
|
ddGroup : 'TreeDD',
|
|
|
|
|
enableDragDrop: true,
|
|
|
|
|
plugins: expander,
|
|
|
|
|
selModel : new Ext.grid.RowSelectionModel({
|
|
|
|
|
listeners : {
|
|
|
|
|
'rowselect' : {
|
|
|
|
|
fn : handleRowClick
|
|
|
|
|
},
|
|
|
|
|
'selectionchange' : {
|
|
|
|
|
fn : handleRowClick
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
loadMask : true,
|
|
|
|
|
keys : [
|
|
|
|
|
{
|
|
|
|
|
key : 'c',
|
|
|
|
|
ctrl : true,
|
|
|
|
|
stopEvent : true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this,
|
|
|
|
|
'copyAction');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key : 'x',
|
|
|
|
|
ctrl : true,
|
|
|
|
|
stopEvent : true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this,
|
|
|
|
|
'moveAction');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key : 'a',
|
|
|
|
|
ctrl : true,
|
|
|
|
|
stopEvent : true,
|
|
|
|
|
handler : function() {
|
|
|
|
|
ext_itemgrid
|
|
|
|
|
.getSelectionModel()
|
|
|
|
|
.selectAll();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key : Ext.EventObject.DELETE,
|
|
|
|
|
handler : function() {
|
|
|
|
|
openActionDialog(this,
|
|
|
|
|
'delete');
|
|
|
|
|
}
|
|
|
|
|
} ],
|
|
|
|
|
listeners : {
|
|
|
|
|
'rowcontextmenu' : {
|
|
|
|
|
fn : rowContextMenu
|
|
|
|
|
},
|
|
|
|
|
'celldblclick' : {
|
|
|
|
|
fn : function(grid, rowIndex,
|
|
|
|
|
columnIndex, e) {
|
|
|
|
|
if (Ext.isOpera) {
|
|
|
|
|
// because Opera <= 9
|
|
|
|
|
// doesn't support the
|
|
|
|
|
// right-mouse-button-clicked
|
|
|
|
|
// event (contextmenu)
|
|
|
|
|
// we need to simulate it
|
|
|
|
|
// using the ondblclick
|
|
|
|
|
// event
|
|
|
|
|
rowContextMenu(grid,
|
|
|
|
|
rowIndex, e);
|
|
|
|
|
} else {
|
|
|
|
|
gsm = ext_itemgrid
|
|
|
|
|
.getSelectionModel();
|
|
|
|
|
gsm.clickedRow = rowIndex;
|
|
|
|
|
var selections = gsm
|
|
|
|
|
.getSelections();
|
|
|
|
|
if (!selections[0]
|
|
|
|
|
.get('is_file')) {
|
|
|
|
|
// console.log(datastore.directory);
|
|
|
|
|
chDir(/*
|
2011-01-07 14:16:10 +00:00
|
|
|
* datastore.directory +
|
|
|
|
|
* "/"+
|
|
|
|
|
*/selections[0]
|
2011-08-09 17:33:12 -04:00
|
|
|
.get('id'));
|
|
|
|
|
} else if (selections[0]
|
|
|
|
|
.get('is_editable')) {
|
|
|
|
|
openActionDialog(this,
|
|
|
|
|
'edit');
|
|
|
|
|
} else if (selections[0]
|
|
|
|
|
.get('is_readable')) {
|
|
|
|
|
openActionDialog(this,
|
|
|
|
|
'view');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'validateedit' : {
|
|
|
|
|
fn : function(e) {
|
|
|
|
|
if (e.value == e.originalValue)
|
|
|
|
|
return true;
|
|
|
|
|
var requestParams = getRequestParams();
|
|
|
|
|
requestParams.newitemname = e.value;
|
|
|
|
|
requestParams.item = e.originalValue;
|
|
|
|
|
|
|
|
|
|
requestParams.confirm = 'true';
|
|
|
|
|
requestParams.action = 'rename';
|
|
|
|
|
handleCallback(requestParams);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} ]// another level
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// } /* jj */]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
} ],
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
listeners : {
|
|
|
|
|
"afterlayout" : {
|
|
|
|
|
fn : function() {
|
2011-11-29 18:03:08 -04:00
|
|
|
revisePermission();
|
2011-08-09 17:33:12 -04:00
|
|
|
// alert(Ext.getCmp("locationbarcmp"));
|
|
|
|
|
// Ext.getCmp("documents").
|
|
|
|
|
/*
|
2011-01-07 14:16:10 +00:00
|
|
|
* if(typeof(sw_afterlayout)!="undefined"){
|
|
|
|
|
* //console.log("starting locatiobar");
|
|
|
|
|
* Ext.getCmp("locationbarcmp").tree =
|
2011-02-25 16:52:05 +00:00
|
|
|
* Ext.getCmp("dirTreePanel");
|
2011-01-07 14:16:10 +00:00
|
|
|
* Ext.getCmp("locationbarcmp").initComponent();
|
|
|
|
|
* //console.log("location abr started"); return; }
|
|
|
|
|
*/
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log(typeof(sw_afterlayout));
|
|
|
|
|
sw_afterlayout=true;
|
2011-02-25 16:52:05 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
ext_itemgrid = Ext.getCmp("gridpanel");
|
2011-02-25 16:52:05 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.log("variable ext_itemgrid created");
|
|
|
|
|
// console.trace();
|
|
|
|
|
ext_itemgrid.un('celldblclick', ext_itemgrid.onCellDblClick);
|
|
|
|
|
// console.log("celldoublde click removed");
|
2011-02-25 13:32:46 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
dirTree = Ext.getCmp("dirTreePanel");
|
|
|
|
|
// console.log("dirtree created");
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
/*
|
2011-01-07 14:16:10 +00:00
|
|
|
* dirTree.loader.on('load', function(loader, o,
|
|
|
|
|
* response ) { if( response && response.responseText ) {
|
|
|
|
|
* var json = Ext.decode( response.responseText ); if(
|
|
|
|
|
* json && json.error ) { Ext.Msg.alert('Error',
|
|
|
|
|
* json.error +'onLoad'); } } });
|
|
|
|
|
*/
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
var tsm = dirTree.getSelectionModel();
|
|
|
|
|
// console.log("tried to gtet selection model");
|
|
|
|
|
tsm.on('selectionchange',
|
|
|
|
|
handleNodeClick);
|
|
|
|
|
|
|
|
|
|
// create the editor for the directory
|
|
|
|
|
// tree
|
|
|
|
|
var dirTreeEd = new Ext.tree.TreeEditor(
|
|
|
|
|
dirTree,
|
|
|
|
|
{
|
|
|
|
|
allowBlank : false,
|
|
|
|
|
blankText : 'A name is required',
|
|
|
|
|
selectOnFocus : true
|
|
|
|
|
});
|
|
|
|
|
// console.log("tree editor created");
|
|
|
|
|
|
|
|
|
|
// console.log("before the first chdir");
|
|
|
|
|
chDir('');
|
|
|
|
|
// console.log("starting locatiobar first time");
|
|
|
|
|
Ext.getCmp("locationbarcmp").tree = Ext.getCmp("dirTreePanel");
|
|
|
|
|
Ext.getCmp("locationbarcmp").initComponent();
|
|
|
|
|
// console.log("location abr started first time");
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
}
|
|
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
Ext.onReady(function() {
|
|
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
var viewport = new Ext.Viewport({
|
|
|
|
|
layout : 'border',
|
|
|
|
|
items : [
|
|
|
|
|
documentsTab ]
|
|
|
|
|
});
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// console.info("viewport -end");
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
viewport.doLayout();
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-08-09 17:33:12 -04:00
|
|
|
// routine to hide the debug panel if it is open
|
|
|
|
|
if (parent.PANEL_EAST_OPEN) {
|
|
|
|
|
parent.PANEL_EAST_OPEN = false;
|
|
|
|
|
parent.Ext.getCmp('debugPanel').hide();
|
|
|
|
|
parent.Ext.getCmp('debugPanel').ownerCt.doLayout();
|
|
|
|
|
}
|
2011-01-07 14:16:10 +00:00
|
|
|
|
2011-11-08 18:56:41 -04:00
|
|
|
});
|