mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
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();
|
||||
},
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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']['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']['maintainer'] = array(
|
||||
'name' => 'EGroupware GmbH',
|
||||
|
@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Filemanager - Setup
|
||||
* EGroupware - Collabeditor - Setup
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Hadi Nategh <hn-AT-stylite.de>
|
||||
* @package filemanager
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2016 by Stylite AG
|
||||
* @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
|
||||
* @version $Id$
|
||||
*/
|
@ -1,18 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Filemanager - setup
|
||||
* EGroupware - Collabeditor - Setup
|
||||
*
|
||||
* @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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creating colaboration tables
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function filemanager_upgrade16_1()
|
||||
function collabeditor_upgrade17_1()
|
||||
{
|
||||
$GLOBALS['egw_setup']->oProc->CreateTable('egw_collab_member', array(
|
||||
'fd' => array(
|
||||
@ -58,10 +56,5 @@ function filemanager_upgrade16_1()
|
||||
'uc' => array()
|
||||
));
|
||||
|
||||
return $GLOBALS['setup_info']['filemanager']['currentver'] = '16.2';
|
||||
}
|
||||
|
||||
function filemanager_upgrade16_2()
|
||||
{
|
||||
return $GLOBALS['setup_info']['filemanager']['currentver'] = '17.1';
|
||||
}
|
||||
return $GLOBALS['setup_info']['collabeditor']['currentver'] = '17.1';
|
||||
}
|
@ -297,7 +297,7 @@ class Bo extends So {
|
||||
* Check last active member in a session
|
||||
*
|
||||
* @param type $es_id
|
||||
* @return array|boolean returns an array of active members, false in failure
|
||||
* @return array|boolean returns an array of active members, false in failure
|
||||
*/
|
||||
function checkLastMember ($es_id)
|
||||
{
|
||||
@ -322,7 +322,7 @@ class Bo extends So {
|
||||
$paths = explode('/webdav.php', $file_path);
|
||||
$right = $_right ? $_right : Vfs::WRITABLE;
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ class Bo extends So {
|
||||
{
|
||||
return array (
|
||||
'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);
|
||||
|
@ -49,6 +49,11 @@ class So
|
||||
*/
|
||||
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
|
||||
* @var Api\Db
|
||||
@ -109,7 +114,7 @@ class So
|
||||
'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;
|
||||
}
|
||||
@ -162,7 +167,7 @@ class So
|
||||
array('collab_es_id' => $es_id),
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
'filemanager');
|
||||
self::APP_NAME);
|
||||
$where_query = 'collab_es_id ="'.$es_id.'" AND collab_optype != "AddMember" AND'.
|
||||
' collab_optype != "RemoveMember" AND collab_optype !="AddCursor" AND'.
|
||||
' collab_optype !="RemoveCursor"';
|
||||
@ -172,7 +177,7 @@ class So
|
||||
$where_query,
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
'filemanager'
|
||||
self::APP_NAME
|
||||
);
|
||||
return !$query? false: true;
|
||||
}
|
||||
@ -255,14 +260,14 @@ class So
|
||||
array('collab_es_id' => $es_id),
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
'filemanager'
|
||||
self::APP_NAME
|
||||
);
|
||||
$this->db->delete(
|
||||
self::OP_TABLE,
|
||||
array('collab_es_id' => $es_id),
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
'filemanager'
|
||||
self::APP_NAME
|
||||
);
|
||||
$this->db->delete(
|
||||
self::SESSION_TABLE,
|
||||
@ -310,7 +315,7 @@ class So
|
||||
__FILE__,
|
||||
FALSE,
|
||||
'ORDER BY collab_seq DESC LIMIT 1',
|
||||
'filemanager'
|
||||
self::APP_NAME
|
||||
);
|
||||
$head_seq = $query->fetchRow();
|
||||
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,
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
false, 'ORDER BY collab_seq ASC','filemanager');
|
||||
false, 'ORDER BY collab_seq ASC', self::APP_NAME);
|
||||
|
||||
foreach ($query as $spec)
|
||||
{
|
||||
@ -380,7 +385,7 @@ class So
|
||||
'collab_optype' => $op['optype'],
|
||||
'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_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.'"',
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
'filemanager'
|
||||
self::APP_NAME
|
||||
);
|
||||
}
|
||||
|
||||
@ -440,7 +445,7 @@ class So
|
||||
array('collab_es_id' => $es_id, 'collab_is_active' => 1),
|
||||
__LINE__,
|
||||
__FILE__,
|
||||
'filemanager'
|
||||
self::APP_NAME
|
||||
);
|
||||
$members = $query->getRows();
|
||||
return is_array($members)?self::db2id($members):true;
|
||||
|
@ -156,7 +156,7 @@ class Ui {
|
||||
'caption' => 'Save',
|
||||
'icon' => 'apply',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.filemanager.editor_save',
|
||||
'onExecute' => 'javaScript:app.collabeditor.editor_save',
|
||||
'allowOnMultiple' => false,
|
||||
'toolbarDefault' => true
|
||||
),
|
||||
@ -164,7 +164,7 @@ class Ui {
|
||||
'caption' => 'New',
|
||||
'icon' => 'add',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.filemanager.create_new',
|
||||
'onExecute' => 'javaScript:app.collabeditor.create_new',
|
||||
'allowOnMultiple' => false,
|
||||
'toolbarDefault' => true
|
||||
),
|
||||
@ -172,7 +172,7 @@ class Ui {
|
||||
'caption' => 'Close',
|
||||
'icon' => 'close',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.filemanager.editor_close',
|
||||
'onExecute' => 'javaScript:app.collabeditor.editor_close',
|
||||
'allowOnMultiple' => false,
|
||||
'toolbarDefault' => true
|
||||
),
|
||||
@ -180,7 +180,7 @@ class Ui {
|
||||
'caption' => 'Save As',
|
||||
'icon' => 'save_all',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.filemanager.editor_save',
|
||||
'onExecute' => 'javaScript:app.collabeditor.editor_save',
|
||||
'allowOnMultiple' => false,
|
||||
'toolbarDefault' => true
|
||||
),
|
||||
@ -188,7 +188,7 @@ class Ui {
|
||||
'caption' => 'Delete',
|
||||
'icon' => 'delete',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.filemanager.editor_delete',
|
||||
'onExecute' => 'javaScript:app.collabeditor.editor_delete',
|
||||
'allowOnMultiple' => false,
|
||||
'toolbarDefault' => false
|
||||
),
|
||||
@ -196,7 +196,7 @@ class Ui {
|
||||
'caption' => 'Discard',
|
||||
'icon' => 'discard',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.filemanager.editor_discard',
|
||||
'onExecute' => 'javaScript:app.collabeditor.editor_discard',
|
||||
'allowOnMultiple' => false,
|
||||
'toolbarDefault' => false
|
||||
)
|
||||
|
@ -298,28 +298,14 @@ class filemanager_hooks
|
||||
static function getEditorLink()
|
||||
{
|
||||
$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)
|
||||
{
|
||||
|
||||
if ( \EGroupware\Api\Vfs\Links\StreamWrapper::check_app_rights($app) &&
|
||||
if (($access = \EGroupware\Api\Vfs\Links\StreamWrapper::check_app_rights($app)) &&
|
||||
($l = Api\Hooks::process('filemanager-editor-link',$app, true)) && $l[$app])
|
||||
{
|
||||
$link = $l[$app];
|
||||
}
|
||||
if ($app == 'collabora') break; // collabora is default
|
||||
if ($app == 'collabora' && $access) break; // collabora is default
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
@ -105,9 +105,17 @@ app.classes.filemanager = AppJS.extend(
|
||||
|
||||
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');
|
||||
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');
|
||||
// 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 fe = egw.link_get_registry('filemanager-editor');
|
||||
|
||||
// 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)
|
||||
@ -778,9 +787,9 @@ app.classes.filemanager = AppJS.extend(
|
||||
{
|
||||
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', {
|
||||
menuaction: fe.edit.menuaction,
|
||||
path: decodeURIComponent(data.data.download_url)
|
||||
@ -1284,9 +1293,13 @@ app.classes.filemanager = AppJS.extend(
|
||||
* @return {boolean} returns true
|
||||
*/
|
||||
create_new: function (_action, _selected) {
|
||||
egw.open_link(egw.link('/index.php', {
|
||||
menuaction: 'filemanager.filemanager_ui.editor'
|
||||
}), '', egw.link_get_registry('filemanager','view_popup'));
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
@ -14,8 +14,6 @@ $setup_info['filemanager']['app_order'] = 6;
|
||||
$setup_info['filemanager']['enable'] = 1;
|
||||
$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']['maintainer'] = array(
|
||||
'name' => 'Ralf Becker',
|
||||
|
Loading…
Reference in New Issue
Block a user