git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12047
7612ce4b-ef26-0410-bec9-
ea0150e637f0
- * The following functions are utility functions for this template. Do not
- * echo output in those functions. Output is generated above this comment block
+ * The following functions are utility functions for templates. Do not
+ * echo output in these functions.
*
* @copyright © 2005-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* @copyright © 2005-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @package squirrelmail
*/
* @package squirrelmail
*/
/** Load forms functions, needed for addsubmit(). */
include_once(SM_PATH . 'functions/forms.php');
/** Load forms functions, needed for addsubmit(). */
include_once(SM_PATH . 'functions/forms.php');
/**
* Generate a paginator link.
*
/**
* Generate a paginator link.
*
*/
function get_paginator_link($box, $start_msg, $text) {
sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
*/
function get_paginator_link($box, $start_msg, $text) {
sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
- $result = "<a href=\"$php_self?startMessage=$start_msg&mailbox=$box\" "
- . ">$text</a>";
-
- return ($result);
+ return create_hyperlink("$php_self?startMessage=$start_msg&mailbox=$box", $text);
/**
* This function computes the comapact paginator string.
*
/**
* This function computes the comapact paginator string.
*
- * @param string $box mailbox name
- * @param integer $iOffset offset in total number of messages
- * @param integer $iTotal total number of messages
- * @param integer $iLimit maximum number of messages to show on a page
- * @param bool $bShowAll show all messages at once (non paginate mode)
+ * @param string $box mailbox name
+ * @param integer $iOffset offset in total number of messages
+ * @param integer $iTotal total number of messages
+ * @param integer $iLimit maximum number of messages to show on a page
+ * @param bool $bShowAll whether or not to show all messages at once
+ * ("show all" == non paginate mode)
+ * @param bool $javascript_on whether or not javascript is currently enabled
+ * @param bool $page_selector whether or not to show the page selection widget
+ *
* @return string $result paginate string with links to pages
* @return string $result paginate string with links to pages
*/
function get_compact_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll, $javascript_on, $page_selector) {
*/
function get_compact_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll, $javascript_on, $page_selector) {
sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
/* Initialize paginator string chunks. */
sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
/* Initialize paginator string chunks. */
$box = urlencode($box);
/* Create simple strings that will be creating the paginator. */
$box = urlencode($box);
/* Create simple strings that will be creating the paginator. */
- $spc = ' '; /* This will be used as a space. */
- $sep = '|'; /* This will be used as a seperator. */
+ /* This will be used as a space. */
+ $spc = $oTemplate->fetch('non_breaking_space.tpl');
+ /* This will be used as a seperator. */
+ $sep = '|';
/* Make sure that our start message number is not too big. */
$iOffset = min($iOffset, $iTotal);
/* Make sure that our start message number is not too big. */
$iOffset = min($iOffset, $iTotal);
$last_grp = (($tot_pgs - 1) * $iLimit) + 1;
}
} else {
$last_grp = (($tot_pgs - 1) * $iLimit) + 1;
}
} else {
- $pg_str = "<a href=\"$php_self?showall=0"
- . "&startMessage=1&mailbox=$box\" "
- . ">" ._("Paginate") . '</a>';
+ $pg_str = create_hyperlink("$php_self?showall=0&startMessage=1&mailbox=$box", _("Paginate"));
}
/* Put all the pieces of the paginator string together. */
}
/* Put all the pieces of the paginator string together. */
if ( $prv_str || $nxt_str ) {
/* Compute the 'show all' string. */
if ( $prv_str || $nxt_str ) {
/* Compute the 'show all' string. */
- $all_str = "<a href=\"$php_self?showall=1"
- . "&startMessage=1&mailbox=$box\" "
- . ">" . _("Show All") . '</a>';
+ $all_str = create_hyperlink("$php_self?showall=1&startMessage=1&mailbox=$box", _("Show All"));
$result .= '[' . get_paginator_link($box, 1, '<<') . ']';
$result .= '[' . $prv_str . ']';
$result .= '[' . get_paginator_link($box, 1, '<<') . ']';
$result .= '[' . $prv_str . ']';
$result .= '[' . get_paginator_link($box, $last_grp, '>>') . ']';
if ($page_selector) {
$result .= '[' . get_paginator_link($box, $last_grp, '>>') . ']';
if ($page_selector) {
- $result .= $spc . '<select name="startMessage"';
- if ($javascript_on) {
- $result .= ' onchange="JavaScript:SubmitOnSelect'
- . '(this, \'' . $pg_url . '&startMessage=\')"';
- }
- $result .='>';
-
for ($p = 0; $p < $tot_pgs; $p++) {
for ($p = 0; $p < $tot_pgs; $p++) {
- $result .= '<option ';
- if (($p+1) == $cur_pg) $result .= 'selected ';
- $result .= 'value="' . (($p*$iLimit)+1) . '">'
- . ($p+1) . "/$tot_pgs" . '</option>';
+ $options[(($p*$iLimit)+1)] = ($p+1) . "/$tot_pgs";
-
- $result .= '</select>';
+ $result .= $spc . addSelect('startMessage', $options,
+ ((($cur_pg-1)*$iLimit)+1),
+ TRUE,
+ ($javascript_on ? array('onchange' => 'JavaScript:SubmitOnSelect(this, \'' . $pg_url . '&startMessage=\')') : array()));
- $result .= '<noscript language="JavaScript">'
- . addSubmit(_("Go"))
- . '</noscript>';
+//FIXME: What in the world? Two issues here: for one, $javascript_on is supposed
+// to have already detected whether or not JavaScript is available and enabled.
+// Secondly, we need to rid ourselves of any HTML output in the core. This
+// is being removed (but left in case the original author points out why it
+// should not be) and we'll trust $javascript_on to do the right thing.
+// $result .= '<noscript language="JavaScript">'
+// . addSubmit(_("Go"))
+// . '</noscript>';
} else {
$result .= addSubmit(_("Go"));
}
} else {
$result .= addSubmit(_("Go"));
}
/**
* This function computes the paginator string.
*
/**
* This function computes the paginator string.
*
- * @param string $box mailbox name
- * @param integer $iOffset offset in total number of messages
- * @param integer $iTotal total number of messages
- * @param integer $iLimit maximum number of messages to show on a page
- * @param bool $bShowAll show all messages at once (non paginate mode)
+ * @param string $box mailbox name
+ * @param integer $iOffset offset in total number of messages
+ * @param integer $iTotal total number of messages
+ * @param integer $iLimit maximum number of messages to show on a page
+ * @param bool $bShowAll whether or not to show all messages at once
+ * ("show all" == non paginate mode)
+ * @param bool $page_selector whether or not to show the page selection widget
+ * @param integer $page_selector_max maximum number of pages to show on the screen
+ *
* @return string $result paginate string with links to pages
* @return string $result paginate string with links to pages
*/
function get_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll,$page_selector, $page_selector_max) {
*/
function get_paginator_str($box, $iOffset, $iTotal, $iLimit, $bShowAll,$page_selector, $page_selector_max) {
sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
/* Initialize paginator string chunks. */
sqgetGlobalVar('PHP_SELF',$php_self,SQ_SERVER);
/* Initialize paginator string chunks. */
$box = urlencode($box);
/* Create simple strings that will be creating the paginator. */
$box = urlencode($box);
/* Create simple strings that will be creating the paginator. */
- $spc = ' '; /* This will be used as a space. */
- $sep = '|'; /* This will be used as a seperator. */
+ /* This will be used as a space. */
+ $spc = $oTemplate->fetch('non_breaking_space.tpl');
+ /* This will be used as a seperator. */
+ $sep = '|';
/* Make sure that our start message number is not too big. */
$iOffset = min($iOffset, $iTotal);
/* Make sure that our start message number is not too big. */
$iOffset = min($iOffset, $iTotal);
$last_grp = (($tot_pgs - 1) * $iLimit) + 1;
}
} else {
$last_grp = (($tot_pgs - 1) * $iLimit) + 1;
}
} else {
- $pg_str = "<a href=\"$php_self?showall=0"
- . "&startMessage=1&mailbox=$box\" "
- . ">" ._("Paginate") . '</a>';
+ $pg_str = create_hyperlink("$php_self?showall=0&startMessage=1&mailbox=$box", _("Paginate"));
}
/* Put all the pieces of the paginator string together. */
}
/* Put all the pieces of the paginator string together. */
if ( $prv_str || $nxt_str ) {
/* Compute the 'show all' string. */
if ( $prv_str || $nxt_str ) {
/* Compute the 'show all' string. */
- $all_str = "<a href=\"$php_self?showall=1"
- . "&startMessage=1&mailbox=$box\" "
- . ">" . _("Show All") . '</a>';
+ $all_str = create_hyperlink("$php_self?showall=1&startMessage=1&mailbox=$box", _("Show All"));
$result .= '[';
$result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : '');
$result .= '[';
$result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : '');
/* If the resulting string is blank, return a non-breaking space. */
if ($result == '') {
/* If the resulting string is blank, return a non-breaking space. */
if ($result == '') {
+ $result = $oTemplate->fetch('non_breaking_space.tpl');
}
/* Return our final magical compact paginator string. */
return ($result);
}
}
/* Return our final magical compact paginator string. */
return ($result);
}
*
* Template and utility functions to create a paginator
*
*
* Template and utility functions to create a paginator
*
+ * The following variables are available in this template:
+//FIXME: need to clean (and document) this list, it is just a dump of the array keys of $t
+ * $sTemplateID
+ * $icon_theme_path
+ * $javascript_on
+ * $delayed_errors
+ * $frames
+ * $lang
+ * $page_title
+ * $header_tags
+ * $plugin_output
+ * $header_sent
+ * $body_tag_js
+ * $shortBoxName
+ * $sm_attribute_str
+ * $frame_top
+ * $urlMailbox
+ * $startMessage
+ * $hide_sm_attributions
+ * $uri
+ * $text
+ * $onclick
+ * $class
+ * $id
+ * $target
+ * $color
+ * $form_name
+ * $form_id
+ * $page_selector
+ * $page_selector_max
+ * $messagesPerPage
+ * $showall
+ * $end_msg
+ * $align
+ * $iNumberOfMessages
+ * $aOrder
+ * $aFormElements
+ * $sort
+ * $pageOffset
+ * $baseurl
+ * $aMessages
+ * $trash_folder
+ * $sent_folder
+ * $draft_folder
+ * $thread_link_str
+ * $php_self
+ * $mailbox
+ * $enablesort
+ * $icon_theme
+ * $use_icons
+ * $alt_index_colors
+ * $fancy_index_highlite
+ * $aSortSupported
+ * $show_label_columns
+ * $compact_paginator
+ * $aErrors
+ *
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
*/
/** include functions */
*/
/** include functions */
-include_once(SM_PATH.'templates/util_paginator.php');
+include_once(SM_PATH . 'functions/template/paginator_util.php');
static $bScriptAdded;
extract($t);
static $bScriptAdded;
extract($t);
-if ($javascript_on && $compact_paginator &&!isset($bScriptAdded)) {
+if ($javascript_on && $compact_paginator && !isset($bScriptAdded)) {