adapt AppJS usage in mail app, to get back to the state of usability before introducing it

This commit is contained in:
Klaus Leithoff 2013-04-09 14:43:55 +00:00
parent 91dc1f9df9
commit 42426121ab
6 changed files with 225 additions and 58 deletions

View File

@ -108,7 +108,9 @@ class mail_bo
'balance'=>1,//turn off tag-balancing (config['balance']=>0). That will not introduce any security risk; only standards-compliant tag nesting check/filtering will be turned off (basic tag-balance will remain; i.e., there won't be any unclosed tag, etc., after filtering) 'balance'=>1,//turn off tag-balancing (config['balance']=>0). That will not introduce any security risk; only standards-compliant tag nesting check/filtering will be turned off (basic tag-balance will remain; i.e., there won't be any unclosed tag, etc., after filtering)
'direct_list_nest' => 1, 'direct_list_nest' => 1,
'allow_for_inline' => array('table','div','li','p'),//block elements allowed for nesting when only inline is allowed; Example span does not allow block elements as table; table is the only element tested so far 'allow_for_inline' => array('table','div','li','p'),//block elements allowed for nesting when only inline is allowed; Example span does not allow block elements as table; table is the only element tested so far
'tidy'=>1, // tidy eats away even some wanted whitespace, so we switch it off;
// we used it for its compacting and beautifying capabilities, which resulted in better html for further processing
'tidy'=>0,
'elements' => "* -script", 'elements' => "* -script",
'deny_attribute' => 'on*', 'deny_attribute' => 'on*',
'schemes'=>'href: file, ftp, http, https, mailto; src: cid, data, file, ftp, http, https; *:file, http, https, cid, src', 'schemes'=>'href: file, ftp, http, https, mailto; src: cid, data, file, ftp, http, https; *:file, http, https, cid, src',
@ -820,7 +822,7 @@ class mail_bo
$retval = true; $retval = true;
if($folderToSelect && ($folderStatus = $this->getFolderStatus($folderToSelect,false,true))) { if($folderToSelect && ($folderStatus = $this->getFolderStatus($folderToSelect,false,true))) {
if ($folderStatus instanceof PEAR_Error) return false; if ($folderStatus instanceof PEAR_Error) return false;
if (stripos(array2string($folderStatus['attributes']),'noselect')!==false) if (!empty($folderStatus['attributes']) && stripos(array2string($folderStatus['attributes']),'noselect')!==false)
{ {
$retval = false; $retval = false;
} }
@ -2749,7 +2751,7 @@ class mail_bo
/** /**
* _getStructure * _getStructure
* fetc the structure of a mail, represented by uid * fetch the structure of a mail, represented by uid
* @param string/int $_uid the messageuid, * @param string/int $_uid the messageuid,
* @param boolean $byUid=true, is the messageuid given by UID or ID * @param boolean $byUid=true, is the messageuid given by UID or ID
* @param boolean $_ignoreCache=false, use or disregard cache, when fetching * @param boolean $_ignoreCache=false, use or disregard cache, when fetching
@ -2779,6 +2781,74 @@ class mail_bo
return $structure[$this->icServer->ImapServerId][$_folder][$_uid]; return $structure[$this->icServer->ImapServerId][$_folder][$_uid];
} }
/**
* _getSubStructure
* fetch the substructure of a mail, by given structure and partid
* @param array $_structure='', if given use structure for parsing
* @param string/int $_partID the partid,
* @return array an structured array of information about the mail
*/
function _getSubStructure($_structure, $_partID)
{
$tempID = '';
$structure = $_structure;
if (empty($_partID)) $_partID=1;
$imapPartIDs = explode('.',$_partID);
#error_log(print_r($structure,true));
#error_log(print_r($_partID,true));
if($_partID != 1) {
foreach($imapPartIDs as $imapPartID) {
if(!empty($tempID)) {
$tempID .= '.';
}
$tempID .= $imapPartID;
#error_log(print_r( "TEMPID: $tempID<br>",true));
//_debug_array($structure);
if($structure->subParts[$tempID]->type == 'MESSAGE' && $structure->subParts[$tempID]->subType == 'RFC822' &&
count($structure->subParts[$tempID]->subParts) == 1 &&
$structure->subParts[$tempID]->subParts[$tempID]->type == 'MULTIPART' &&
($structure->subParts[$tempID]->subParts[$tempID]->subType == 'MIXED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'ALTERNATIVE' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'RELATED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT'))
{
$structure = $structure->subParts[$tempID]->subParts[$tempID];
} else {
$structure = $structure->subParts[$tempID];
}
}
}
if($structure->partID != $_partID) {
foreach($imapPartIDs as $imapPartID) {
if(!empty($tempID)) {
$tempID .= '.';
}
$tempID .= $imapPartID;
//print "TEMPID: $tempID<br>";
//_debug_array($structure);
if($structure->subParts[$tempID]->type == 'MESSAGE' && $structure->subParts[$tempID]->subType == 'RFC822' &&
count($structure->subParts[$tempID]->subParts) == 1 &&
$structure->subParts[$tempID]->subParts[$tempID]->type == 'MULTIPART' &&
($structure->subParts[$tempID]->subParts[$tempID]->subType == 'MIXED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'ALTERNATIVE' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'RELATED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT')) {
$structure = $structure->subParts[$tempID]->subParts[$tempID];
} else {
$structure = $structure->subParts[$tempID];
}
}
if($structure->partID != $_partID) {
error_log(__METHOD__."(". __LINE__ .") partID's don't match");
return false;
}
}
return $structure;
}
/** /**
* getMimePartCharset - fetches the charset mimepart if it exists * getMimePartCharset - fetches the charset mimepart if it exists
* @param $_mimePartObject structure object * @param $_mimePartObject structure object
@ -3636,6 +3706,11 @@ class mail_bo
//if ( $_uid && $partID) error_log(__METHOD__.__LINE__.array2string($structure).' Uid:'.$_uid.' PartID:'.$partID.' -> '.array2string($this->icServer->getParsedHeaders($_uid, true, $partID, true))); //if ( $_uid && $partID) error_log(__METHOD__.__LINE__.array2string($structure).' Uid:'.$_uid.' PartID:'.$partID.' -> '.array2string($this->icServer->getParsedHeaders($_uid, true, $partID, true)));
if(isset($structure->parameters['NAME'])) { if(isset($structure->parameters['NAME'])) {
//error_log(__METHOD__.__LINE__.array2string(substr($structure->parameters['NAME'],0,strlen('data:'))));
if (!is_array($structure->parameters['NAME']) && substr($structure->parameters['NAME'],0,strlen('data:'))==='data:') {
$namecounter++;
return lang("unknown").$namecounter.($structure->subType ? ".".$structure->subType : "");
}
if (is_array($structure->parameters['NAME'])) $structure->parameters['NAME'] = implode(' ',$structure->parameters['NAME']); if (is_array($structure->parameters['NAME'])) $structure->parameters['NAME'] = implode(' ',$structure->parameters['NAME']);
return rawurldecode(self::decode_header($structure->parameters['NAME'])); return rawurldecode(self::decode_header($structure->parameters['NAME']));
} elseif(isset($structure->dparameters['FILENAME'])) { } elseif(isset($structure->dparameters['FILENAME'])) {
@ -3731,6 +3806,80 @@ class mail_bo
} }
} }
/**
* retrieve a attachment
*
* @param int _uid the uid of the message
* @param string _partID the id of the part, which holds the attachment
* @param int _winmail_nr winmail.dat attachment nr.
*
* @return array
*/
function getAttachment($_uid, $_partID, $_winmail_nr=0)
{
// parse message structure
$structure = $this->_getStructure($_uid, true);
if($_partID != '') {
$structure = $this->_getSubStructure($structure, $_partID);
}
$filename = $this->getFileNameFromStructure($structure, $_uid, $structure->partID);
$attachment = $this->icServer->getBodyPart($_uid, $_partID, true, true);
if (PEAR::isError($attachment))
{
error_log(__METHOD__.__LINE__.' failed:'.$attachment->message);
return array('type' => 'text/plain',
'filename' => 'error.txt',
'attachment' =>__METHOD__.' failed:'.$attachment->message
);
}
if (PEAR::isError($attachment))
{
error_log(__METHOD__.__LINE__.' failed:'.$attachment->message);
return array('type' => 'text/plain',
'filename' => 'error.txt',
'attachment' =>__METHOD__.' failed:'.$attachment->message
);
}
switch ($structure->encoding) {
case 'BASE64':
// use imap_base64 to decode
$attachment = imap_base64($attachment);
break;
case 'QUOTED-PRINTABLE':
// use imap_qprint to decode
#$attachment = imap_qprint($attachment);
$attachment = quoted_printable_decode($attachment);
break;
default:
// it is either not encoded or we don't know about it
}
if ($structure->type === 'TEXT' && isset($structure->parameters['CHARSET']) && stripos('UTF-16',$structure->parameters['CHARSET'])!==false)
{
$attachment = translation::convert($attachment,$structure->parameters['CHARSET'],self::$displayCharset);
}
$attachmentData = array(
'type' => $structure->type .'/'. $structure->subType,
'filename' => $filename,
'attachment' => $attachment
);
// try guessing the mimetype, if we get the application/octet-stream
if (strtolower($attachmentData['type']) == 'application/octet-stream') $attachmentData['type'] = mime_magic::filename2mime($attachmentData['filename']);
# if the attachment holds a winmail number and is a winmail.dat then we have to handle that.
if ( $filename == 'winmail.dat' && $_winmail_nr > 0 &&
( $wmattach = $this->decode_winmail( $_uid, $_partID, $_winmail_nr ) ) )
{
$attachmentData = array(
'type' => $wmattach['type'],
'filename' => $wmattach['name'],
'attachment' => $wmattach['attachment'],
);
}
return $attachmentData;
}
/** /**
* functions to allow access to mails through other apps to fetch content * functions to allow access to mails through other apps to fetch content
* used in infolog, tracker * used in infolog, tracker

View File

@ -69,7 +69,7 @@ class mail_hooks
} }
/** /**
* Hook called by link-class to include calendar in the appregistry of the linkage * Hook called by link-class to include mail in the appregistry of the linkage
* *
* @param array/string $location location and other parameters (not used) * @param array/string $location location and other parameters (not used)
* @return array with method-names * @return array with method-names

View File

@ -636,7 +636,7 @@ class mail_ui
'open' => array( 'open' => array(
'caption' => lang('Open'), 'caption' => lang('Open'),
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:app.mail.open', 'onExecute' => 'javaScript:app.mail.open', //dummy by nathan
'allowOnMultiple' => false, 'allowOnMultiple' => false,
'default' => true, 'default' => true,
), ),
@ -644,14 +644,14 @@ class mail_ui
'caption' => 'Reply', 'caption' => 'Reply',
'icon' => 'mail_reply', 'icon' => 'mail_reply',
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:mail_compose', 'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
'reply_all' => array( 'reply_all' => array(
'caption' => 'Reply All', 'caption' => 'Reply All',
'icon' => 'mail_replyall', 'icon' => 'mail_replyall',
'group' => $group, 'group' => $group,
'onExecute' => 'javaScript:mail_compose', 'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
'forward' => array( 'forward' => array(
@ -663,14 +663,14 @@ class mail_ui
'caption' => 'forward inline', 'caption' => 'forward inline',
'icon' => 'mail_forward', 'icon' => 'mail_forward',
'group' => $group, 'group' => $group,
'onExecute' => 'javaScript:mail_compose', 'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
'forwardasattach' => array( 'forwardasattach' => array(
'caption' => 'forward as attachment', 'caption' => 'forward as attachment',
'icon' => 'mail_forward', 'icon' => 'mail_forward',
'group' => $group, 'group' => $group,
'onExecute' => 'javaScript:mail_compose', 'onExecute' => 'javaScript:app.mail.mail_compose',
), ),
), ),
), ),
@ -678,14 +678,14 @@ class mail_ui
'caption' => 'Compose as new', 'caption' => 'Compose as new',
'icon' => 'new', 'icon' => 'new',
'group' => $group, 'group' => $group,
'onExecute' => 'javaScript:mail_compose', 'onExecute' => 'javaScript:app.mail.mail_compose',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
$moveaction => array( $moveaction => array(
'caption' => lang('Move selected to').': '.(isset($lastFolderUsedForMove['shortDisplayName'])?$lastFolderUsedForMove['shortDisplayName']:''), 'caption' => lang('Move selected to').': '.(isset($lastFolderUsedForMove['shortDisplayName'])?$lastFolderUsedForMove['shortDisplayName']:''),
'icon' => 'move', 'icon' => 'move',
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:mail_move2folder', 'onExecute' => 'javaScript:app.mail.mail_move2folder',
'allowOnMultiple' => true, 'allowOnMultiple' => true,
), ),
'infolog' => array( 'infolog' => array(
@ -693,7 +693,7 @@ class mail_ui
'hint' => 'Save as InfoLog', 'hint' => 'Save as InfoLog',
'icon' => 'infolog/navbar', 'icon' => 'infolog/navbar',
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:mail_infolog', 'onExecute' => 'javaScript:app.mail.mail_infolog',
'url' => 'menuaction=infolog.infolog_ui.import_mail', 'url' => 'menuaction=infolog.infolog_ui.import_mail',
'popup' => egw_link::get_registry('infolog', 'add_popup'), 'popup' => egw_link::get_registry('infolog', 'add_popup'),
'allowOnMultiple' => false, 'allowOnMultiple' => false,
@ -703,7 +703,7 @@ class mail_ui
'hint' => 'Save as ticket', 'hint' => 'Save as ticket',
'group' => $group, 'group' => $group,
'icon' => 'tracker/navbar', 'icon' => 'tracker/navbar',
'onExecute' => 'javaScript:mail_tracker', 'onExecute' => 'javaScript:app.mail.mail_tracker',
'url' => 'menuaction=tracker.tracker_ui.import_mail', 'url' => 'menuaction=tracker.tracker_ui.import_mail',
'popup' => egw_link::get_registry('tracker', 'add_popup'), 'popup' => egw_link::get_registry('tracker', 'add_popup'),
'allowOnMultiple' => false, 'allowOnMultiple' => false,
@ -711,7 +711,7 @@ class mail_ui
'print' => array( 'print' => array(
'caption' => 'Print', 'caption' => 'Print',
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:mail_print', 'onExecute' => 'javaScript:app.mail.mail_print',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
'save' => array( 'save' => array(
@ -724,7 +724,7 @@ class mail_ui
'hint' => 'Save message to disk', 'hint' => 'Save message to disk',
'group' => $group, 'group' => $group,
'icon' => 'fileexport', 'icon' => 'fileexport',
'onExecute' => 'javaScript:mail_save', 'onExecute' => 'javaScript:app.mail.mail_save',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
'save2filemanager' => array( 'save2filemanager' => array(
@ -732,7 +732,7 @@ class mail_ui
'hint' => 'Save message to filemanager', 'hint' => 'Save message to filemanager',
'group' => $group, 'group' => $group,
'icon' => 'filemanager/navbar', 'icon' => 'filemanager/navbar',
'onExecute' => 'javaScript:mail_save2fm', 'onExecute' => 'javaScript:app.mail.mail_save2fm',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
), ),
@ -747,7 +747,7 @@ class mail_ui
'hint' => 'View header lines', 'hint' => 'View header lines',
'group' => $group, 'group' => $group,
'icon' => 'kmmsgread', 'icon' => 'kmmsgread',
'onExecute' => 'javaScript:mail_header', 'onExecute' => 'javaScript:app.mail.mail_header',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
'mailsource' => array( 'mailsource' => array(
@ -755,7 +755,7 @@ class mail_ui
'hint' => 'View full Mail Source', 'hint' => 'View full Mail Source',
'group' => $group, 'group' => $group,
'icon' => 'fileexport', 'icon' => 'fileexport',
'onExecute' => 'javaScript:mail_mailsource', 'onExecute' => 'javaScript:app.mail.mail_mailsource',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
), ),
), ),
@ -777,27 +777,27 @@ class mail_ui
'label1' => array( 'label1' => array(
'caption' => "<font color='#ff0000'>".lang('urgent')."</font>", 'caption' => "<font color='#ff0000'>".lang('urgent')."</font>",
'icon' => 'mail_label1', 'icon' => 'mail_label1',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'label2' => array( 'label2' => array(
'caption' => "<font color='#ff8000'>".lang('job')."</font>", 'caption' => "<font color='#ff8000'>".lang('job')."</font>",
'icon' => 'mail_label2', 'icon' => 'mail_label2',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'label3' => array( 'label3' => array(
'caption' => "<font color='#008000'>".lang('personal')."</font>", 'caption' => "<font color='#008000'>".lang('personal')."</font>",
'icon' => 'mail_label3', 'icon' => 'mail_label3',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'label4' => array( 'label4' => array(
'caption' => "<font color='#0000ff'>".lang('to do')."</font>", 'caption' => "<font color='#0000ff'>".lang('to do')."</font>",
'icon' => 'mail_label4', 'icon' => 'mail_label4',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'label5' => array( 'label5' => array(
'caption' => "<font color='#8000ff'>".lang('later')."</font>", 'caption' => "<font color='#8000ff'>".lang('later')."</font>",
'icon' => 'mail_label5', 'icon' => 'mail_label5',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
), ),
), ),
@ -810,27 +810,27 @@ class mail_ui
'unlabel1' => array( 'unlabel1' => array(
'caption' => "<font color='#ff0000'>".lang('urgent')."</font>", 'caption' => "<font color='#ff0000'>".lang('urgent')."</font>",
'icon' => 'mail_unlabel1', 'icon' => 'mail_unlabel1',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'unlabel2' => array( 'unlabel2' => array(
'caption' => "<font color='#ff8000'>".lang('job')."</font>", 'caption' => "<font color='#ff8000'>".lang('job')."</font>",
'icon' => 'mail_unlabel2', 'icon' => 'mail_unlabel2',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'unlabel3' => array( 'unlabel3' => array(
'caption' => "<font color='#008000'>".lang('personal')."</font>", 'caption' => "<font color='#008000'>".lang('personal')."</font>",
'icon' => 'mail_unlabel3', 'icon' => 'mail_unlabel3',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'unlabel4' => array( 'unlabel4' => array(
'caption' => "<font color='#0000ff'>".lang('to do')."</font>", 'caption' => "<font color='#0000ff'>".lang('to do')."</font>",
'icon' => 'mail_unlabel4', 'icon' => 'mail_unlabel4',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
'unlabel5' => array( 'unlabel5' => array(
'caption' => "<font color='#8000ff'>".lang('later')."</font>", 'caption' => "<font color='#8000ff'>".lang('later')."</font>",
'icon' => 'mail_unlabel5', 'icon' => 'mail_unlabel5',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
), ),
), ),
), ),
@ -838,7 +838,7 @@ class mail_ui
'group' => ++$group, 'group' => ++$group,
'caption' => 'Flagged', 'caption' => 'Flagged',
'icon' => 'unread_flagged_small', 'icon' => 'unread_flagged_small',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
//'disableClass' => 'flagged', //'disableClass' => 'flagged',
//'enabled' => "javaScript:mail_disabledByClass", //'enabled' => "javaScript:mail_disabledByClass",
'shortcut' => egw_keymanager::shortcut(egw_keymanager::F, true, true), 'shortcut' => egw_keymanager::shortcut(egw_keymanager::F, true, true),
@ -847,7 +847,7 @@ class mail_ui
'group' => $group, 'group' => $group,
'caption' => 'Unflagged', 'caption' => 'Unflagged',
'icon' => 'read_flagged_small', 'icon' => 'read_flagged_small',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
//'enableClass' => 'flagged', //'enableClass' => 'flagged',
//'enabled' => "javaScript:mail_enabledByClass", //'enabled' => "javaScript:mail_enabledByClass",
'shortcut' => egw_keymanager::shortcut(egw_keymanager::U, true, true), 'shortcut' => egw_keymanager::shortcut(egw_keymanager::U, true, true),
@ -856,7 +856,7 @@ class mail_ui
'group' => $group, 'group' => $group,
'caption' => 'Read', 'caption' => 'Read',
'icon' => 'read_small', 'icon' => 'read_small',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
//'enableClass' => 'unseen', //'enableClass' => 'unseen',
//'enabled' => "javaScript:mail_enabledByClass", //'enabled' => "javaScript:mail_enabledByClass",
), ),
@ -864,7 +864,7 @@ class mail_ui
'group' => $group, 'group' => $group,
'caption' => 'Unread', 'caption' => 'Unread',
'icon' => 'unread_small', 'icon' => 'unread_small',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
//'disableClass' => 'unseen', //'disableClass' => 'unseen',
//'enabled' => "javaScript:mail_disabledByClass", //'enabled' => "javaScript:mail_disabledByClass",
), ),
@ -872,7 +872,7 @@ class mail_ui
'group' => $group, 'group' => $group,
'caption' => 'Undelete', 'caption' => 'Undelete',
'icon' => 'revert', 'icon' => 'revert',
'onExecute' => 'javaScript:mail_flag', 'onExecute' => 'javaScript:app.mail.mail_flag',
'enableClass' => 'deleted', 'enableClass' => 'deleted',
'enabled' => "javaScript:mail_enabledByClass", 'enabled' => "javaScript:mail_enabledByClass",
), ),
@ -882,12 +882,12 @@ class mail_ui
'caption' => 'Delete', 'caption' => 'Delete',
'hint' => $deleteOptions[$this->mail_bo->mailPreferences->preferences['deleteOptions']], 'hint' => $deleteOptions[$this->mail_bo->mailPreferences->preferences['deleteOptions']],
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:mail_delete', 'onExecute' => 'javaScript:app.mail.mail_delete',
), ),
'drag_mail' => array( 'drag_mail' => array(
'dragType' => 'mail', 'dragType' => 'mail',
'type' => 'drag', 'type' => 'drag',
'onExecute' => 'javaScript:mail_dragStart', 'onExecute' => 'javaScript:app.mail.mail_dragStart',
), ),
); );
// save as tracker, save as infolog, as this are actions that are either available for all, or not, we do that for all and not via css-class disabling // save as tracker, save as infolog, as this are actions that are either available for all, or not, we do that for all and not via css-class disabling
@ -1510,7 +1510,7 @@ unset($query['actions']);
*/ */
function ajax_setFolderStatus($_folder) function ajax_setFolderStatus($_folder)
{ {
//error_log(__METHOD__.__LINE__.array2string($_folder)); error_log(__METHOD__.__LINE__.array2string($_folder));
if ($_folder) if ($_folder)
{ {
$del = $this->mail_bo->getHierarchyDelimiter(false); $del = $this->mail_bo->getHierarchyDelimiter(false);
@ -1533,11 +1533,11 @@ unset($query['actions']);
} }
} }
} }
//error_log(__METHOD__.__LINE__.array2string($oA)); error_log(__METHOD__.__LINE__.array2string($oA));
if ($oA) if ($oA)
{ {
$response = egw_json_response::get(); $response = egw_json_response::get();
$response->call('mail_setFolderStatus',$oA,'mail'); $response->call('app.mail.mail_setFolderStatus',$oA,'mail');
} }
} }
} }

View File

@ -30,7 +30,7 @@ init: function() {
this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut); this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut);
//inital call of refresh folderstatus //inital call of refresh folderstatus
var self = this; var self = this;
window.setTimeout(function() {self.mail_refreshFolderStatus();},1000); window.setTimeout(function() {self.mail_refreshFolderStatus.apply(self);},1000);
}, },
open: function(action, senders, ids) { open: function(action, senders, ids) {
@ -54,7 +54,7 @@ mail_startTimerFolderStatusUpdate: function(_refreshTimeOut) {
} }
if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds
var self = this; var self = this;
this.mail_doTimedRefresh = window.setInterval(self.mail_refreshFolderStatus, _refreshTimeOut); this.mail_doTimedRefresh = window.setInterval(function() {self.mail_refreshFolderStatus.apply(self)}, _refreshTimeOut);
} }
}, },
@ -92,12 +92,13 @@ mail_queueRefreshFolderList: function(_folders)
// Copy idx onto the anonymous function scope // Copy idx onto the anonymous function scope
var idx = this.mail_queuedFoldersIndex; var idx = this.mail_queuedFoldersIndex;
var self = this;
window.setTimeout(function() { window.setTimeout(function() {
if (idx == this.mail_queuedFoldersIndex) if (idx == self.mail_queuedFoldersIndex)
{ {
//var folders = mail_queuedFolders.join(","); //var folders = mail_queuedFolders.join(",");
this.mail_queuedFoldersIndex = 0; self.mail_queuedFoldersIndex = 0;
this.mail_queuedFolders = []; self.mail_queuedFolders = [];
var request = new egw_json_request('mail.mail_ui.ajax_setFolderStatus',[_folders]); var request = new egw_json_request('mail.mail_ui.ajax_setFolderStatus',[_folders]);
request.sendRequest(); request.sendRequest();
@ -134,7 +135,7 @@ mail_refreshMessageGrid: function() {
app_refresh: function(_msg, _app, _id, _type) app_refresh: function(_msg, _app, _id, _type)
{ {
var bufferExists = false; var bufferExists = false;
window.clearInterval(this.doStatus); // whatever message was up to be activated window.clearInterval(app.mail.doStatus); // whatever message was up to be activated
//alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')"); //alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
//myCurrentMsg = mail_getMsg(); //myCurrentMsg = mail_getMsg();
//if (myCurrentMsg.length) { //if (myCurrentMsg.length) {
@ -142,7 +143,7 @@ app_refresh: function(_msg, _app, _id, _type)
myMessageBuffer = ""; //myCurrentMsg; myMessageBuffer = ""; //myCurrentMsg;
bufferExists = true; bufferExists = true;
//} //}
mail_setMsg('<span style="font-weight: bold;">' +_msg+ '</span>'); app.mail.mail_setMsg('<span style="font-weight: bold;">' +_msg+ '</span>');
if (_app=='mail') if (_app=='mail')
{ {
//we may want to trigger some actions, like modifying the grid, disable preview and stuff //we may want to trigger some actions, like modifying the grid, disable preview and stuff
@ -151,7 +152,7 @@ app_refresh: function(_msg, _app, _id, _type)
} }
if (bufferExists) if (bufferExists)
{ {
this.doStatus = window.setInterval("egw_appWindow('mail').mail_setMsg(myMessageBuffer);", 10000); this.doStatus = window.setInterval("app.mail.mail_setMsg(myMessageBuffer);", 10000);
} }
}, },
@ -191,13 +192,13 @@ mail_setMsg: function(myMsg)
*/ */
mail_delete: function(_action,_elems) mail_delete: function(_action,_elems)
{ {
var msg = mail_getFormData(_elems); var msg = this.mail_getFormData(_elems);
//alert(_action.id+','+ msg); //alert(_action.id+','+ msg);
app_refresh(egw.lang('delete messages'), 'mail'); app_refresh(egw.lang('delete messages'), 'mail');
mail_setRowClass(_elems,'deleted'); this.mail_setRowClass(_elems,'deleted');
var request = new egw_json_request('mail.mail_ui.ajax_deleteMessages',[msg]); var request = new egw_json_request('mail.mail_ui.ajax_deleteMessages',[msg]);
request.sendRequest(false); request.sendRequest(false);
mail_refreshMessageGrid() this.mail_refreshMessageGrid()
}, },
/** /**
@ -248,7 +249,7 @@ mail_changeProfile: function(folder,_widget) {
// alert(folder); // alert(folder);
var request = new egw_json_request('mail.mail_ui.ajax_changeProfile',[folder]); var request = new egw_json_request('mail.mail_ui.ajax_changeProfile',[folder]);
request.sendRequest(false); request.sendRequest(false);
mail_refreshMessageGrid(); this.mail_refreshMessageGrid();
return true; return true;
}, },
@ -266,7 +267,7 @@ mail_changeFolder: function(folder,_widget) {
{ {
if (!(img.search(eval('/'+'thunderbird'+'/'))<0)) if (!(img.search(eval('/'+'thunderbird'+'/'))<0))
{ {
rv = mail_changeProfile(folder,_widget); rv = this.mail_changeProfile(folder,_widget);
if (rv) if (rv)
{ {
return rv; return rv;
@ -313,9 +314,9 @@ mail_changeFolder: function(folder,_widget) {
mail_flag: function(_action, _elems) mail_flag: function(_action, _elems)
{ {
//alert(_action.id+' - '+_elems[0].id); //alert(_action.id+' - '+_elems[0].id);
var msg = mail_getFormData(_elems); var msg = this.mail_getFormData(_elems);
// //
mail_flagMessages(_action.id,msg); this.mail_flagMessages(_action.id,msg);
}, },
/** /**
@ -329,7 +330,7 @@ mail_flagMessages: function(_flag, _elems)
app_refresh(egw.lang('flag messages'), 'mail'); app_refresh(egw.lang('flag messages'), 'mail');
var request = new egw_json_request('mail.mail_ui.ajax_flagMessages',[_flag, _elems]); var request = new egw_json_request('mail.mail_ui.ajax_flagMessages',[_flag, _elems]);
request.sendRequest(false); request.sendRequest(false);
mail_refreshMessageGrid() this.mail_refreshMessageGrid()
}, },
/** /**
@ -354,7 +355,7 @@ mail_header: function(_action, _elems)
var url = window.egw_webserverUrl+'/index.php?'; var url = window.egw_webserverUrl+'/index.php?';
url += 'menuaction=mail.mail_ui.displayHeader'; // todo compose for Draft folder url += 'menuaction=mail.mail_ui.displayHeader'; // todo compose for Draft folder
url += '&id='+_elems[0].id; url += '&id='+_elems[0].id;
mail_displayHeaderLines(url); this.mail_displayHeaderLines(url);
}, },
/** /**
@ -370,7 +371,7 @@ mail_mailsource: function(_action, _elems)
url += 'menuaction=mail.mail_ui.saveMessage'; // todo compose for Draft folder url += 'menuaction=mail.mail_ui.saveMessage'; // todo compose for Draft folder
url += '&id='+_elems[0].id; url += '&id='+_elems[0].id;
url += '&location=display'; url += '&location=display';
mail_displayHeaderLines(url); this.mail_displayHeaderLines(url);
}, },
/** /**

View File

@ -2,7 +2,7 @@
/** /**
* EGroupware - eTemplates for Application mail * EGroupware - eTemplates for Application mail
* http://www.egroupware.org * http://www.egroupware.org
* generated by soetemplate::dump4setup() 2013-02-20 14:05 * generated by soetemplate::dump4setup() 2013-04-09 15:37
* *
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package mail * @package mail
@ -12,9 +12,11 @@
$templ_version=1; $templ_version=1;
$templ_data[] = array('name' => 'mail.index','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:3:{i:0;a:5:{s:7:"onclick";s:47:"mail_changeFolder(widget.event_args[0],widget);";s:4:"name";s:14:"nm[foldertree]";s:4:"type";s:4:"tree";s:11:"parent_node";s:11:"tree_target";s:11:"autoloading";s:28:"mail.mail_ui.ajax_foldertree";}i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:3:"msg";}i:2;a:3:{s:4:"name";s:2:"nm";s:4:"size";s:15:"mail.index.rows";s:4:"type";s:9:"nextmatch";}}','size' => '','style' => '','modified' => '1360682502',); $templ_data[] = array('name' => 'mail.index','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:4:{i:0;a:5:{s:7:"onclick";s:56:"app.mail.mail_changeFolder(widget.event_args[0],widget);";s:4:"name";s:14:"nm[foldertree]";s:4:"type";s:4:"tree";s:11:"parent_node";s:11:"tree_target";s:11:"autoloading";s:28:"mail.mail_ui.ajax_foldertree";}i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:3:"msg";}i:2;a:3:{s:4:"name";s:2:"nm";s:4:"size";s:15:"mail.index.rows";s:4:"type";s:9:"nextmatch";}i:3;a:3:{s:4:"type";s:8:"template";s:4:"name";s:7:"preview";s:4:"size";s:12:"mail.preview";}}','size' => '','style' => '','modified' => '1365514624',);
$templ_data[] = array('name' => 'mail.index.rows','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:9:{s:2:"c1";s:2:"th";s:1:"A";s:2:"25";s:1:"F";s:3:"120";s:1:"E";s:2:"95";s:2:"c2";s:16:"$row_cont[class]";s:1:"G";s:3:"120";s:1:"H";s:2:"50";s:1:"C";s:2:"20";s:1:"B";s:2:"20";}i:1;a:8:{s:1:"A";a:4:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:2:"ID";s:4:"name";s:3:"uid";s:8:"readonly";s:1:"1";}s:1:"B";a:4:{s:4:"type";s:16:"nextmatch-header";s:4:"name";s:6:"status";s:5:"label";s:3:"St.";s:4:"help";s:6:"Status";}s:1:"C";a:4:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:3:"...";s:4:"name";s:11:"attachments";s:4:"help";s:16:"attachments, ...";}s:1:"D";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"subject";s:5:"label";s:7:"subject";}s:1:"E";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"date";s:4:"name";s:4:"date";s:5:"align";s:6:"center";}s:1:"F";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:2:"to";s:4:"name";s:9:"toaddress";}s:1:"G";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"from";s:4:"name";s:11:"fromaddress";}s:1:"H";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"size";s:4:"name";s:4:"size";s:5:"align";s:6:"center";}}i:2;a:8:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:11:"${row}[uid]";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"span";s:12:"1,status_img";}s:1:"C";a:2:{s:4:"type";s:4:"html";s:4:"name";s:19:"${row}[attachments]";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[subject]";}s:1:"E";a:4:{s:4:"type";s:15:"date-time_today";s:4:"name";s:12:"${row}[date]";s:8:"readonly";s:1:"1";s:5:"align";s:6:"center";}s:1:"F";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:17:"${row}[toaddress]";s:8:"readonly";s:1:"1";}s:1:"G";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:19:"${row}[fromaddress]";s:8:"readonly";s:1:"1";}s:1:"H";a:5:{s:4:"type";s:8:"vfs-size";s:4:"name";s:12:"${row}[size]";s:7:"no_lang";s:1:"1";s:8:"readonly";s:1:"1";s:5:"align";s:5:"right";}}}s:4:"rows";i:2;s:4:"cols";i:8;}}','size' => '','style' => '','modified' => '1360252030',); $templ_data[] = array('name' => 'mail.index.rows','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:9:{s:2:"c1";s:2:"th";s:1:"A";s:2:"25";s:1:"F";s:3:"120";s:1:"E";s:2:"95";s:2:"c2";s:16:"$row_cont[class]";s:1:"G";s:3:"120";s:1:"H";s:2:"50";s:1:"C";s:2:"20";s:1:"B";s:2:"20";}i:1;a:8:{s:1:"A";a:4:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:2:"ID";s:4:"name";s:3:"uid";s:8:"readonly";s:1:"1";}s:1:"B";a:4:{s:4:"type";s:16:"nextmatch-header";s:4:"name";s:6:"status";s:5:"label";s:3:"St.";s:4:"help";s:6:"Status";}s:1:"C";a:4:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:3:"...";s:4:"name";s:11:"attachments";s:4:"help";s:16:"attachments, ...";}s:1:"D";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"subject";s:5:"label";s:7:"subject";}s:1:"E";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"date";s:4:"name";s:4:"date";s:5:"align";s:6:"center";}s:1:"F";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:2:"to";s:4:"name";s:9:"toaddress";}s:1:"G";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"from";s:4:"name";s:11:"fromaddress";}s:1:"H";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"size";s:4:"name";s:4:"size";s:5:"align";s:6:"center";}}i:2;a:8:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:11:"${row}[uid]";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"span";s:12:"1,status_img";}s:1:"C";a:2:{s:4:"type";s:4:"html";s:4:"name";s:19:"${row}[attachments]";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[subject]";}s:1:"E";a:4:{s:4:"type";s:15:"date-time_today";s:4:"name";s:12:"${row}[date]";s:8:"readonly";s:1:"1";s:5:"align";s:6:"center";}s:1:"F";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:17:"${row}[toaddress]";s:8:"readonly";s:1:"1";}s:1:"G";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:19:"${row}[fromaddress]";s:8:"readonly";s:1:"1";}s:1:"H";a:5:{s:4:"type";s:8:"vfs-size";s:4:"name";s:12:"${row}[size]";s:7:"no_lang";s:1:"1";s:8:"readonly";s:1:"1";s:5:"align";s:5:"right";}}}s:4:"rows";i:2;s:4:"cols";i:8;}}','size' => '','style' => '','modified' => '1360252030',);
$templ_data[] = array('name' => 'mail.preview','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"subject";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:7:"subject";}}}s:4:"rows";i:1;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1363178999',);
$templ_data[] = array('name' => 'mail.TestConnection','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1360585356',); $templ_data[] = array('name' => 'mail.TestConnection','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1360585356',);

View File

@ -268,6 +268,15 @@ pre {
.dtree table, .dtree tr, .dtree td { .dtree table, .dtree tr, .dtree td {
border: none; border: none;
} }
.dtree table {
overflow: hidden;
width: 100%;
display: table-row;
}
.dtree tbody, .dtree tr, .dtree td, .dtree span {
width: 100%;
overflow: hidden;
}
/* /*
influence the tree display and scrolling behavior influence the tree display and scrolling behavior
*/ */
@ -282,3 +291,9 @@ pre {
overflow-y: auto; overflow-y: auto;
z-index:100; z-index:100;
} }
/*
we need the the image displayed with our buttons on the left side
*/
input[type=button] {
background-position: left;
}