[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * $Horde: horde/lib/prefs.php,v 1.19.4.10 2006/01/01 21:29:05 jan Exp $ 4 * 5 * Copyright 1999-2006 Charles J. Hagenbuch <chuck@horde.org> 6 * Copyright 1999-2006 Jon Parise <jon@horde.org> 7 * 8 * See the enclosed file COPYING for license information (LGPL). If you 9 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 10 */ 11 12 function handle_showsummaryselect($updated) 13 { 14 global $prefs; 15 16 $show_summaries = Util::getFormData('show_summaries'); 17 if (!is_null($show_summaries)) { 18 $prefs->setValue('show_summaries', $show_summaries); 19 $updated = true; 20 } 21 22 return $updated; 23 } 24 25 function handle_themeselect($updated) 26 { 27 global $prefs; 28 29 $theme = Util::getFormData('theme'); 30 if (!is_null($theme)) { 31 $prefs->setValue('theme', $theme); 32 $updated = true; 33 } 34 35 return $updated; 36 } 37 38 function handle_categorymanagement($updated) 39 { 40 require_once 'Horde/Prefs/CategoryManager.php'; 41 $cManager = &new Prefs_CategoryManager(); 42 43 /* Always save colors of all categories. */ 44 $colors = array(); 45 $categories = $cManager->get(); 46 foreach ($categories as $category) { 47 if ($color = Util::getFormData('color_' . base64_encode($category))) { 48 $colors[$category] = $color; 49 } 50 } 51 if ($color = Util::getFormData('color_' . base64_encode('_default_'))) { 52 $colors['_default_'] = $color; 53 } 54 if ($color = Util::getFormData('color_' . base64_encode('_unfiled_'))) { 55 $colors['_unfiled_'] = $color; 56 } 57 $cManager->setColors($colors); 58 59 $action = Util::getFormData('cAction'); 60 $category = Util::getFormData('category'); 61 62 switch ($action) { 63 case 'add': 64 $cManager->add($category); 65 break; 66 67 case 'remove': 68 $cManager->remove($category); 69 break; 70 71 default: 72 /* Save button. */ 73 $updated = true; 74 } 75 76 return $updated; 77 } 78 79 /** 80 * Do anything that we need to do as a result of certain preferences 81 * changing. 82 */ 83 function prefs_callback() 84 { 85 global $prefs, $registry, $notification, $nls; 86 87 if ($prefs->isDirty('language') || 88 $prefs->isDirty('show_sidebar')) { 89 if ($prefs->isDirty('language')) { 90 NLS::setLang($prefs->getValue('language')); 91 NLS::setTextdomain($registry->getApp(), $registry->get('fileroot') . '/locale', NLS::getCharset()); 92 String::setDefaultCharset(NLS::getCharset()); 93 } 94 95 $url = $registry->get('webroot', 'horde'); 96 if (substr($url, -1) != '/') { 97 $url .= '/'; 98 } 99 $url = Util::addParameter($url . 'index.php', 'url', Horde::selfUrl(true)); 100 $notification->push('if (window.parent.frames) window.parent.frames.location = \'' . addslashes(Horde::url($url, true)) . '\';', 'javascript'); 101 } 102 103 if ($prefs->isDirty('sidebar_width')) { 104 $notification->push('if (window.parent && window.parent.document.getElementById(\'hf\') && window.parent.horde_menu && window.parent.horde_menu.expandedSidebar.shown()) window.parent.document.getElementById(\'hf\').cols = window.parent.horde_menu.rtl ? \'*,' . $prefs->getValue('sidebar_width') . '\' : \'' . $prefs->getValue('sidebar_width') . ',*\';', 'javascript'); 105 } 106 107 if ($prefs->isDirty('theme') || 108 $prefs->isDirty('menu_view') || 109 $prefs->isDirty('menu_refresh_time')) { 110 $notification->push('if (window.parent.frames.horde_menu) window.parent.frames.horde_menu.location.reload();', 'javascript'); 111 } 112 } 113 114 /* Assign variables for select lists. */ 115 if (!$prefs->isLocked('timezone')) { 116 $timezone_options = $tz; 117 array_unshift($timezone_options, _("Default")); 118 } 119 if (!$prefs->isLocked('initial_application')) { 120 global $perms; 121 122 $initial_application_options = array(); 123 $apps = $registry->listApps(array('active')); 124 foreach ($apps as $a) { 125 if (file_exists($registry->get('fileroot', $a)) && 126 (($perms->exists($a) && ($perms->hasPermission($a, Auth::getAuth(), PERMS_READ) || Auth::isAdmin())) || 127 !$perms->exists($a))) { 128 $initial_application_options[$a] = $registry->get('name', $a); 129 } 130 } 131 asort($initial_application_options); 132 } 133 if (!$prefs->isLocked('theme')) { 134 $theme_options = array(); 135 $theme_base = $registry->get('themesfs', 'horde'); 136 $dh = @opendir($theme_base); 137 if (!$dh) { 138 $notification->push("Theme directory can't be opened", 'horde.error'); 139 } else { 140 while (($dir = readdir($dh)) !== false) { 141 if ($dir == '.' || $dir == '..') { 142 continue; 143 } 144 145 $theme_name = null; 146 @include $theme_base . '/' . $dir . '/info.php'; 147 if (!empty($theme_name)) { 148 $theme_options[$dir] = $theme_name; 149 } 150 } 151 } 152 153 asort($theme_options); 154 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |