phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] preferences preferences.php templates/base/pref...


From: Dave Hall
Subject: [Phpgroupware-cvs] preferences preferences.php templates/base/pref...
Date: Tue, 19 Sep 2006 13:21:32 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    preferences
Changes by:     Dave Hall <skwashd>     06/09/19 13:21:32

Modified files:
        .              : preferences.php 
        templates/base : preferences.tpl 
Removed files:
        templates/probusiness: preferences.tpl 

Log message:
        cleanup errors and css, still some work to be done

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/preferences/preferences.php?cvsroot=phpgroupware&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/preferences/templates/base/preferences.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/preferences/templates/probusiness/preferences.tpl?cvsroot=phpgroupware&r1=1.2&r2=0

Patches:
Index: preferences.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/preferences.php,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- preferences.php     18 Sep 2006 09:31:02 -0000      1.39
+++ preferences.php     19 Sep 2006 13:21:32 -0000      1.40
@@ -5,15 +5,16 @@
        * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package preferences
-       * @version $Id: preferences.php,v 1.39 2006/09/18 09:31:02 sigurdne Exp 
$
+       * @version $Id: preferences.php,v 1.40 2006/09/19 13:21:32 skwashd Exp $
        */
 
-       $GLOBALS['phpgw_info']['flags'] = array(
-               'noheader'                => True,
-               'noappheader'             => True,
-               'nonavbar'                => True,
-               'currentapp'              => $_GET['appname'],
-               'enable_nextmatchs_class' => True
+       $GLOBALS['phpgw_info']['flags'] = array
+       (
+               'noheader'                => true,
+               'noappheader'             => true,
+               'nonavbar'                => true,
+               'currentapp'              => isset($_GET['appname']) ? 
$_GET['appname'] : '',
+               'enable_nextmatchs_class' => true
        );
        
        /**
@@ -21,7 +22,7 @@
         */
        include('../header.inc.php');
        
-       if ($_POST['cancel'])
+       if ( isset($_POST['cancel']) && $_POST['cancel'] )
        {
                Header('Location: ' . 
$GLOBALS['phpgw']->link('/preferences/index.php') . '#' . $_GET['appname']);
                exit;
@@ -31,10 +32,9 @@
        $forced  = get_var('forced',Array('POST'));
        $default = get_var('default',Array('POST'));
 
-       $t = 
CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('preferences'));
-       $t->set_file(array(
-               'preferences' => 'preferences.tpl'
-       ));
+       $t =& $GLOBALS['phpgw']->template;
+       $t->set_root( $GLOBALS['phpgw']->common->get_tpl_dir('preferences') );
+       $t->set_file('preferences', 'preferences.tpl');
        $t->set_block('preferences','list','lists');
        $t->set_block('preferences','row','rowhandle');
        $t->set_block('preferences','help_row','help_rowhandle');
@@ -119,17 +119,17 @@
         * @param $type
         * @return boolean
         */
-       function create_input_box($label,$name,$help='',$default='',$size = 
'',$max_size = '',$type='',
-               $run_lang=True)
+       function create_input_box($label, $name, $help = '', $default = '', 
$size = '',$maxsize = '', $type = '', $run_lang = true)
        {
-               global $t,$prefs;
+               global $t, $prefs;
 
                $_appname = check_app();
                if (is_forced_value($_appname,$name))
                {
-                       return True;
+                       return true;
                }
 
+               $options = '';
                if ($type)      // used to specify password
                {
                        $options = " type=\"$type\"";
@@ -143,6 +143,7 @@
                        $options .= " maxsize=\"$maxsize\"";
                }
 
+               $default = '';
                if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
                {
                        $default = $prefs[$name];
@@ -156,11 +157,11 @@
                        {
                                $def_text = 
$GLOBALS['phpgw']->preferences->lang_notify($def_text,$notifys[$name]);
                        }
-                       $def_text = ($def_text != '') ? ' <i><font size="-1">' 
. lang('default') . ':&nbsp;' . $def_text . '</font></i>' : '';
+                       $def_text = ($def_text != '') ? lang('default') . " 
$def_text" : '';
                }
-               $t->set_var('row_value',"<input 
name=\"${GLOBALS[type]}[$name]\" value=\"" . htmlentities($default) . 
"\"$options />$def_text");
+               $t->set_var('row_value',"<input 
name=\"${GLOBALS['type']}[$name]\" value=\"" . htmlentities($default) . 
"\"$options />$def_text");
                $t->set_var('row_name',lang($label));
-               $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
+               $GLOBALS['phpgw']->nextmatchs->template_alternate_row_class($t);
 
                $t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 
'row',True);
        }
@@ -227,12 +228,18 @@
         */
        function create_option_string($selected,$values)
        {
-               while (is_array($values) && list($var,$value) = each($values))
+               $s = '';
+               if ( !is_array($values) )
+               {
+                       return '';
+               }
+
+               foreach ( $values as $var => $value )
                {
                        $s .= '<option value="' . $var . '"';
                        if ("$var" == "$selected")      // the "'s are 
necessary to force a string-compare
                        {
-                               $s .= ' selected="selected"';
+                               $s .= ' selected';
                        }
                        $s .= '>' . $value . '</option>';
                }
@@ -281,9 +288,9 @@
                        $def_text = 
$GLOBALS['phpgw']->preferences->default[$_appname][$name];
                        $def_text = $def_text != '' ? ' <i><font 
size="-1">'.lang('default').':&nbsp;'.$values[$def_text].'</font></i>' : '';
                }
-               $t->set_var('row_value',"<select 
name=\"${GLOBALS[type]}[$name]\">$s</select>$def_text");
+               $t->set_var('row_value',"<select 
name=\"${GLOBALS['type']}[$name]\">$s</select>$def_text");
                $t->set_var('row_name',lang($label));
-               $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
+               $GLOBALS['phpgw']->nextmatchs->template_alternate_row_class($t);
 
                $t->fp('rows',process_help($help) ? 'help_row' : 'row',True);
        }
@@ -373,7 +380,7 @@
                }
                $t->set_var('row_value',"<textarea rows=\"$rows\" 
cols=\"$cols\" 
name=\"${GLOBALS[type]}[$name]\">".htmlentities($default)."</textarea>$def_text");
                $t->set_var('row_name',lang($label));
-               $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
+               $GLOBALS['phpgw']->nextmatchs->template_alternate_row_class($t);
 
                $t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 
'row',True);
        }
@@ -417,7 +424,7 @@
                                }
                                $prefs[$var] = stripslashes($value);
 
-                               if ($notifys[$var])     // need to translate 
the key-words back
+                               if ( isset($notifys[$var]) && $notifys[$var] ) 
// need to translate the key-words back
                                {
                                        $prefs[$var] = 
$GLOBALS['phpgw']->preferences->lang_notify($prefs[$var],$notifys[$var],True);
                                }
@@ -522,8 +529,14 @@
        }
        $has_help = 0;
 
-       if ($_POST['submit'])
+       $error = '';
+       if ( isset($_POST['submit']) && $_POST['submit'] )
+       {
+               if ( !isset($session_data['notifys']) )
        {
+                       $session_data['notifys'] = array();
+               }
+               
                /* Don't use a switch here, we need to check some permissions 
durring the ifs */
                if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
                {
@@ -557,21 +570,22 @@
                'appname'   => $_GET['appname']         // we use this to reset 
prefix on appname-change
        ));
        // changes for the admin itself, should have immediate feedback ==> 
redirect
-       if (!$error && $_POST['submit'] && $GLOBALS['type'] == 'user' && 
$_GET['appname'] == 'preferences') {
-               
$GLOBALS['phpgw']->redirect_link('/preferences/preferences.php','appname='.$_GET['appname']);
+       if ( !$error 
+               && ( isset($_POST['submit']) && $_POST['submit'] )
+               && $GLOBALS['type'] == 'user' 
+               && $_GET['appname'] == 'preferences')
+       {
+               
$GLOBALS['phpgw']->redirect_link('/preferences/preferences.php', 
array('appname' => $_GET['appname']) );
        }
 
        $GLOBALS['phpgw_info']['flags']['app_header'] = $_GET['appname'] == 
'preferences' ?
                lang('Preferences') : lang('%1 - 
Preferences',$GLOBALS['phpgw_info']['apps'][$_GET['appname']]['title']);
-       $GLOBALS['phpgw']->common->phpgw_header();
-       echo parse_navbar();
+       $GLOBALS['phpgw']->common->phpgw_header(true);
 
        $t->set_var('messages',$error);
-       
$t->set_var('action_url',$GLOBALS['phpgw']->link('/preferences/preferences.php',array('appname'=>
 $_GET['appname'])));
+       
$t->set_var('action_url',$GLOBALS['phpgw']->link('/preferences/preferences.php',
 array('appname'=> $_GET['appname'])));
        $t->set_var('th_bg',  $GLOBALS['phpgw_info']['theme']['th_bg']);
        $t->set_var('th_text',$GLOBALS['phpgw_info']['theme']['th_text']);
-       $t->set_var('row_on', $GLOBALS['phpgw_info']['theme']['row_on']);
-       $t->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
 
        switch ($GLOBALS['type'])       // set up some globals to be used by 
the hooks
        {

Index: templates/base/preferences.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/templates/base/preferences.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/preferences.tpl      30 Dec 2004 11:22:15 -0000      1.1
+++ templates/base/preferences.tpl      19 Sep 2006 13:21:32 -0000      1.2
@@ -1,47 +1,43 @@
-<br>
-<center><b>{messages}</b></center>
+<div class="error_message">{messages}</div>
 
 <!-- BEGIN form -->
 {tabs}
 <form method="POST" action="{action_url}">
 
-<table border="0">
-<!-- <tr>
-  <td colspan="2">{tabs}</td>
- </tr> -->
-
-<!-- BEGIN list -->
- <tr bgcolor="{th_bg}">
-  <td colspan="2"><b>{list_header}</b></td>
+       <!-- BEGIN list -->
+       <table id="prefs_list">
+               <thead>
+                       <tr>
+                               <th colspan="2"><b>{list_header}</b></th>
  </tr>
-{rows}
-<!-- END list -->
+               </thead>
+               <tbody>
+                       {rows}
+               </tbody>
+       </table>
+       <!-- END list -->
 
- <tr height="30" valign="bottom">
-  <td align="left">
-   <input type="submit" name="submit" value="{lang_submit}"> &nbsp;
+       <div class="button_group">
+               <input type="submit" name="submit" value="{lang_submit}">
    <input type="submit" name="cancel" value="{lang_cancel}">
-  </td>
-  <td align="right">&nbsp; {help_button}</td>
- </tr>
-</table>
-
+               {help_button}
+       </div>
 </form>
 <!-- END form -->
 
 <!-- BEGIN row -->
- <tr bgcolor="{tr_color}">
+               <tr class="{tr_class}">
   <td>{row_name}</td>
   <td>{row_value}</td>
  </tr>
 <!-- END row -->
 
 <!-- BEGIN help_row -->
-  <tr bgcolor="{tr_color}">
-  <td><b>{row_name}<b></td>
+               <tr class="{tr_class}">
+                       <td>{row_name}</td>
   <td>{row_value}</td>
  </tr>
- <tr bgcolor="{tr_color}">
+               <tr class="{tr_class}">
   <td colspan="2">{help_value}</td>
  </tr>
 <!-- END help_row -->

Index: templates/probusiness/preferences.tpl
===================================================================
RCS file: templates/probusiness/preferences.tpl
diff -N templates/probusiness/preferences.tpl
--- templates/probusiness/preferences.tpl       30 Dec 2004 11:19:04 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-<br />
-<b>{messages}</b>
-<!-- BEGIN form -->
-<form method="post" action="{action_url}">
-  <table class="basic" align="center">
-    <tr><td colspan="2">{tabs}</td></tr>
-<!-- BEGIN list -->
-    <tr class="header"><td colspan="2"><b>{list_header}</b></td></tr>
-    {rows}
-<!-- END list -->
-    <tr valign="bottom">
-      <td class="left">
-        <input type="submit" name="submit" value="{lang_submit}" /> &nbsp;
-        <input type="submit" name="cancel" value="{lang_cancel}" />
-      </td>
-      <td class="right">&nbsp; {help_button}</td>
-    </tr>
-  </table>
-</form>
-<!-- END form -->
-
-<!-- BEGIN row -->
-    <tr>
-      <td>{row_name}</td>
-      <td>{row_value}</td>
-    </tr>
-<!-- END row -->
-
-<!-- BEGIN help_row -->
-    <tr class="bg_color2">
-      <td><b>{row_name}<b></td>
-      <td>{row_value}</td>
-    </tr>
-    <tr class="bg_color1"><td colspan="2">{help_value}</td></tr>
-<!-- END help_row -->
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]