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;
129 div.popup_body div#log div.row0,
130 div.popup_body div#log div.row1 {
134 border-top: 1px solid #ccc;
136 div.popup_body div#log div.row0
143 $textbrowser = strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'w3m/') !== false;
146 <input type="hidden" id="thismonth">
149 if ($textbrowser || (isset($_GET['month']) && $_GET['month'] == 'normal')) {
151 <table id="calendar" width="100%" class="smallfont border" cellspacing="0" summary="">
153 <th width="5%">KW</th>
154 <th width="20%">Datum</th>
155 <th width="55%">Beschreibung</th>
156 <th width="20%">Location</th>
160 setlocale('LC_TIME', 'de_DE');
161 $now = date('Y-m-d H:i:s');
162 $pivot = date('Y-m-d H:i:s', time()+(7*24*60*60));
164 $item = new Calendar();
167 if (empty($_GET['year'])) {
171 $from = mktime(0,0,0,1,1,intval($_GET['year']));
172 $to = mktime(0,0,0,1,1,intval($_GET['year'])+1) - 1;
175 foreach ($item->getItems($from, $to) as $row) {
176 $start = new DateTime($row->dtstart);
177 $newmonth = $start->format('F Y');
178 if ($month != $newmonth) {
181 printf('<tr><td colspan="4"> </td></tr>');
182 printf('<tr class="month" month="%s"><td colspan="4">%s</td></tr>',
183 $start->format('Y-m'), $month);
188 if (strlen($row->description))
189 $tooltip = sprintf(' title="%s"', htmlspecialchars($row->description));
192 if ($row->dtstart >= $now && $row->dtstart < $pivot)
193 $class .= ' current';
194 if (strlen($kw) && $kw != $row->kw)
197 $item = new Calendar_Item($row->dav_id);
198 printf('<tr id="%d" class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
201 $kw != $row->kw ? $row->kw : ' ',
202 Calendar::formatTimespan($row->dtstart, $row->dtend),
203 utf8_decode($item->toSpan()),
204 utf8_decode($row->location));
212 } // $textbrowser || month == 'monat'
215 <div class="clear"></div>
217 <div id="menu" class="menu" style="display:none;">
218 <span class="menu_title" onmouseup="\$(this).parent().hide()">Titel</span>
219 <span class="menu" onmouseup="add_comment()">Comment</span>
220 <span class="menu" onmouseup="show_log()">Protocol</span>
221 <span class="menu" onmouseup="colorise()">Color</span>
222 <span class="menu" onmouseup="menu_close()">close</span>
225 <select name="colorpicker" style="display:none;">
226 <option value="#5484ed">Bold blue</option>
227 <option value="#a4bdfc">Blue</option>
228 <option value="#63b8ff">Steel blue</option>
229 <option value="#87ceeb">Sky blue</option>
230 <option value="#46d6db">Turquoise</option>
231 <option value="#7ae7bf">Light green</option>
232 <option value="#c0ff3e">Olive</option>
233 <option value="#7bd148">Green</option>
234 <option value="#51b749">Bold green</option>
235 <option value="#ffff00">Yellow</option>
236 <option value="#fbd75b">Yellow</option>
237 <option value="#ffb878">Orange</option>
238 <option value="#f4a460">Sandy brown</option>
239 <option value="#ff6a6a">IndianRed</option>
240 <option value="#ffa500">Orange</option>
241 <option value="#ff8247">Sienna</option>
242 <option value="#ff887c">Red</option>
243 <option value="#dc2127">Bold red</option>
244 <option value="#ff7f00">Dark orange</option>
245 <option value="#ee82ee">Violett</option>
246 <option value="#dbadff">Purple</option>
247 <option value="#ff00ff">Magenta</option>
248 <option value="#d4d4d4">Gray</option>
249 <option value="#e1e1e1">Gray</option>
250 <option value="#ededed">Light gray</option>
253 <protect><script type="text/javascript">
254 function menu_close()
256 $('div#menu').hide();
259 function dom_enhance()
261 var html = ['<div class="view">',
262 '<button id="prev" style="display:none;"><<</button>',
264 '<button id="next" style="display:none;">>></button>',
266 '<select id="month" style="display:none;">',
267 '<option value="">jetzt</option>',
270 '<select id="view">',
271 '<option value="normal">Normal</option>',
272 '<option value="bimonth">2 Monate</option>',
273 '<option value="month">Monat</option>',
277 $(html.join('')).insertAfter('h3');
278 $.invoke('Calendar/Months');
281 var logwindow = false;
287 logwindow = new Popup('Protocol', '460px', false, '<div id="log"></div>');
288 logwindow.centerPopup();
290 logwindow.openPopup();
293 $.invoke('Calendar_Item/Log', {id: $('div#menu').attr('dav_id')});
296 var commentwindow = false;
297 function add_comment()
301 if (!commentwindow) {
302 var html = ['<form id="comment">',
303 '<input type="hidden" name="id">',
304 '<label for="name">Name</label>',
305 '<input name="name" style="width: 296px;">',
306 '<label for="url">Link</label>',
307 '<input name="url" style="width: 296px;">',
308 '<label for="comment">Bemerkung</label>',
309 '<textarea name="comment" style="width: 296px; height:65px;"></textarea>',
310 '<div style="text-align: center; margin-top: 5px;"><input type="submit" value="Speichern"></div>',
312 commentwindow = new Popup('Bemerkung hinzufügen', '300px', false, html.join(''));
313 commentwindow.centerPopup();
314 $('form#comment input[type="submit"]').click(function(e){
315 $.invoke('Calendar_Item/AddLog', $('form#comment').serialize(), function(data){
316 commentwindow.closePopup();
321 commentwindow.openPopup();
323 $('form#comment input,form#comment textarea').not('form#comment input[type="submit"]').val('');
324 $('form#comment input[name="id"]').val($('div#menu').attr('dav_id'));
325 $('form#comment input[name="name"]').focus();
328 var incolorise = false;
333 $('select[name="colorpicker"]').simplecolorpicker({
335 }).change(function(e) {
336 if (incolorise) return;
339 var color = $('select[name="colorpicker"]').val();
340 var id = $('div#menu').attr('dav_id');
342 $('span[dav_id="'+id+'"]').css('background-color', color);
344 $.invoke('Calendar_Item/SetColor', {id: id, color: color}, function(data){
348 $('select[name="colorpicker"]').simplecolorpicker('destroy');
349 $('select[name="colorpicker"]').hide();
353 function month_actions(data)
355 $('#termine span').contextmenu(function(e){
356 $('select[name="colorpicker"]').simplecolorpicker('destroy');
357 $('select[name="colorpicker"]').hide();
358 $('div#menu').attr('dav_id', $(this).attr('dav_id'));
359 $('div#menu').positionOn($(this), 'center').show();
362 $('#termine span').click(function(e){
363 $('div#menu').attr('dav_id', $(this).attr('dav_id'));
367 $('select#month').val($('#thismonth').val());
373 $('#view').val('normal').change(function(e){
374 if ($('#view').val() == 'normal') {
375 document.location.href = document.location.href.split('?')[0] + '?month=normal';
376 } else if ($('#view').val() == 'bimonth') {
377 $('#month,div.view button').show();
378 $.invoke('Calendar/BiMonth', {month: $('#thismonth').val()}, month_actions);
379 } else if ($('#view').val() == 'month') {
380 $('#month,div.view button').show();
381 $.invoke('Calendar/Month', {month: $('#thismonth').val()}, month_actions);
384 $('#month').change(function(e){
385 if ($('#view').val() == 'bimonth') {
386 $.invoke('Calendar/BiMonth', {month: $('#month').val()}, month_actions);
387 } else if ($('#view').val() == 'month') {
388 $.invoke('Calendar/Month', {month: $('#month').val()}, month_actions);
392 $('div.view button').click(function(e){
393 if ($('#view').val() == 'bimonth') {
394 $.invoke('Calendar/BiMonth',
395 {month: $('#thismonth').val(),
396 direction: $(this).attr('id') == 'prev' ? 'prev' : 'next'}, month_actions);
397 } else if ($('#view').val() == 'month') {
398 $.invoke('Calendar/Month',
399 {month: $('#thismonth').val(),
400 direction: $(this).attr('id') == 'prev' ? 'prev' : 'next'}, month_actions);
403 if (document.location.href.indexOf('month=normal') == -1) {
404 $('#view').val('bimonth');
405 $.invoke('Calendar/BiMonth', {month: '<?=date('Y-m')?>'}, month_actions);
407 $('#month,div.view button').show();