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')
{
// 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).

View File

@ -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

View File

@ -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("<img class='sideboxstar'/>");
$j("li[data-id='"+self.preferred+"'] img",self.sidebox_target)
self.sidebox_target.find("div.ui-icon-heart")
.replaceWith("<div class='sideboxstar'/>");
$j("li[data-id='"+self.preferred+"'] div.sideboxstar",self.sidebox_target)
.replaceWith("<div class='ui-icon ui-icon-heart'/>");
}
// 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='" +
this.egw().lang('Set as default') + "'/>"+
(filters[name].name != undefined ? filters[name].name : name) +
(filters[name].group != false ? " ♦" :"") +
(filters[name].group != false && !this.is_admin || name == 'blank' ? "" :
"<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;
app[this.options.app].setState(this.stored_filters[filter_name]);
return false;
},

View File

@ -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';

View File

@ -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',

View File

@ -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 .= "<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 .= "<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' ? "" :
"<div class='ui-icon ui-icon-trash' title='" . lang('Delete') . "'></div>");
$html .= "</a></li>\n";
@ -1972,7 +1974,14 @@ abstract class egw_framework
$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";
html += "<a href='#' class='ui-corner-all' tabindex='-1'>";
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 += "</a></li>\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

View File

@ -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' )),

View File

@ -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);