1 #include <infodrom.style>
4 <page func="Infodrom Oldenburg" title="Termine">
5 <script type="text/javascript" src="<root_prefix>jquery.editable.js"></script>
7 <style type="text/css">
8 @media only screen and (max-device-width: 400px) {
14 @media only screen and (max-device-width: 980px) {
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.onemonth div.monthcolumn {
50 border-bottom: 1px solid #ccc;
55 border-bottom: 1px solid #ccc;
58 border-bottom: 1px solid black;
79 div.month table thead td.title {
82 div.month table tbody td {
87 div.month table tbody td.empty {
90 div.month table tbody td span {
105 border-bottom: 1px solid #8f8f8f;
111 border: 1px solid #8f8f8f;
124 div.popup_body div#log div.caltitle {
125 border-top: 0px !important;
134 div.popup_body div#log div.row0,
135 div.popup_body div#log div.row1 {
139 border-top: 1px solid #ccc;
141 div.popup_body div#log div.row0
148 $textbrowser = strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'w3m/') !== false;
151 <input type="hidden" id="thismonth">
154 if ($textbrowser || (isset($_GET['month']) && $_GET['month'] == 'normal')) {
156 <table id="calendar" width="100%" class="smallfont border" cellspacing="0" summary="">
158 <th width="5%">KW</th>
159 <th width="20%">Datum</th>
160 <th width="55%">Beschreibung</th>
161 <th width="20%">Location</th>
165 setlocale('LC_TIME', 'de_DE');
166 $now = date('Y-m-d H:i:s');
167 $pivot = date('Y-m-d H:i:s', time()+(7*24*60*60));
169 $item = new Calendar();
172 if (empty($_GET['year'])) {
176 $from = mktime(0,0,0,1,1,intval($_GET['year']));
177 $to = mktime(0,0,0,1,1,intval($_GET['year'])+1) - 1;
180 foreach ($item->getItems($from, $to) as $row) {
181 $start = new DateTime($row->dtstart);
182 $newmonth = $start->format('F Y');
183 if ($month != $newmonth) {
186 printf('<tr><td colspan="4"> </td></tr>');
187 printf('<tr class="month" month="%s"><td colspan="4">%s</td></tr>',
188 $start->format('Y-m'), $month);
193 if (strlen($row->description))
194 $tooltip = sprintf(' title="%s"', htmlspecialchars($row->description));
197 if ($row->dtstart >= $now && $row->dtstart < $pivot)
198 $class .= ' current';
199 if (strlen($kw) && $kw != $row->kw)
202 $item = new Calendar_Item($row->dav_id);
203 printf('<tr id="%d" class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
206 $kw != $row->kw ? $row->kw : ' ',
207 Calendar::formatTimespan($row->dtstart, $row->dtend),
208 utf8_decode($item->toSpan()),
209 utf8_decode($row->location));
217 } // $textbrowser || month == 'monat'
220 <div class="clear"></div>
222 <div id="menu" class="menu" style="display:none;">
223 <span class="menu_title" onmouseup="\$(this).parent().hide()">Titel</span>
224 <span class="menu" onmouseup="add_comment()">Comment</span>
225 <span class="menu" onmouseup="show_log()">Protocol</span>
226 <span class="menu" onmouseup="colorise()">Color</span>
227 <span class="menu" onmouseup="menu_close()">close</span>
230 <select name="colorpicker" style="display:none;">
231 <option value="#5484ed">Bold blue</option>
232 <option value="#a4bdfc">Blue</option>
233 <option value="#63b8ff">Steel blue</option>
234 <option value="#87ceeb">Sky blue</option>
235 <option value="#46d6db">Turquoise</option>
236 <option value="#7ae7bf">Light green</option>
237 <option value="#c0ff3e">Olive</option>
238 <option value="#7bd148">Green</option>
239 <option value="#51b749">Bold green</option>
240 <option value="#ffff00">Yellow</option>
241 <option value="#fbd75b">Yellow</option>
242 <option value="#ffb878">Orange</option>
243 <option value="#f4a460">Sandy brown</option>
244 <option value="#ff6a6a">IndianRed</option>
245 <option value="#ffa500">Orange</option>
246 <option value="#ff8247">Sienna</option>
247 <option value="#ff887c">Red</option>
248 <option value="#dc2127">Bold red</option>
249 <option value="#ff7f00">Dark orange</option>
250 <option value="#ee82ee">Violett</option>
251 <option value="#dbadff">Purple</option>
252 <option value="#ff00ff">Magenta</option>
253 <option value="#d4d4d4">Gray</option>
254 <option value="#e1e1e1">Gray</option>
255 <option value="#ededed">Light gray</option>
258 <protect><script type="text/javascript">
259 function menu_close()
261 $('div#menu').hide();
264 function dom_enhance()
266 var html = ['<div class="view">',
267 '<button id="prev" style="display:none;"><img src="'+site_url('pix/left.png')+'" /></button>',
269 '<button id="sync" style="display:none;"><img src="'+site_url('pix/sync.png')+'" /></button>',
271 '<button id="next" style="display:none;"><img src="'+site_url('pix/right.png')+'" /></button>',
273 '<select id="month" style="display:none;">',
274 '<option value="">jetzt</option>',
277 '<select id="view">',
278 '<option value="normal">Normal</option>',
279 '<option value="bimonth">2 Monate</option>',
280 '<option value="onemonth">1 Monat</option>',
281 '<option value="month">Monat</option>',
285 $(html.join('')).insertAfter('h3');
286 $.invoke('Calendar/Months');
289 var logwindow = false;
295 logwindow = new Popup('Protocol', '460px', false, '<div id="log"></div>');
296 logwindow.centerPopup();
298 logwindow.openPopup();
301 $.invoke('Calendar_Item/Log', {id: $('div#menu').attr('dav_id')}, function(data){
303 make_editable('div#log div.editable');
307 var commentwindow = false;
308 function add_comment()
312 if (!commentwindow) {
313 var html = ['<form id="comment">',
314 '<input type="hidden" name="id">',
315 '<label for="name">Name</label>',
316 '<input name="name" style="width: 296px;">',
317 '<label for="url">Link</label>',
318 '<input name="url" style="width: 296px;">',
319 '<label for="comment">Bemerkung</label>',
320 '<textarea name="comment" style="width: 296px; height:65px;"></textarea>',
321 '<div style="text-align: center; margin-top: 5px;"><input type="submit" value="Speichern"></div>',
323 commentwindow = new Popup('Bemerkung hinzufügen', '300px', false, html.join(''));
324 commentwindow.centerPopup();
325 $('form#comment input[type="submit"]').click(function(e){
326 $.invoke('Calendar_Item/AddLog', $('form#comment').serialize(), function(data){
327 commentwindow.closePopup();
332 commentwindow.openPopup();
334 $('form#comment input,form#comment textarea').not('form#comment input[type="submit"]').val('');
335 $('form#comment input[name="id"]').val($('div#menu').attr('dav_id'));
336 $('form#comment input[name="name"]').focus();
339 var incolorise = false;
344 $('select[name="colorpicker"]').simplecolorpicker({
346 }).change(function(e) {
347 if (incolorise) return;
350 var color = $('select[name="colorpicker"]').val();
351 var id = $('div#menu').attr('dav_id');
353 $('span[dav_id="'+id+'"]').css('background-color', color);
355 $.invoke('Calendar_Item/SetColor', {id: id, color: color}, function(data){
359 $('select[name="colorpicker"]').simplecolorpicker('destroy');
360 $('select[name="colorpicker"]').hide();
364 function month_actions(data)
366 $('#termine span').contextmenu(function(e){
367 $('select[name="colorpicker"]').simplecolorpicker('destroy');
368 $('select[name="colorpicker"]').hide();
369 $('div#menu').attr('dav_id', $(this).attr('dav_id'));
370 $('div#menu').positionOn($(this), 'center').show();
373 $('#termine span').click(function(e){
374 $('div#menu').attr('dav_id', $(this).attr('dav_id'));
378 $('select#month').val($('#thismonth').val());
384 $('#view').val('normal').change(function(e){
385 if ($('#view').val() == 'normal') {
386 document.location.href = document.location.href.split('?')[0] + '?month=normal';
387 } else if ($('#view').val() == 'bimonth') {
388 $('#month,div.view button').show();
389 $.invoke('Calendar/BiMonth', {month: $('#thismonth').val()}, month_actions);
390 } else if ($('#view').val() == 'onemonth') {
391 $('#month,div.view button').show();
392 $.invoke('Calendar/OneMonth', {month: $('#thismonth').val()}, month_actions);
393 } else if ($('#view').val() == 'month') {
394 $('#month,div.view button').show();
395 $.invoke('Calendar/Month', {month: $('#thismonth').val()}, month_actions);
398 $('#month').change(function(e){
399 if ($('#view').val() == 'bimonth') {
400 $.invoke('Calendar/BiMonth', {month: $('#month').val()}, month_actions);
401 } else if ($('#view').val() == 'month') {
402 $.invoke('Calendar/Month', {month: $('#month').val()}, month_actions);
406 $('div.view button').click(function(e){
408 if ($(this).attr('id') != 'sync')
409 direction = $(this).attr('id') == 'prev' ? 'prev' : 'next';
410 if ($('#view').val() == 'bimonth') {
411 $.invoke('Calendar/BiMonth',
412 {month: $('#thismonth').val(),
413 direction: direction}, month_actions);
414 } else if ($('#view').val() == 'onemonth') {
415 $.invoke('Calendar/OneMonth',
416 {month: $('#thismonth').val(),
417 direction: direction}, month_actions);
418 } else if ($('#view').val() == 'month') {
419 $.invoke('Calendar/Month',
420 {month: $('#thismonth').val(),
421 direction: direction}, month_actions);
424 if (document.location.href.indexOf('month=normal') == -1) {
426 $('<meta name="viewport" content="width=device-width, initial-scale=0.75" />').insertAfter('title');
427 $('#view').val('onemonth');
428 $.invoke('Calendar/OneMonth', {month: '<?=date('Y-m')?>'}, month_actions);
429 $('select#view').hide();
431 $('#view').val('bimonth');
432 $.invoke('Calendar/BiMonth', {month: '<?=date('Y-m')?>'}, month_actions);
435 $('#month,div.view button').show();