work in progress aligning nextmatch headers

This commit is contained in:
Ralf Becker 2016-02-12 17:19:27 +00:00
parent 5a27104036
commit ab3e235ed6
3 changed files with 65 additions and 79 deletions

View File

@ -306,7 +306,6 @@ class addressbook_ui extends addressbook_bo
// dont show tid-selection if we have only one content_type
// be a bit more sophisticated about it
$content['nm']['header_right'] = 'addressbook.index.right_add';
$availabletypes = array_keys($this->content_types);
if ($content['nm']['col_filter']['tid'] && !in_array($content['nm']['col_filter']['tid'],$availabletypes))
{

View File

@ -2,20 +2,6 @@
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
<!-- $Id$ -->
<overlay>
<template id="addressbook.index.left" template="" lang="" group="0" version="1.3.001">
<menulist class="bold">
<menupopup statustext="Select a view" id="org_view" no_lang="1" rows="1" empty_label="All contacts"/>
</menulist>
</template>
<template id="addressbook.index.right_add" template="" lang="" group="0" version="1.7.001">
<hbox>
<menulist>
<menupopup align="right" label="Type" id="col_filter[tid]" empty_label="All"/>
</menulist>
<buttononly align="right" statustext="Advanced search" image="advanced-search" background_image="1" id="search" onclick="egw(window).openPopup(egw::link('/index.php','menuaction=addressbook.addressbook_ui.search'),'850','440','_blank','addressbook',null,true); return false;"/>
<buttononly align="right" statustext="Add a new contact" label="Add" id="add" onclick="egw(window).openPopup(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit'),'850','440','_blank','addressbook',null,true); return false;"/>
</hbox>
</template>
<template id="addressbook.index.rows" template="" lang="" group="0" version="1.9.005">
<grid width="100%">
<columns>
@ -187,46 +173,21 @@
</rows>
</grid>
</template>
<template id="addressbook.index.left" template="" lang="" group="0" version="1.7.001">
<buttononly align="right" statustext="Add a new contact" id="add" onclick="egw(window).openPopup(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit'),'850','440','_blank','addressbook',null,true); return false;"/>
</template>
<template id="addressbook.index.row" template="" lang="" group="0" version="1.3.001">
<buttononly align="right" statustext="Advanced search" image="advanced-search" background_image="1" id="search" onclick="egw(window).openPopup(egw::link('/index.php','menuaction=addressbook.addressbook_ui.search'),'850','440','_blank','addressbook',null,true); return false;"/>
<menulist>
<menupopup statustext="Select a view" id="org_view" no_lang="1" rows="1" empty_label="All contacts"/>
</menulist>
</template>
<template id="addressbook.index.right" template="" lang="" group="0" version="1.7.001">
<menulist>
<menupopup align="right" label="Type" id="col_filter[tid]" empty_label="All"/>
</menulist>
</template>
<template id="addressbook.index" template="" lang="" group="0" version="1.9.002">
<grid width="100%">
<columns>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
</columns>
<rows>
<row disabled="!@msg">
<description align="center" id="msg" no_lang="1" span="all" class="redItalic"/>
<description/>
<description/>
<description/>
<description/>
<description/>
<description/>
<description/>
<description/>
</row>
<row disabled="1">
<template id="addressbook.index.left"/>
<template align="right" id="addressbook.index.right_add"/>
</row>
<row>
<nextmatch id="nm" template="addressbook.index.rows" span="all"/>
</row>
<row class="noPrint dialogFooterToolbar" disabled="!@nm[selectcols]=/legacy_actions/">
<button statustext="Add a new contact" label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=addressbook.addressbook_ui.edit'),'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false;"/>
<hbox align="right" span="all">
<buttononly statustext="Select action" label="Select action" id="legacy_actions" onclick="if (!egw_globalObjectManager.getObjectById('addressbook.'+({$cont[nm][do_email]} ? 'email' : 'index') + '.rows').executeActionImplementation(this, 'popup')) alert(egw::lang('You need to select some entries first!')); return false;;"/>
<button statustext="Check all" label="Check all" id="check_all" needed="1" onclick="egw_globalObjectManager.getObjectById('addressbook.'+({$cont[nm][do_email]} ? 'email' : 'index') + '.rows').toggleAllSelected(); return false;" image="arrow_ltr" class="checkAllArrow"/>
</hbox>
</row>
</rows>
</grid>
<nextmatch id="nm" template="addressbook.index.rows" span="all" header_left="addressbook.index.left" header_row="addressbook.index.row" header_right="addressbook.index.right"/>
</template>
</overlay>

View File

@ -66,6 +66,20 @@ var et2_INextmatchSortable = new Interface({
/**
* Class which implements the "nextmatch" XET-Tag
*
* NM header is build like this in DOM
*
* +- nextmatch_header -----+------------+----------+--------+---------+--------------+-----------+-------+
* + header_left | search.. | header_row | category | filter | filter2 | header_right | favorites | count |
* +-------------+----------+------------+----------+--------+---------+--------------+-----------+-------+
*
* everything left incl. standard filters is floated left:
* +- nextmatch_header -----+------------+----------+--------+---------+
* + header_left | search.. | header_row | category | filter | filter2 |
* +-------------+----------+------------+----------+--------+---------+
* everything from header_right on is floated right:
* +--------------+-----------+-------+
* | header_right | favorites | count |
* +--------------+-----------+-------+
* @augments et2_DOMWidget
*/
var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrint],
@ -2035,7 +2049,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
var nm = this;
var dialog = et2_dialog.show_dialog(
// Abort the long task if they canceled the data load
function() {count = total; cancel=true;window.setTimeout(function() {defer.reject();},0)},
function() {count = total; cancel=true;window.setTimeout(function() {defer.reject();},0);},
egw.lang('Loading'), egw.lang('please wait...'),{},[
{"button_id": et2_dialog.CANCEL_BUTTON,"text": 'cancel',id: 'dialog[cancel]',image: 'cancel'}
]
@ -2119,7 +2133,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
{"button_id": 1,"text": egw.lang('Ok'), id: 'dialog[ok]', image: 'check', "default":true},
// Nice for small lists, kills server for large lists
//{"button_id": 2,"text": egw.lang('All'), id: 'dialog[all]', image: ''},
{"button_id": 0,"text": egw.lang('Cancel'), id: 'dialog[cancel]', image: 'cancel'},
{"button_id": 0,"text": egw.lang('Cancel'), id: 'dialog[cancel]', image: 'cancel'}
]
);
return defer;
@ -2256,7 +2270,6 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
this.div.prependTo(nm_div);
// Left & Right (& row) headers
this.header_div = jQuery(document.createElement("div")).addClass("ui-helper-clearfix ui-helper-reset").prependTo(this.div);
this.headers = [
{id:this.nextmatch.options.header_left},
{id:this.nextmatch.options.header_right},
@ -2264,7 +2277,7 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
];
// The rest of the header
this.row_div = jQuery(document.createElement("div"))
this.header_div = this.row_div = jQuery(document.createElement("div"))
.addClass("nextmatch_header_row")
.appendTo(this.div);
@ -2342,7 +2355,7 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
jQuery(self.div).slideToggle('fast');
jQuery(self.div).removeClass('nm_header_hide');
jQuery(this).toggleClass('nm_toggle_header_on');
window.setTimeout(function(){self.nextmatch.resize()},800);
window.setTimeout(function(){self.nextmatch.resize();},800);
})
.prependTo(this.search_box);
// Context menu
@ -2490,13 +2503,26 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
// Load the template
var self = this;
var header = et2_createWidget("template", {"id": template_name}, this);
jQuery(header.getDOMNode()).addClass(location == "left" ? "et2_hbox_left": location=="right" ?"et2_hbox_right":'').addClass("nm_header");
this.headers[id] = header;
var deferred = [];
header.loadingFinished(deferred);
// Wait until all child widgets are loaded, then bind
jQuery.when.apply(jQuery,deferred).then(function() {
// fix order in DOM by reattaching templates in correct position
switch (id) {
case 0: // header_left: prepend
jQuery(header.getDOMNode()).prependTo(self.header_div);
break;
case 1: // header_right: before favorites and count
jQuery(header.getDOMNode()).prependTo(self.header_div.find('div.header_row_right'));
break;
case 2: // header_row: after search
window.setTimeout(function(){ // otherwise we might end up after filters
jQuery(header.getDOMNode()).insertAfter(self.header_div.find('div.search'));
}, 1);
break;
}
self._bindHeaderInput(header);
});
},