mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-01 20:34:20 +01:00
W.I.P. collab editor:
- Fix minor bugs caught by scrutinizer
This commit is contained in:
parent
a8268adfb5
commit
fcff069f45
@ -177,7 +177,15 @@ class filemanager_collab extends filemanager_collab_bo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function is_collabAllowed ($file_path, $_right)
|
/**
|
||||||
|
* Check if the collaboration is allowed for given file path
|
||||||
|
*
|
||||||
|
* @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)
|
||||||
{
|
{
|
||||||
$paths = explode('/webdav.php', $file_path);
|
$paths = explode('/webdav.php', $file_path);
|
||||||
$right = $_right ? $_right : Api\Vfs::WRITABLE;
|
$right = $_right ? $_right : Api\Vfs::WRITABLE;
|
||||||
@ -186,11 +194,18 @@ class filemanager_collab extends filemanager_collab_bo {
|
|||||||
return $allowed;
|
return $allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* client.
|
||||||
|
*
|
||||||
|
* @param type $file_path file path
|
||||||
|
*
|
||||||
|
*/
|
||||||
function ajax_getGenesisUrl ($file_path)
|
function ajax_getGenesisUrl ($file_path)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = array();
|
||||||
$es_id = md5($file_path);
|
$es_id = md5($file_path);
|
||||||
|
|
||||||
$paths = explode('/webdav.php', $file_path);
|
$paths = explode('/webdav.php', $file_path);
|
||||||
$dir_parts = explode('/',$paths[1]);
|
$dir_parts = explode('/',$paths[1]);
|
||||||
array_pop($dir_parts);
|
array_pop($dir_parts);
|
||||||
@ -205,7 +220,7 @@ class filemanager_collab extends filemanager_collab_bo {
|
|||||||
'genesis_url' => $session['genesis_url']
|
'genesis_url' => $session['genesis_url']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if ($this->is_collabAllowed($file_path))
|
else if ($this->is_collabAllowed($file_path, Api\Vfs::WRITABLE))
|
||||||
{
|
{
|
||||||
$genesis_file = $dir.'/.'.$es_id.'.webodf.odt';
|
$genesis_file = $dir.'/.'.$es_id.'.webodf.odt';
|
||||||
$genesis_url = $paths[0].'/webdav.php'.$genesis_file;
|
$genesis_url = $paths[0].'/webdav.php'.$genesis_file;
|
||||||
|
@ -1481,7 +1481,7 @@ class filemanager_ui
|
|||||||
*
|
*
|
||||||
* @param array $content
|
* @param array $content
|
||||||
*/
|
*/
|
||||||
function editor(array $content=null)
|
function editor($content=null)
|
||||||
{
|
{
|
||||||
$tmpl = new Etemplate('filemanager.editor');
|
$tmpl = new Etemplate('filemanager.editor');
|
||||||
$file_path = $_GET['path'];
|
$file_path = $_GET['path'];
|
||||||
|
@ -233,7 +233,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
egw(window).message(egw.lang('Document %1 successfully has been saved.', filename[1]));
|
egw(window).message(egw.lang('Document %1 successfully has been saved.', filename[1]));
|
||||||
self.editor.setDocumentModified(false);
|
self.editor.setDocumentModified(false);
|
||||||
egw.json('filemanager.filemanager_collab.ajax_actions',[self.editor_getFilePath(), 'save']).sendRequest();
|
egw.json('filemanager.filemanager_collab.ajax_actions',[self.collab_server.es_id, 'save']).sendRequest();
|
||||||
},
|
},
|
||||||
error: function () {},
|
error: function () {},
|
||||||
data: blob,
|
data: blob,
|
||||||
|
Loading…
Reference in New Issue
Block a user