From 6af1e23b662d996db15621536c38cfcd99490f16 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 19 Mar 2016 15:25:32 +0000 Subject: [PATCH] move et2 widget browser to api, thought link to it is currently only in old eTemplate sidebox menu --- api/js/etemplate/widget_browser.js | 3 + .../src/Etemplate/WidgetBrowser.php | 36 +++--- .../templates/default/widget_browser.css | 4 +- etemplate/inc/hook_sidebox_menu.inc.php | 115 +++++++++--------- 4 files changed, 81 insertions(+), 77 deletions(-) rename etemplate/inc/class.etemplate_et2_widgets.inc.php => api/src/Etemplate/WidgetBrowser.php (58%) rename {etemplate => api}/templates/default/widget_browser.css (91%) diff --git a/api/js/etemplate/widget_browser.js b/api/js/etemplate/widget_browser.js index 62abc4da94..6a13cf4f7f 100644 --- a/api/js/etemplate/widget_browser.js +++ b/api/js/etemplate/widget_browser.js @@ -12,6 +12,9 @@ * @version $Id$ */ +/*egw:uses + etemplate2; +*/ /** * widget_browser shows a list of widgets, and allows you to view them one at a time. diff --git a/etemplate/inc/class.etemplate_et2_widgets.inc.php b/api/src/Etemplate/WidgetBrowser.php similarity index 58% rename from etemplate/inc/class.etemplate_et2_widgets.inc.php rename to api/src/Etemplate/WidgetBrowser.php index 15a8ba82a6..4d02ce46e6 100644 --- a/etemplate/inc/class.etemplate_et2_widgets.inc.php +++ b/api/src/Etemplate/WidgetBrowser.php @@ -1,7 +1,6 @@ true ); - public static function index($content = array()) + public static function index() { $GLOBALS['egw_info']['flags']['currentapp'] = 'etemplate'; $GLOBALS['egw_info']['flags']['app_header'] = 'et2 Widgets'; //'js_link_registry' => True, // Widget browser code - egw_framework::validate_file('/etemplate/js/widget_browser.js'); + egw_framework::validate_file('/api/js/etemplate/widget_browser.js'); // Include the etemplate2 javascript code - egw_framework::validate_file('.', 'etemplate2', 'etemplate'); + egw_framework::validate_file('.', 'etemplate2', 'etemplate'); - // Include the jQuery-UI CSS - many more complex widgets use it - $theme = 'redmond'; + // Include the jQuery-UI CSS - many more complex widgets use it + $theme = 'redmond'; egw_framework::includeCSS("/phpgwapi/js/jquery/jquery-ui/$theme/jquery-ui-1.10.3.custom.css"); - egw_framework::includeCSS('/etemplate/templates/default/etemplate2.css'); + egw_framework::includeCSS('/api/templates/default/etemplate2.css'); - egw_framework::includeCSS('etemplate','widget_browser',false); + egw_framework::includeCSS('api','widget_browser',false); // load translations - translation::add_app('etemplate'); - - common::egw_header(); - parse_navbar(); + Api\Translation::add_app('etemplate'); - echo ' + $GLOBALS['egw']->framework->render('
-
'; - common::egw_footer(); +
'); } } diff --git a/etemplate/templates/default/widget_browser.css b/api/templates/default/widget_browser.css similarity index 91% rename from etemplate/templates/default/widget_browser.css rename to api/templates/default/widget_browser.css index 392895f90f..cf97a8a4fc 100644 --- a/etemplate/templates/default/widget_browser.css +++ b/api/templates/default/widget_browser.css @@ -1,6 +1,6 @@ /** * CSS for the widget browser - * etemplate.etemplate_et2_widgets.index + * Api\Etemplate\WidgetBrowser.php */ /* Basic layout */ @@ -14,7 +14,7 @@ overflow-y: scroll; height: 55%; width: inherit; - list-style-type: none; + list-style-type: none; margin: 0; padding: 0; } diff --git a/etemplate/inc/hook_sidebox_menu.inc.php b/etemplate/inc/hook_sidebox_menu.inc.php index 4d92e0aa17..fd67e83616 100644 --- a/etemplate/inc/hook_sidebox_menu.inc.php +++ b/etemplate/inc/hook_sidebox_menu.inc.php @@ -1,63 +1,62 @@ - * @version $Id$ - */ +/** + * EGroupware - eTemplate sidebox + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package etemplate + * @link http://www.egroupware.org + * @author Ralf Becker + * @version $Id$ + */ - $menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); - $file = Array( - 'eTemplate Editor' => $GLOBALS['egw']->link('/index.php','menuaction=etemplate.editor.edit'), - 'DB-Tools' => $GLOBALS['egw']->link('/index.php','menuaction=etemplate.db_tools.edit'), +$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); +$file = Array( + 'eTemplate Editor' => $GLOBALS['egw']->link('/index.php','menuaction=etemplate.editor.edit'), + 'DB-Tools' => $GLOBALS['egw']->link('/index.php','menuaction=etemplate.db_tools.edit'), +); +if (@$GLOBALS['egw_info']['user']['apps']['developer_tools']) +{ + $file += array( + '_NewLine_', // give a newline + 'developer_tools' => $GLOBALS['egw']->link('/index.php','menuaction=developer_tools.uilangfile.index'), ); - if (@$GLOBALS['egw_info']['user']['apps']['developer_tools']) - { - $file += array( - '_NewLine_', // give a newline - 'developer_tools' => $GLOBALS['egw']->link('/index.php','menuaction=developer_tools.uilangfile.index'), - ); - } - if($GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate') - { - display_sidebox($appname,$menu_title,$file); - } - $menu_title = lang('Documentation'); - $docs = $GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/doc/'; - $file = Array( - array( - 'text' => 'eTemplate2 Reference', - 'link' => egw::link('/index.php','menuaction=etemplate.etemplate_et2_widgets.index', 'etemplate'), - ), - array( - 'text' => 'eTemplate Tutorial', - 'link' => $docs.'etemplate.html', - 'target' => 'docs' - ), - array( - 'text' => 'eTemplate Reference', - 'link' => $docs.'reference.html', - 'target' => 'docs' - ), - array( - 'text' => 'eGroupWare '.lang('Documentation'), - 'no_lang' => True, - 'link' => 'http://egroupware.org/wiki/DeveloperDocs', - 'target' => 'docs' - ), - array( - 'text' => 'CSS properties', - 'link' => 'http://www.w3.org/TR/REC-CSS2/propidx.html', - 'target' => 'docs' - ), + } + if($GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate') + { + display_sidebox($appname,$menu_title,$file); + } +$menu_title = lang('Documentation'); +$docs = $GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/doc/'; +$doc_file = Array( + array( + 'text' => 'eTemplate2 Reference', + 'link' => egw::link('/index.php','menuaction=api.EGroupware\\Api\\Etemplate\\WidgetBrowser.index', 'etemplate'), + ), + array( + 'text' => 'eTemplate Tutorial', + 'link' => $docs.'etemplate.html', + 'target' => 'docs' + ), + array( + 'text' => 'eTemplate Reference', + 'link' => $docs.'reference.html', + 'target' => 'docs' + ), + array( + 'text' => 'eGroupWare '.lang('Documentation'), + 'no_lang' => True, + 'link' => 'http://egroupware.org/wiki/DeveloperDocs', + 'target' => 'docs' + ), + array( + 'text' => 'CSS properties', + 'link' => 'http://www.w3.org/TR/REC-CSS2/propidx.html', + 'target' => 'docs' + ), - ); +); - if($GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate') - { - display_sidebox($appname,$menu_title,$file); - } +if($GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate') +{ + display_sidebox($appname, $menu_title, $doc_file); +}