Bug Tracker

Changeset 2831

Show
Ignore:
Timestamp:
08/22/07 04:02:56 (1 year ago)
Author:
grabanski
Message:

Wrote custom tabs with continue button - still needs to be styled.

Location:
trunk/plugins/calendar
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/calendar/index.html

    r2641 r2831  
    11<html> 
    22<head> 
    3 <title>jQuery Calendar Examples</title> 
    4 <script type="text/javascript" src="jquery.pack.js"></script> 
    5 <script type="text/javascript" src="jquery.debug.js"></script> 
    6 <script type="text/javascript" src="jquery.tabs.js"></script> 
    7 <!--script type="text/javascript" src="jquery.blockUI.js"></script--> 
    8 <script type="text/javascript" src="jquery-calendar.js"></script> 
    9 <script type="text/javascript" src="jquery-calendar-fr.js"></script> 
    10 <script type="text/javascript" src="jquery-calendar-demo.js"></script> 
    11 <link rel="stylesheet" type="text/css" href="jquery-calendar.css" title="default"/> 
    12 <link rel="stylesheet" type="text/css" href="jquery-calendar-alt.css" title="alt"/> 
    13 <style type="text/css">@import "jquery.tabs.css";</style> 
    14 <style type="text/css"> 
    15 body { font-family: Arial, Helvetica, Sans-serif; } 
    16 pre { margin: 5px 10px; } 
    17 #tabs ul { width: 100%; } 
    18 .feature { border: 1px solid #3c576c; } 
    19 .calLabel { float: left; width: 15em; } 
    20 .ar_day { color: white !important; background: #eee url(img/ar.gif) no-repeat center !important; } 
    21 .au_day { color: blue !important; background: #eee url(img/au.gif) no-repeat center !important; } 
    22 .br_day { color: green !important; background: #eee url(img/br.gif) no-repeat center !important; } 
    23 .cn_day { color: red !important; background: #eee url(img/cn.gif) no-repeat center !important; } 
    24 .id_day { color: white !important; background: #eee url(img/id.gif) no-repeat center !important; } 
    25 .ie_day { color: white !important; background: #eee url(img/ie.gif) no-repeat center !important; } 
    26 .ke_day { color: red !important; background: #eee url(img/ke.gif) no-repeat center !important; } 
    27 .lb_day { color: white !important; background: #eee url(img/lb.gif) no-repeat center !important; } 
    28 .nz_day { color: blue !important; background: #eee url(img/nz.gif) no-repeat center !important; } 
    29 .se_day { color: blue !important; background: #eee url(img/se.gif) no-repeat center !important; } 
    30 .us_day { color: white !important; background: #eee url(img/us.gif) no-repeat center !important; } 
    31 .za_day { color: green !important; background: #eee url(img/za.gif) no-repeat center !important; } 
    32 </style> 
     3    <title>jQuery Calendar Examples</title> 
     4    <script type="text/javascript" src="jquery.pack.js"></script> 
     5    <script type="text/javascript" src="jquery.debug.js"></script> 
     6    <script type="text/javascript" src="jquery-calendar.js"></script> 
     7    <script type="text/javascript" src="jquery-calendar-fr.js"></script> 
     8    <script type="text/javascript" src="jquery-calendar-demo.js"></script> 
     9    <link rel="stylesheet" type="text/css" href="jquery-calendar.css" title="default"/> 
     10    <link rel="stylesheet" type="text/css" href="jquery-calendar-alt.css" title="alt"/> 
     11    <link rel="stylesheet" type="text/css" href="jquery-calendar-demo.css" /> 
    3312</head> 
    3413<body> 
    35 <h1>jQuery Calendar Examples</h1> 
    36 <div id="tabs"> 
    37     <ul> 
    38         <li><a href="#default"><span>Defaults</span></a></li> 
    39         <li><a href="#invoke"><span>Invocation</span></a></li> 
    40         <li><a href="#keys"><span>Keystrokes</span></a></li> 
    41         <li><a href="#restrict"><span>Restricting</span></a></li> 
    42         <li><a href="#custom"><span>Customise</span></a></li> 
    43         <li><a href="#l10n"><span>Localisation</span></a></li> 
    44         <li><a href="#range"><span>Date range</span></a></li> 
    45         <li><a href="#misc"><span>Miscellaneous</span></a></li> 
    46         <li><a href="#inline"><span>Inline</span></a></li> 
    47         <li><a href="#styles"><span>Stylesheets</span></a></li> 
     14<div id="wrap"> 
     15    <p><a href="http://docs.jquery.com/Plugins/Calendar">jQuery Calendar API</a></p> 
     16    <p><a href="http://docs.jquery.com/Plugins/Calendar/ChangeLog">jQuery Calendar Change Log</a></p> 
     17    <h1>jQuery Calendar Examples</h1> 
     18    <ul id="tabs"> 
     19        <li><a href="#default">Defaults</a></li> 
     20        <li><a href="#invoke">Invocation</a></li> 
     21        <li><a href="#keys">Keystrokes</a></li> 
     22        <li><a href="#restrict">Restricting</a></li> 
     23        <li><a href="#custom">Customise</a></li> 
     24        <li><a href="#l10n">Localisation</a></li> 
     25        <li><a href="#range">Date range</a></li> 
     26        <li><a href="#misc">Miscellaneous</a></li> 
     27        <li><a href="#inline">Inline</a></li> 
     28        <li><a href="#styles">Stylesheets</a></li> 
    4829    </ul> 
    4930    <div id="default" class="feature"> 
     31        <h2>Defaults</h2> 
    5032        <p>The calendar can easily be added to an input field with appropriate default settings.</p> 
    5133        <pre>$('#defaultFocus').calendar();</pre> 
     
    7052    </div> 
    7153    <div id="invoke" class="feature"> 
     54        <h2>Invocation</h2> 
    7255        <p>The calendar can be invoked in a variety of ways, as shown below. 
    7356            Also shown is the use of an image only trigger, 
     
    9376        <p>The calendar can also be triggered externally for a particular input.</p> 
    9477        <p><span class="calLabel">External trigger:</span> 
    95             <button onclick="popUpCal.showFor($('#invokeFocus')[0]);">Open calendar</button></p> 
     78            <button onClick="popUpCal.showFor($('#invokeFocus')[0]);">Open calendar</button></p> 
    9679        <pre>popUpCal.showFor($('#invokeFocus')[0]);</pre> 
    9780        <p>Or even opened as a "dialog". If the <em>blockUI</em> plugin is available, 
     
    9982        <p><span class="calLabel">Calendar dialog:</span> 
    10083            <input type="text" size="10" id="invokeDialog" readonly="readonly"/> 
    101             <button onclick="popUpCal.dialogCalendar($('#invokeDialog').val(), 
     84            <button onClick="popUpCal.dialogCalendar($('#invokeDialog').val(), 
    10285                setDateFromDialog, {prompt: 'Choose a date', speed: ''});">Open dialog</button></p> 
    10386        <pre>popUpCal.dialogCalendar($('#invokeDialog').val(), setDateFromDialog, 
     
    10588    </div> 
    10689    <div id="keys" class="feature"> 
     90        <h2>Keystrokes</h2> 
    10791        <p>The calendar also responds to keystrokes entered in the input field.</p> 
    10892        <p><span class="calLabel">Keyboard driven:</span> 
     
    121105    </div> 
    122106    <div id="restrict" class="feature"> 
     107        <h2>Restricting</h2> 
    123108        <p>You can restrict the functionality of the calendar in various ways. 
    124109            The first example sets the first day of the week to Monday and prevents it from being 
     
    141126    </div> 
    142127    <div id="custom" class="feature"> 
     128        <h2>Customise</h2> 
    143129        <p>You can customise the selectability and/or appearance of individual days 
    144130            by setting a callback function that accepts a date and returns an array 
     
    169155    </div> 
    170156    <div id="l10n" class="feature"> 
     157        <h2>Localisation</h2> 
    171158        <p>You can localise the calendar for other languages and regional differences. 
    172159            The calendar defaults to English with a date format of DD/MM/YYYY. 
     
    190177    </div> 
    191178    <div id="range" class="feature"> 
     179        <h2>Date Range</h2> 
    192180        <p>Use a custom field settings function to create a date range control: 
    193181            two date fields, each restricting the other. The function takes an 
     
    204192    </div> 
    205193    <div id="misc" class="feature"> 
     194        <h2>Miscellaneous</h2> 
    206195        <p>Additional settings let you move the <em>Clear</em>/<em>Close</em> controls 
    207196            to the bottom and display the days in other months (non-selectable). 
     
    216205            on the fly. As an example, here we change the speed at which the calendar appears.</p> 
    217206        <p><span class="calLabel">Display speed:</span> 
    218             <select onchange="setSpeed(this);"><option value="">immediate</option> 
     207            <select onChange="setSpeed(this);"><option value="">immediate</option> 
    219208            <option value="slow">slow</option><option value="medium" selected="selected">medium</option> 
    220209            <option value="fast">fast</option></select></p> 
     
    231220            The attribute values are evaluated as JavaScript.</p> 
    232221        <p><span class="calLabel">Inline configuration 1:</span> 
    233             <input type="text" size="10" class="inlineConfig" onchange="showDay(this);" 
     222            <input type="text" size="10" class="inlineConfig" onChange="showDay(this);" 
    234223                cal:closeAtTop="false" cal:firstDay="1" cal:appendText="which is a"/> 
    235224            <span id="inlineDay">blank</span></p> 
     
    246235    </div> 
    247236    <div id="inline" class="feature"> 
     237        <h2>Inline</h2> 
    248238        <p>The calendar can be used inline rather than as a popup.</p> 
    249239        <p><span class="calLabel">Inline date range:</span> 
     
    270260    </div> 
    271261    <div id="styles" class="feature"> 
     262        <h2>Stylesheets</h2> 
    272263        <p>The calendar can be formatted through the use of a stylesheet. 
    273264            The default stylesheet is used in the rest of this demo 
     
    277268        <p><span class="calLabel">In a dialog:</span> 
    278269            <input type="text" size="10" id="altDialog" readonly="readonly"/> 
    279             <button onclick="popUpCal.dialogCalendar($('#altDialog').val(), 
     270            <button onClick="popUpCal.dialogCalendar($('#altDialog').val(), 
    280271                setAltDateFromDialog, {prompt: 'Choose a date', speed: ''});">Open dialog</button></p> 
    281272        <p>The basic HTML structure of the calendar is shown below:</p> 
     
    315306&lt;/div></pre> 
    316307    </div> 
    317     <p><a href="http://docs.jquery.com/Plugins/Calendar">jQuery Calendar API</a></p> 
    318     <p><a href="http://docs.jquery.com/Plugins/Calendar/ChangeLog">jQuery Calendar Change Log</a></p> 
    319308</div> 
    320309</body> 
  • trunk/plugins/calendar/jquery-calendar-demo.js

    r2796 r2831  
    44 
    55$(document).ready(function () { 
    6     $('#tabs').tabs({onClick: updateTabs}) 
     6    tabs.init(); 
    77    // Restore default language after loading French localisation 
    88    popUpCal.setDefaults(popUpCal.regional['']); 
     
    5353    $('#altStyle').calendar(); 
    5454}); 
    55  
    56 function updateTabs(anchor, newDiv, oldDiv) { 
    57     var stylesheet = (newDiv.id == 'styles' ? 'alt' : 'default'); 
    58     $('link').each(function() { 
    59         this.disabled = (this.title != '' && this.title != stylesheet); 
    60     }); 
    61 } 
    6255 
    6356function setSpeed(select) { 
     
    120113        (month < 10 ? '0' : '') + month + '/' + date.getFullYear(); 
    121114} 
     115 
     116// Custom Tabs by Marc Grabanski 
     117var tabs =  
     118{ 
     119    init : function ()  
     120    { 
     121        // Setup tabs 
     122        var nextHTML = '<div class="nextFeature"><a>Continue to next section &gt;&gt;</a></div>'; 
     123        //var backHTML 
     124        $(".feature").hide().append(nextHTML); 
     125        $(".feature:first").show().id; 
     126        var tabCount = $("#tabs a").size(); 
     127        $("#tabs a:eq(0)").addClass('over'); 
     128         
     129        // Get all of the IDs from the hrefs 
     130        tabs.IDs = []; 
     131        for (var i=0;i<tabCount;i++) { 
     132            tabs.IDs[i] = $("#tabs a:eq(" + i + ")").attr("href").replace("#",""); 
     133        } 
     134         
     135        // Slide visible up and clicked one down 
     136        $("#tabs a").each(function(i){ 
     137            $(this).click(function () { 
     138                $('.over').removeClass('over'); 
     139                $(this).addClass('over'); 
     140                $(".feature:visible").slideUp("fast", function() {  
     141                    $("#" + tabs.IDs[i]).slideDown(); 
     142                }); 
     143                tabs.stylesheet = (tabs.IDs[i] == 'styles') ? 'alt' : 'default'; 
     144                $('link').each(function() { 
     145                    this.disabled = (this.title != '' && this.title != tabs.stylesheet); 
     146                }); 
     147            }); 
     148        }); 
     149         
     150        $(".feature .nextFeature a").each(function(i){ 
     151            $(this).click(function() {  
     152                $(".feature:visible").slideUp("fast", function() {  
     153                    if (tabs.IDs.length > (i+1) ) { 
     154                        $("#" + tabs.IDs[i+1]).slideDown(); 
     155                        $('.over').removeClass('over'); 
     156                        $("#tabs a:eq(" + (i+1) + ")").addClass('over'); 
     157                    } else { 
     158                        $("#" + tabs.IDs[0]).slideDown(); 
     159                        $('.over').removeClass('over'); 
     160                        $("#tabs a:eq(0)").addClass('over'); 
     161                    } 
     162                }); 
     163            }); 
     164        }); 
     165    } 
     166}