W.I.P. collab editor:

- Implement delete action, including cleaning up the tables
This commit is contained in:
Hadi Nategh 2016-08-22 13:05:47 +02:00
parent 224c4ce446
commit 81b78074ce
2 changed files with 30 additions and 2 deletions

View File

@ -60,6 +60,7 @@ class filemanager_collab extends filemanager_collab_bo {
*/
function leave_session ($es_id, $member_id)
{
if (!$this->is_sessionValid($es_id)) throw new Exception ('Session is not valid!');
return array (
'session_id' => $es_id,
'memberid' => $member_id,
@ -173,6 +174,9 @@ class filemanager_collab extends filemanager_collab_bo {
case 'save':
$this->SESSION_Save($es_id);
break;
case 'delete':
$this->SESSION_cleanup($es_id);
break;
}
}
@ -182,7 +186,7 @@ class filemanager_collab extends filemanager_collab_bo {
*
* @param string $file_path file path
* @param int $_right VFS file access right
*
*
* @return boolean returns true if allowed
*/
function is_collabAllowed ($file_path, $_right=null)
@ -194,6 +198,19 @@ class filemanager_collab extends filemanager_collab_bo {
return $allowed;
}
/**
* Check if session is valid
*
* @param type $es_id
*
* @return boolean return true if session is valid otherwise false
*/
function is_sessionValid ($es_id)
{
$session = $this->SESSION_Get($es_id);
return $session? true : false;
}
/**
* Function to get genesis url by generating a temp genesis temp file
* out of given path, and returnig es_id md5 hash and genesis url to

View File

@ -295,7 +295,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
{
if (_btn == 2)
{
self._do_action('delete', [fullpath], false, path);
self._do_action('delete', [fullpath,path+'/.'+self.collab_server.es_id+'.webodf.odt'], false, path);
self.editor_close(_egwAction);
}
},
@ -458,6 +458,17 @@ app.classes.filemanager = app.classes.filemanager.extend({
}
});
});
},
_do_action_callback:function(_data)
{
this._super.apply(this,arguments);
switch(_data.action)
{
case 'delete':
if (!_data.errs) egw.json('filemanager.filemanager_collab.ajax_actions', [this.collab_server.es_id, 'delete']).sendRequest();
}
}
});