forked from extern/egroupware
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']);
|
$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);
|
unset($hook_data);
|
||||||
@ -515,7 +520,7 @@ class Etemplate extends Etemplate\Widget\Template
|
|||||||
{
|
{
|
||||||
$this->dom_id = $new_id;
|
$this->dom_id = $new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure there's a new request, in case of multiple Etemplates in one call.
|
* Make sure there's a new request, in case of multiple Etemplates in one call.
|
||||||
* Normally this isn't a problem, but if you've got an etemplate in the sidebox,
|
* Normally this isn't a problem, but if you've got an etemplate in the sidebox,
|
||||||
|
@ -115,6 +115,24 @@ class filemanager_ui
|
|||||||
return $view;
|
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
|
* Context menu
|
||||||
*
|
*
|
||||||
@ -138,33 +156,10 @@ class filemanager_ui
|
|||||||
'document' => array (
|
'document' => array (
|
||||||
'caption' => 'Document',
|
'caption' => 'Document',
|
||||||
'icon' => 'new',
|
'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(
|
'mkdir' => array(
|
||||||
'caption' => lang('Create directory'),
|
'caption' => lang('Create directory'),
|
||||||
'icon' => 'filemanager/button_createdir',
|
'icon' => 'filemanager/button_createdir',
|
||||||
@ -172,6 +167,13 @@ class filemanager_ui
|
|||||||
'allowOnMultiple' => false,
|
'allowOnMultiple' => false,
|
||||||
'onExecute' => 'javaScript:app.filemanager.createdir'
|
'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(
|
'mail' => array(
|
||||||
'caption' => lang('Share files'),
|
'caption' => lang('Share files'),
|
||||||
'icon' => 'filemanager/mail_post_to',
|
'icon' => 'filemanager/mail_post_to',
|
||||||
@ -186,6 +188,24 @@ class filemanager_ui
|
|||||||
'onExecute' => 'javaScript:app.filemanager.share_link'
|
'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(
|
'egw_paste' => array(
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
'group' => $group + 0.5,
|
'group' => $group + 0.5,
|
||||||
@ -546,6 +566,9 @@ class filemanager_ui
|
|||||||
'5' => 'Files from links',
|
'5' => 'Files from links',
|
||||||
'0' => 'Files from subdirectories',
|
'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
|
// 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')
|
if (substr($_SERVER['SCRIPT_FILENAME'], -10) == '/share.php')
|
||||||
{
|
{
|
||||||
|
@ -102,6 +102,13 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
this.set_readonly.apply(this, this.readonly);
|
this.set_readonly.apply(this, this.readonly);
|
||||||
delete 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.
|
* 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');
|
mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||||
|
|
||||||
return data.data.mime.match(mime.mime_odf_regex)?true:false;
|
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
|
* Select file dialog
|
||||||
*/
|
*/
|
||||||
.selectPath { font-weight: bold; width: 98% }
|
.selectPath { font-weight: bold; width: 98% }
|
||||||
.selectPathContainer { width: 470px; overflow: auto; }
|
|
||||||
.selectName input { width: 100%; }
|
.selectName input { width: 100%; }
|
||||||
.selectMime select { width: 100%; }
|
.selectMime select { width: 100%; }
|
||||||
.displayNone input, input.displayNone { display: none; }
|
.displayNone input, input.displayNone { display: none; }
|
||||||
@ -177,4 +177,13 @@ div.editInfoMarker {
|
|||||||
width:5px;
|
width:5px;
|
||||||
border-radius: none;
|
border-radius: none;
|
||||||
}
|
}
|
||||||
#filemanager-index_nm .et2_file div.progress {position:absolute;}
|
#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"/>
|
<buttononly statustext="Tile view" id="button[change_view]" onclick="app.filemanager.change_view" image="list_tile" background_image="true"/>
|
||||||
</template>
|
</template>
|
||||||
<template id="filemanager.index.header_right" template="" lang="" group="0" version="1.9.003">
|
<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="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 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"/>
|
<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;
|
font-weight: bold;
|
||||||
width: 98%;
|
width: 98%;
|
||||||
}
|
}
|
||||||
.selectPathContainer {
|
|
||||||
width: 470px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
.selectName input {
|
.selectName input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@ -219,6 +215,13 @@ div.editInfoMarker {
|
|||||||
#filemanager-index_nm .et2_file div.progress {
|
#filemanager-index_nm .et2_file div.progress {
|
||||||
position: absolute;
|
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
|
// sidebar
|
||||||
|
|
||||||
@ -251,15 +254,6 @@ table.egwGridView_grid img {
|
|||||||
height: auto;
|
height: auto;
|
||||||
width: 24px;
|
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 {
|
#filemanager-select #filemanager-select_apps {
|
||||||
background-color: #d9d9d9;
|
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);
|
-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);
|
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 */
|
/* tablets and smartphones */
|
||||||
@media all {
|
@media all {
|
||||||
#filemanager-index_nm table.egwGridView_outer tbody span[id^='filemanager-index'][id$='size]'] {
|
#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;
|
font-weight: bold;
|
||||||
width: 98%;
|
width: 98%;
|
||||||
}
|
}
|
||||||
.selectPathContainer {
|
|
||||||
width: 470px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
.selectName input {
|
.selectName input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@ -207,6 +203,13 @@ div.editInfoMarker {
|
|||||||
#filemanager-index_nm .et2_file div.progress {
|
#filemanager-index_nm .et2_file div.progress {
|
||||||
position: absolute;
|
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
|
// sidebar
|
||||||
|
|
||||||
@ -239,15 +242,6 @@ table.egwGridView_grid img {
|
|||||||
height: auto;
|
height: auto;
|
||||||
width: 24px;
|
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 {
|
#filemanager-select #filemanager-select_apps {
|
||||||
background-color: #d9d9d9;
|
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);
|
-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);
|
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;
|
height: auto;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
}
|
}
|
||||||
.selectPathContainer {
|
|
||||||
overflow: auto;
|
|
||||||
width: 470px;
|
|
||||||
margin-top: 0px;
|
|
||||||
height: 32px;
|
|
||||||
input {height: 20px;}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#filemanager-select_apps {
|
#filemanager-select_apps {
|
||||||
.background_color_15_gray;
|
.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