TaskForest

 view release on metacpan or  search on metacpan

htdocs/logs_form.html  view on Meta::CPAN

<include TaskForest::REST::PassThrough /head.html />


    <link rel="stylesheet" type="text/css" href="/yui/build/calendar/assets/skins/sam/calendar.css">
    <link rel="stylesheet" type="text/css" href="/yui/build/container/assets/skins/sam/container.css" />
    <script type="text/javascript" src="/yui/build/calendar/calendar-min.js"></script>
    <script type="text/javascript" src="/yui/build/container/container-min.js"></script> 
    <style type="text/css">
        /* Clear calendar's float, using dialog inbuilt form element */
        #container .bd form {
            clear:left;
        }

        /* Have calendar squeeze upto bd bounding box */
        #container .bd {
            padding:0;
        }

        #container .hd {
            text-align:left;
        }

        /* Prevent border-collapse:collapse from bleeding through in IE6, IE7 */
        #container_c.yui-overlay-hidden table {
            *display:none;
        }

        /* Remove calendar's border and set padding in ems instead of px, so we can specify an width in ems for the container */
        #cal {
            border:none;
            padding:1em;
        }
    </style>




    <form id="logs" class="request" method="GET" action="/logs.html">
            <div class="width2 label"><label for="logs_date">Date</label></div>
            <div style="float:left;"><input class="width1" id="logs_date" name="date" size=8 maxlength=8></div>
            <div class="width1"><button type="button" id="show" title="Show Calendar" style="vertical-align:middle;"><img src="/calendar.png" width="13" height="11" alt="Calendar"></button></div>
            <div class="width1"><input type=submit name=submit  value="View Logs"/></div>

    </form>
    <script type="text/javascript">
    // adapted from http://developer.yahoo.com/yui/examples/calendar/calcontainer.html
    YAHOO.util.Event.onDOMReady(function(){
 
        var Event = YAHOO.util.Event,
            Dom = YAHOO.util.Dom,
            dialog,
            calendar;
 
        var showBtn = Dom.get("show");
 
        Event.on(showBtn, "click", function() {
 
            // Lazy Dialog Creation - Wait to create the Dialog, and setup document click listeners, until the first time the button is clicked.
            if (!dialog) {
 
                // Hide Calendar if we click anywhere in the document other than the calendar
                Event.on(document, "click", function(e) {
                    var el = Event.getTarget(e);
                    var dialogEl = dialog.element;
                    if (el != dialogEl && !Dom.isAncestor(dialogEl, el) && el != showBtn && !Dom.isAncestor(showBtn, el)) {
                        dialog.hide();
                    }
                });
 
                function resetHandler() {
                    // Reset the current calendar page to the select date, or 
                    // to today if nothing is selected.
                    var selDates = calendar.getSelectedDates();
                    var resetDate;
        
                    if (selDates.length > 0) {
                        resetDate = selDates[0];
                    } else {
                        resetDate = calendar.today;
                    }
        
                    calendar.cfg.setProperty("pagedate", resetDate);
                    calendar.render();
                }
        
                function closeHandler() {
                    dialog.hide();
                }
 
                dialog = new YAHOO.widget.Dialog("container", {
                    visible:false,
                    context:["show", "tl", "bl"],
                    draggable:false,
                    close:true
                });
                dialog.setHeader('Select Date');
                dialog.setBody('<div id="cal"></div>');
                dialog.render(document.body);
 
                dialog.showEvent.subscribe(function() {
                    if (YAHOO.env.ua.ie) {
                        // Since we're hiding the table using yui-overlay-hidden, we 
                        // want to let the dialog know that the content size has changed, when
                        // shown
                        dialog.fireEvent("changeContent");
                    }
                });
            }
 
            // Lazy Calendar Creation - Wait to create the Calendar until the first time the button is clicked.
            if (!calendar) {
 
                calendar = new YAHOO.widget.Calendar("cal", {
                    iframe:false,          // Turn iframe off, since container has iframe support.
                    hide_blank_weeks:true  // Enable, to demonstrate how we handle changing height, using changeContent
                });
                calendar.render();
 
                calendar.selectEvent.subscribe(function() {
                    if (calendar.getSelectedDates().length > 0) {
 
                        var selDate = calendar.getSelectedDates()[0];
 
                        var yStr = selDate.getFullYear();
                        var mStr = selDate.getMonth() + 1;
                        var dStr = selDate.getDate();
        
                        Dom.get("logs_date").value = yStr.toString() + (mStr < 10 ? '0' : '') + mStr.toString() + (dStr < 10 ? '0' : '') + dStr.toString();
                    } else {
                        Dom.get("logs_date").value = "";
                    }
                    dialog.hide();
                });
 
                calendar.renderEvent.subscribe(function() {
                    // Tell Dialog it's contents have changed, which allows 
                    // container to redraw the underlay (for IE6/Safari2)
                    dialog.fireEvent("changeContent");
                });
            }
 
            var seldate = calendar.getSelectedDates();
 
            if (seldate.length > 0) {
                // Set the pagedate to show the selected date if it exists
                calendar.cfg.setProperty("pagedate", seldate[0]);
                calendar.render();
            }
 
            dialog.show();
        });
    });
   </script>

<!--    
   <form id="logs" class="request" method="GET" action="/logs.html">
     <div class="width2 label"><label for="logs_date">Date</label></div>
     <div class="width2"><input class="width1" id="logs_date" name="date" size=8 maxlength=8></div>
     <div class="width1"><input type=submit name=submit  value="View Logs"/></div>
     
   </form>
   -->



( run in 1.005 second using v1.01-cache-2.11-cpan-524268b4103 )