From: pdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0> Date: Tue, 24 Feb 2004 13:23:33 +0000 (+0000) Subject: Corified Msg_Flags plugin, along with Jimmy's icon themes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6395c46db0a732860324fa43886b6ca806ad2588;p=squirrelmail.git Corified Msg_Flags plugin, along with Jimmy's icon themes git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6638 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/ChangeLog b/ChangeLog index 8539e2f6..d4f6b589 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ Version 1.5.1 -- CVS - New reply citation to include date and author. - XSS fix. - Norwegian Bokmal translation uses nb_NO + - Integrated Msg_Flags plugin - turn on/off icons using configuration tool, menu + number 11 (Tweaks), option number 3, after which users must select an icon + theme in Options/Display Preferences. "Flag"/"Unflag" buttons are implemented + as separate plugin. Version 1.5.0 diff --git a/config/conf.pl b/config/conf.pl index c9ccec0d..3798683b 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -398,6 +398,10 @@ if (!$oldway ) { $oldway = 'false'; } +if (!$use_icons ) { + $use_icons = 'false'; +} + if (!$use_php_recode ) { $use_php_recode = 'false'; } @@ -668,10 +672,11 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) { print $WHT. "Interface tweaks\n" . $NRM; print "1. Advanced tree : $WHT$advanced_tree$NRM\n"; print "2. Oldway : $WHT$oldway$NRM\n"; + print "3. Use Icons : $WHT$use_icons$NRM\n"; print "\n"; print $WHT. "PHP tweaks\n" . $NRM; - print "3. Use php recode functions : $WHT$use_php_recode$NRM\n"; - print "4. Use php iconv functions : $WHT$use_php_iconv$NRM\n"; + print "4. Use php recode functions : $WHT$use_php_recode$NRM\n"; + print "5. Use php iconv functions : $WHT$use_php_iconv$NRM\n"; print "\n"; print "R Return to Main Menu\n"; } @@ -790,7 +795,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) { elsif ( $command == 10 ) { $allow_thread_sort = command312(); } elsif ( $command == 11 ) { $allow_server_sort = command313(); } elsif ( $command == 12 ) { $allow_charset_search = command314(); } - elsif ( $command == 13 ) { $session_name = command316(); } + elsif ( $command == 13 ) { $session_name = command316(); } } elsif ( $menu == 5 ) { if ( $command == 1 ) { command41(); } elsif ( $command == 2 ) { $theme_css = command42(); } @@ -822,8 +827,9 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) { } elsif ( $menu == 11 ) { if ( $command == 1 ) { $advanced_tree = commandB1(); } elsif ( $command == 2 ) { $oldway = commandB2(); } - elsif ( $command == 3 ) { $use_php_recode = commandB3(); } - elsif ( $command == 4 ) { $use_php_iconv = commandB4(); } + elsif ( $command == 3 ) { $use_icons = commandB3(); } + elsif ( $command == 4 ) { $use_php_recode = commandB4(); } + elsif ( $command == 5 ) { $use_php_iconv = commandB5(); } } } } @@ -2984,8 +2990,33 @@ sub commandB2 { } return $oldway; } -# php recode +# use icons sub commandB3 { + print "Enabling this option will cause icons to be used instead of text\n"; + print "markers next to each message in mailbox lists that represent\n"; + print "new, read, flagged, and deleted messages, as well as those that\n"; + print "have been replied to and forwarded. Icons are also used next to\n"; + print "(un)expanded folders in the folder list (Oldway = false). These\n"; + print "icons are quite small, but will obviously be more of a resource\n"; + print "drain than text markers.\n"; + print "\n"; + + if ( lc($use_icons) eq "true" ) { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Use icons? (y/n) [$WHT$default_value$NRM]: $WHT"; + $use_icons = <STDIN>; + if ( ( $use_icons =~ /^y\n/i ) || ( ( $use_icons =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { + $use_icons = "true"; + } else { + $use_icons = "false"; + } + return $use_icons; +} +# php recode +sub commandB4 { print "Enable this option if you want to use php recode functions to read\n"; print "emails written in charset that differs from the one that is set in\n"; print "translation selected by user. Code is experimental, it might cause\n"; @@ -3008,7 +3039,7 @@ sub commandB3 { return $use_php_recode; } # php iconv -sub commandB4 { +sub commandB5 { print "Enable this option if you want to use php iconv functions to read\n"; print "emails written in charset that differs from the one that is set in\n"; print "translation selected by user. Code is experimental, it works only\n"; @@ -3278,18 +3309,20 @@ sub save_data { # boolean print CF "\$addrbook_global_listing = $addrbook_global_listing;\n\n"; # boolean - print CF "\$no_list_for_subscribe = $no_list_for_subscribe;\n"; + print CF "\$no_list_for_subscribe = $no_list_for_subscribe;\n"; # string - print CF "\$smtp_auth_mech = '$smtp_auth_mech';\n"; - print CF "\$imap_auth_mech = '$imap_auth_mech';\n"; + print CF "\$smtp_auth_mech = '$smtp_auth_mech';\n"; + # string + print CF "\$imap_auth_mech = '$imap_auth_mech';\n"; # boolean - print CF "\$use_imap_tls = $use_imap_tls;\n"; - print CF "\$use_smtp_tls = $use_smtp_tls;\n"; - - print CF "\$session_name = '$session_name';\n"; + print CF "\$use_imap_tls = $use_imap_tls;\n"; + # boolean + print CF "\$use_smtp_tls = $use_smtp_tls;\n"; + # string + print CF "\$session_name = '$session_name';\n"; - print CF "\n"; + print CF "\n"; # boolean print CF "\$advanced_tree = $advanced_tree;\n"; @@ -3298,6 +3331,9 @@ sub save_data { print CF "\$oldway = $oldway;\n"; print CF "\n"; # boolean + print CF "\$use_icons = $use_icons;\n"; + print CF "\n"; + # boolean print CF "\$use_php_recode = $use_php_recode;\n"; print CF "\n"; # boolean diff --git a/config/config_default.php b/config/config_default.php index 581130c1..bbe4389b 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -648,6 +648,10 @@ $advanced_tree = false; * Use older way of folder listing */ $oldway = false; +/** + * Use icons for message and folder markers + */ +$use_icons = false; /** * Use experimental code with php recode functions when reading messages with * different encoding. This code is faster that original SM functions, @@ -695,4 +699,4 @@ $config_use_color = 2; * sent and regular output to begin, which will majorly screw * things up when we try to send more headers later. */ -?> \ No newline at end of file +?> diff --git a/doc/plugin.txt b/doc/plugin.txt index 7a4783ad..ecbfc0c7 100644 --- a/doc/plugin.txt +++ b/doc/plugin.txt @@ -240,7 +240,6 @@ but may be out of date soon thereafter. You never know. ;-) get_pref functions/file_prefs.php hook_func special_mailbox functions/imap_mailbox.php hook_func % rename_or_delete_folder functions/imap_mailbox.php hook_func - msg_envelope functions/mailbox_display.php do_hook mailbox_index_before functions/mailbox_display.php do_hook mailbox_form_before functions/mailbox_display.php do_hook mailbox_index_after functions/mailbox_display.php do_hook @@ -268,7 +267,6 @@ but may be out of date soon thereafter. You never know. ;-) left_main_after_each_folder src/left_main.php concat_hook left_main_before src/left_main.php do_hook left_main_after src/left_main.php do_hook - create_collapse_link src/left_main.php hook_func login_cookie src/login.php do_hook login_top src/login.php do_hook login_form src/login.php do_hook diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index b4b8b546..6e93c81e 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -58,7 +58,9 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $allow_server_sort, /* enable/disable server-side sorting */ $truncate_sender, /* number of characters for From/To field (<= 0 for unchanged) */ $email_address, - $show_recipient_instead; /* show recipient name instead of default identity */ + $show_recipient_instead, /* show recipient name instead of default identity */ + $use_icons, /* indicates to use icons or text markers */ + $icon_theme; /* icons theming */ $color_string = $color[4]; @@ -274,41 +276,102 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, echo html_tag( 'td', $td_str, 'left', $hlt_color ); break; case 5: /* flags */ - $stuff = false; - $td_str = "<b><small>"; - if (isset($msg['FLAG_ANSWERED']) && $msg['FLAG_ANSWERED'] == true) { - $td_str .= _("A"); - $stuff = true; - } - if ($msg['TYPE0'] == 'multipart') { - $td_str .= '+'; - $stuff = true; + // icon message markers + // + if ($use_icons && $icon_theme != 'none') { + $td_str = "<b><small>"; + if (isset($msg['FLAG_FLAGGED']) && $msg['FLAG_FLAGGED'] == true) { + $td_str .= _('<IMG SRC="' . SM_PATH . 'images/themes/' . $icon_theme . '/flagged.gif" border="0" height="10" width="10"> '); + } + if ($default_use_priority) { + if ( ($msg['PRIORITY'] == 1) || ($msg['PRIORITY'] == 2) ) { + $td_str .= '<IMG SRC="' . SM_PATH . 'images/themes/' . $icon_theme . '/prio_high.gif" border="0" height="10" width="5"> '; + } + else if ($msg['PRIORITY'] == 5) { + $td_str .= '<IMG SRC="' . SM_PATH . 'images/themes/' . $icon_theme . '/prio_low.gif" border="0" height="10" width="5"> '; + } + else + { + $td_str .= '<IMG SRC="' . SM_PATH . 'images/themes/' . $icon_theme . '/transparent.gif" border="0" width="5"> '; + } + } + if ($msg['TYPE0'] == 'multipart') { + $td_str .= '<IMG SRC="' . SM_PATH . 'images/themes/' . $icon_theme . '/attach.gif" border="0" height="10" width="6">'; + } + else + { + $td_str .= '<IMG SRC="' . SM_PATH . 'images/themes/' . $icon_theme . '/transparent.gif" border="0" width="6">'; + } + + $msg_icon = ''; + if (!isset($msg['FLAG_SEEN']) || ($msg['FLAG_SEEN']) == false) + { + $msg_alt = '(' . _("New") . ')'; + $msg_title = '(' . _("New") . ')'; + $msg_icon .= SM_PATH . 'images/themes/' . $icon_theme . '/msg_new'; + } + else + { + $msg_alt = '(' . _("Read") . ')'; + $msg_title = '(' . _("Read") . ')'; + $msg_icon .= SM_PATH . 'images/themes/' . $icon_theme . '/msg_read'; + } + if (isset($msg['FLAG_DELETED']) && ($msg['FLAG_DELETED']) == true) + { + $msg_icon .= '_deleted'; + } + if (isset($msg['FLAG_ANSWERED']) && ($msg['FLAG_ANSWERED']) == true) + { + $msg_icon .= '_reply'; + } + $td_str .= '<IMG SRC="' . $msg_icon . '.gif" border="0" alt="'. $msg_alt . '" title="' . $msg_title . '" height="12" width="18" >'; + $td_str .= '</small></b>'; + echo html_tag( 'td', + $td_str, + 'right', + $hlt_color, + 'nowrap' ); } - if ($default_use_priority) { - if ( ($msg['PRIORITY'] == 1) || ($msg['PRIORITY'] == 2) ) { - $td_str .= "<font color=\"$color[1]\">!</font>"; + + + // plain text message markers + // + else { + $stuff = false; + $td_str = "<b><small>"; + if (isset($msg['FLAG_ANSWERED']) && $msg['FLAG_ANSWERED'] == true) { + $td_str .= _("A"); $stuff = true; } - if ($msg['PRIORITY'] == 5) { - $td_str .= "<font color=\"$color[8]\">?</font>"; + if ($msg['TYPE0'] == 'multipart') { + $td_str .= '+'; $stuff = true; } + if ($default_use_priority) { + if ( ($msg['PRIORITY'] == 1) || ($msg['PRIORITY'] == 2) ) { + $td_str .= "<font color=\"$color[1]\">!</font>"; + $stuff = true; + } + if ($msg['PRIORITY'] == 5) { + $td_str .= "<font color=\"$color[8]\">?</font>"; + $stuff = true; + } + } + if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'] == true) { + $td_str .= "<font color=\"$color[1]\">D</font>"; + $stuff = true; + } + if (!$stuff) { + $td_str .= ' '; + } + $td_str .= '</small></b>'; + echo html_tag( 'td', + $td_str, + 'center', + $hlt_color, + 'nowrap' ); } - if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'] == true) { - $td_str .= "<font color=\"$color[1]\">D</font>"; - $stuff = true; - } - if (!$stuff) { - $td_str .= ' '; - } - do_hook("msg_envelope"); - $td_str .= '</small></b>'; - echo html_tag( 'td', - $td_str, - 'center', - $hlt_color, - 'nowrap' ); break; case 6: /* size */ echo html_tag( 'td', diff --git a/images/themes/default/attach.gif b/images/themes/default/attach.gif new file mode 100644 index 00000000..b2bc63b8 Binary files /dev/null and b/images/themes/default/attach.gif differ diff --git a/images/themes/default/flagged.gif b/images/themes/default/flagged.gif new file mode 100644 index 00000000..8d595a18 Binary files /dev/null and b/images/themes/default/flagged.gif differ diff --git a/images/themes/default/index.php b/images/themes/default/index.php new file mode 100644 index 00000000..f86109e8 --- /dev/null +++ b/images/themes/default/index.php @@ -0,0 +1,3 @@ +<?php +header("Location:../../../index.php"); +?> diff --git a/images/themes/default/msg_new.gif b/images/themes/default/msg_new.gif new file mode 100644 index 00000000..e455c09b Binary files /dev/null and b/images/themes/default/msg_new.gif differ diff --git a/images/themes/default/msg_new_deleted.gif b/images/themes/default/msg_new_deleted.gif new file mode 100644 index 00000000..b30057b0 Binary files /dev/null and b/images/themes/default/msg_new_deleted.gif differ diff --git a/images/themes/default/msg_new_deleted_reply.gif b/images/themes/default/msg_new_deleted_reply.gif new file mode 100644 index 00000000..e34818f5 Binary files /dev/null and b/images/themes/default/msg_new_deleted_reply.gif differ diff --git a/images/themes/default/msg_new_reply.gif b/images/themes/default/msg_new_reply.gif new file mode 100644 index 00000000..359c9ab8 Binary files /dev/null and b/images/themes/default/msg_new_reply.gif differ diff --git a/images/themes/default/msg_read.gif b/images/themes/default/msg_read.gif new file mode 100644 index 00000000..782ec650 Binary files /dev/null and b/images/themes/default/msg_read.gif differ diff --git a/images/themes/default/msg_read_deleted.gif b/images/themes/default/msg_read_deleted.gif new file mode 100644 index 00000000..d2f2bd90 Binary files /dev/null and b/images/themes/default/msg_read_deleted.gif differ diff --git a/images/themes/default/msg_read_deleted_reply.gif b/images/themes/default/msg_read_deleted_reply.gif new file mode 100644 index 00000000..6c377409 Binary files /dev/null and b/images/themes/default/msg_read_deleted_reply.gif differ diff --git a/images/themes/default/msg_read_reply.gif b/images/themes/default/msg_read_reply.gif new file mode 100644 index 00000000..f4d681dc Binary files /dev/null and b/images/themes/default/msg_read_reply.gif differ diff --git a/images/themes/default/prio_high.gif b/images/themes/default/prio_high.gif new file mode 100644 index 00000000..a62b7012 Binary files /dev/null and b/images/themes/default/prio_high.gif differ diff --git a/images/themes/default/prio_low.gif b/images/themes/default/prio_low.gif new file mode 100644 index 00000000..fcee5cba Binary files /dev/null and b/images/themes/default/prio_low.gif differ diff --git a/images/themes/default/theme.php b/images/themes/default/theme.php new file mode 100644 index 00000000..35960263 --- /dev/null +++ b/images/themes/default/theme.php @@ -0,0 +1,3 @@ +<?php + $icon_themes[] = array('NAME'=>'Default','PATH'=> 'default'); +?> diff --git a/images/themes/default/transparent.gif b/images/themes/default/transparent.gif new file mode 100644 index 00000000..3a09af51 Binary files /dev/null and b/images/themes/default/transparent.gif differ diff --git a/images/themes/index.php b/images/themes/index.php new file mode 100644 index 00000000..9d9ed2ca --- /dev/null +++ b/images/themes/index.php @@ -0,0 +1,14 @@ +<?php +/** + ** index.php + ** + ** This file simply takes any attempt to view source files + ** and sends those people to the login screen. At this + ** point no attempt is made to see if the person is logged + ** or not. + **/ + +header("Location:../index.php"); + +/** pretty impressive huh? **/ +?> diff --git a/images/themes/none/index.php b/images/themes/none/index.php new file mode 100644 index 00000000..a9aa9d18 --- /dev/null +++ b/images/themes/none/index.php @@ -0,0 +1,17 @@ +<?php + +/** + * index.php -- Displays the main frameset + * + * Copyright (c) 1999-2003 The SquirrelMail Project Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Redirects to the login page. + * + * $Id$ + */ + +header("Location: src/login.php\n\n"); + +?> +<html></html> diff --git a/images/themes/none/theme.php b/images/themes/none/theme.php new file mode 100644 index 00000000..5a0c1d9a --- /dev/null +++ b/images/themes/none/theme.php @@ -0,0 +1,3 @@ +<?php + $icon_themes[] = array('NAME'=>'None','PATH'=> 'none'); +?> diff --git a/images/themes/xp/attach.gif b/images/themes/xp/attach.gif new file mode 100644 index 00000000..8153a60c Binary files /dev/null and b/images/themes/xp/attach.gif differ diff --git a/images/themes/xp/flagged.gif b/images/themes/xp/flagged.gif new file mode 100644 index 00000000..249e1d8f Binary files /dev/null and b/images/themes/xp/flagged.gif differ diff --git a/images/themes/xp/index.php b/images/themes/xp/index.php new file mode 100644 index 00000000..9d9ed2ca --- /dev/null +++ b/images/themes/xp/index.php @@ -0,0 +1,14 @@ +<?php +/** + ** index.php + ** + ** This file simply takes any attempt to view source files + ** and sends those people to the login screen. At this + ** point no attempt is made to see if the person is logged + ** or not. + **/ + +header("Location:../index.php"); + +/** pretty impressive huh? **/ +?> diff --git a/images/themes/xp/msg_new.gif b/images/themes/xp/msg_new.gif new file mode 100644 index 00000000..63dd651f Binary files /dev/null and b/images/themes/xp/msg_new.gif differ diff --git a/images/themes/xp/msg_new_deleted.gif b/images/themes/xp/msg_new_deleted.gif new file mode 100644 index 00000000..6d59218e Binary files /dev/null and b/images/themes/xp/msg_new_deleted.gif differ diff --git a/images/themes/xp/msg_new_deleted_reply.gif b/images/themes/xp/msg_new_deleted_reply.gif new file mode 100644 index 00000000..0a89f987 Binary files /dev/null and b/images/themes/xp/msg_new_deleted_reply.gif differ diff --git a/images/themes/xp/msg_new_reply.gif b/images/themes/xp/msg_new_reply.gif new file mode 100644 index 00000000..c857f137 Binary files /dev/null and b/images/themes/xp/msg_new_reply.gif differ diff --git a/images/themes/xp/msg_read.gif b/images/themes/xp/msg_read.gif new file mode 100644 index 00000000..2014f9c3 Binary files /dev/null and b/images/themes/xp/msg_read.gif differ diff --git a/images/themes/xp/msg_read_deleted.gif b/images/themes/xp/msg_read_deleted.gif new file mode 100644 index 00000000..be7d5468 Binary files /dev/null and b/images/themes/xp/msg_read_deleted.gif differ diff --git a/images/themes/xp/msg_read_deleted_reply.gif b/images/themes/xp/msg_read_deleted_reply.gif new file mode 100644 index 00000000..10d49b0a Binary files /dev/null and b/images/themes/xp/msg_read_deleted_reply.gif differ diff --git a/images/themes/xp/msg_read_reply.gif b/images/themes/xp/msg_read_reply.gif new file mode 100644 index 00000000..d875a7d4 Binary files /dev/null and b/images/themes/xp/msg_read_reply.gif differ diff --git a/images/themes/xp/prio_high.gif b/images/themes/xp/prio_high.gif new file mode 100644 index 00000000..2da06127 Binary files /dev/null and b/images/themes/xp/prio_high.gif differ diff --git a/images/themes/xp/prio_low.gif b/images/themes/xp/prio_low.gif new file mode 100644 index 00000000..420c066b Binary files /dev/null and b/images/themes/xp/prio_low.gif differ diff --git a/images/themes/xp/theme.php b/images/themes/xp/theme.php new file mode 100644 index 00000000..29996923 --- /dev/null +++ b/images/themes/xp/theme.php @@ -0,0 +1,3 @@ +<?php + $icon_themes[] = array('NAME'=>'XP','PATH'=> 'xp'); +?> diff --git a/images/themes/xp/transparent.gif b/images/themes/xp/transparent.gif new file mode 100644 index 00000000..35d42e80 Binary files /dev/null and b/images/themes/xp/transparent.gif differ diff --git a/include/load_prefs.php b/include/load_prefs.php index eea76b35..c83436fa 100644 --- a/include/load_prefs.php +++ b/include/load_prefs.php @@ -77,6 +77,9 @@ if (!defined('download_php')) { sqsession_register($theme_css, 'theme_css'); } +// user's icon theme, if using icons +$icon_theme = getPref($data_dir, $username, 'icon_theme', 'none' ); + $use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book); /* Load the user's special folder preferences */ diff --git a/include/options/display.php b/include/options/display.php index 9d9397fb..ac209ce8 100644 --- a/include/options/display.php +++ b/include/options/display.php @@ -17,6 +17,20 @@ define('SMOPT_GRP_GENERAL', 0); define('SMOPT_GRP_MAILBOX', 1); define('SMOPT_GRP_MESSAGE', 2); +// load icon themes if in use +global $use_icons; +if ($use_icons) { + global $icon_themes; + $dirName = SM_PATH . 'images/themes'; + $d = dir($dirName); + while($dir = $d->read()) { + if ($dir != "." && $dir != "..") { + if (is_dir($dirName."/".$dir) && file_exists("$dirName/$dir/theme.php")) + include("$dirName/$dir/theme.php"); + } + } +} + /** * This function builds an array with all the information about * the options available to the user, and returns it. The options @@ -33,7 +47,7 @@ define('SMOPT_GRP_MESSAGE', 2); function load_optpage_data_display() { global $theme, $language, $languages, $js_autodetect_results, $compose_new_win, $default_use_mdn, $squirrelmail_language, $allow_thread_sort, - $optmode, $show_alternative_names, $available_languages; + $optmode, $show_alternative_names, $available_languages, $use_icons; /* Build a simple array into which we will build options. */ $optgrps = array(); @@ -174,6 +188,26 @@ function load_optpage_data_display() { 'refresh' => SMOPT_REFRESH_NONE ); +echo "use icons? $use_icons<br>"; + if ($use_icons) { + global $icon_themes, $icon_theme; + $temp = array(); + for ($count = 0; $count < sizeof($icon_themes); $count++) { + $temp[$count] = $icon_themes[$count]['NAME']; + if ($icon_theme == $icon_themes[$count]['PATH']) + $value = $count; + } + $optvals[SMOPT_GRP_MAILBOX][] = array( + 'name' => 'icon_theme', + 'caption' => _("Message Flags Icon Theme"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_NONE, + 'posvals' => $temp, + 'initial_value' => $value, + 'save' => 'icon_theme_save' + ); + } + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'page_selector', 'caption' => _("Enable Page Selector"), @@ -450,4 +484,22 @@ function save_option_javascript_autodetect($option) { } } +/** + * This function saves the user's icon theme setting + */ +function icon_theme_save($option) { + + global $icon_themes, $data_dir, $username; + + + // Don't assume the new value is there, double check + // and only save if found + // + if (isset($icon_themes[$option->new_value]['PATH'])) + setPref($data_dir, $username, 'icon_theme', $icon_themes[$option->new_value]['PATH']); + else + setPref($data_dir, $username, 'icon_theme', 'none'); + +} + ?> diff --git a/src/left_main.php b/src/left_main.php index 29a689fb..fadc96c6 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -170,23 +170,27 @@ function compute_folder_children(&$parbox, $boxcount) { * currently appropriate. */ function create_collapse_link($boxnum) { - global $boxes, $imapConnection, $unseen_notify, $color; + global $boxes, $imapConnection, $unseen_notify, $color, $use_icons, $icon_theme; $mailbox = urlencode($boxes[$boxnum]['unformatted']); /* Create the link for this collapse link. */ $link = '<a target="left" style="text-decoration:none" ' . 'href="left_main.php?'; if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED) { - $link .= "unfold=$mailbox\">+"; + if ($use_icons && $icon_theme != 'none') { + $link .= "unfold=$mailbox\"><IMG src=\"" . SM_PATH . "images/plus.png\" border=\"0\" height=\"7\" width=\"7\">"; + } else { + $link .= "unfold=$mailbox\">+"; + } } else { - $link .= "fold=$mailbox\">-"; + if ($use_icons && $icon_theme != 'none') { + $link .= "fold=$mailbox\"><IMG src=\"" . SM_PATH . "images/minus.png\" border=\"0\" height=\"7\" width=\"7\">"; + } else { + $link .= "fold=$mailbox\">-"; + } } $link .= '</a>'; - $hooklink = do_hook_function('create_collapse_link',$link); - if ($hooklink != '') - $link = $hooklink; - /* Return the finished product. */ return ($link); } @@ -290,7 +294,8 @@ function is_parent_box($curbox_name, $parbox_name) { function ListBoxes ($boxes, $j=0 ) { global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type, - $move_to_trash, $trash_folder, $collapse_folders, $imapConnection; + $move_to_trash, $trash_folder, $collapse_folders, $imapConnection, + $use_icons, $icon_theme; if (!isset($boxes) || empty($boxes)) return; @@ -346,9 +351,17 @@ function ListBoxes ($boxes, $j=0 ) { $link = '<a target="left" style="text-decoration:none" ' .'href="left_main.php?'; if ($collapse) { - $link .= "unfold=$mailboxURL\">$leader+ </tt>"; + if ($use_icons && $icon_theme != 'none') { + $link .= "unfold=$mailboxURL\">$leader<IMG src=\"" . SM_PATH . "images/plus.png\" border=\"0\" height=\"7\" width=\"7\"> </tt>"; + } else { + $link .= "unfold=$mailboxURL\">$leader+ </tt>"; + } } else { - $link .= "fold=$mailboxURL\">$leader- </tt>"; + if ($use_icons && $icon_theme != 'none') { + $link .= "fold=$mailboxURL\">$leader<IMG src=\"" . SM_PATH . "images/minus.png\" border=\"0\" height=\"7\" width=\"7\"> </tt>"; + } else { + $link .= "fold=$mailboxURL\">$leader- </tt>"; + } } $link .= '</a>'; $pre .= $link;