* @version $Id$ * * Functions that output HTML markup, used for the presentation logic of the * plugin */ /** Includes */ include_once(SM_PATH . 'plugins/useracl/constants.php'); /** * Print permissions table header row * * @param boolean $separate True for new folder table. * @return void */ function useracl_print_table_header($separate = false) { global $color, $acl; echo ''; if($separate==true) { print '' . _("Folder") . ''; } echo '' . _("User") . ''; foreach($acl as $a=>$info) { if($separate==true && isset($info['sep'])){ continue; } echo '' . $info['desc'] . ''; } echo ''; } /** * Print permissions table Add New User row * * @return void */ function useracl_print_addnew($formname = '') { global $color, $useracl_show_images ; print ''. ''; useracl_print_ldapsearchbutton(urlencode($formname)); print ''; useracl_print_addnew_perms(); print "\n"; } /** * Print permissions table New User permissions checkbox columns * * @return void */ function useracl_print_addnew_perms() { global $acl; foreach($acl as $a=>$info) { echo ''; } } /** * Print permissions table row for existing user * * @param array $perm Array that describes this mailbox's ACLs. e.g. * array(username=>lrsw) * @param string $mbox Mailbox Name * * @return void */ function useracl_print_array($perm, $mbox){ global $color, $names, $mails, $useracl_show_images, $acl; $i=0; $toggle = false; foreach($perm as $user=>$perm){ echo "'; if(!$toggle) { $toggle = true; } elseif($toggle) { $toggle = false; } /* User column */ echo ''; if(isset($mails[$user])) { $comp_uri = 'src/compose.php?mailbox='.$mbox.'&send_to='.urlencode($mails[$user]); } if(isset($names[$user])) { $disp = $names[$user] . ' ('.$user.')'; } else { $disp = $user; } if(isset($comp_uri)) { echo makeComposeLink($comp_uri, $disp); unset($comp_uri); } else { echo $disp; } echo ''; /* ACLs columns */ foreach($acl as $a=>$info) { echo ''; echo ''; } echo ''; echo ''; echo ''; $i++; } } /** * Print permissions table footer row * * @return void */ function useracl_print_table_footer() { global $useracl_enable_notify, $useracl_show_images; echo ' '; // ' Check All - Clear All ' . if($useracl_enable_notify) { echo ''; if($useracl_show_images) { echo '' . _('; } else { // ''; } } echo ''. '' . // FIXME // ''. ' '. ''; } /** * Print New User Row for separate table, with mailbox select * * @param string $mybox Optional parameter for preselected mailbox field * @param string $myuser Optional parameter for prefilled user field * @return void */ function useracl_print_addnew_separate($mybox = '', $myuser = '') { global $color, $boxes, $useracl_show_images, $useracl_enable_notify; print ''. ''; print ''. ''; /* Search LDAP button */ useracl_print_ldapsearchbutton('form_addnew'); /* Notification button */ if($useracl_enable_notify) { echo '
'; echo ''; if($useracl_show_images) { echo '' . _('; } else { // ''; } echo '
'; } print ''; useracl_print_addnew_perms(); print ''; print ''; } /** * Print button that links to the directory plugin search page. * The button will be printed if you have enabled the 'directory' plugin. * * @param string $formname The formname to link to, by javascript means. * @see http://email.uoa.gr/projects/squirrelmail/directory.php */ function useracl_print_ldapsearchbutton($formname = 'form_addnew') { global $plugins, $useracl_show_images; if(in_array('directory', $plugins)) { echo ""; /* Non-javascript browsers not supported at the moment. */ /* echo "\n"; } else { echo ' ' . "\n"; } */ } } /** * Link to Directory UserInfo (vcard.php) page, if directory plugin is enabled. * @param string $user Username. * @return string */ function useracl_user_link($user) { global $plugins, $base_uri; if(in_array('directory', $plugins)) { include_once(SM_PATH . 'plugins/directory/include/exported_functions.php'); return directory_user_link($user); } else { return $user; } } /** * HTML Output functions follow. */ function useracl_html_printheader($title) { global $color; print '
'. $title . ''; print '
'; } function useracl_html_print_all_sections_start() { echo ''; } function useracl_html_print_section_start($title) { global $color, $error; print ""; if(isset($error)) { print ''; } print "\n"; echo "\n"; } function useracl_html_print_all_sections_end() { echo "
". $title . "

'. $error . '

"; } function useracl_html_print_section_end() { global $color; echo "
 
"; } function useracl_html_printfooter() { print '
'; print '
'; }