summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-13 17:22:35 +0000
committeralecpl <alec@alec.pl>2011-05-13 17:22:35 +0000
commit8e99ffbcaccf83602a47b2be230eb4dd2f106399 (patch)
tree50390a0c5594568db2ba536c369d219734a6f99f
parenta208a4fa68d3c26c34ca3dae250267fec761675c (diff)
- Use less included files in mail and message templates for better performance
- Add access to template name in template expressions
-rwxr-xr-xprogram/include/rcube_template.php9
-rw-r--r--skins/default/includes/forwardmenu.html7
-rw-r--r--skins/default/includes/messagemenu.html10
-rw-r--r--skins/default/includes/messagetoolbar.html65
-rw-r--r--skins/default/includes/replyallmenu.html7
-rw-r--r--skins/default/templates/mail.html33
-rw-r--r--skins/default/templates/message.html23
7 files changed, 74 insertions, 80 deletions
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index 3131b39c2..8495ab8ee 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -38,6 +38,7 @@ class rcube_template extends rcube_html_page
private $js_commands = array();
private $object_handlers = array();
private $plugin_skin_path;
+ private $template_name;
public $browser;
public $framed = false;
@@ -365,7 +366,9 @@ class rcube_template extends rcube_html_page
$plugin = false;
$realname = $name;
$temp = explode('.', $name, 2);
+
$this->plugin_skin_path = null;
+ $this->template_name = $realname;
if (count($temp) > 1) {
$plugin = $temp[0];
@@ -600,7 +603,8 @@ class rcube_template extends rcube_html_page
'/env:([a-z0-9_]+)/i',
'/request:([a-z0-9_]+)/i',
'/cookie:([a-z0-9_]+)/i',
- '/browser:([a-z0-9_]+)/i'
+ '/browser:([a-z0-9_]+)/i',
+ '/template:name/i',
),
array(
"\$_SESSION['\\1']",
@@ -608,7 +612,8 @@ class rcube_template extends rcube_html_page
"\$this->env['\\1']",
"get_input_value('\\1', RCUBE_INPUT_GPC)",
"\$_COOKIE['\\1']",
- "\$this->browser->{'\\1'}"
+ "\$this->browser->{'\\1'}",
+ $this->template_name,
),
$expression);
}
diff --git a/skins/default/includes/forwardmenu.html b/skins/default/includes/forwardmenu.html
deleted file mode 100644
index 685d67ec5..000000000
--- a/skins/default/includes/forwardmenu.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<div id="forwardmenu" class="popupmenu">
- <ul>
- <li><roundcube:button command="forward" label="forwardinline" prop="sub" classAct="forwardlink active" class="forwardlink" /></li>
- <li><roundcube:button command="forward-attachment" label="forwardattachment" prop="sub" classAct="forwardattachmentlink active" class="forwardattachmentlink" /></li>
- <roundcube:container name="forwardmenu" id="forwardmenu" />
- </ul>
-</div>
diff --git a/skins/default/includes/messagemenu.html b/skins/default/includes/messagemenu.html
deleted file mode 100644
index e89155ae8..000000000
--- a/skins/default/includes/messagemenu.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<div id="messagemenu" class="popupmenu">
- <ul class="toolbarmenu">
- <li><roundcube:button class="printlink" command="print" label="printmessage" classAct="printlink active" /></li>
- <li><roundcube:button class="downloadlink" command="download" label="emlsave" classAct="downloadlink active" /></li>
- <li><roundcube:button class="editlink" command="edit" label="editasnew" classAct="editlink active" /></li>
- <li class="separator_below"><roundcube:button class="sourcelink" command="viewsource" label="viewsource" classAct="sourcelink active" /></li>
- <li><roundcube:button class="openlink" command="open" label="openinextwin" target="_blank" classAct="openlink active" /></li>
- <roundcube:container name="messagemenu" id="messagemenu" />
- </ul>
-</div>
diff --git a/skins/default/includes/messagetoolbar.html b/skins/default/includes/messagetoolbar.html
new file mode 100644
index 000000000..dcc27caea
--- /dev/null
+++ b/skins/default/includes/messagetoolbar.html
@@ -0,0 +1,65 @@
+<div id="messagetoolbar">
+<roundcube:if condition="template:name == 'message'" />
+<roundcube:button command="list" type="link" class="button back" classAct="button back" classSel="button backSel" title="backtolist" content=" " />
+<roundcube:else />
+<roundcube:button command="checkmail" type="link" class="button checkmail" classAct="button checkmail" classSel="button checkmailSel" title="checkmail" content=" " />
+<roundcube:endif />
+<roundcube:button command="compose" type="link" class="button compose" classAct="button compose" classSel="button composeSel" title="writenewmessage" content=" " />
+<roundcube:button command="reply" type="link" class="buttonPas reply" classAct="button reply" classSel="button replySel" title="replytomessage" content=" " />
+<span class="dropbutton">
+<roundcube:button command="reply-all" type="link" class="buttonPas replyAll" classAct="button replyAll" classSel="button replyAllSel" title="replytoallmessage" content=" " />
+<span id="replyallmenulink" onclick="rcmail_ui.show_popup('replyallmenu');return false"></span>
+</span>
+<span class="dropbutton">
+<roundcube:button command="forward" type="link" class="buttonPas forward" classAct="button forward" classSel="button forwardSel" title="forwardmessage" content=" " />
+<span id="forwardmenulink" onclick="rcmail_ui.show_popup('forwardmenu');return false"></span>
+</span>
+<roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletemessage" content=" " />
+<roundcube:container name="toolbar" id="messagetoolbar" />
+<roundcube:if condition="template:name == 'mail'" />
+<roundcube:button name="markmenulink" id="markmenulink" type="link" class="button markmessage" title="markmessages" onclick="rcmail_ui.show_popup('markmenu');return false" content=" " />
+<roundcube:endif />
+<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " />
+<roundcube:if condition="template:name == 'message'" />
+<roundcube:object name="mailboxlist" type="select" noSelection="moveto" maxlength="25" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" folder_filter="mail" />
+<roundcube:endif />
+</div>
+
+<div id="forwardmenu" class="popupmenu">
+ <ul>
+ <li><roundcube:button command="forward" label="forwardinline" prop="sub" classAct="forwardlink active" class="forwardlink" /></li>
+ <li><roundcube:button command="forward-attachment" label="forwardattachment" prop="sub" classAct="forwardattachmentlink active" class="forwardattachmentlink" /></li>
+ <roundcube:container name="forwardmenu" id="forwardmenu" />
+ </ul>
+</div>
+
+<div id="replyallmenu" class="popupmenu">
+ <ul>
+ <li><roundcube:button command="reply-all" label="replyall" prop="sub" classAct="replyalllink active" class="replyalllink" /></li>
+ <li><roundcube:button command="reply-list" label="replylist" prop="sub" classAct="replylistlink active" class="replylistlink" /></li>
+ <roundcube:container name="replyallmenu" id="replyallmenu" />
+ </ul>
+</div>
+
+<div id="messagemenu" class="popupmenu">
+ <ul class="toolbarmenu">
+ <li><roundcube:button class="printlink" command="print" label="printmessage" classAct="printlink active" /></li>
+ <li><roundcube:button class="downloadlink" command="download" label="emlsave" classAct="downloadlink active" /></li>
+ <li><roundcube:button class="editlink" command="edit" label="editasnew" classAct="editlink active" /></li>
+ <li class="separator_below"><roundcube:button class="sourcelink" command="viewsource" label="viewsource" classAct="sourcelink active" /></li>
+ <li><roundcube:button class="openlink" command="open" label="openinextwin" target="_blank" classAct="openlink active" /></li>
+ <roundcube:container name="messagemenu" id="messagemenu" />
+ </ul>
+</div>
+
+<roundcube:if condition="template:name == 'mail'" />
+<div id="markmessagemenu" class="popupmenu">
+ <ul class="toolbarmenu">
+ <li><roundcube:button command="mark" prop="read" label="markread" classAct="readlink active" class="readlink" /></li>
+ <li><roundcube:button command="mark" prop="unread" label="markunread" classAct="unreadlink active" class="unreadlink" /></li>
+ <li><roundcube:button command="mark" prop="flagged" label="markflagged" classAct="flaggedlink active" class="flaggedlink" /></li>
+ <li><roundcube:button command="mark" prop="unflagged" label="markunflagged" classAct="unflaggedlink active" class="unflaggedlink" /></li>
+ <roundcube:container name="markmenu" id="markmessagemenu" />
+ </ul>
+</div>
+<roundcube:endif />
diff --git a/skins/default/includes/replyallmenu.html b/skins/default/includes/replyallmenu.html
deleted file mode 100644
index 5cf1236b4..000000000
--- a/skins/default/includes/replyallmenu.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<div id="replyallmenu" class="popupmenu">
- <ul>
- <li><roundcube:button command="reply-all" label="replyall" prop="sub" classAct="replyalllink active" class="replyalllink" /></li>
- <li><roundcube:button command="reply-list" label="replylist" prop="sub" classAct="replylistlink active" class="replylistlink" /></li>
- <roundcube:container name="replyallmenu" id="replyallmenu" />
- </ul>
-</div>
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html
index 7ea93145d..ea6a2f71c 100644
--- a/skins/default/templates/mail.html
+++ b/skins/default/templates/mail.html
@@ -102,41 +102,10 @@
</div>
</div>
-
-</div>
-</div>
-
-<div id="messagetoolbar">
-<roundcube:button command="checkmail" type="link" class="button checkmail" classAct="button checkmail" classSel="button checkmailSel" title="checkmail" content=" " />
-<roundcube:button command="compose" type="link" class="button compose" classAct="button compose" classSel="button composeSel" title="writenewmessage" content=" " />
-<roundcube:button command="reply" type="link" class="buttonPas reply" classAct="button reply" classSel="button replySel" title="replytomessage" content=" " />
-<span class="dropbutton">
-<roundcube:button command="reply-all" type="link" class="buttonPas replyAll" classAct="button replyAll" classSel="button replyAllSel" title="replytoallmessage" content=" " />
-<span id="replyallmenulink" onclick="rcmail_ui.show_popup('replyallmenu');return false"></span>
-</span>
-<span class="dropbutton">
-<roundcube:button command="forward" type="link" class="buttonPas forward" classAct="button forward" classSel="button forwardSel" title="forwardmessage" content=" " />
-<span id="forwardmenulink" onclick="rcmail_ui.show_popup('forwardmenu');return false"></span>
-</span>
-<roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletemessage" content=" " />
-<roundcube:container name="toolbar" id="messagetoolbar" />
-<roundcube:button name="markmenulink" id="markmenulink" type="link" class="button markmessage" title="markmessages" onclick="rcmail_ui.show_popup('markmenu');return false" content=" " />
-<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " />
</div>
-
-<div id="markmessagemenu" class="popupmenu">
- <ul class="toolbarmenu">
- <li><roundcube:button command="mark" prop="read" label="markread" classAct="readlink active" class="readlink" /></li>
- <li><roundcube:button command="mark" prop="unread" label="markunread" classAct="unreadlink active" class="unreadlink" /></li>
- <li><roundcube:button command="mark" prop="flagged" label="markflagged" classAct="flaggedlink active" class="flaggedlink" /></li>
- <li><roundcube:button command="mark" prop="unflagged" label="markunflagged" classAct="unflaggedlink active" class="unflaggedlink" /></li>
- <roundcube:container name="markmenu" id="markmessagemenu" />
- </ul>
</div>
-<roundcube:include file="/includes/replyallmenu.html" />
-<roundcube:include file="/includes/forwardmenu.html" />
-<roundcube:include file="/includes/messagemenu.html" />
+<roundcube:include file="/includes/messagetoolbar.html" />
<div id="searchmenu" class="popupmenu">
<ul class="toolbarmenu">
diff --git a/skins/default/templates/message.html b/skins/default/templates/message.html
index 3fd14e4b6..8e2bb2cb3 100644
--- a/skins/default/templates/message.html
+++ b/skins/default/templates/message.html
@@ -16,28 +16,7 @@
<roundcube:include file="/includes/taskbar.html" />
<roundcube:include file="/includes/header.html" />
-
-<div id="messagetoolbar">
-<roundcube:button command="list" type="link" class="button back" classAct="button back" classSel="button backSel" title="backtolist" content=" " />
-<roundcube:button command="compose" type="link" class="button compose" classAct="button compose" classSel="button composeSel" title="writenewmessage" content=" " />
-<roundcube:button command="reply" type="link" class="buttonPas reply" classAct="button reply" classSel="button replySel" title="replytomessage" content=" " />
-<span class="dropbutton">
-<roundcube:button command="reply-all" type="link" class="buttonPas replyAll" classAct="button replyAll" classSel="button replyAllSel" title="replytoallmessage" content=" " />
-<span id="replyallmenulink" onclick="rcmail_ui.show_popup('replyallmenu');return false"></span>
-</span>
-<span class="dropbutton">
-<roundcube:button command="forward" type="link" class="buttonPas forward" classAct="button forward" classSel="button forwardSel" title="forwardmessage" content=" " />
-<span id="forwardmenulink" onclick="rcmail_ui.show_popup('forwardmenu');return false"></span>
-</span>
-<roundcube:button command="delete" type="link" class="buttonPas delete" classAct="button delete" classSel="button deleteSel" title="deletemessage" content=" " />
-<roundcube:container name="toolbar" id="messagetoolbar" />
-<roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " />
-<roundcube:object name="mailboxlist" type="select" noSelection="moveto" maxlength="25" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" folder_filter="mail" />
-</div>
-
-<roundcube:include file="/includes/replyallmenu.html" />
-<roundcube:include file="/includes/forwardmenu.html" />
-<roundcube:include file="/includes/messagemenu.html" />
+<roundcube:include file="/includes/messagetoolbar.html" />
<div id="mainscreen">
<div id="mailleftcontainer">