Show/hide lots of to/cc email addresses

This commit is contained in:
Nathan Gray 2013-12-18 00:37:30 +00:00
parent 644fc9fbd0
commit 8ff6950c3f
4 changed files with 47 additions and 50 deletions

View File

@ -143,7 +143,7 @@ class mail_ui
));
}
$GLOBALS['egw']->session->commit_session();
//$GLOBALS['egw']->session->commit_session();
//_debug_array($this->mail_bo->mailPreferences);
//$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__. " time used: ".$endtime);

View File

@ -110,7 +110,6 @@ app.classes.mail = AppJS.extend(
this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut);
//inital call of refresh folderstatus
var self = this;
window.setTimeout(function() {self.mail_refreshFolderStatus.call(self,undefined,undefined,false);},1000);
}
if (isDisplay)
{
@ -535,12 +534,12 @@ app.classes.mail = AppJS.extend(
// We add a new URL widget for each, so they get all the UI
// list of keys:
var additional_addresses = [
{data: 'additionaltoaddress', widget: 'additionalToAddress', line: 'mailPreviewHeadersTo'},
{data: 'additionalccaddress', widget: 'additionalCCAddress', line: 'mailPreviewHeadersCC'}
{data: 'toaddress', widget: 'additionalToAddress', line: 'mailPreviewHeadersTo'},
{data: 'ccaddress', widget: 'additionalCCAddress', line: 'mailPreviewHeadersCC'}
];
for(var j = 0; j < additional_addresses.length; j++)
{
var field = additional_addresses[j];
var field = additional_addresses[j] || [];
var additional = dataElem.data[field.data] || [];
// Disable whole box if there are none
@ -549,7 +548,7 @@ app.classes.mail = AppJS.extend(
var widget = this.et2.getWidgetById(field.widget);
if(widget == null) continue;
widget.set_disabled(true);
$j(widget.getDOMNode()).removeClass('visible');
// Remove any existing
var children = widget.getChildren();
@ -568,7 +567,9 @@ app.classes.mail = AppJS.extend(
}
// Set up button
line.iterateOver(function(button) {
button.set_disabled(additional.length <=1);
},this,et2_button);
}
//console.log("mail_preview",dataElem);
@ -594,42 +595,18 @@ app.classes.mail = AppJS.extend(
},
/**
* mail_showAllAddresses
* showAllAddresses
* requires: mainWindow, one mail selected for preview
*/
mail_showAllAddresses: function(_id) {
var dataElem = {data:{subject:"",fromaddress:"",toaddress:"",additionaltoaddress:"",ccaddress:"",date:"",subject:""}};
dataElem = egw.dataGetUIDdata(_id);
//console.log(_id,dataElem);
var buttons = [
{text: this.egw.lang("Close"), id:"close"}
];
var allAddresses = [{type:this.egw.lang('from'),address:dataElem.data.fromaddress}];
allAddresses.push({type:this.egw.lang('to'),address:dataElem.data.toaddress})
var parsedTo = [];
if (dataElem.data.additionaltoaddress.length>0) parsedTo=JSON.parse(dataElem.data.additionaltoaddress);
//console.log(_id,parsedTo);
for (i=0;i<parsedTo.length;i++)
{
allAddresses.push({type:'',address:parsedTo[i]});
}
var parsedCC = [];
if (dataElem.data.ccaddress.length>0) parsedCC=JSON.parse(dataElem.data.ccaddress);
//console.log(_id,parsedCC);
for (i=0;i<parsedCC.length;i++)
{
allAddresses.push({type:(i==0?this.egw.lang('cc'):''),address:parsedCC[i]});
}
var dialog = et2_createWidget("dialog",{
// If you use a template, the second parameter will be the value of the template, as if it were submitted.
callback: function(button_id, value) {},
buttons: buttons,
modal: false,
title: dataElem.data.subject,
template:egw.webserverUrl+"/mail/templates/default/displayAllAdresses.xet",
value: { content: {displayallAdresses:allAddresses}, sel_options: {}}
});
showAllAddresses: function(button) {
// Show list as a list
var list = jQuery(button).prev();
list.toggleClass('visible');
// Revert if user clicks elsewhere
$j('body').one('click', list, function(ev) {
ev.data.removeClass('visible');
});
},
mail_setMailBody: function(content) {
@ -655,9 +632,6 @@ app.classes.mail = AppJS.extend(
}
if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds
var self = this;
this.mail_doTimedRefresh = window.setInterval(function() {
self.mail_refreshFolderStatus.call(self,undefined,undefined,true);
}, _refreshTimeOut);
}
},

View File

@ -431,7 +431,7 @@ input[type=button] {
#mail-index_mailPreviewContainer {
position: absolute;
border: 1px solid silver;
top: 60px;
top: 9em;
bottom: 0;
left: 3px;
right: 0;
@ -540,3 +540,28 @@ div.mailComposeHeaders > span:first-child {
div.mailDisplayHeaders > span:first-child, div.mailComposeHeaders > span:first-child, div.mailComposeBody, div.mailPreviewHeaders > * {
margin-left: 3px;
}
div.mailPreviewHeaders div.mail_extraEmails {
display: inline-block;
max-height: 1em;
max-width: 50%;
padding: 5px;
overflow: hidden;
text-overflow: ellipsis;
}
div.mailPreviewHeaders div.mail_extraEmails.visible {
position: absolute;
left: 7em;
display: block;
max-height: 8em;
min-width: 30em;
z-index: 1;
overflow-y: auto;
background-color: white;
}
.mail_extraEmails > a {
display:inline;
}
.mail_extraEmails.visible > a {
display: list-item;
}

View File

@ -54,17 +54,15 @@
</hbox>
<hbox width="100%" id="mailPreviewHeadersTo" class="mailPreviewHeaders">
<description value="To"/>
<url-email id="previewToAddress" readonly="true"/>
<hbox id="additionalToAddress" class="mail_extraEmails" disabled="true">
<hbox id="additionalToAddress" class="mail_extraEmails">
</hbox>
<buttononly class="et2_button ui-button mail_DisplayNone" label="Show all Addresses" image="foldertree_nolines_plus" onclick="var addr = widget.getParent().getWidgetById('additionalToAddress'); addr.set_disabled(!addr.disabled);"/>
<buttononly class="et2_button ui-button" label="Show all Addresses" image="foldertree_nolines_plus" onclick="app.mail.showAllAddresses"/>
</hbox>
<hbox id="mailPreviewHeadersCC" class="mailPreviewHeaders">
<description value="CC"/>
<url-email id="previewCCAddress" readonly="true"/>
<hbox id="additionalCCAddress" class="mail_extraEmails" disabled="true">
<hbox id="additionalCCAddress" class="mail_extraEmails">
</hbox>
<buttononly class="et2_button ui-button mail_DisplayNone" label="Show all Addresses" image="foldertree_nolines_plus" onclick="var addr = widget.getParent().getWidgetById('additionalCCAddress'); addr.set_disabled(!addr.disabled);"/>
<buttononly class="et2_button ui-button" label="Show all Addresses" image="foldertree_nolines_plus" onclick="var list = jQuery(this).prev(); list.toggleClass('visible');"/>
</hbox>
<hbox width="100%" id="mailPreviewHeadersDate" class="mailPreviewHeaders">
<description value="Date"/>