From: Michael M Slusarz Date: Mon, 30 Mar 2009 19:01:57 +0000 (-0600) Subject: Ticket #8126: Implement readonly mailboxes in dimp view X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d5d067dbaaa63aeae6eed60492dea04d3dce9afe;p=horde.git Ticket #8126: Implement readonly mailboxes in dimp view --- diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index 94b74b7fc..654bfd265 100644 --- a/imp/js/src/DimpBase.js +++ b/imp/js/src/DimpBase.js @@ -446,7 +446,7 @@ var DimpBase = { this.setMessageListTitle(); }.bind(this), onComplete: function() { - var row, ssc, + var row, ssc, tmp, l = this.viewport.getMetaData('label'); if (this.uid) { @@ -489,6 +489,25 @@ var DimpBase = { } } } + + /* Read-only changes. 'oa_setflag' is handled + * elsewhere. */ + tmp = [ $('button_deleted') ].compact().invoke('up', 'SPAN'); + [ 'ctx_message_', 'ctx_draft_' ].each(function(c) { + var t = $(c + 'setflag'); + if (t) { + tmp = tmp.concat([ t, t.previous('DIV.sep'), t.next('DIV.sep') ]); + } + tmp = tmp.concat($(c + 'deleted', c + 'undeleted')); + }); + + if (this.viewport.getMetaData('readonly')) { + tmp.compact().invoke('hide'); + $('folderName').next().show(); + } else { + tmp.compact().invoke('show'); + $('folderName').next().hide(); + } } else if (this.filtertoggle) { if (this.filtertoggle == 1 && this.viewport.getMetaData('sortby') == DIMP.conf.sortthread) { @@ -740,7 +759,13 @@ var DimpBase = { break; case 'ctx_otheractions': - $('oa_setflag', 'oa_sep1', 'oa_blacklist', 'oa_whitelist', 'oa_sep2', 'oa_undeleted').compact().invoke(this.viewport.getSelected().size() ? 'show' : 'hide'); + tmp = $('oa_sep1', 'oa_blacklist', 'oa_whitelist', 'oa_sep2', 'oa_undeleted'); + if (this.viewport.getMetaData('readonly')) { + $('oa_setflag').hide().previous('DIV.sep').hide(); + } else { + tmp.push($('oa_setflag')); + } + tmp.compact().invoke(this.viewport.getSelected().size() ? 'show' : 'hide'); break; default: diff --git a/imp/lib/Views/ListMessages.php b/imp/lib/Views/ListMessages.php index 5a724fd2c..ef0baa8da 100644 --- a/imp/lib/Views/ListMessages.php +++ b/imp/lib/Views/ListMessages.php @@ -93,7 +93,7 @@ class IMP_Views_ListMessages /* Create the base object. */ $result = new stdClass; $result->id = $mbox; - $result->reset = false; + $result->reset = 0; $result->totalrows = $msgcount; $result->label = $label; $result->cacheid = $imp_mailbox->getCacheID(); @@ -141,6 +141,9 @@ class IMP_Views_ListMessages if ($GLOBALS['imp_search']->isSearchMbox($mbox)) { $md->search = 1; } + if ($GLOBALS['imp_imap']->isReadOnly($mbox)) { + $md->readonly = 1; + } /* Check for mailbox existence now. If there are no messages, there * is a chance that the mailbox doesn't exist. If there is at least diff --git a/imp/message-dimp.php b/imp/message-dimp.php index fbe0940fd..7d3b5b413 100644 --- a/imp/message-dimp.php +++ b/imp/message-dimp.php @@ -19,6 +19,7 @@ if (!$index || !$folder) { } $imp_ui = new IMP_UI_Message(); +$readonly = $imp_imap->isReadOnly($folder); $args = array( 'headers' => array_diff(array_keys($imp_ui->basicHeaders()), array('subject')), @@ -63,6 +64,7 @@ foreach (array('from', 'to', 'cc', 'bcc', 'replyTo') as $val) { $compose_result['js'][] = 'DimpFullmessage.' . $val . ' = ' . Horde_Serialize::serialize($show_msg_result[$val], Horde_Serialize::JSON); } } + IMP::addInlineScript($compose_result['js']); IMP::addInlineScript($compose_result['jsonload'], 'load'); IMP::addInlineScript(array(DIMP::notify()), 'dom'); diff --git a/imp/templates/chunks/message.php b/imp/templates/chunks/message.php index 3c0befdde..b8c990226 100644 --- a/imp/templates/chunks/message.php +++ b/imp/templates/chunks/message.php @@ -49,9 +49,11 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true) + + diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index 24cc363f7..36dd71f7c 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -165,6 +165,7 @@ function _simpleButton($id, $text, $image, $imagedir = null) + diff --git a/imp/themes/graphics/locked.png b/imp/themes/graphics/locked.png new file mode 100644 index 000000000..e79c2a534 Binary files /dev/null and b/imp/themes/graphics/locked.png differ diff --git a/imp/themes/screen-dimp.css b/imp/themes/screen-dimp.css index 9fd54f77b..0c4c43ef2 100644 --- a/imp/themes/screen-dimp.css +++ b/imp/themes/screen-dimp.css @@ -1116,3 +1116,7 @@ span.keyupImg { span.keydownImg { background-image: url("graphics/key_down.png"); } +span.readonlyImg { + background-image: url("graphics/locked.png"); + vertical-align: sub; +} diff --git a/imp/themes/silver/graphics/locked.png b/imp/themes/silver/graphics/locked.png new file mode 100644 index 000000000..2ebc4f6f9 Binary files /dev/null and b/imp/themes/silver/graphics/locked.png differ diff --git a/imp/themes/silver/screen-dimp.css b/imp/themes/silver/screen-dimp.css index 5ffe2c80b..d65c3b4b1 100644 --- a/imp/themes/silver/screen-dimp.css +++ b/imp/themes/silver/screen-dimp.css @@ -203,3 +203,6 @@ span.keyupImg { span.keydownImg { background-image: url("graphics/key_down.png"); } +span.readonlyImg { + background-image: url("graphics/locked.png"); +}