X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fhtml.php;h=41f38bd5debb87fa6b7df5dbe1700a08fa0a1b41;hp=3172bc5044d4c7fd855e0def212b323d61fea25e;hb=fdf58ef92a0b69f93bd08e22be831aa8172bfe62;hpb=bcc55e4b9574a2bf4741cbb091196fecff86ce42 diff --git a/functions/html.php b/functions/html.php index 3172bc50..41f38bd5 100644 --- a/functions/html.php +++ b/functions/html.php @@ -7,7 +7,7 @@ * the right to left implementation by "functionize" some * html outputs. * - * @copyright © 1999-2006 The SquirrelMail Project Team + * @copyright © 1999-2007 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -18,22 +18,31 @@ /** * Generates a hyperlink * - * @param string $uri The target link location - * @param string $text The link text - * @param string $target The location where the link should - * be opened (OPTIONAL; default not used) - * @param string $onclick The onClick JavaScript handler (OPTIONAL; - * default not used) - * @param string $class The CSS class name (OPTIONAL; default - * not used) - * @param string $id The ID name (OPTIONAL; default not used) + * @param string $uri The target link location + * @param string $text The link text + * @param string $target The location where the link should + * be opened (OPTIONAL; default not used) + * @param string $onclick The onClick JavaScript handler (OPTIONAL; + * default not used) + * @param string $class The CSS class name (OPTIONAL; default + * not used) + * @param string $id The ID name (OPTIONAL; default not used) + * @param string $name The anchor name (OPTIONAL; default not used) + * @param array $aAttribs Any extra attributes: this must be an + * associative array, where keys will be + * added as the attribute name, and values + * (which are optional - should be null if + * none should be used) will be placed in + * double quotes (pending template implementation) + * as the attribute value (OPTIONAL; default empty). * * @return string The desired hyperlink tag. * * @since 1.5.2 * */ -function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='') { +function create_hyperlink($uri, $text, $target='', $onclick='', + $class='', $id='', $name='', $aAttribs=array()) { global $oTemplate; @@ -43,6 +52,9 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id=' $oTemplate->assign('onclick', $onclick); $oTemplate->assign('class', $class); $oTemplate->assign('id', $id); + $oTemplate->assign('name', $name); + + $oTemplate->assign('aAttribs', $aAttribs); return $oTemplate->fetch('hyperlink.tpl'); @@ -80,6 +92,13 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id=' * if for some reason the image tag * cannot or should not be produced * (OPTIONAL; default not used) + * @param array $aAttribs Any extra attributes: this must be an + * associative array, where keys will be + * added as the attribute name, and values + * (which are optional - should be null if + * none should be used) will be placed in + * double quotes (pending template implementation) + * as the attribute value (OPTIONAL; default empty). * * @return string The desired hyperlink tag. * @@ -89,7 +108,7 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id=' function create_image($src, $alt='', $width='', $height='', $border='', $class='', $id='', $onclick='', $title='', $align='', $hspace='', $vspace='', - $text_alternative='') { + $text_alternative='', $aAttribs=array()) { global $oTemplate; @@ -107,13 +126,118 @@ function create_image($src, $alt='', $width='', $height='', $oTemplate->assign('vspace', $vspace); $oTemplate->assign('text_alternative', $text_alternative); + $oTemplate->assign('aAttribs', $aAttribs); + return $oTemplate->fetch('image.tpl'); } +/** + * Generates a label tag + * + * @param string $value The contents that belong inside the label + * @param string $for The ID to which the label applies (OPTIONAL; + * default not used) + * @param array $aAttribs Any extra attributes: this must be an + * associative array, where keys will be + * added as the attribute name, and values + * (which are optional - should be null if + * none should be used) will be placed in + * double quotes (pending template implementation) + * as the attribute value (OPTIONAL; default empty). + * + * @return string The desired label tag. + * + * @since 1.5.2 + * + */ +function create_label($value, $for='', $aAttribs=array()) { + + global $oTemplate; + + $oTemplate->assign('text', $value); + $oTemplate->assign('for', $for); + + $oTemplate->assign('aAttribs', $aAttribs); + + return $oTemplate->fetch('label.tpl'); + +} + + +/** + * Generates a span tag + * + * @param string $value The contents that belong inside the span + * @param string $class The CSS class name (OPTIONAL; default + * not used) + * @param string $id The ID name (OPTIONAL; default not used) + * @param array $aAttribs Any extra attributes: this must be an + * associative array, where keys will be + * added as the attribute name, and values + * (which are optional - should be null if + * none should be used) will be placed in + * double quotes (pending template implementation) + * as the attribute value (OPTIONAL; default empty). + * + * @return string The desired span tag. + * + * @since 1.5.2 + * + */ +function create_span($value, $class='', $id='', $aAttribs=array()) { + + global $oTemplate; + + $oTemplate->assign('value', $value); + $oTemplate->assign('class', $class); + $oTemplate->assign('id', $id); + + $oTemplate->assign('aAttribs', $aAttribs); + + return $oTemplate->fetch('span.tpl'); + +} + + +/** + * Generates an opening body tag + * + * @param string $onload Body onload JavaScript handler code + * (OPTIONAL; default not used) + * @param string $class The CSS class name (OPTIONAL; default + * not used) + * @param array $aAttribs Any extra attributes: this must be an + * associative array, where keys will be + * added as the attribute name, and values + * (which are optional - should be null if + * none should be used) will be placed in + * double quotes (pending template implementation) + * as the attribute value (OPTIONAL; default empty). + * + * @return string The desired body tag. + * + * @since 1.5.2 + * + */ +function create_body($onload='', $class='', $aAttribs=array()) { + + global $oTemplate; + + $oTemplate->assign('onload', $onload); + $oTemplate->assign('class', $class); + + $oTemplate->assign('aAttribs', $aAttribs); + + return $oTemplate->fetch('body.tpl'); + +} + + /** * Generates html tags +//FIXME: This should not be used anywhere in the core, or we should convert this to use templates. We sould not be assuming HTML output. * * @param string $tag Tag to output * @param string $val Value between tags @@ -191,14 +315,19 @@ function html_tag( $tag, // Tag to output /** * handy function to set url vars +//FIXME: You call this documentation? :-) What does "set url vars" mean? Looks like it might take a fully-formed URI (possibly with a query string) and adds a variable/value pair to it(?)... Does $link work on only the var being added or the whole URI? * * especially useful when $url = $PHP_SELF + * * @param string $url url that must be modified * @param string $var variable name * @param string $val variable value * @param boolean $link controls sanitizing of ampersand in urls (since 1.3.2) + * * @return string $url modified url + * * @since 1.3.0 + * */ function set_url_var($url, $var, $val=0, $link=true) { $k = '';