From f0d775149694b93bcb44561ede7e700d9afbc160 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 12 Feb 2014 21:51:25 +0000 Subject: [PATCH] removed caret from group favorites, fixed prefered favorite was not show correct initialy nor updated --- .../inc/class.addressbook_hooks.inc.php | 10 ++------- calendar/inc/class.calendar_ui.inc.php | 10 +-------- etemplate/js/et2_widget_favorites.js | 10 ++++----- .../inc/class.filemanager_hooks.inc.php | 10 ++------- infolog/inc/class.infolog_hooks.inc.php | 10 ++------- phpgwapi/inc/class.egw_framework.inc.php | 21 +++++++++++++------ phpgwapi/js/jsapi/app_base.js | 4 ++-- resources/inc/class.resources_hooks.inc.php | 10 ++------- timesheet/inc/class.timesheet_hooks.inc.php | 10 ++------- 9 files changed, 32 insertions(+), 63 deletions(-) diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index 4e40eced7d..f8630b686b 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -29,14 +29,8 @@ class addressbook_hooks if ($location == 'sidebox_menu') { // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox($appname,lang('Favorites'),array( - array( - 'no_lang' => true, - 'text'=> egw_framework::favorite_list('addressbook','addressbook.addressbook_ui.get_rows'), - 'link'=>false, - 'icon' => false - ) - )); + display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list('addressbook')); + $file = array( 'Add' => "javascript:egw_openWindowCentered2('". egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.edit'),false). diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index c43e8e0976..10248404ce 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -567,15 +567,7 @@ class calendar_ui { $link_vars = array(); // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox('calendar',lang('Favorites'),array( - 'menuOpened' => true, // menu open by default - array( - 'no_lang' => true, - 'text'=> egw_framework::favorite_list('calendar',false), - 'link'=>false, - 'icon' => false - ) - )); + display_sidebox('calendar', lang('Favorites'), egw_framework::favorite_list('calendar')); $file = array('menuOpened' => true); // menu open by default $n = 0; // index for file-array diff --git a/etemplate/js/et2_widget_favorites.js b/etemplate/js/et2_widget_favorites.js index 6e8123fcb4..e406cab104 100644 --- a/etemplate/js/et2_widget_favorites.js +++ b/etemplate/js/et2_widget_favorites.js @@ -135,11 +135,10 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader], // Update sidebox, if there if(self.sidebox_target.length) { - self.sidebox_target.find(".ui-icon-heart") - .replaceWith(""); - $j("li[data-id='"+self.preferred+"'] img",self.sidebox_target) + self.sidebox_target.find("div.ui-icon-heart") + .replaceWith("
"); + $j("li[data-id='"+self.preferred+"'] div.sideboxstar",self.sidebox_target) .replaceWith("
"); - } // Close the menu @@ -221,7 +220,6 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader], options[name] = ""+ (filters[name].name != undefined ? filters[name].name : name) + - (filters[name].group != false ? " ♦" :"") + (filters[name].group != false && !this.is_admin || name == 'blank' ? "" : "
"); } @@ -307,7 +305,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader], } if(filter_name == 'add') return false; - + app[this.options.app].setState(this.stored_filters[filter_name]); return false; }, diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php index 6ec20cb069..4b87167ac3 100644 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -34,14 +34,8 @@ class filemanager_hooks static function sidebox_menu($args) { // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox(self::$appname,lang('Favorites'),array( - array( - 'no_lang' => true, - 'text'=> egw_framework::favorite_list(self::$appname,'filemanager.filemanager_ui.get_rows'), - 'link'=>false, - 'icon' => false - ) - )); + display_sidebox(self::$appname, lang('Favorites'), egw_framework::favorite_list(self::$appname)); + $location = is_array($args) ? $args['location'] : $args; $rootpath = '/'; $basepath = '/home'; diff --git a/infolog/inc/class.infolog_hooks.inc.php b/infolog/inc/class.infolog_hooks.inc.php index 93b769c826..548c8d573a 100644 --- a/infolog/inc/class.infolog_hooks.inc.php +++ b/infolog/inc/class.infolog_hooks.inc.php @@ -93,14 +93,8 @@ class infolog_hooks if ($location == 'sidebox_menu') { // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox($appname,lang('Favorites'),array( - array( - 'no_lang' => true, - 'text'=> egw_framework::favorite_list($appname,'infolog.infolog_ui.get_rows'), - 'link'=>false, - 'icon' => false - ) - )); + display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list($appname)); + $file = array( 'infolog list' => egw::link('/index.php',array( 'menuaction' => 'infolog.infolog_ui.index', diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index aa2ba93250..5ff2d0356f 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -1907,15 +1907,17 @@ abstract class egw_framework * get the favorite list when a nextmatch is _not_ on the page. If * a nextmatch is on the page, it will update / replace this list. * - * @param $app String Current application, needed to find preferences - * @param $default String Preference name for default favorite + * @param string $app application, needed to find preferences + * @param string $default=null preference name for default favorite, default "nextmatch-$app.index.rows-favorite" * - * @return String HTML fragment for the list + * @return array with a single sidebox menu item (array) containing html for favorites */ - public static function favorite_list($app, $default) + public static function favorite_list($app, $default=null) { if(!$app) return ''; + if (!$default) $default = "nextmatch-$app.index.rows-favorite"; + // This target is used client-side to find & enable adding new favorites $target = 'favorite_sidebox_'.$app; $pref_prefix = 'favorite_'; @@ -1960,7 +1962,7 @@ abstract class egw_framework $html .= "\n"; @@ -1972,7 +1974,14 @@ abstract class egw_framework $html .= ''; - return $html; + return array( + array( + 'no_lang' => true, + 'text' => $html, + 'link' => false, + 'icon' => false, + ), + ); } /** diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js index ee5c4e8acb..8e451fd9d4 100644 --- a/phpgwapi/js/jsapi/app_base.js +++ b/phpgwapi/js/jsapi/app_base.js @@ -494,7 +494,7 @@ var AppJS = Class.extend( var html = "\n"; $j(html).on('click.favorites',jQuery.proxy(function(event) { @@ -585,7 +585,7 @@ var AppJS = Class.extend( function(result) { // Got the full response from callback, which we don't want if(result.type) return; - + if(result && typeof result == 'boolean') { // Remove line from list diff --git a/resources/inc/class.resources_hooks.inc.php b/resources/inc/class.resources_hooks.inc.php index 56516e7d2b..bf67aeab83 100644 --- a/resources/inc/class.resources_hooks.inc.php +++ b/resources/inc/class.resources_hooks.inc.php @@ -27,14 +27,8 @@ class resources_hooks if ($location == 'sidebox_menu') { // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox($appname,lang('Favorites'),array( - array( - 'no_lang' => true, - 'text'=> egw_framework::favorite_list($appname,'resources.resources_ui.get_rows'), - 'link'=>false, - 'icon' => false - ) - )); + display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list($appname, 'nextmatch-resources.show.rows-favorite')); + $title = $GLOBALS['egw_info']['apps']['resources']['title'].' '.lang('Menu'); $file = array( 'Resources list' => egw::link('/index.php',array('menuaction' => 'resources.resources_ui.index' )), diff --git a/timesheet/inc/class.timesheet_hooks.inc.php b/timesheet/inc/class.timesheet_hooks.inc.php index 3b4f4d6fe0..f4f2840fcb 100644 --- a/timesheet/inc/class.timesheet_hooks.inc.php +++ b/timesheet/inc/class.timesheet_hooks.inc.php @@ -104,14 +104,8 @@ class timesheet_hooks if ($location == 'sidebox_menu') { // Magic etemplate2 favorites menu (from nextmatch widget) - display_sidebox($appname,lang('Favorites'),array( - array( - 'no_lang' => true, - 'text'=> egw_framework::favorite_list($appname,'timesheet.timesheet_ui.get_rows'), - 'link'=>false, - 'icon' => false - ) - )); + display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list($appname)); + $file = array( ); display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);