Subversion Repositories public

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 andreas 1
<?php
2
	/*
3
		Copyright (C) 2003-2004 MJG/04-Inconceivable.org
4
		See file LICENSE for licensing details.
5
		See file VERSION for versioning/author/source details
6
		See file CHANGELOG for changes from version to version
7
	*/
8
	// Include configuration data
9
//require_once('version.inc');
10
//require_once('header.inc');
11
require_once('../dbaccess.inc');
12
	include("../global_config.inc.php");
13
 
14
	// connect to the database
15
	$CONF['dbConn'] = OpenDB();
16
 
17
	// Authenticate via the set cookie from index.php
18
	if ( md5($CONF['adm_user'] . $CONF['adm_pass']) != $_COOKIE['mcal_adm_auth'] )
19
	{
20
		header("Location: index.php?year=" . $FORM['year'] . "&month=" . $FORM['month'] . "&today=" . $FORM['today'] . "\n\n");
21
		exit(1);
22
	}
23
?>
24
 
25
 
26
<html>
27
	<head>
28
		<title>Schedule Administration || Appt! Personal Scheduler</title>
29
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
30
		<style type="text/css">
31
<?php include($CONF['path_include'] . "/styles.css"); ?>
32
		</style>
33
		<script language="JavaScript">
34
		<!--
35
			function confirm_del($url)
36
			{
37
				var return_value = confirm('*** WARNING ***\n\nYou are about to remove this event.\n\nYour information will be lost.\n\nContinue?') ;
38
				if ( return_value == true ) { window.location = $url; }
39
			}
40
		-->
41
		</script>
42
	</head>
43
<body bgcolor="#ffffff">
44
 
45
 
46
 
47
<?php
48
 
49
 
50
 
51
//begin outer table structure
52
echo "<table align='center' border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"528\">
53
        <tr>
54
          <td>
55
            <table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"311\" bgcolor=\"black\">
56
              <tr>
57
                <td bgcolor=\"white\" valign=\"middle\" align=\"center\"><b>$daylong, $monthlong $today, $year</b></td>
58
              </tr>
59
            </table>
60
          </td>
61
          <td valign=\"middle\" align=\"center\">
62
            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
63
              <tr>
64
                <td valign=\"middle\" align=\"center\"><a href=\"" . $CONF['url_base'] . "/admin/admin.php?year=$last_year&today=$today&month=$month\" onmouseover=\"document.calb2.src='" . $CONF['url_images'] . "/ltab2over.gif'\" onmouseout=\"document.calb2.src='" . $CONF['url_images'] . "/ltab2.gif'\"><img src=\"" . $CONF['url_images'] . "/ltab2.gif\" border=\"0\" name=\"calb2\"></a></td><td>&nbsp;</td>
65
                <td valign=\"middle\" align=\"center\">
66
                  <table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"180\" bgcolor=\"black\">
67
                    <tr>
68
                      <td bgcolor=\"white\" valign=\"middle\" align=\"center\"><b>$year</b></td>
69
                    </tr>
70
                  </table>
71
                </td>
72
                <td>&nbsp;</td><td valign=\"middle\" align=\"center\"><a href=\"" . $CONF['url_base'] . "/admin/admin.php?year=$next_year&today=$today&month=$month\" onmouseover=\"document.calb1.src='" . $CONF['url_images'] . "/rtab2over.gif'\" onmouseout=\"document.calb1.src='" . $CONF['url_images'] . "/rtab2.gif'\"><img src=\"" . $CONF['url_images'] . "/rtab2.gif\" border=\"0\" name=\"calb1\"></a></td>
73
              </tr>
74
            </table>
75
          </td>
76
        </tr>
77
        <tr>
78
          <td valign=\"top\">
79
 
80
              <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"445\">
81
              <tr>
82
                <td class=\"cellbg\" valign=\"top\">";
83
 
84
// Load and display day title and content in fields
85
$sql_date = mktime(0, 0, 0, $month, $today, $year);
86
$sqlQuery = "SELECT ca_title, ca_text, ca_num ";
87
$sqlQuery .= "FROM calendar ";
88
$sqlQuery .= "WHERE ca_date = '$sql_date'";
89
 
90
if ( $sqlExec = QueryDB($CONF['dbConn'], $sqlQuery) )
91
{
92
	if ($sqlExec)
93
	   $nr = pg_num_rows($sqlExec);
94
	else
95
	   $nr = 0;
96
 
97
	if ( $nr > 0 && $data = pg_fetch_row($sqlExec, 0) )
98
	{
99
		$EVENT['title'] = $data[0];
100
		$EVENT['event']	= stripslashes($data[1]);
101
		$EVENT['html'] = 1;
102
		$EVENT['date'] = $sql_date;
103
		$EVENT['id'] = $data[2];
104
	}
105
}
106
 
107
if ( isset($EVENT['html']) && ($EVENT['html'] == 1) )
108
{
109
	$Ychecked = " checked";
110
	$Nchecked = "";
111
}
112
else
113
{
114
	$Ychecked = "";
115
	$Nchecked = " checked";
116
}
117
 
118
echo '<form name="post" action="post.php" method="post">
119
      <input type="hidden" name="year" value="' . $FORM['year'] . '">
120
      <input type="hidden" name="month" value="' . $FORM['month'] . '">
121
      <input type="hidden" name="today" value="' . $FORM['today'] . '">';
122
echo '<table cellspacing="0" cellpadding="0">';
123
echo '<tr>';
124
echo '<td width="100%" colspan="2">';
125
 
126
echo 'HTML anzeigen? Nein<input type="radio" value="0" name="html" ' . $Nchecked . '> Ja<input type="radio" value="1" name="html" ' . $Ychecked . '><br /><br />
127
      Titel des Eintrags<br /><input type="text" name="day_title" value="' . $EVENT['title'] . '" size="40"><br />
128
      <br />
129
      Event Info<br /><textarea name="day_event" cols="40" rows="14">' . $EVENT['event'] . '</textarea>
130
      <br /><br />';
131
echo '</td></tr>';
132
echo '<tr><td width="50%" align="center">';
133
echo '<input type="image" src="' . $CONF['url_images'] . '/addevent.gif">';
134
echo '</td><td width="50%" align="center">';
135
echo "<a href=\"javascript:void(null)\" onClick=\"confirm_del('post.php?year=" . $FORM['year'] . "&month=" . $FORM['month'] . "&today=" . $FORM['today'] . "&del=1'); return false\"><img src=\"" . $CONF['url_images'] . "/delevent.gif\" border=\"0\"></a>\n";
136
echo '</td></tr>';
137
echo '<tr><td width="100%" align="center" colspan="2">';
138
echo "<br><center>";
139
echo "<a href='http://www.inconceivable.org/projects/appt'><font size='-2'>Powered by Appt! " . $CONF['__version'] . "</font></a>";
140
echo '<br />';
141
echo '<a href="../appt.php?year=' . $FORM['year'] . '&month=' . $FORM['month'] . '&today=' . $FORM['today'] . '" style="font-size:10px;">MAIN</a>';
142
echo "</center>";
143
echo '</td></tr>';
144
echo '</table>';
145
echo '</form>';
146
 
147
         echo "</td>
148
              </tr>
149
              </table>
150
 
151
          <td valign=\"top\">
152
 
153
  <table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"black\" width=\"250\">
154
      <tr>
155
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=1';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=1\" class=\"normal\">Jan</a> </td>
156
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=2';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=2\" class=\"normal\">Feb</a> </td>
157
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=3';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=3\" class=\"normal\">M&auml;r</a> </td>
158
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=4';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=4\" class=\"normal\">Apr</a> </td>
159
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=5';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=5\" class=\"normal\">Mai</a> </td>
160
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=6';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=6\" class=\"normal\">Jun</a> </td>
161
      </tr>
162
      <tr>
163
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=7';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=7\" class=\"normal\">Jul</a> </td>
164
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=8';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=8\" class=\"normal\">Aug</a> </td>
165
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=9';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=9\" class=\"normal\">Sep</a> </td>
166
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=10';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=10\" class=\"normal\">Okt</a> </td>
167
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=11';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=11\" class=\"normal\">Nov</a> </td>
168
        <td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=1&month=12';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=12\" class=\"normal\">Dez</a> </td>
169
      </tr>
170
    </table><br />\n";
171
 
172
 
173
//display name of month
174
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" bgcolor=\"black\" width=\"250\">\n<tr>\n";
175
echo "<td class=\"cellbg\" colspan=\"7\" valign=\"middle\" align=\"center\"><font class=\"regheading\"><b>" . date("F",mktime(1,1,1,$month,1,$year)) . "</b></font>\n</td>\n";
176
echo "</tr>\n<tr>\n";
177
 
178
 
179
// Display day names
180
foreach($alldays as $value) {
181
  echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\" width=\"10%\"><font class=\"normaltext\"><b>$value</b></font></td>\n";
182
}
183
echo "</tr>\n<tr>\n";
184
 
185
 
186
// Display blank days as nbsp's
187
for ($i = 0; $i < $dayone; $i++) {
188
  echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\"><font class=\"normaltext\">&nbsp;</font></td>\n";
189
}
190
 
191
 
192
// Display days
193
for ($zz = 1; $zz <= $numdays; $zz++) {
194
  if ($i >= 7) {  print("</tr>\n<tr>\n"); $i=0; }
195
  //check current day for an event
196
  $result_found = 0;
197
  if ($zz == $today) { //mark todays cell regardless
198
    echo "<td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=$zz&month=$month';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='celltoday'\" class=\"celltoday\"><a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=$zz&month=$month\" class=\"today\">$zz</a></td>\n";
199
    $result_found = 1;
200
  }
201
  if ($result_found != 1) {//search for event on this day and mark cell if title not empty
202
    $sql_currentday = mktime(0, 0, 0, $month, $zz, $year);
203
    $eventQuery = "SELECT ca_title ";
204
    $eventQuery .= "FROM calendar ";
205
    $eventQuery .= "WHERE ca_date = '$sql_currentday'";
206
 
207
    $eventExec = QueryDB($CONF['dbConn'], $eventQuery);
208
    $nr = pg_num_rows($eventExec);
209
    $j = 0;
210
 
211
    while($j < $nr) {
212
       $data = pg_fetch_row($eventExec, $j);
213
       $row['title'] = $data[0];
214
 
215
      if (strlen($row["title"]) > 0)
216
      {
217
        echo "<td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=$zz&month=$month';\"  onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellevent'\" class=\"cellevent\"><a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=$zz&month=$month\" class=\"normal\">$zz</a></td>\n";
218
        $result_found = 1;
219
      }
220
 
221
      $j++;
222
    }
223
  }
224
 
225
  if ($result_found != 1) {//show default cell style for day
226
    echo "<td valign=\"middle\" align=\"center\" onClick=\"window.location='" .$_SERVER['PHP_SELF']. "?year=$year&today=$zz&month=$month';\" onMouseOver=\"this.className='cellover'\"; onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"><a href=\"".$_SERVER['PHP_SELF']."?year=$year&today=$zz&month=$month\" class=\"normal\">$zz</a></td>\n";
227
  }
228
 
229
  $i++; $result_found = 0;
230
}
231
 
232
$create_emptys = 7 - (($dayone + $numdays) % 7);
233
if ($create_emptys == 7) { $create_emptys = 0; }
234
 
235
//display blank remaining cells
236
if ($create_emptys != 0) {
237
  echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\" colspan=\"$create_emptys\"><font class=\"normaltext\">&nbsp;</font></td>\n";
238
}
239
 
240
echo "</tr>\n";
241
echo "</table><br />\n";
242
//add weekly glance here if needed
243
echo "<center><a href=\"".$_SERVER['PHP_SELF']."\" class=\"normal\">Jump to Today</a></center>";
244
 
245
 
246
 
247
//end outer table
248
echo "</td>
249
        </tr>
250
      </table>\n";
251
 
252
?>
253
 
254
	</body>
255
</html>