phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php, 1.35, 1


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php, 1.35, 1.35.2.1 class.date_widget.inc.php, 1.13.2.1, 1.13.2.2 class.html.inc.php, 1.22, 1.22.2.1 class.soetemplate.inc.php, 1.28, 1.28.2.1 class.uietemplate.inc.php, 1.62.2.1, 1.62.2.2
Date: Tue, 19 Aug 2003 20:35:26 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv2091/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boetemplate.inc.php class.date_widget.inc.php 
        class.html.inc.php class.soetemplate.inc.php 
        class.uietemplate.inc.php 
Log Message:
1) implemented blurText (displayed in emty input-fields with no focus)
2) use phpgw_app_sessions table for php4-session too (so we dont run out of 
memory)
3) fix to allow jsCalendar and a time

Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -C2 -r1.35 -r1.35.2.1
*** class.boetemplate.inc.php   21 Apr 2003 20:29:18 -0000      1.35
--- class.boetemplate.inc.php   20 Aug 2003 00:35:24 -0000      1.35.2.1
***************
*** 204,207 ****
--- 204,288 ----
  
                /*!
+               @functin appsession
+               @syntax appsession($location = 'default', $appname = '', $data 
= '##NOTHING##')
+               @abstract db-sessions appsession function
+               @note It is used to overcome the problem with overflowing 
php4-sessions
+               */
+               function appsession($location = 'default', $appname = '', $data 
= '##NOTHING##')
+               {
+                       // use the version from the sessions-class if we use 
db-sessions
+                       //
+                       if ($GLOBALS['phpgw_info']['server']['sessions_type'] 
== 'db')
+                       {
+                               return 
$GLOBALS['phpgw']->session->appsession($location,$appname,$data);
+                       }
+                       // if not, we use or own copy of the appsessions 
function
+                       // setting these class vars to be compatible with the 
session-class
+                       //
+                       $this->sessionid  = 
$GLOBALS['phpgw']->session->sessionid;
+                       $this->account_id = 
$GLOBALS['phpgw']->session->account_id;
+ 
+                       if (! $appname)
+                       {
+                               $appname = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       }
+ 
+                       if ($data == '##NOTHING##')
+                       {
+                               $query = "SELECT content FROM 
phpgw_app_sessions WHERE"
+                                       ." sessionid='".$this->sessionid."' AND 
loginid='".$this->account_id."'"
+                                       ." AND app = '".$appname."' AND 
location='".$location."'";
+ 
+                               
$GLOBALS['phpgw']->db->query($query,__LINE__,__FILE__);
+                               $GLOBALS['phpgw']->db->next_record();
+ 
+                               // I added these into seperate steps for easier 
debugging
+                               $data = $GLOBALS['phpgw']->db->f('content');
+                               // Changed by Skeeter 2001 Mar 04 0400Z
+                               // This was not properly decoding structures 
saved into session data properly
+ //                            $data = 
$GLOBALS['phpgw']->common->decrypt($data);
+ //                            return stripslashes($data);
+                               // Changed by milosch 2001 Dec 20
+                               // do not stripslashes here unless this proves 
to be a problem.
+                               // Changed by milosch 2001 Dec 25
+                               /* do not decrypt and return if no data 
(decrypt returning garbage) */
+                               if($data)
+                               {
+                                       $data = 
$GLOBALS['phpgw']->crypto->decrypt($data);
+ //                                    echo 'appsession returning: '; 
_debug_array($data);
+                               }
+                       }
+                       else
+                       {
+                               $GLOBALS['phpgw']->db->query("SELECT content 
FROM phpgw_app_sessions WHERE "
+                                       . "sessionid = '".$this->sessionid."' 
AND loginid = '".$this->account_id."'"
+                                       . " AND app = '".$appname."' AND 
location = '".$location."'",__LINE__,__FILE__);
+ 
+                               $encrypteddata = 
$GLOBALS['phpgw']->crypto->encrypt($data);
+                               $encrypteddata = 
$GLOBALS['phpgw']->db->db_addslashes($encrypteddata);
+ 
+                               if ($GLOBALS['phpgw']->db->num_rows()==0)
+                               {
+                                       $GLOBALS['phpgw']->db->query("INSERT 
INTO phpgw_app_sessions (sessionid,loginid,app,location,content,session_dla) "
+                                               . "VALUES 
('".$this->sessionid."','".$this->account_id."','".$appname
+                                               . 
"','".$location."','".$encrypteddata."','" . time() . "')",__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       $GLOBALS['phpgw']->db->query("UPDATE 
phpgw_app_sessions SET content='".$encrypteddata."'"
+                                               . "WHERE sessionid = 
'".$this->sessionid."'"
+                                               . "AND loginid = 
'".$this->account_id."' AND app = '".$appname."'"
+                                               . "AND location = 
'".$location."'",__LINE__,__FILE__);
+                               }
+                       }
+                       // we need to clean up not longer used records, else 
the db gets bigger and bigger
+                       //
+                       $GLOBALS['phpgw']->db->query("DELETE FROM 
phpgw_app_sessions WHERE session_dla <= '" . (time() - 
$GLOBALS['phpgw_info']['server']['sessions_timeout'])
+                               . "'",__LINE__,__FILE__);
+ 
+                       return $data;
+               }
+ 
+               /*!
                @function save_appsession
                @syntax save_appsession( $data,$id='' )
***************
*** 222,226 ****
                                $id = $this->appsession_id;
                        }
!                       
$GLOBALS['phpgw']->session->appsession($id,'etemplate',$data);
  
                        return $id;
--- 303,307 ----
                                $id = $this->appsession_id;
                        }
!                       
$this/*GLOBALS['phpgw']->session*/->appsession($id,'etemplate',$data);
  
                        return $id;
***************
*** 237,243 ****
                function get_appsession($id)
                {
!                       $data = 
$GLOBALS['phpgw']->session->appsession($id,'etemplate');
  
                        //echo "<p>get_appsession('$id') data="; 
_debug_array($data);
  
                        return $data;
--- 318,328 ----
                function get_appsession($id)
                {
!                       $data = 
$this/*GLOBALS['phpgw']->session*/->appsession($id,'etemplate');
  
                        //echo "<p>get_appsession('$id') data="; 
_debug_array($data);
+ 
+                       // if we delete the returned value here, we cant get 
back (back-button),
+                       // not even to a non-submitted page
+                       
//$GLOBALS['phpgw']->session->appsession_delete($id,'etemplate');
  
                        return $data;

Index: class.date_widget.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.date_widget.inc.php,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -C2 -r1.13.2.1 -r1.13.2.2
*** class.date_widget.inc.php   18 Aug 2003 23:13:52 -0000      1.13.2.1
--- class.date_widget.inc.php   20 Aug 2003 00:35:24 -0000      1.13.2.2
***************
*** 154,158 ****
                                        $dcell['type'] = 'html';
                                        $dcell['name'] = 'str';
!                                       $value['str'] = 
$this->jscal->input($name.'[str]',False,$value['Y'],$value['m'],$value['d'],$cell['help']);
                                        $n = 2;                         // no 
other fields
                                        $options &= ~2;         // no set-today 
button
--- 154,158 ----
                                        $dcell['type'] = 'html';
                                        $dcell['name'] = 'str';
!                                       $value['str'] = 
$this->jscal->input($name.'[str]',False,$value['Y'],$value['m'],$value['d'],lang($cell['help']));
                                        $n = 2;                         // no 
other fields
                                        $options &= ~2;         // no set-today 
button
***************
*** 165,169 ****
                                        $dcell['size'] = $opts[$format[$n]];
                                        $dcell['name'] = $format[$n];
!                                       $dcell['help'] = 
lang($help[$format[$n]]).': '.$cell['help'];   // note: no lang on help, 
already done
                                }
                                if ($n == 4)
--- 165,169 ----
                                        $dcell['size'] = $opts[$format[$n]];
                                        $dcell['name'] = $format[$n];
!                                       $dcell['help'] = 
lang($help[$format[$n]]).': '.lang($cell['help']);     // note: no lang on 
help, already done
                                }
                                if ($n == 4)
***************
*** 193,197 ****
                                {
                                        $dcell = $tpl->empty_cell();
!                                       $dcell['type'] = 'label';
                                        $dcell['name'] = 'space';
                                        $value['space'] = ' &nbsp; &nbsp; ';
--- 193,197 ----
                                {
                                        $dcell = $tpl->empty_cell();
!                                       $dcell['type'] = 'html';
                                        $dcell['name'] = 'space';
                                        $value['space'] = ' &nbsp; &nbsp; ';
***************
*** 241,247 ****
                                }
                        }
!                       if (isset($value_in['str']))
                        {
!                               $value = 
$this->jscal->input2date($value_in['str'],False,'d','m','Y');
                        }
                        if ($value['d'] || isset($value['H']) && $value['H'] 
!== '' ||
--- 241,251 ----
                                }
                        }
!                       if (isset($value_in['str']) && !empty($value_in['str']))
                        {
!                               if (!is_array($value))
!                               {
!                                       $value = array();
!                               }
!                               $value += 
$this->jscal->input2date($value_in['str'],False,'d','m','Y');
                        }
                        if ($value['d'] || isset($value['H']) && $value['H'] 
!== '' ||

Index: class.html.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.html.inc.php,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -C2 -r1.22 -r1.22.2.1
*** class.html.inc.php  6 Jul 2003 11:01:16 -0000       1.22
--- class.html.inc.php  20 Aug 2003 00:35:24 -0000      1.22.2.1
***************
*** 171,175 ****
                if (!is_array($vars))
                {
!                       $vars = explode('&',$vars);
                }
                list($url,$v) = explode('?',$url);      // url may contain 
additional vars
--- 171,175 ----
                if (!is_array($vars))
                {
!                       $vars = empty($vars) ? array() : explode('&',$vars);
                }
                list($url,$v) = explode('?',$url);      // url may contain 
additional vars

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -C2 -r1.28 -r1.28.2.1
*** class.soetemplate.inc.php   8 Aug 2003 16:18:30 -0000       1.28
--- class.soetemplate.inc.php   20 Aug 2003 00:35:24 -0000      1.28.2.1
***************
*** 761,765 ****
                                if (!isset($langarr[$message_id]))
                                {
!                                       if (isset($langarr[$content]))  // 
caused by not lowercased-message_id's
                                        {
                                                unset($langarr[$content]);
--- 761,765 ----
                                if (!isset($langarr[$message_id]))
                                {
!                                       if (@isset($langarr[$content])) // 
caused by not lowercased-message_id's
                                        {
                                                unset($langarr[$content]);

Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.62.2.1
retrieving revision 1.62.2.2
diff -C2 -r1.62.2.1 -r1.62.2.2
*** class.uietemplate.inc.php   18 Aug 2003 23:13:52 -0000      1.62.2.1
--- class.uietemplate.inc.php   20 Aug 2003 00:35:24 -0000      1.62.2.2
***************
*** 115,140 ****
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
$content['app_header'];
                        }
- /*
-                       $html = '';
-                       if ($this->stable)
-                       {
-                               $hooked = 
$GLOBALS['phpgw']->template->get_var('phpgw_body');
-                               if 
(address@hidden'phpgw_info']['etemplate']['hooked'] && !$return_html)
-                               {
-                                       
$GLOBALS['phpgw_info']['flags']['java_script'] = $this->include_java_script(2);
-                                       
$GLOBALS['phpgw']->common->phpgw_header();
-                               }
-                               else
-                               {
-                                       $html = $this->include_java_script(2);  
// better than nothing
-                               }
-                       }
-                       else
-                       {
-                               $hooked = 
$GLOBALS['phpgw']->xslttpl->get_var('phpgw');
-                               $hooked = $hooked['body_data'];
-                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('java_script' => 
$this->include_java_script(2)));
-                       }
- */
                        if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 
'etemplate')
                        {
--- 115,118 ----
***************
*** 542,557 ****
                                $help = 
$this->get_array($content,substr($help,1));
                        }
                        if ($this->java_script())
                        {
                                if ($help)
                                {
!                                       $options .= " 
onFocus=\"self.status='".addslashes(lang($help))."'; return true;\"";
!                                       $options .= " onBlur=\"self.status=''; 
return true;\"";
                                        if ($cell['type'] == 'button' || 
$cell['type'] == 'file')       // for button additionally when mouse over button
                                        {
!                                               $options .= " 
onMouseOver=\"self.status='".addslashes(lang($help))."'; return true;\"";
                                                $options .= " 
onMouseOut=\"self.status=''; return true;\"";
                                        }
                                }
                                if ($cell['onchange'] && $cell['type'] != 
'button') // values != '1' can only set by a program (not in the editor so fa
                                {
--- 520,551 ----
                                $help = 
$this->get_array($content,substr($help,1));
                        }
+                       $blur = $cell['blur'][0] == '@' ? 
$this->get_array($content,substr($cell['blur'],1)) :
+                               (strlen($cell['blur']) <= 1 ? $cell['blur'] : 
lang($cell['blur']));
+ 
                        if ($this->java_script())
                        {
+                               if ($blur)
+                               {
+                                       if (empty($value))
+                                       {
+                                               $value = $blur;
+                                       }
+                                       $onFocus .= 
"if(this.value=='".addslashes(htmlspecialchars($blur))."') this.value='';";
+                                       $onBlur  .= "if(this.value=='') 
this.value='".addslashes(htmlspecialchars($blur))."';";
+                               }
                                if ($help)
                                {
!                                       $onFocus .= 
"self.status='".addslashes(htmlspecialchars(lang($help)))."'; return true;";
!                                       $onBlur  .= "self.status=''; return 
true;";
                                        if ($cell['type'] == 'button' || 
$cell['type'] == 'file')       // for button additionally when mouse over button
                                        {
!                                               $options .= " 
onMouseOver=\"self.status='".addslashes(htmlspecialchars(lang($help)))."'; 
return true;\"";
                                                $options .= " 
onMouseOut=\"self.status=''; return true;\"";
                                        }
                                }
+                               if ($onBlur)
+                               {
+                                       $options .= " onFocus=\"$onFocus\" 
onBlur=\"$onBlur\"";
+                               }
                                if ($cell['onchange'] && $cell['type'] != 
'button') // values != '1' can only set by a program (not in the editor so fa
                                {
***************
*** 893,896 ****
--- 887,896 ----
                                
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = 
'ext-'.$ext_type;
                        }
+                       // save blur-value to strip it in process_exec
+                       if (!empty($blur) && 
isset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
+                       {
+                               
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = 
is_array($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]) ? 
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] : array('type' => 
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]);
+                               
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]['blur'] = $blur;
+                       }
                        if ($extra_label && ($label != '' || $html == ''))
                        {
***************
*** 968,971 ****
--- 968,976 ----
                                }
                                $value = 
$this->get_array($content_in,$form_name);
+ 
+                               if (isset($attr['blur']) && $attr['blur'] == 
stripslashes($value))
+                               {
+                                       $value = '';    // blur-values is equal 
to emtpy
+                               }
                                //echo "<p>process_show($this->name) $type: 
$form_name = '$value'</p>\n";
                                list($type,$sub) = explode('-',$type);





reply via email to

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