forked from extern/egroupware
W.I.P. migrating of Collabeditor (webodf):
- Migrate database part into Collabeditor setup - Fix create new action - Disable new button if there's no filemanager-editor installed
This commit is contained in:
parent
2c2d9b02a7
commit
06db393f1c
@ -159,6 +159,24 @@ app.classes.collabeditor = AppJS.extend({
|
|||||||
}).sendRequest();
|
}).sendRequest();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to create a new document
|
||||||
|
* @param {object} _action either action or node
|
||||||
|
* @param {object} _selected either widget or selected row
|
||||||
|
*
|
||||||
|
* @return {boolean} returns true
|
||||||
|
*/
|
||||||
|
create_new: function (_action, _selected) {
|
||||||
|
var fe = egw.link_get_registry('filemanager-editor');
|
||||||
|
if (fe && fe.edit)
|
||||||
|
{
|
||||||
|
egw.open_link(egw.link('/index.php', {
|
||||||
|
menuaction: fe.edit.menuaction
|
||||||
|
}), '', fe.popup_edit);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to leave the current editing session
|
* Function to leave the current editing session
|
||||||
* and as result it will call client-side and server leave session.
|
* and as result it will call client-side and server leave session.
|
||||||
|
@ -13,6 +13,8 @@ $setup_info['collabeditor']['app_order'] = 1;
|
|||||||
$setup_info['collabeditor']['enable'] = 2;
|
$setup_info['collabeditor']['enable'] = 2;
|
||||||
$setup_info['collabeditor']['autoinstall'] = false;
|
$setup_info['collabeditor']['autoinstall'] = false;
|
||||||
|
|
||||||
|
$setup_info['collabeditor']['tables'] = array('egw_collab_member', 'egw_collab_op', 'egw_collab_session');
|
||||||
|
|
||||||
$setup_info['collabeditor']['author'] = 'Hadi Nategh';
|
$setup_info['collabeditor']['author'] = 'Hadi Nategh';
|
||||||
$setup_info['collabeditor']['maintainer'] = array(
|
$setup_info['collabeditor']['maintainer'] = array(
|
||||||
'name' => 'EGroupware GmbH',
|
'name' => 'EGroupware GmbH',
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* EGroupware - Filemanager - Setup
|
* EGroupware - Collabeditor - Setup
|
||||||
*
|
*
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Hadi Nategh <hn-AT-stylite.de>
|
* @package collabeditor
|
||||||
* @package filemanager
|
* @author Hadi Nategh <hn-AT-egroupware.de>
|
||||||
* @subpackage setup
|
* @copyright (c) 2016 by Hadi Nategh <hn-AT-egroupware.de>
|
||||||
* @copyright (c) 2016 by Stylite AG
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
@ -1,18 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* EGroupware - Filemanager - setup
|
* EGroupware - Collabeditor - Setup
|
||||||
*
|
*
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @package filemanager
|
* @package collabeditor
|
||||||
|
* @author Hadi Nategh <hn-AT-egroupware.de>
|
||||||
|
* @copyright (c) 2016 by Hadi Nategh <hn-AT-egroupware.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
function collabeditor_upgrade17_1()
|
||||||
* Creating colaboration tables
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function filemanager_upgrade16_1()
|
|
||||||
{
|
{
|
||||||
$GLOBALS['egw_setup']->oProc->CreateTable('egw_collab_member', array(
|
$GLOBALS['egw_setup']->oProc->CreateTable('egw_collab_member', array(
|
||||||
'fd' => array(
|
'fd' => array(
|
||||||
@ -58,10 +56,5 @@ function filemanager_upgrade16_1()
|
|||||||
'uc' => array()
|
'uc' => array()
|
||||||
));
|
));
|
||||||
|
|
||||||
return $GLOBALS['setup_info']['filemanager']['currentver'] = '16.2';
|
return $GLOBALS['setup_info']['collabeditor']['currentver'] = '17.1';
|
||||||
}
|
|
||||||
|
|
||||||
function filemanager_upgrade16_2()
|
|
||||||
{
|
|
||||||
return $GLOBALS['setup_info']['filemanager']['currentver'] = '17.1';
|
|
||||||
}
|
}
|
@ -322,7 +322,7 @@ class Bo extends So {
|
|||||||
$paths = explode('/webdav.php', $file_path);
|
$paths = explode('/webdav.php', $file_path);
|
||||||
$right = $_right ? $_right : Vfs::WRITABLE;
|
$right = $_right ? $_right : Vfs::WRITABLE;
|
||||||
$allowed = Vfs::check_access($paths[1], $right) &&
|
$allowed = Vfs::check_access($paths[1], $right) &&
|
||||||
!preg_match('/\/api\/js\/webodf\/template.odf$/', $file_path);
|
!preg_match('/\/collabeditor\/assets\/template.odt$/', $file_path);
|
||||||
return $allowed;
|
return $allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ class Bo extends So {
|
|||||||
{
|
{
|
||||||
return array (
|
return array (
|
||||||
'es_id' => self::NEW_FILE_ES_ID,
|
'es_id' => self::NEW_FILE_ES_ID,
|
||||||
'genesis_url' => $GLOBALS['egw_info']['server']['webserver_url'].'/api/js/webodf/template.odt'
|
'genesis_url' => $GLOBALS['egw_info']['server']['webserver_url'].'/collabeditor/assets/template.odt'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$session = $this->SESSION_Get($es_id);
|
$session = $this->SESSION_Get($es_id);
|
||||||
|
@ -49,6 +49,11 @@ class So
|
|||||||
*/
|
*/
|
||||||
const EXCEPTION_MESSAGE_NO_OPS = 'ops need to be an array of op data, none array given!';
|
const EXCEPTION_MESSAGE_NO_OPS = 'ops need to be an array of op data, none array given!';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application name
|
||||||
|
*/
|
||||||
|
const APP_NAME = 'collabeditor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database object
|
* Database object
|
||||||
* @var Api\Db
|
* @var Api\Db
|
||||||
@ -109,7 +114,7 @@ class So
|
|||||||
'account_id' => $GLOBALS['egw_info']['user']['account_id']
|
'account_id' => $GLOBALS['egw_info']['user']['account_id']
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->db->insert(self::SESSION_TABLE, $data,false,__LINE__, __FILE__,'filemanager');
|
$this->db->insert(self::SESSION_TABLE, $data,false,__LINE__, __FILE__,self::APP_NAME);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -162,7 +167,7 @@ class So
|
|||||||
array('collab_es_id' => $es_id),
|
array('collab_es_id' => $es_id),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
'filemanager');
|
self::APP_NAME);
|
||||||
$where_query = 'collab_es_id ="'.$es_id.'" AND collab_optype != "AddMember" AND'.
|
$where_query = 'collab_es_id ="'.$es_id.'" AND collab_optype != "AddMember" AND'.
|
||||||
' collab_optype != "RemoveMember" AND collab_optype !="AddCursor" AND'.
|
' collab_optype != "RemoveMember" AND collab_optype !="AddCursor" AND'.
|
||||||
' collab_optype !="RemoveCursor"';
|
' collab_optype !="RemoveCursor"';
|
||||||
@ -172,7 +177,7 @@ class So
|
|||||||
$where_query,
|
$where_query,
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
'filemanager'
|
self::APP_NAME
|
||||||
);
|
);
|
||||||
return !$query? false: true;
|
return !$query? false: true;
|
||||||
}
|
}
|
||||||
@ -255,14 +260,14 @@ class So
|
|||||||
array('collab_es_id' => $es_id),
|
array('collab_es_id' => $es_id),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
'filemanager'
|
self::APP_NAME
|
||||||
);
|
);
|
||||||
$this->db->delete(
|
$this->db->delete(
|
||||||
self::OP_TABLE,
|
self::OP_TABLE,
|
||||||
array('collab_es_id' => $es_id),
|
array('collab_es_id' => $es_id),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
'filemanager'
|
self::APP_NAME
|
||||||
);
|
);
|
||||||
$this->db->delete(
|
$this->db->delete(
|
||||||
self::SESSION_TABLE,
|
self::SESSION_TABLE,
|
||||||
@ -310,7 +315,7 @@ class So
|
|||||||
__FILE__,
|
__FILE__,
|
||||||
FALSE,
|
FALSE,
|
||||||
'ORDER BY collab_seq DESC LIMIT 1',
|
'ORDER BY collab_seq DESC LIMIT 1',
|
||||||
'filemanager'
|
self::APP_NAME
|
||||||
);
|
);
|
||||||
$head_seq = $query->fetchRow();
|
$head_seq = $query->fetchRow();
|
||||||
return is_array($head_seq)? $head_seq['collab_seq']: '';
|
return is_array($head_seq)? $head_seq['collab_seq']: '';
|
||||||
@ -337,7 +342,7 @@ class So
|
|||||||
'collab_es_id ="'. $es_id.'" AND collab_seq >'.$seq_head,
|
'collab_es_id ="'. $es_id.'" AND collab_seq >'.$seq_head,
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
false, 'ORDER BY collab_seq ASC','filemanager');
|
false, 'ORDER BY collab_seq ASC', self::APP_NAME);
|
||||||
|
|
||||||
foreach ($query as $spec)
|
foreach ($query as $spec)
|
||||||
{
|
{
|
||||||
@ -380,7 +385,7 @@ class So
|
|||||||
'collab_optype' => $op['optype'],
|
'collab_optype' => $op['optype'],
|
||||||
'collab_opspec' => json_encode($op)
|
'collab_opspec' => json_encode($op)
|
||||||
);
|
);
|
||||||
return $this->db->insert(self::OP_TABLE, $data,false,__LINE__, __FILE__,'filemanager');
|
return $this->db->insert(self::OP_TABLE, $data,false,__LINE__, __FILE__, self::APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -398,7 +403,7 @@ class So
|
|||||||
'collab_color' => $color,
|
'collab_color' => $color,
|
||||||
'collab_is_active' => 1
|
'collab_is_active' => 1
|
||||||
);
|
);
|
||||||
$this->db->insert(self::MEMBER_TABLE, $data,false,__LINE__, __FILE__,'filemanager');
|
$this->db->insert(self::MEMBER_TABLE, $data,false,__LINE__, __FILE__, self::APP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -419,7 +424,7 @@ class So
|
|||||||
'collab_es_id ="'.$es_id.'" AND collab_member_id="'.$member_id.'"',
|
'collab_es_id ="'.$es_id.'" AND collab_member_id="'.$member_id.'"',
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
'filemanager'
|
self::APP_NAME
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +445,7 @@ class So
|
|||||||
array('collab_es_id' => $es_id, 'collab_is_active' => 1),
|
array('collab_es_id' => $es_id, 'collab_is_active' => 1),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
__FILE__,
|
__FILE__,
|
||||||
'filemanager'
|
self::APP_NAME
|
||||||
);
|
);
|
||||||
$members = $query->getRows();
|
$members = $query->getRows();
|
||||||
return is_array($members)?self::db2id($members):true;
|
return is_array($members)?self::db2id($members):true;
|
||||||
|
@ -156,7 +156,7 @@ class Ui {
|
|||||||
'caption' => 'Save',
|
'caption' => 'Save',
|
||||||
'icon' => 'apply',
|
'icon' => 'apply',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'onExecute' => 'javaScript:app.filemanager.editor_save',
|
'onExecute' => 'javaScript:app.collabeditor.editor_save',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'toolbarDefault' => true
|
'toolbarDefault' => true
|
||||||
),
|
),
|
||||||
@ -164,7 +164,7 @@ class Ui {
|
|||||||
'caption' => 'New',
|
'caption' => 'New',
|
||||||
'icon' => 'add',
|
'icon' => 'add',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'onExecute' => 'javaScript:app.filemanager.create_new',
|
'onExecute' => 'javaScript:app.collabeditor.create_new',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'toolbarDefault' => true
|
'toolbarDefault' => true
|
||||||
),
|
),
|
||||||
@ -172,7 +172,7 @@ class Ui {
|
|||||||
'caption' => 'Close',
|
'caption' => 'Close',
|
||||||
'icon' => 'close',
|
'icon' => 'close',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'onExecute' => 'javaScript:app.filemanager.editor_close',
|
'onExecute' => 'javaScript:app.collabeditor.editor_close',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'toolbarDefault' => true
|
'toolbarDefault' => true
|
||||||
),
|
),
|
||||||
@ -180,7 +180,7 @@ class Ui {
|
|||||||
'caption' => 'Save As',
|
'caption' => 'Save As',
|
||||||
'icon' => 'save_all',
|
'icon' => 'save_all',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'onExecute' => 'javaScript:app.filemanager.editor_save',
|
'onExecute' => 'javaScript:app.collabeditor.editor_save',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'toolbarDefault' => true
|
'toolbarDefault' => true
|
||||||
),
|
),
|
||||||
@ -188,7 +188,7 @@ class Ui {
|
|||||||
'caption' => 'Delete',
|
'caption' => 'Delete',
|
||||||
'icon' => 'delete',
|
'icon' => 'delete',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'onExecute' => 'javaScript:app.filemanager.editor_delete',
|
'onExecute' => 'javaScript:app.collabeditor.editor_delete',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'toolbarDefault' => false
|
'toolbarDefault' => false
|
||||||
),
|
),
|
||||||
@ -196,7 +196,7 @@ class Ui {
|
|||||||
'caption' => 'Discard',
|
'caption' => 'Discard',
|
||||||
'icon' => 'discard',
|
'icon' => 'discard',
|
||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'onExecute' => 'javaScript:app.filemanager.editor_discard',
|
'onExecute' => 'javaScript:app.collabeditor.editor_discard',
|
||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'toolbarDefault' => false
|
'toolbarDefault' => false
|
||||||
)
|
)
|
||||||
|
@ -298,28 +298,14 @@ class filemanager_hooks
|
|||||||
static function getEditorLink()
|
static function getEditorLink()
|
||||||
{
|
{
|
||||||
$implemented = Api\Hooks::implemented('filemanager-editor-link');
|
$implemented = Api\Hooks::implemented('filemanager-editor-link');
|
||||||
// default is CollabEditor
|
|
||||||
// TODO: CollabEditor needs to be migrated into an individual app, so its link
|
|
||||||
$link = array (
|
|
||||||
'edit' => array(
|
|
||||||
'menuaction' => 'filemanager.filemanager_ui.editor',
|
|
||||||
),
|
|
||||||
'edit_popup' => '980x750',
|
|
||||||
'mime' => array (
|
|
||||||
'application/vnd.oasis.opendocument.text' => array (
|
|
||||||
'mime_popup' => '' // try to avoid mime_open exception
|
|
||||||
),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
foreach ($implemented as $app)
|
foreach ($implemented as $app)
|
||||||
{
|
{
|
||||||
|
if (($access = \EGroupware\Api\Vfs\Links\StreamWrapper::check_app_rights($app)) &&
|
||||||
if ( \EGroupware\Api\Vfs\Links\StreamWrapper::check_app_rights($app) &&
|
|
||||||
($l = Api\Hooks::process('filemanager-editor-link',$app, true)) && $l[$app])
|
($l = Api\Hooks::process('filemanager-editor-link',$app, true)) && $l[$app])
|
||||||
{
|
{
|
||||||
$link = $l[$app];
|
$link = $l[$app];
|
||||||
}
|
}
|
||||||
if ($app == 'collabora') break; // collabora is default
|
if ($app == 'collabora' && $access) break; // collabora is default
|
||||||
}
|
}
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,17 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
|
|
||||||
if (name == 'filemanager.index')
|
if (name == 'filemanager.index')
|
||||||
{
|
{
|
||||||
var new_options = this.et2.getArrayMgr('sel_options').getEntry('new');
|
var fe = egw.link_get_registry('filemanager-editor');
|
||||||
var new_widget = this.et2.getWidgetById('new');
|
var new_widget = this.et2.getWidgetById('new');
|
||||||
new_widget.set_select_options(new_options);
|
if (fe && fe.edit)
|
||||||
|
{
|
||||||
|
var new_options = this.et2.getArrayMgr('sel_options').getEntry('new');
|
||||||
|
new_widget.set_select_options(new_options);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_widget.set_disabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -768,6 +776,7 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
var mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
var mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||||
// try to get mime widget DOM node out of the row DOM
|
// try to get mime widget DOM node out of the row DOM
|
||||||
var mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row");
|
var mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row");
|
||||||
|
var fe = egw.link_get_registry('filemanager-editor');
|
||||||
|
|
||||||
// symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir'
|
// symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir'
|
||||||
if (data.data.mime == 'httpd/unix-directory' || data.data['class'] && data.data['class'].split(/ +/).indexOf('isDir') != -1)
|
if (data.data.mime == 'httpd/unix-directory' || data.data['class'] && data.data['class'].split(/ +/).indexOf('isDir') != -1)
|
||||||
@ -778,9 +787,9 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
{
|
{
|
||||||
mime_dom.click();
|
mime_dom.click();
|
||||||
}
|
}
|
||||||
else if (mime && this.isEditable(_action, _senders))
|
else if (mime && this.isEditable(_action, _senders) && fe && fe.edit)
|
||||||
{
|
{
|
||||||
var fe = egw.link_get_registry('filemanager-editor');
|
|
||||||
egw.open_link(egw.link('/index.php', {
|
egw.open_link(egw.link('/index.php', {
|
||||||
menuaction: fe.edit.menuaction,
|
menuaction: fe.edit.menuaction,
|
||||||
path: decodeURIComponent(data.data.download_url)
|
path: decodeURIComponent(data.data.download_url)
|
||||||
@ -1284,9 +1293,13 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
* @return {boolean} returns true
|
* @return {boolean} returns true
|
||||||
*/
|
*/
|
||||||
create_new: function (_action, _selected) {
|
create_new: function (_action, _selected) {
|
||||||
egw.open_link(egw.link('/index.php', {
|
var fe = egw.link_get_registry('filemanager-editor');
|
||||||
menuaction: 'filemanager.filemanager_ui.editor'
|
if (fe && fe.edit)
|
||||||
}), '', egw.link_get_registry('filemanager','view_popup'));
|
{
|
||||||
|
egw.open_link(egw.link('/index.php', {
|
||||||
|
menuaction: fe.edit.menuaction
|
||||||
|
}), '', fe.popup_edit);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14,8 +14,6 @@ $setup_info['filemanager']['app_order'] = 6;
|
|||||||
$setup_info['filemanager']['enable'] = 1;
|
$setup_info['filemanager']['enable'] = 1;
|
||||||
$setup_info['filemanager']['index'] = 'filemanager.filemanager_ui.index&ajax=true';
|
$setup_info['filemanager']['index'] = 'filemanager.filemanager_ui.index&ajax=true';
|
||||||
|
|
||||||
$setup_info['filemanager']['tables'] = array('egw_collab_member', 'egw_collab_op', 'egw_collab_session');
|
|
||||||
|
|
||||||
$setup_info['filemanager']['author'] =
|
$setup_info['filemanager']['author'] =
|
||||||
$setup_info['filemanager']['maintainer'] = array(
|
$setup_info['filemanager']['maintainer'] = array(
|
||||||
'name' => 'Ralf Becker',
|
'name' => 'Ralf Becker',
|
||||||
|
Loading…
Reference in New Issue
Block a user