From f71b8f33d78f087691e594edf9ca5686c6eeb083 Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@server.pippins.net>
Date: Wed, 30 Jan 2008 07:49:34 -0700
Subject: [PATCH] Updated install steps

---
 doc/install.txt              |   4 +-
 inc/class.jscalendar.inc.php | 143 +++++++++++++++++++++++++++++++++++
 2 files changed, 145 insertions(+), 2 deletions(-)
 create mode 100644 inc/class.jscalendar.inc.php

diff --git a/doc/install.txt b/doc/install.txt
index d1df207..4521caa 100644
--- a/doc/install.txt
+++ b/doc/install.txt
@@ -32,8 +32,8 @@ Installing
    4) Edit the LOCAL CONFIGURATION section of eq/inc/class.eq.inc.php
       Make sure you update the path locations for your specific:
       upload_target_path & script_path
-   5) Edit the GLOBALS section of the eq/bin/import_ward_data script
-   6) Edit the GLOBALS section of the eq/bin/parse_ward_data script
+   5) Edit the GLOBALS section of the eq/bin/import_ward_data script and fix the permissions
+   6) Edit the GLOBALS section of the eq/bin/parse_ward_data script and fix the permissions
    7) Try to run eq/bin/import_ward_data & parse_ward_data scripts from the commandline
       to check for any missing perl library dependencies and mysql connection. 
       Just run them without command line args.
diff --git a/inc/class.jscalendar.inc.php b/inc/class.jscalendar.inc.php
new file mode 100644
index 0000000..0fda175
--- /dev/null
+++ b/inc/class.jscalendar.inc.php
@@ -0,0 +1,143 @@
+<?php
+	/**
+	* jsCalendar wrapper-class
+	*
+	* @author Ralf Becker <RalfBecker@outdoor-training.de>
+	* @copyright Copyright (C) 2003,2004 Free Software Foundation, Inc. http://www.fsf.org/
+	* @license http://www.fsf.org/licenses/gpl.html GNU General Public License
+	* @package phpgwapi
+	* @subpackage gui
+	* @version $Id: class.jscalendar.inc.php,v 1.1.2.12 2004/05/01 09:24:53 skwashd Exp $
+	*/
+
+	/**
+	* jsCalendar wrapper-class
+	*
+	* @package phpgwapi
+	* @subpackage gui
+	* @internal The constructor load the necessary javascript-files
+	*/
+class jscalendar
+{
+	/*!
+	@function jscalendar
+	@syntax jscalendar( $do_header=True )
+	@author ralfbecker
+	@abstract constructor of the class
+	@param $do_header if true, necessary javascript and css gets loaded, only needed for input
+	*/
+	function jscalendar($do_header=True)
+	{
+		if(!is_object($GLOBALS['phpgw']->js))
+		{
+			$GLOBALS['phpgw']->js = createObject('phpgwapi.javascript');
+		}
+		$GLOBALS['phpgw']->js->validate_file('jscalendar', 'calendar');
+		$this->phpgw_js_url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js';
+		$this->dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+		if ($do_header && !strstr($GLOBALS['phpgw_info']['flags']['css'],'jscalendar'))
+		{
+			$GLOBALS['phpgw_info']['flags']['css'] .= "-->\n</style>\n"
+				. '<link rel="stylesheet" type="text/css" media="all" href="'
+				. $this->phpgw_js_url
+				. '/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />'
+				. "\n<style type=\"text/css\">\n<!--\n";
+
+			$GLOBALS['phpgw_info']['flags']['java_script'] .= "\n"
+				. '<script type="text/javascript" src="'
+				. $GLOBALS['phpgw']->link('/phpgwapi/js/jscalendar/jscalendar-setup.php')
+				."\">\n</script>\n";
+		}
+	}
+
+	/*!
+	@function input
+	@syntax input( $name,$date,$year=0,$month=0,$day=0 )
+	@author ralfbecker
+	@abstract creates an inputfield for the jscalendar (returns the necessary html and js)
+	@param $name name and id of the input-field (it also names the id of the img $name.'-toggle')
+	@param $date date as string or unix timestamp (in users localtime)
+	@param $year,$month,$day if $date is not used
+	@param $helpmsg a helpmessage for the statusline of the browser
+	@param $options any other options to the inputfield
+	@param $setup any other calendar setup options
+	*/
+	function input($name,$date,$year=0,$month=0,$day=0,$helpmsg='',$options='',$setup='')
+	{
+		//echo "<p>jscalendar::input(name='$name', date='$date'='".date('Y-m-d',$date)."', year='$year', month='$month', day='$day')</p>\n";
+
+		if ($date && (is_int($date) || is_numeric($date)))
+		{
+			$year  = intval($GLOBALS['phpgw']->common->show_date($date,'Y'));
+			$month = intval($GLOBALS['phpgw']->common->show_date($date,'n'));
+			$day   = intval($GLOBALS['phpgw']->common->show_date($date,'d'));
+		}
+		if ($year && $month && $day)
+		{
+			$date = date($this->dateformat,mktime(12,0,0,$month,$day,$year));
+		}
+		if ($helpmsg !== '')
+		{
+			$options .= " onFocus=\"self.status='".addslashes($helpmsg)."'; return true;\"" .
+				" onBlur=\"self.status=''; return true;\"";
+		}
+		return
+		'<input type="text" id="'.$name.'" name="'.$name.'" size="12" value="'.$date.'"'.$options.'/>
+		<script type="text/javascript">
+		document.writeln(\'<img id="'.$name.'-trigger" src="'.$GLOBALS['phpgw']->common->find_image('phpgwapi','cal').'" title="'.lang('Select date').'" style="cursor:pointer; cursor:hand;"/>\');
+		Calendar.setup(
+			{
+				inputField  : "'.$name.'",
+				button      : "'.$name.'-trigger",
+				'.$setup.'
+			}
+		);
+		</script>
+		';
+	}
+
+	/*!
+	@function input2date
+	@syntax input2date( $datestr,$raw='raw',$day='day',$month='month',$year='year' )
+	@author ralfbecker
+	@abstract converts the date-string back to an array with year, month, day and a timestamp
+	@param $datestr content of the inputfield generated by jscalendar::input()
+	@param $raw key of the timestamp-field in the returned array or False of no timestamp
+	@param $day,$month,$year keys for the array, eg. to set mday instead of day
+	*/
+	function input2date($datestr,$raw='raw',$day='day',$month='month',$year='year')
+	{
+		if ($datestr === '')
+		{
+			return False;
+		}
+		$fields = split('[./-]',$datestr);
+		foreach(split('[./-]',$this->dateformat) as $n => $field)
+		{
+			$date[$field] = intval($fields[$n]);
+			if($field == 'M')
+			{
+				for($i=1; $i <=12; $i++)
+				{
+					if(date('M',mktime(0,0,0,$i,1,2000)) == $fields[$n])
+					{
+						$date['m'] = $i;
+					}
+				}
+			}
+		}
+		$ret = array(
+			$year  => $date['Y'],
+			$month => $date['m'],
+			$day   => $date['d']
+		);
+		if ($raw)
+		{
+			$ret[$raw] = mktime(12,0,0,$date['m'],$date['d'],$date['Y']);
+		}
+		//echo "<p>jscalendar::input2date('$datestr','$raw',$day','$month','$year') = "; print_r($ret); echo "</p>\n";
+
+		return $ret;
+	}
+}
-- 
2.34.1