Move action for documents
This commit is contained in:
@@ -583,15 +583,25 @@ function uploadDocument(){
|
|||||||
G::RenderPage ( 'publish', 'raw' );
|
G::RenderPage ( 'publish', 'raw' );
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyAction(){
|
function copyAction(){
|
||||||
|
copyMoveAction("copy");
|
||||||
|
}
|
||||||
|
function moveAction(){
|
||||||
|
copyMoveAction("move");
|
||||||
|
}
|
||||||
|
function copyMoveAction($type){
|
||||||
$dir=$_REQUEST['dir'];
|
$dir=$_REQUEST['dir'];
|
||||||
$copyDialog["xtype"]="form";
|
$copyDialog["xtype"]="form";
|
||||||
$copyDialog["id"]="simpleform";
|
$copyDialog["id"]="simpleform";
|
||||||
$copyDialog["labelWidth"]=125;
|
$copyDialog["labelWidth"]=125;
|
||||||
$copyDialog["width"]=340;
|
$copyDialog["width"]=340;
|
||||||
$copyDialog["url"]="URL_SCRIPT";
|
$copyDialog["url"]="URL_SCRIPT";
|
||||||
$copyDialog["dialogtitle"]= "Copy/Move";
|
if($type=="copy"){
|
||||||
|
$copyDialog["dialogtitle"]= "Copy";
|
||||||
|
}else{
|
||||||
|
$copyDialog["dialogtitle"]= "Move";
|
||||||
|
}
|
||||||
|
|
||||||
$copyDialog["frame"]= true;
|
$copyDialog["frame"]= true;
|
||||||
$copyDialog["items"]=array();
|
$copyDialog["items"]=array();
|
||||||
|
|
||||||
@@ -609,24 +619,38 @@ function copyAction(){
|
|||||||
$copyDialog["buttons"]=array();
|
$copyDialog["buttons"]=array();
|
||||||
|
|
||||||
$itemButton=array();
|
$itemButton=array();
|
||||||
$itemButton["text"]= "Create";
|
if($type=="copy"){
|
||||||
|
$itemButton["text"]= "Copy";
|
||||||
|
}else{
|
||||||
|
$itemButton["text"]= "Move";
|
||||||
|
}
|
||||||
$itemButton["handler"]="copyDialogCreateButtonFunction";
|
$itemButton["handler"]="copyDialogCreateButtonFunction";
|
||||||
$functionsToReplace["copyDialogCreateButtonFunction"]="function() {
|
$functionsToReplace["copyDialogCreateButtonFunction"]="function() {
|
||||||
form = Ext.getCmp('simpleform').getForm();
|
form = Ext.getCmp('simpleform').getForm();
|
||||||
statusBarMessage( 'Please wait...', true );
|
statusBarMessage( 'Please wait...', true );
|
||||||
var requestParams = getRequestParams();
|
var requestParams = getRequestParams();
|
||||||
requestParams.confirm = 'true';
|
requestParams.confirm = 'true';
|
||||||
requestParams.action = 'copyExecute';
|
requestParams.action = '".$type."Execute';
|
||||||
form.submit({
|
form.submit({
|
||||||
//reset: true,
|
//reset: true,
|
||||||
reset: false,
|
reset: false,
|
||||||
success: function(form, action) {
|
success: function(form, action) {
|
||||||
|
if(action.result.success){
|
||||||
|
if(action.result.success=='success'){
|
||||||
statusBarMessage( action.result.message, false, true );
|
statusBarMessage( action.result.message, false, true );
|
||||||
try{
|
try{
|
||||||
dirTree.getSelectionModel().getSelectedNode().reload();
|
dirTree.getSelectionModel().getSelectedNode().reload();
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
datastore.reload();
|
datastore.reload();
|
||||||
Ext.getCmp('dialog').destroy();
|
Ext.getCmp('dialog').destroy();
|
||||||
|
}else{
|
||||||
|
statusBarMessage( action.result.message, false, false );
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if( !action.result ) return;
|
||||||
|
Ext.MessageBox.alert('Error!', action.result.error);
|
||||||
|
statusBarMessage( action.result.error, false, false );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
failure: function(form, action) {
|
failure: function(form, action) {
|
||||||
if( !action.result ) return;
|
if( !action.result ) return;
|
||||||
|
|||||||
@@ -150,11 +150,10 @@ function openActionDialog( caller, action ) {
|
|||||||
case 'copyAction':
|
case 'copyAction':
|
||||||
case 'edit':
|
case 'edit':
|
||||||
case 'newFolder':
|
case 'newFolder':
|
||||||
case 'move':
|
case 'moveAction':
|
||||||
case 'rename':
|
case 'rename':
|
||||||
case 'search':
|
case 'search':
|
||||||
case 'uploadDocument':
|
case 'uploadDocument':
|
||||||
case 'move':
|
|
||||||
requestParams = getRequestParams();
|
requestParams = getRequestParams();
|
||||||
requestParams.action = action;
|
requestParams.action = action;
|
||||||
if( action != "edit" ) {
|
if( action != "edit" ) {
|
||||||
@@ -316,6 +315,7 @@ function handleCallback(requestParams, node) {
|
|||||||
if( success ) {
|
if( success ) {
|
||||||
json = Ext.decode( response.responseText );
|
json = Ext.decode( response.responseText );
|
||||||
if( json.success ) {
|
if( json.success ) {
|
||||||
|
if( json.success == "success"){
|
||||||
statusBarMessage( json.message, false, true );
|
statusBarMessage( json.message, false, true );
|
||||||
try {
|
try {
|
||||||
if( dropEvent) {
|
if( dropEvent) {
|
||||||
@@ -331,6 +331,9 @@ function handleCallback(requestParams, node) {
|
|||||||
datastore.reload();
|
datastore.reload();
|
||||||
}
|
}
|
||||||
} catch(e) { datastore.reload(); }
|
} catch(e) { datastore.reload(); }
|
||||||
|
}else{
|
||||||
|
statusBarMessage( json.message, false, false );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Ext.Msg.alert( 'Failure', json.error );
|
Ext.Msg.alert( 'Failure', json.error );
|
||||||
}
|
}
|
||||||
@@ -444,6 +447,7 @@ function handleCallback(requestParams, node) {
|
|||||||
|
|
||||||
function statusBarMessage( msg, isLoading, success ) {
|
function statusBarMessage( msg, isLoading, success ) {
|
||||||
// console.log("Status Bar needed");
|
// console.log("Status Bar needed");
|
||||||
|
console.log(msg);
|
||||||
var statusBar = Ext.getCmp('statusPanel');
|
var statusBar = Ext.getCmp('statusPanel');
|
||||||
if( !statusBar ) return;
|
if( !statusBar ) return;
|
||||||
// console.log("Status bar acceced: "+msg);
|
// console.log("Status bar acceced: "+msg);
|
||||||
@@ -460,12 +464,13 @@ function handleCallback(requestParams, node) {
|
|||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
Ext.msgBoxSlider.msg('success', msg );
|
Ext.msgBoxSlider.msg('success', msg );
|
||||||
} else if( success != null ) {
|
} else {
|
||||||
statusBar.setStatus({
|
statusBar.setStatus({
|
||||||
text: 'error: ' + msg,
|
text: 'error: ' + msg,
|
||||||
iconCls: 'error',
|
iconCls: 'error',
|
||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
|
Ext.msgBoxSlider.msg('error', msg );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,9 +690,9 @@ var gridtb = new Ext.Toolbar(
|
|||||||
icon : '/images/documents/_move.png',
|
icon : '/images/documents/_move.png',
|
||||||
tooltip : 'Move',
|
tooltip : 'Move',
|
||||||
cls : 'x-btn-icon',
|
cls : 'x-btn-icon',
|
||||||
disabled : true,
|
disabled : false,
|
||||||
handler : function() {
|
handler : function() {
|
||||||
openActionDialog(this, 'move');
|
openActionDialog(this, 'moveAction');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1006,7 +1011,7 @@ gridCtxMenu = new Ext.menu.Menu({
|
|||||||
icon : '/images/documents/_move.png',
|
icon : '/images/documents/_move.png',
|
||||||
text : 'movelink',
|
text : 'movelink',
|
||||||
handler : function() {
|
handler : function() {
|
||||||
openActionDialog(this, 'move');
|
openActionDialog(this, 'moveAction');
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id : 'gc_delete',
|
id : 'gc_delete',
|
||||||
@@ -1115,7 +1120,7 @@ var dirCtxMenu = new Ext.menu.Menu(
|
|||||||
text : 'Move',
|
text : 'Move',
|
||||||
handler : function() {
|
handler : function() {
|
||||||
dirCtxMenu.hide();
|
dirCtxMenu.hide();
|
||||||
openActionDialog(this, 'move');
|
openActionDialog(this, 'moveAction');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1161,7 +1166,7 @@ var copymoveCtxMenu = new Ext.menu.Menu({
|
|||||||
text : 'copylink',
|
text : 'copylink',
|
||||||
handler : function() {
|
handler : function() {
|
||||||
copymoveCtxMenu.hide();
|
copymoveCtxMenu.hide();
|
||||||
copymove('copyAction');
|
copymove('copyExecute');
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id : 'copymoveCtxMenu_move',
|
id : 'copymoveCtxMenu_move',
|
||||||
@@ -1169,7 +1174,7 @@ var copymoveCtxMenu = new Ext.menu.Menu({
|
|||||||
text : 'movelink',
|
text : 'movelink',
|
||||||
handler : function() {
|
handler : function() {
|
||||||
copymoveCtxMenu.hide();
|
copymoveCtxMenu.hide();
|
||||||
copymove('move');
|
copymove('moveExecute');
|
||||||
}
|
}
|
||||||
}, '-', {
|
}, '-', {
|
||||||
id : 'copymoveCtxMenu_cancel',
|
id : 'copymoveCtxMenu_cancel',
|
||||||
@@ -1335,7 +1340,7 @@ var documentsTab = {
|
|||||||
stopEvent : true,
|
stopEvent : true,
|
||||||
handler : function() {
|
handler : function() {
|
||||||
openActionDialog(this,
|
openActionDialog(this,
|
||||||
'move');
|
'moveAction');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user