1 #include <infodrom.style>
4 <page func="Infodrom Oldenburg" title="Termine">
6 <style type="text/css">
7 @media only screen and (max-device-width: 640px) {
13 @media only screen and (max-device-width: 400px) {
15 float: left !important;
28 table#calendar tr.row:hover {
31 table#calendar tr.newkw td {
32 border-top: 1px solid #999;
34 table#calendar tr.month {
37 table#calendar tr.current {
40 div.bimonth div.monthcolumn {
44 div.bimonth div.head {
46 border-bottom: 1px solid #ccc;
51 border-bottom: 1px solid #ccc;
53 div.bimonth div.sunday {
54 border-bottom: 1px solid black;
56 div.bimonth div.today {
59 div.bimonth div div.wday {
64 div.bimonth div div.date {
75 div.month table thead td.title {
78 div.month table tbody td {
83 div.month table tbody td.empty {
86 div.month table tbody td span {
100 border-bottom: 1px solid #8f8f8f;
106 border: 1px solid #8f8f8f;
119 div.popup_body div#log div.caltitle {
120 border-top: 0px !important;
122 div.popup_body div#log div {
126 border-top: 1px solid #ccc;
128 div.popup_body div#log div:hover
135 $textbrowser = strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'w3m/') !== false;
138 <input type="hidden" id="thismonth">
141 if ($textbrowser || (isset($_GET['month']) && $_GET['month'] == 'normal')) {
143 <table id="calendar" width="100%" class="smallfont border" cellspacing="0" summary="">
145 <th width="5%">KW</th>
146 <th width="20%">Datum</th>
147 <th width="55%">Beschreibung</th>
148 <th width="20%">Location</th>
152 setlocale('LC_TIME', 'de_DE');
153 $now = date('Y-m-d H:i:s');
154 $pivot = date('Y-m-d H:i:s', time()+(7*24*60*60));
156 $item = new Calendar();
159 if (empty($_GET['year'])) {
163 $from = mktime(0,0,0,1,1,intval($_GET['year']));
164 $to = mktime(0,0,0,1,1,intval($_GET['year'])+1) - 1;
167 foreach ($item->getItems($from, $to) as $row) {
168 $start = new DateTime($row->dtstart);
169 $newmonth = $start->format('F Y');
170 if ($month != $newmonth) {
173 printf('<tr><td colspan="4"> </td></tr>');
174 printf('<tr class="month" month="%s"><td colspan="4">%s</td></tr>',
175 $start->format('Y-m'), $month);
180 if (strlen($row->description))
181 $tooltip = sprintf(' title="%s"', htmlspecialchars($row->description));
184 if ($row->dtstart >= $now && $row->dtstart < $pivot)
185 $class .= ' current';
186 if (strlen($kw) && $kw != $row->kw)
189 $item = new Calendar_Item($row->dav_id);
190 printf('<tr id="%d" class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
193 $kw != $row->kw ? $row->kw : ' ',
194 Calendar::formatTimespan($row->dtstart, $row->dtend),
195 utf8_decode($item->toSpan()),
196 utf8_decode($row->location));
204 } // $textbrowser || month == 'monat'
207 <div class="clear"></div>
209 <div id="menu" class="menu" style="display:none;">
210 <span class="menu_title" onmouseup="\$(this).parent().hide()">Titel</span>
211 <span class="menu" onmouseup="add_comment()">Comment</span>
212 <span class="menu" onmouseup="show_log()">Protocol</span>
213 <span class="menu" onmouseup="colorise()">Color</span>
214 <span class="menu" onmouseup="menu_close()">close</span>
217 <select name="colorpicker" style="display:none;">
218 <option value="#5484ed">Bold blue</option>
219 <option value="#a4bdfc">Blue</option>
220 <option value="#63b8ff">Steel blue</option>
221 <option value="#87ceeb">Sky blue</option>
222 <option value="#46d6db">Turquoise</option>
223 <option value="#7ae7bf">Light green</option>
224 <option value="#c0ff3e">Olive</option>
225 <option value="#7bd148">Green</option>
226 <option value="#51b749">Bold green</option>
227 <option value="#ffff00">Yellow</option>
228 <option value="#fbd75b">Yellow</option>
229 <option value="#ffb878">Orange</option>
230 <option value="#f4a460">Sandy brown</option>
231 <option value="#ff6a6a">IndianRed</option>
232 <option value="#ffa500">Orange</option>
233 <option value="#ff8247">Sienna</option>
234 <option value="#ff887c">Red</option>
235 <option value="#dc2127">Bold red</option>
236 <option value="#ff7f00">Dark orange</option>
237 <option value="#ee82ee">Violett</option>
238 <option value="#dbadff">Purple</option>
239 <option value="#ff00ff">Magenta</option>
240 <option value="#d4d4d4">Gray</option>
241 <option value="#e1e1e1">Gray</option>
242 <option value="#ededed">Light gray</option>
245 <protect><script type="text/javascript">
246 function menu_close()
248 $('div#menu').hide();
251 function dom_enhance()
253 var html = ['<div class="view">',
254 '<button id="prev" style="display:none;"><<</button>',
256 '<button id="next" style="display:none;">>></button>',
258 '<select id="month" style="display:none;">',
259 '<option value="">jetzt</option>',
262 '<select id="view">',
263 '<option value="normal">Normal</option>',
264 '<option value="bimonth">2 Monate</option>',
265 '<option value="month">Monat</option>',
269 $(html.join('')).insertAfter('h3');
270 $.invoke('Calendar/Months');
273 var logwindow = false;
279 logwindow = new Popup('Protocol', '500px', false, '<div id="log"></div>');
280 logwindow.centerPopup();
282 logwindow.openPopup();
285 $.invoke('Calendar_Item/Log', {id: $('div#menu').attr('dav_id')});
288 var commentwindow = false;
289 function add_comment()
293 if (!commentwindow) {
294 var html = ['<form id="comment">',
295 '<input type="hidden" name="id">',
296 '<label for="name">Name</label>',
297 '<input name="name" style="width: 296px;">',
298 '<label for="url">Link</label>',
299 '<input name="url" style="width: 296px;">',
300 '<label for="comment">Bemerkung</label>',
301 '<textarea name="comment" style="width: 296px; height:65px;"></textarea>',
302 '<div style="text-align: center; margin-top: 5px;"><input type="submit" value="Speichern"></div>',
304 commentwindow = new Popup('Bemerkung hinzufügen', '300px', false, html.join(''));
305 commentwindow.centerPopup();
306 $('form#comment input[type="submit"]').click(function(e){
307 $.invoke('Calendar_Item/AddLog', $('form#comment').serialize(), function(data){
308 commentwindow.closePopup();
313 commentwindow.openPopup();
315 $('form#comment input,form#comment textarea').not('form#comment input[type="submit"]').val('');
316 $('form#comment input[name="id"]').val($('div#menu').attr('dav_id'));
317 $('form#comment input[name="name"]').focus();
320 var incolorise = false;
325 $('select[name="colorpicker"]').simplecolorpicker({
327 }).change(function(e) {
328 if (incolorise) return;
331 var color = $('select[name="colorpicker"]').val();
332 var id = $('div#menu').attr('dav_id');
334 $('span[dav_id="'+id+'"]').css('background-color', color);
336 $.invoke('Calendar_Item/SetColor', {id: id, color: color}, function(data){
340 $('select[name="colorpicker"]').simplecolorpicker('destroy');
341 $('select[name="colorpicker"]').hide();
345 function month_actions(data)
347 $('#termine span').contextmenu(function(e){
348 $('select[name="colorpicker"]').simplecolorpicker('destroy');
349 $('select[name="colorpicker"]').hide();
350 $('div#menu').attr('dav_id', $(this).attr('dav_id'));
351 $('div#menu').positionOn($(this), 'center').show();
355 $('select#month').val($('#thismonth').val());
361 $('#view').val('normal').change(function(e){
362 if ($('#view').val() == 'normal') {
363 document.location.href = document.location.href.split('?')[0] + '?month=normal';
364 } else if ($('#view').val() == 'bimonth') {
365 $('#month,div.view button').show();
366 $.invoke('Calendar/BiMonth', {month: $('#thismonth').val()}, month_actions);
367 } else if ($('#view').val() == 'month') {
368 $('#month,div.view button').show();
369 $.invoke('Calendar/Month', {month: $('#thismonth').val()}, month_actions);
372 $('#month').change(function(e){
373 if ($('#view').val() == 'bimonth') {
374 $.invoke('Calendar/BiMonth', {month: $('#month').val()}, month_actions);
375 } else if ($('#view').val() == 'month') {
376 $.invoke('Calendar/Month', {month: $('#month').val()}, month_actions);
380 $('div.view button').click(function(e){
381 if ($('#view').val() == 'bimonth') {
382 $.invoke('Calendar/BiMonth',
383 {month: $('#thismonth').val(),
384 direction: $(this).attr('id') == 'prev' ? 'prev' : 'next'}, month_actions);
385 } else if ($('#view').val() == 'month') {
386 $.invoke('Calendar/Month',
387 {month: $('#thismonth').val(),
388 direction: $(this).attr('id') == 'prev' ? 'prev' : 'next'}, month_actions);
391 if (document.location.href.indexOf('month=normal') == -1) {
392 $('#view').val('bimonth');
393 $.invoke('Calendar/BiMonth', {month: '<?=date('Y-m')?>'}, month_actions);
395 $('#month,div.view button').show();