sending toolbar actions from index and get_rows (were on every rows/mail before), ToDo: only send them in get_rows if labels change

This commit is contained in:
Ralf Becker 2014-02-27 17:47:06 +00:00
parent 30de2b30c2
commit 5fab71efab
5 changed files with 140 additions and 131 deletions

View File

@ -585,6 +585,9 @@ class mail_ui
$etpl->setElementAttribute(self::$nm_index.'[foldertree]','actions', $tree_actions);
// sending preview toolbar actions
$etpl->setElementAttribute('mailPreview[toolbar]', 'actions', $this->get_toolbar_actions());
if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick';
$readonlys = $preserv = $sel_options;
if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'',__METHOD__.__LINE__);
@ -1584,25 +1587,13 @@ unset($query['actions']);
}
/**
* function header2gridelements - to populate the grid elements with the collected Data
* Get actions for preview toolbar
*
* @param array $_headers, headerdata to process
* @param array $cols, cols to populate
* @param array $_folderName, used to ensure the uniqueness of the uid over all folders
* @param array $_folderType=0, foldertype, used to determine if we need to populate from/to
* @param array $previewMessage=0, the message previewed
* @return array populated result array
* @return array
*/
public function header2gridelements($_headers, $cols, $_folderName, $_folderType=0, $previewMessage=0)
function get_toolbar_actions()
{
if (mail_bo::$debugTimes) $starttime = microtime(true);
$timestamp7DaysAgo =
mktime(date("H"), date("i"), date("s"), date("m"), date("d")-7, date("Y"));
$timestampNow =
mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$dateToday = date("Y-m-d");
$rv = array();
$actions = self::get_actions();
$actions = $this->get_actions();
foreach(array('composeasnew','reply','reply_all','forward','flagged','delete','print','infolog','tracker','save','view') as $a => $act)
{
//error_log(__METHOD__.__LINE__.' '.$act.'->'.array2string($actions[$act]));
@ -1625,6 +1616,30 @@ unset($query['actions']);
if (isset($actions[$act])) $actionsenabled[$act]=$actions[$act];
}
}
unset($actionsenabled['drag_mail']);
return $actionsenabled;
}
/**
* function header2gridelements - to populate the grid elements with the collected Data
*
* @param array $_headers, headerdata to process
* @param array $cols, cols to populate
* @param array $_folderName, used to ensure the uniqueness of the uid over all folders
* @param array $_folderType=0, foldertype, used to determine if we need to populate from/to
* @param array $previewMessage=0, the message previewed
* @return array populated result array
*/
public function header2gridelements($_headers, $cols, $_folderName, $_folderType=0, $previewMessage=0)
{
if (mail_bo::$debugTimes) $starttime = microtime(true);
$timestamp7DaysAgo =
mktime(date("H"), date("i"), date("s"), date("m"), date("d")-7, date("Y"));
$timestampNow =
mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$dateToday = date("Y-m-d");
$rv = array();
$i=0;
$firstuid = null;
@ -1854,15 +1869,17 @@ unset($query['actions']);
else $data["flags"][$flag] = $flag;
}
}
unset($actionsenabled['drag_mail']);
$data['attachmentsPresent'] = $imageTag;
$data['attachmentsBlock'] = $imageHTMLBlock;
$data['toolbaractions'] = json_encode($actionsenabled);
$data['address'] = ($_folderType?$data["toaddress"]:$data["fromaddress"]);
$rv[] = $data;
//error_log(__METHOD__.__LINE__.array2string($result));
}
if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'Folder:'.$_folderName,__METHOD__.__LINE__);
// ToDo: call this ONLY if labels change
etemplate_widget::setElementAttribute('toolbar', 'actions', $this->get_toolbar_actions());
return $rv;
}

View File

@ -697,8 +697,6 @@ app.classes.mail = AppJS.extend(
this.mail_selectedMails.push(_id);
}
this.mail_disablePreviewArea(false);
var toolbaractions = ((typeof dataElem != 'undefined' && typeof dataElem.data != 'undefined' && typeof dataElem.data.toolbaractions != 'undefined')?JSON.parse(dataElem.data.toolbaractions):undefined);
if (toolbaractions) this.et2.getWidgetById('toolbar').set_actions(toolbaractions);
// Request email body from server
IframeHandle.set_src(egw.link('/index.php',{menuaction:'mail.mail_ui.loadEmailBody',_messageID:_id}));
@ -2444,10 +2442,10 @@ app.classes.mail = AppJS.extend(
/**
* Focus handler for folder, address, reject textbox/taglist to automatic check associated radio button
*
* @param {event} _ev
*
* @param {event} _ev
* @param {object} _widget taglist
*
*
*/
sieve_focus_radioBtn: function(_ev, _widget)
{
@ -2456,7 +2454,7 @@ app.classes.mail = AppJS.extend(
/**
* Select all aliases
*
*
*/
sieve_vac_all_aliases: function()
{
@ -2539,12 +2537,12 @@ app.classes.mail = AppJS.extend(
/**
* Send back action resault to server
*
*
* @param {string} _typeId action name
* @param {object} _data content
* @param {string} _selectedID selected row id
* @param {string} _msg message
*
*
*/
_do_action: function(_typeID, _data,_selectedID,_msg)
{
@ -2556,10 +2554,10 @@ app.classes.mail = AppJS.extend(
},
/**
*
*
* @todo: Need to find a way how to refresh the grid
*
*
*
*
*/
sieve_refresh: function()
{
@ -2624,7 +2622,7 @@ app.classes.mail = AppJS.extend(
/**
* Open seive filter list
*
*
* @param {egwAction} action - Action user did to get here
* @param {egwActionObject[]} selected - selected row(s)
*

View File

@ -103,9 +103,7 @@
</grid>
<buttononly class="et2_button ui-button" label="Show all attachments" image="foldertree_nolines_plus" onclick="app.mail.showAllHeader"/>
</hbox>
<hbox id="mailPreviewIcons">
<toolbar id="toolbar"/>
</hbox>
<toolbar id="toolbar" class="mailPreviewIcons"/>
<box id="mailPreviewContainer">
<iframe frameborder="1" id="messageIFRAME" scrolling="auto"/>
</box>

View File

@ -2079,7 +2079,7 @@ input[type=button] {
padding: 0px;
height: 16px !important;
}
#mail-index_mailPreviewIcons {
.mailPreviewIcons {
position: absolute;
right: 0;
top: 0;
@ -2393,21 +2393,21 @@ input[type=button] {
background-color: #ffc200;
}
/*#toolbar-actionbox{.dimension_height_s;}*/
/*
/*
h.ui-toolbar-menulistHeader,
#ui-accordion-toolbar-actionbox-header-0{
.dimension_height_s;
background-color: @gray_50;
color: @gray_0;
margin:0;
// little ICON
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
margin-top: -11px;
color: @gray_0;
}
}
// accordion, where Button be placed
@ -2415,13 +2415,13 @@ div#toolbar-menulist{
background-color: @gray_50;
color: @gray_0;
Elemente
Elemente
button {
height: 24px !important;
img[src$="svg"]{
.gradient_vertical (@gray_60, @gray_60);
background-color: @gray_100;
}

View File

@ -118,7 +118,7 @@ div#mail-index{
.border_none;
}
tr.mail td img[src*="svg"]{ .gradient_vertical (@gray_70, @gray_70);}
tr.mail div span {.dimension_height_xs;.box_shadow_none; display: table-cell; }
@ -172,10 +172,6 @@ div#mail-index{
white-space: nowrap;
}
// Icons
div#mail-index_mailPreviewIcons{}
// Email Inhalt
div#mail-index_mailPreviewContainer{
@ -337,24 +333,24 @@ div#mail-index{
width: 100%;
height: 35px !important;
padding: 5px 5px 5px 2px !important;
.gradient_thead;
.color_100_gray;
button[id="mail-compose_button[sent]"],
button.et2_button{
/* background-color: @gray_30;*/
/*height: 33px;*/
/*margin: 0px 3px 0 !important;*/
}
span.email-button-group {
.span_tool_group;
height: 27px;
}
span.sent {float: left; background-color: @egw_color_2_a; background-image: none;}
@ -608,7 +604,7 @@ div#mail-index{
// gesamtbreite
width: 870px;
padding: 5px;
/*.mailDisplayHeaderSection{*/
/*top: 0;*/
/*position: relative;*/
@ -625,10 +621,10 @@ div#mail-index{
/* padding: 5px 3px;*/
height: 36px;
/*display: -webkit-box;*/
// all buttons
div.et2_toolbar_actionlist{margin-top: 3px; margin-left: 3px;}
button {
.Complete_Button_Icon_normal;
height: 24px;
@ -760,15 +756,15 @@ div#mail-index{
}
}
}
/*OPEN SINGLE WINDOW AFTER CLICK ON MAIL*/
// ###################### buttons##############################
// # # # # # # # # # ####
// # # # # # # # # # ####
// ############################################################
#toolbar-actionlist{
padding: 0px 3px;
span[data-group] {margin: 0px 40px 0 0;}
button {
@ -776,8 +772,8 @@ div#mail-index{
height: 27px;
[src*="svg"]{
.gradient_vertical (@gray_90, @gray_90);
}
}
}
}
button[id*="toolbar-composeasnew"],
button[id*="toolbar-reply"],
button[id*="toolbar-reply_all"],
@ -799,10 +795,10 @@ div#mail-index{
button[id*="toolbar-tracker"]{
&:hover {background-color: @egw_color_1_a;}
&:active {background-color: .background_color_15_gray;}
}
}
}
}
@ -832,10 +828,10 @@ div#mail-index{
.mail_DisplayNone{
display: none;
}
} // Ende Display
@ -845,7 +841,7 @@ div#mail-index{
* et2_toolbar
*/
.et2_toolbar {
button {
}
}
@ -853,30 +849,30 @@ div#mail-index{
.et2_toolbar-dropdown{
background: @gray_10 !important;
background-color: @gray_10 !important;
button{
background: @gray_10 !important;
background-color: @gray_10 !important;
&:hover{}
}
ul> li{ }
ul{ }
}
.et2_toolbar-dropdown-menulist {
button{
background: @gray_10 !important;
background-color: @gray_10 !important;
&:nth-child(2){}
}
ul{ }
ul{ }
}
@ -885,22 +881,22 @@ div.ui-toolbar-menulist{
.border_normal;
}
.ui-toolbar-menulist{
h {
padding-bottom: 7px;
margin: 0;
}
button {
}
div{
background-color: @gray_10 !important;
.border_normal;
}
}
}
.ui-toolbar-menulistHeader{
}
@ -912,14 +908,14 @@ div.ui-toolbar-menulist{
// aufgeklappte Toolbar
div#displayToolbar-menulist{
.et2_dropdown{
.box_shadow_none;
border: none !important;
button {.box_shadow_none;}
}
img {.dimension_width_height_sm; }
}
/* ##################################################################################
@ -928,33 +924,33 @@ div#displayToolbar-menulist{
* ##################################################################################
*/
#mail-subscribe{
table.et2_grid tr td {
padding: 0px;
/*Label*/
.mail_subscription_header {
.headline_h2;
.headline_h2;
line-height: 2em;
font-weight: bold;
font-size: 150%;
padding-bottom: 20px;
}
// Folder List
div.et2_box {
margin-top: 16px;
height: 484px;
overflow: auto;
}
}
} // #mail-subscribe
.mail_subscription_header
@ -1337,10 +1333,10 @@ pre {
right:-72px;
width:200px !important;
z-index:99;
div.et2_progress {background-color: @gray_30 !important;}
div.et2_progress > div {min-height: 4px !important;}
}
.mail-index_quotaDisplayNone {
display: none !important;
@ -1448,7 +1444,7 @@ input[type=button] {
#mail-index_mailPreviewIcons {
.mailPreviewIcons {
position: absolute;
right: 0;
top: 0;
@ -1495,13 +1491,13 @@ input[type=button] {
background: none;
/*margin: 5px 5px 0 0;*/
/*border: none;*/
// alle Buttons / drag + drop
#toolbar-actionlist{
margin-top: 3px;
}
@ -1509,10 +1505,10 @@ input[type=button] {
button {
height: 24px !important;
img[src$="svg"]{
.gradient_vertical (@gray_60, @gray_60);
background-color: @gray_100;
}
@ -1542,97 +1538,97 @@ input[type=button] {
button[id*="toolbar-save"],
button[id*="toolbar-header"]{
&:focus {
background-color: @color_positive_action;
background-color: @color_positive_action;
.gradient_vertical (@color_positive_action, @color_positive_action);
img[src$="svg"]{
.gradient_vertical (@color_positive_action, @color_positive_action);
background-color: @color_positive_action;
}
}
&:hover {
background-color: @color_positive_action;
background-color: @color_positive_action;
.gradient_vertical (@color_positive_action, @color_positive_action);
img[src$="svg"]{
.gradient_vertical (@color_positive_action, @color_positive_action);
background-color: @color_positive_action;
}
}
&:active {
background-color: @color_positive_action;
background-color: @color_positive_action;
.gradient_vertical (@color_positive_action, @color_positive_action);
img[src$="svg"]{
.gradient_vertical (@color_positive_action, @color_positive_action);
background-color: @color_positive_action;
}
}
}
button[id*="toolbar-unflagged"],
button[id*="toolbar-delete"]{
&:focus {
background-color: @color_negative_action;;
background-color: @color_negative_action;;
.gradient_vertical (@color_negative_action, @color_negative_action);
img[src$="svg"]{
.gradient_vertical (@color_negative_action, @color_negative_action);
background-color: @color_negative_action;
}
}
&:hover {
background-color: @color_negative_action;
background-color: @color_negative_action;
.gradient_vertical (@color_negative_action, @color_negative_action);
img[src$="svg"]{
.gradient_vertical (@color_negative_action, @color_negative_action);
background-color: @color_negative_action;
}
}
&:active {
background-color: @color_negative_action;;
background-color: @color_negative_action;;
.gradient_vertical (@color_negative_action, @color_negative_action);
img[src$="svg"]{
.gradient_vertical (@color_negative_action, @color_negative_action);
background-color: @color_negative_action;
}
}
}
button[id*="toolbar-infolog"],
button[id*="toolbar-tracker"]{
&:focus {
background-color: @egw_color_1_a;
background-color: @egw_color_1_a;
.gradient_vertical (@egw_color_1_a, @egw_color_1_a);
img[src$="svg"]{
.gradient_vertical (@egw_color_1_a, @egw_color_1_a);
background-color: @egw_color_1_a;
}
}
&:hover {
background-color: @egw_color_1_a;
background-color: @egw_color_1_a;
.gradient_vertical (@egw_color_1_a, @egw_color_1_a);
img[src$="svg"]{
.gradient_vertical (@egw_color_1_a, @egw_color_1_a);
background-color: @egw_color_1_a;
}
}
&:active {
background-color: @egw_color_1_a;
background-color: @egw_color_1_a;
.gradient_vertical (@egw_color_1_a, @egw_color_1_a);
img[src$="svg"]{
.gradient_vertical (@egw_color_1_a, @egw_color_1_a);
background-color: @egw_color_1_a;
}
}
}
@ -1640,21 +1636,21 @@ input[type=button] {
// weitere Button
/*#toolbar-actionbox{.dimension_height_s;}*/
/*
/*
h.ui-toolbar-menulistHeader,
#ui-accordion-toolbar-actionbox-header-0{
.dimension_height_s;
background-color: @gray_50;
color: @gray_0;
margin:0;
// little ICON
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
margin-top: -11px;
color: @gray_0;
}
}
// accordion, where Button be placed
@ -1662,13 +1658,13 @@ div#toolbar-menulist{
background-color: @gray_50;
color: @gray_0;
Elemente
Elemente
button {
height: 24px !important;
img[src$="svg"]{
.gradient_vertical (@gray_60, @gray_60);
background-color: @gray_100;
}