mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Filemanager "New" actions:
- Add "New" actions into nm header as drop down list - Re-arrange actions in contextmenu - Let Etemplate modifies sel_options if extra changes are available
This commit is contained in:
parent
c74955e124
commit
a4fdc052ab
@ -129,6 +129,11 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
{
|
||||
$readonlys = array_merge($readonlys, $extra['readonlys']);
|
||||
}
|
||||
|
||||
if ($extra['sel_options'] && is_array($extra['sel_options']))
|
||||
{
|
||||
$sel_options = array_merge($sel_options, $extra['sel_options']);
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($hook_data);
|
||||
|
@ -115,6 +115,24 @@ class filemanager_ui
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build select options out of actions
|
||||
* @param type $actions
|
||||
* @return type
|
||||
*/
|
||||
public static function convertActionsToselOptions ($actions)
|
||||
{
|
||||
$sel_options = array ();
|
||||
foreach ($actions as $action => $value)
|
||||
{
|
||||
$sel_options[$action] = array (
|
||||
'label' => $value['caption'],
|
||||
'icon' => $value['icon']
|
||||
);
|
||||
}
|
||||
return $sel_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Context menu
|
||||
*
|
||||
@ -138,33 +156,10 @@ class filemanager_ui
|
||||
'document' => array (
|
||||
'caption' => 'Document',
|
||||
'icon' => 'new',
|
||||
'onExecute' => 'javaScript:app.filemanager.editor_new',
|
||||
'onExecute' => 'javaScript:app.filemanager.create_new',
|
||||
)
|
||||
)
|
||||
),
|
||||
'saveas' => array(
|
||||
'caption' => lang('Save as'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'filesave',
|
||||
'onExecute' => 'javaScript:app.filemanager.force_download',
|
||||
'disableClass' => 'isDir',
|
||||
'enabled' => 'javaScript:app.filemanager.is_multiple_allowed'
|
||||
),
|
||||
'saveaszip' => array(
|
||||
'caption' => lang('Save as ZIP'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'save_zip',
|
||||
'postSubmit' => true
|
||||
),
|
||||
'edit' => array(
|
||||
'caption' => lang('Edit settings'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => false,
|
||||
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
|
||||
'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
||||
),
|
||||
'mkdir' => array(
|
||||
'caption' => lang('Create directory'),
|
||||
'icon' => 'filemanager/button_createdir',
|
||||
@ -172,6 +167,13 @@ class filemanager_ui
|
||||
'allowOnMultiple' => false,
|
||||
'onExecute' => 'javaScript:app.filemanager.createdir'
|
||||
),
|
||||
'edit' => array(
|
||||
'caption' => lang('Edit settings'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => false,
|
||||
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
|
||||
'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
|
||||
),
|
||||
'mail' => array(
|
||||
'caption' => lang('Share files'),
|
||||
'icon' => 'filemanager/mail_post_to',
|
||||
@ -186,6 +188,24 @@ class filemanager_ui
|
||||
'onExecute' => 'javaScript:app.filemanager.share_link'
|
||||
)),
|
||||
),
|
||||
'saveas' => array(
|
||||
'caption' => lang('Save as'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'filesave',
|
||||
'onExecute' => 'javaScript:app.filemanager.force_download',
|
||||
'disableClass' => 'isDir',
|
||||
'enabled' => 'javaScript:app.filemanager.is_multiple_allowed',
|
||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 83, 'caption' => 'Ctrl + Shift + S'),
|
||||
),
|
||||
'saveaszip' => array(
|
||||
'caption' => lang('Save as ZIP'),
|
||||
'group' => $group,
|
||||
'allowOnMultiple' => true,
|
||||
'icon' => 'save_zip',
|
||||
'postSubmit' => true,
|
||||
'shortcut' => array('ctrl' => true, 'shift' => true, 'keyCode' => 90, 'caption' => 'Ctrl + Shift + Z'),
|
||||
),
|
||||
'egw_paste' => array(
|
||||
'enabled' => false,
|
||||
'group' => $group + 0.5,
|
||||
@ -546,6 +566,9 @@ class filemanager_ui
|
||||
'5' => 'Files from links',
|
||||
'0' => 'Files from subdirectories',
|
||||
);
|
||||
|
||||
$sel_options['new'] = self::convertActionsToselOptions($content['nm']['actions']['new']['children']);
|
||||
|
||||
// sharing has no divAppbox, we need to set popupMainDiv instead, to be able to drop files everywhere
|
||||
if (substr($_SERVER['SCRIPT_FILENAME'], -10) == '/share.php')
|
||||
{
|
||||
|
@ -102,6 +102,13 @@ app.classes.filemanager = AppJS.extend(
|
||||
this.set_readonly.apply(this, this.readonly);
|
||||
delete this.readonly;
|
||||
}
|
||||
|
||||
if (name == 'filemanager.index')
|
||||
{
|
||||
var new_options = this.et2.getArrayMgr('sel_options').getEntry('new');
|
||||
var new_widget = this.et2.getWidgetById('new');
|
||||
new_widget.set_select_options(new_options);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1262,15 +1269,6 @@ app.classes.filemanager = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method to create a new document
|
||||
*/
|
||||
editor_new: function () {
|
||||
egw.open_link(egw.link('/index.php', {
|
||||
menuaction: 'filemanager.filemanager_ui.editor'
|
||||
}), '', egw.link_get_registry('filemanager','view_popup'));
|
||||
},
|
||||
|
||||
/**
|
||||
* Function to check wheter selected file is editable. ATM only .odt is supported.
|
||||
*
|
||||
@ -1285,5 +1283,19 @@ app.classes.filemanager = AppJS.extend(
|
||||
mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||
|
||||
return data.data.mime.match(mime.mime_odf_regex)?true:false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
egw.open_link(egw.link('/index.php', {
|
||||
menuaction: 'filemanager.filemanager_ui.editor'
|
||||
}), '', egw.link_get_registry('filemanager','view_popup'));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -85,7 +85,7 @@ table.egwGridView_grid .tile .file_tile {
|
||||
* Select file dialog
|
||||
*/
|
||||
.selectPath { font-weight: bold; width: 98% }
|
||||
.selectPathContainer { width: 470px; overflow: auto; }
|
||||
|
||||
.selectName input { width: 100%; }
|
||||
.selectMime select { width: 100%; }
|
||||
.displayNone input, input.displayNone { display: none; }
|
||||
@ -178,3 +178,12 @@ div.editInfoMarker {
|
||||
border-radius: none;
|
||||
}
|
||||
#filemanager-index_nm .et2_file div.progress {position:absolute;}
|
||||
|
||||
#filemanager-index_new_wrapper {
|
||||
float: left;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
#filemanager-index_new_wrapper .ui-icon-triangle-1-s {
|
||||
background-position: 0px -192px;
|
||||
}
|
@ -54,7 +54,7 @@
|
||||
<buttononly statustext="Tile view" id="button[change_view]" onclick="app.filemanager.change_view" image="list_tile" background_image="true"/>
|
||||
</template>
|
||||
<template id="filemanager.index.header_right" template="" lang="" group="0" version="1.9.003">
|
||||
<buttononly statustext="Create new open document file" id="button[new_doc]" onclick="app.filemanager.editor_new();" image="new" background_image="true"/>
|
||||
<dropdown_button id="new" onchange="app.filemanager.create_new" label="New" onclick="app.filemanager.create_new"/>
|
||||
<buttononly statustext="Rename, change permissions or ownership" id="button[edit]" onclick="app.filemanager.editprefs();" image="edit" background_image="true"/>
|
||||
<buttononly statustext="Create directory" id="button[createdir]" onclick="app.filemanager.createdir();" image="button_createdir" ro_image="createdir_disabled" background_image="true"/>
|
||||
<buttononly statustext="Create a link" id="button[symlink]" onclick="app.filemanager.symlink();" image="link" ro_image="link_disabled" background_image="true"/>
|
||||
|
@ -109,10 +109,6 @@ table.egwGridView_grid .tile .file_tile {
|
||||
font-weight: bold;
|
||||
width: 98%;
|
||||
}
|
||||
.selectPathContainer {
|
||||
width: 470px;
|
||||
overflow: auto;
|
||||
}
|
||||
.selectName input {
|
||||
width: 100%;
|
||||
}
|
||||
@ -219,6 +215,13 @@ div.editInfoMarker {
|
||||
#filemanager-index_nm .et2_file div.progress {
|
||||
position: absolute;
|
||||
}
|
||||
#filemanager-index_new_wrapper {
|
||||
float: left;
|
||||
margin-right: 6px;
|
||||
}
|
||||
#filemanager-index_new_wrapper .ui-icon-triangle-1-s {
|
||||
background-position: 0px -192px;
|
||||
}
|
||||
/*/*****************************************************************
|
||||
// sidebar
|
||||
|
||||
@ -251,15 +254,6 @@ table.egwGridView_grid img {
|
||||
height: auto;
|
||||
width: 24px;
|
||||
}
|
||||
#filemanager-select .dialogHeader .selectPathContainer {
|
||||
overflow: auto;
|
||||
width: 470px;
|
||||
margin-top: 0px;
|
||||
height: 32px;
|
||||
}
|
||||
#filemanager-select .dialogHeader .selectPathContainer input {
|
||||
height: 20px;
|
||||
}
|
||||
#filemanager-select #filemanager-select_apps {
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
@ -408,6 +402,12 @@ div#stylite-filemanager-upload .dialogFooterToolbar button:active {
|
||||
-moz-box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
#filemanager-index_new_wrapper .ui-icon-triangle-1-s {
|
||||
background-image: url(../../../pixelegg/images/add.png);
|
||||
background-size: 12px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
/* tablets and smartphones */
|
||||
@media all {
|
||||
#filemanager-index_nm table.egwGridView_outer tbody span[id^='filemanager-index'][id$='size]'] {
|
||||
|
@ -97,10 +97,6 @@ table.egwGridView_grid .tile .file_tile {
|
||||
font-weight: bold;
|
||||
width: 98%;
|
||||
}
|
||||
.selectPathContainer {
|
||||
width: 470px;
|
||||
overflow: auto;
|
||||
}
|
||||
.selectName input {
|
||||
width: 100%;
|
||||
}
|
||||
@ -207,6 +203,13 @@ div.editInfoMarker {
|
||||
#filemanager-index_nm .et2_file div.progress {
|
||||
position: absolute;
|
||||
}
|
||||
#filemanager-index_new_wrapper {
|
||||
float: left;
|
||||
margin-right: 6px;
|
||||
}
|
||||
#filemanager-index_new_wrapper .ui-icon-triangle-1-s {
|
||||
background-position: 0px -192px;
|
||||
}
|
||||
/*/*****************************************************************
|
||||
// sidebar
|
||||
|
||||
@ -239,15 +242,6 @@ table.egwGridView_grid img {
|
||||
height: auto;
|
||||
width: 24px;
|
||||
}
|
||||
#filemanager-select .dialogHeader .selectPathContainer {
|
||||
overflow: auto;
|
||||
width: 470px;
|
||||
margin-top: 0px;
|
||||
height: 32px;
|
||||
}
|
||||
#filemanager-select .dialogHeader .selectPathContainer input {
|
||||
height: 20px;
|
||||
}
|
||||
#filemanager-select #filemanager-select_apps {
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
@ -396,3 +390,9 @@ div#stylite-filemanager-upload .dialogFooterToolbar button:active {
|
||||
-moz-box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: inset 1px 2px 1px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
#filemanager-index_new_wrapper .ui-icon-triangle-1-s {
|
||||
background-image: url(../../../pixelegg/images/add.png);
|
||||
background-size: 12px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
@ -46,13 +46,6 @@ table.egwGridView_grid img {
|
||||
height: auto;
|
||||
width: 24px;
|
||||
}
|
||||
.selectPathContainer {
|
||||
overflow: auto;
|
||||
width: 470px;
|
||||
margin-top: 0px;
|
||||
height: 32px;
|
||||
input {height: 20px;}
|
||||
}
|
||||
}
|
||||
#filemanager-select_apps {
|
||||
.background_color_15_gray;
|
||||
@ -127,4 +120,12 @@ div#stylite-filemanager-upload {
|
||||
}
|
||||
}
|
||||
}
|
||||
#filemanager-index_new_wrapper {
|
||||
.ui-icon-triangle-1-s {
|
||||
background-image: url(../../../pixelegg/images/add.png);
|
||||
background-size: 12px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user