removed caret from group favorites, fixed prefered favorite was not show correct initialy nor updated

This commit is contained in:
Ralf Becker 2014-02-12 21:51:25 +00:00
parent 6dfc3ef819
commit f0d7751496
9 changed files with 32 additions and 63 deletions

View File

@ -29,14 +29,8 @@ class addressbook_hooks
if ($location == 'sidebox_menu') if ($location == 'sidebox_menu')
{ {
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox($appname,lang('Favorites'),array( display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list('addressbook'));
array(
'no_lang' => true,
'text'=> egw_framework::favorite_list('addressbook','addressbook.addressbook_ui.get_rows'),
'link'=>false,
'icon' => false
)
));
$file = array( $file = array(
'Add' => "javascript:egw_openWindowCentered2('". 'Add' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.edit'),false). egw::link('/index.php',array('menuaction' => 'addressbook.addressbook_ui.edit'),false).

View File

@ -567,15 +567,7 @@ class calendar_ui
{ {
$link_vars = array(); $link_vars = array();
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox('calendar',lang('Favorites'),array( display_sidebox('calendar', lang('Favorites'), egw_framework::favorite_list('calendar'));
'menuOpened' => true, // menu open by default
array(
'no_lang' => true,
'text'=> egw_framework::favorite_list('calendar',false),
'link'=>false,
'icon' => false
)
));
$file = array('menuOpened' => true); // menu open by default $file = array('menuOpened' => true); // menu open by default
$n = 0; // index for file-array $n = 0; // index for file-array

View File

@ -135,11 +135,10 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
// Update sidebox, if there // Update sidebox, if there
if(self.sidebox_target.length) if(self.sidebox_target.length)
{ {
self.sidebox_target.find(".ui-icon-heart") self.sidebox_target.find("div.ui-icon-heart")
.replaceWith("<img class='sideboxstar'/>"); .replaceWith("<div class='sideboxstar'/>");
$j("li[data-id='"+self.preferred+"'] img",self.sidebox_target) $j("li[data-id='"+self.preferred+"'] div.sideboxstar",self.sidebox_target)
.replaceWith("<div class='ui-icon ui-icon-heart'/>"); .replaceWith("<div class='ui-icon ui-icon-heart'/>");
} }
// Close the menu // Close the menu
@ -221,7 +220,6 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
options[name] = "<input type='radio' name='"+this.internal_ids.menu+"[button][favorite]' value='"+name+"' title='" + options[name] = "<input type='radio' name='"+this.internal_ids.menu+"[button][favorite]' value='"+name+"' title='" +
this.egw().lang('Set as default') + "'/>"+ this.egw().lang('Set as default') + "'/>"+
(filters[name].name != undefined ? filters[name].name : name) + (filters[name].name != undefined ? filters[name].name : name) +
(filters[name].group != false ? " ♦" :"") +
(filters[name].group != false && !this.is_admin || name == 'blank' ? "" : (filters[name].group != false && !this.is_admin || name == 'blank' ? "" :
"<div class='ui-icon ui-icon-trash' title='" + this.egw().lang('Delete') + "'/>"); "<div class='ui-icon ui-icon-trash' title='" + this.egw().lang('Delete') + "'/>");
} }
@ -307,7 +305,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
} }
if(filter_name == 'add') return false; if(filter_name == 'add') return false;
app[this.options.app].setState(this.stored_filters[filter_name]); app[this.options.app].setState(this.stored_filters[filter_name]);
return false; return false;
}, },

View File

@ -34,14 +34,8 @@ class filemanager_hooks
static function sidebox_menu($args) static function sidebox_menu($args)
{ {
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox(self::$appname,lang('Favorites'),array( display_sidebox(self::$appname, lang('Favorites'), egw_framework::favorite_list(self::$appname));
array(
'no_lang' => true,
'text'=> egw_framework::favorite_list(self::$appname,'filemanager.filemanager_ui.get_rows'),
'link'=>false,
'icon' => false
)
));
$location = is_array($args) ? $args['location'] : $args; $location = is_array($args) ? $args['location'] : $args;
$rootpath = '/'; $rootpath = '/';
$basepath = '/home'; $basepath = '/home';

View File

@ -93,14 +93,8 @@ class infolog_hooks
if ($location == 'sidebox_menu') if ($location == 'sidebox_menu')
{ {
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox($appname,lang('Favorites'),array( display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list($appname));
array(
'no_lang' => true,
'text'=> egw_framework::favorite_list($appname,'infolog.infolog_ui.get_rows'),
'link'=>false,
'icon' => false
)
));
$file = array( $file = array(
'infolog list' => egw::link('/index.php',array( 'infolog list' => egw::link('/index.php',array(
'menuaction' => 'infolog.infolog_ui.index', 'menuaction' => 'infolog.infolog_ui.index',

View File

@ -1907,15 +1907,17 @@ abstract class egw_framework
* get the favorite list when a nextmatch is _not_ on the page. If * 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. * a nextmatch is on the page, it will update / replace this list.
* *
* @param $app String Current application, needed to find preferences * @param string $app application, needed to find preferences
* @param $default String Preference name for default favorite * @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(!$app) return '';
if (!$default) $default = "nextmatch-$app.index.rows-favorite";
// This target is used client-side to find & enable adding new favorites // This target is used client-side to find & enable adding new favorites
$target = 'favorite_sidebox_'.$app; $target = 'favorite_sidebox_'.$app;
$pref_prefix = 'favorite_'; $pref_prefix = 'favorite_';
@ -1960,7 +1962,7 @@ abstract class egw_framework
$html .= "<li data-id='$name' data-group='{$filter['group']}' class='ui-menu-item' role='menuitem'>\n"; $html .= "<li data-id='$name' data-group='{$filter['group']}' class='ui-menu-item' role='menuitem'>\n";
$html .= '<a href="'.htmlspecialchars($href).'" class="ui-corner-all" tabindex="-1">'; $html .= '<a href="'.htmlspecialchars($href).'" class="ui-corner-all" tabindex="-1">';
$html .= "<div class='" . ($name == $default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>". $html .= "<div class='" . ($name == $default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>".
$filter['name'] .($filter['group'] != false ? "" :""); $filter['name'];
$html .= ($filter['group'] != false && !$is_admin || $name == 'blank' ? "" : $html .= ($filter['group'] != false && !$is_admin || $name == 'blank' ? "" :
"<div class='ui-icon ui-icon-trash' title='" . lang('Delete') . "'></div>"); "<div class='ui-icon ui-icon-trash' title='" . lang('Delete') . "'></div>");
$html .= "</a></li>\n"; $html .= "</a></li>\n";
@ -1972,7 +1974,14 @@ abstract class egw_framework
$html .= '</ul></span>'; $html .= '</ul></span>';
return $html; return array(
array(
'no_lang' => true,
'text' => $html,
'link' => false,
'icon' => false,
),
);
} }
/** /**

View File

@ -494,7 +494,7 @@ var AppJS = Class.extend(
var html = "<li data-id='"+safe_name+"' data-group='" + favorite.group + "' class='ui-menu-item' role='menuitem'>\n"; var html = "<li data-id='"+safe_name+"' data-group='" + favorite.group + "' class='ui-menu-item' role='menuitem'>\n";
html += "<a href='#' class='ui-corner-all' tabindex='-1'>"; html += "<a href='#' class='ui-corner-all' tabindex='-1'>";
html += "<div class='" + 'sideboxstar' + "'></div>"+ html += "<div class='" + 'sideboxstar' + "'></div>"+
favorite.name +(favorite.group != false ? " ♦" :""); favorite.name;
html += "<div class='ui-icon ui-icon-trash' title='" + egw.lang('Delete') + "'/>"; html += "<div class='ui-icon ui-icon-trash' title='" + egw.lang('Delete') + "'/>";
html += "</a></li>\n"; html += "</a></li>\n";
$j(html).on('click.favorites',jQuery.proxy(function(event) { $j(html).on('click.favorites',jQuery.proxy(function(event) {
@ -585,7 +585,7 @@ var AppJS = Class.extend(
function(result) { function(result) {
// Got the full response from callback, which we don't want // Got the full response from callback, which we don't want
if(result.type) return; if(result.type) return;
if(result && typeof result == 'boolean') if(result && typeof result == 'boolean')
{ {
// Remove line from list // Remove line from list

View File

@ -27,14 +27,8 @@ class resources_hooks
if ($location == 'sidebox_menu') if ($location == 'sidebox_menu')
{ {
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox($appname,lang('Favorites'),array( display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list($appname, 'nextmatch-resources.show.rows-favorite'));
array(
'no_lang' => true,
'text'=> egw_framework::favorite_list($appname,'resources.resources_ui.get_rows'),
'link'=>false,
'icon' => false
)
));
$title = $GLOBALS['egw_info']['apps']['resources']['title'].' '.lang('Menu'); $title = $GLOBALS['egw_info']['apps']['resources']['title'].' '.lang('Menu');
$file = array( $file = array(
'Resources list' => egw::link('/index.php',array('menuaction' => 'resources.resources_ui.index' )), 'Resources list' => egw::link('/index.php',array('menuaction' => 'resources.resources_ui.index' )),

View File

@ -104,14 +104,8 @@ class timesheet_hooks
if ($location == 'sidebox_menu') if ($location == 'sidebox_menu')
{ {
// Magic etemplate2 favorites menu (from nextmatch widget) // Magic etemplate2 favorites menu (from nextmatch widget)
display_sidebox($appname,lang('Favorites'),array( display_sidebox($appname, lang('Favorites'), egw_framework::favorite_list($appname));
array(
'no_lang' => true,
'text'=> egw_framework::favorite_list($appname,'timesheet.timesheet_ui.get_rows'),
'link'=>false,
'icon' => false
)
));
$file = array( $file = array(
); );
display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file); display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);