Ensure properly encoded popup title
[infodrom.org/service.infodrom.org] / src / Infodrom / calendar / index.wml
index 3448505..c15d24d 100644 (file)
@@ -2,21 +2,21 @@
 
 <future>
 <page func="Infodrom Oldenburg" title="Termine">
+<script type="text/javascript" src="<root_prefix>jquery.editable.js"></script>
 
 <style type="text/css">
-@media only screen and (max-device-width: 640px) {
-     button {
-        width: 4em;
-    }
-}
-
 @media only screen and (max-device-width: 400px) {
     div.view {
-       float: left !important;
        margin-left: 100px;
     }
 }
 
+@media only screen and (max-device-width: 980px) {
+     button {
+        width: 3em;
+    }
+}
+
 div.view {
     float:right;
     margin-top:-30px;
@@ -41,32 +41,36 @@ div.bimonth div.monthcolumn {
     float: left;
     width: 50%;
 }
-div.bimonth div.head {
+div.onemonth div.monthcolumn {
+    float: left;
+    width: 100%;
+}
+div.head {
     font-weight: bold;
     border-bottom: 1px solid #ccc;
     text-align: center;
 }
-div.bimonth div.day {
+div.day {
     position: relative;
     border-bottom: 1px solid #ccc;
 }
-div.bimonth div.sunday {
+div.sunday {
     border-bottom: 1px solid black;
 }
-div.bimonth div.today {
+div.today {
     background: #90ee90;
 }
-div.bimonth div div.wday {
+div div.wday {
     width: 1.6em;
     margin-right: 2px;
     float: left;
 }
-div.bimonth div div.date {
+div div.date {
     width: 1.6em;
     margin-right: 2px;
     float: left;
 }
-div.bimonth div.kw {
+div.kw {
     position: absolute;
     top: 0px;
     right: 1px;
@@ -251,6 +255,7 @@ div.popup_body div#log div.row0
 </select>
 
 <protect><script type="text/javascript">
+var POPUP_TITLE_COMMENT = '<?php echo utf8_encode('Bemerkung hinzufügen'); ?>';
 function menu_close()
 {
     $('div#menu').hide();
@@ -272,6 +277,7 @@ function dom_enhance()
                '<select id="view">',
                '<option value="normal">Normal</option>',
                '<option value="bimonth">2 Monate</option>',
+               '<option value="onemonth">1 Monat</option>',
                '<option value="month">Monat</option>',
                '</select>',
                '</div>'];
@@ -292,7 +298,10 @@ function show_log()
        logwindow.openPopup();
     }
 
-    $.invoke('Calendar_Item/Log', {id: $('div#menu').attr('dav_id')});
+    $.invoke('Calendar_Item/Log', {id: $('div#menu').attr('dav_id')}, function(data){
+       if (!is_mobile())
+           make_editable('div#log div.editable');
+    });
 }
 
 var commentwindow = false;
@@ -311,7 +320,7 @@ function add_comment()
                    '<textarea name="comment" style="width: 296px; height:65px;"></textarea>',
                    '<div style="text-align: center; margin-top: 5px;"><input type="submit" value="Speichern"></div>',
                    '</form>'];
-       commentwindow = new Popup('Bemerkung hinzufügen', '300px', false, html.join(''));
+       commentwindow = new Popup(POPUP_TITLE_COMMENT, '300px', false, html.join(''));
        commentwindow.centerPopup();
        $('form#comment input[type="submit"]').click(function(e){
            $.invoke('Calendar_Item/AddLog', $('form#comment').serialize(), function(data){
@@ -378,6 +387,9 @@ $(function(){
        } else if ($('#view').val() == 'bimonth') {
            $('#month,div.view button').show();
            $.invoke('Calendar/BiMonth', {month: $('#thismonth').val()}, month_actions);
+       } else if ($('#view').val() == 'onemonth') {
+           $('#month,div.view button').show();
+           $.invoke('Calendar/OneMonth', {month: $('#thismonth').val()}, month_actions);
        } else if ($('#view').val() == 'month') {
            $('#month,div.view button').show();
            $.invoke('Calendar/Month', {month: $('#thismonth').val()}, month_actions);
@@ -399,6 +411,10 @@ $(function(){
            $.invoke('Calendar/BiMonth',
                     {month: $('#thismonth').val(),
                      direction: direction}, month_actions);
+       } else if ($('#view').val() == 'onemonth') {
+           $.invoke('Calendar/OneMonth',
+                    {month: $('#thismonth').val(),
+                     direction: direction}, month_actions);
        } else if ($('#view').val() == 'month') {
            $.invoke('Calendar/Month',
                     {month: $('#thismonth').val(),
@@ -406,8 +422,15 @@ $(function(){
        }
     });
     if (document.location.href.indexOf('month=normal') == -1) {
-       $('#view').val('bimonth');
-       $.invoke('Calendar/BiMonth', {month: '<?=date('Y-m')?>'}, month_actions);
+        if (is_mobile()) {
+           $('<meta name="viewport" content="width=device-width, initial-scale=0.75" />').insertAfter('title');
+           $('#view').val('onemonth');
+           $.invoke('Calendar/OneMonth', {month: '<?=date('Y-m')?>'}, month_actions);
+           $('select#view').hide();
+       } else {
+           $('#view').val('bimonth');
+           $.invoke('Calendar/BiMonth', {month: '<?=date('Y-m')?>'}, month_actions);
+       }
     }
     $('#month,div.view button').show();
 });