From: <al...@us...> - 2008-10-23 17:45:33
|
Revision: 754 http://sciret.svn.sourceforge.net/sciret/?rev=754&view=rev Author: alpeb Date: 2008-10-23 17:45:25 +0000 (Thu, 23 Oct 2008) Log Message: ----------- use YUI's calendar widget instead of the older one Modified Paths: -------------- trunk/templates/EditArticle.tpl Modified: trunk/templates/EditArticle.tpl =================================================================== --- trunk/templates/EditArticle.tpl 2008-10-23 17:44:06 UTC (rev 753) +++ trunk/templates/EditArticle.tpl 2008-10-23 17:45:25 UTC (rev 754) @@ -15,7 +15,7 @@ <!-- Needed for Menus, Buttons and Overlays used in the Toolbar --> <script type="text/javascript" src="javascript/yui/build/menu/menu-min.js"></script> <!-- Source file for Rich Text Editor--> -<script src="javascript/yui/build/editor/editor-beta-min.js"></script> +<script src="javascript/yui/build/editor/editor-min.js"></script> <h1> <!-- BEGIN addArticleTitle_block --> @@ -78,11 +78,14 @@ </span> </td> <td> - <input type="hidden" id="hiddenDate" name="expDate" value="{expDate}" /> - <span id="dateShow">{expDateContents}</span> - <img src="images/datepopup.gif" id="expDateButton" style="cursor:pointer" /> - <span id="labelSetDate" style="display:{labelSetExpDateDisplay}">([l]Currently none.<br />Click icon to set one.[/l])</span> - <a id="removeDateLink" href="javascript:void(0);" onclick="removeDate();" style="display:{removeExpDateLinkDisplay}; font-weight:bold; font-size:10px">[l]Remove expiration date[/l]</a> + <div style="position:relative"> + <input type="hidden" id="hiddenDate" name="expDate" value="{expDate}" /> + <span id="dateShow">{expDateContents}</span> + <img src="images/datepopup.gif" id="expDateButton" style="cursor:pointer" /> + <div id="expirationCalContainer" style="display:none; position:absolute; left:10px; z-index:1"></div> + <span id="labelSetDate" style="display:{labelSetExpDateDisplay}">([l]Currently none.<br />Click icon to set one.[/l])</span> + <a id="removeDateLink" href="javascript:void(0);" onclick="removeArticleExpiration();" style="display:{removeExpDateLinkDisplay}; font-weight:bold; font-size:10px">[l]Remove expiration date[/l]</a> + </div> </td> </tr> @@ -131,16 +134,39 @@ </table> </form> <script type="text/javascript"> - Calendar.setup( - { - inputField : "hiddenDate", - ifFormat : "%Y-%m-%d", - daFormat : "{jsCalDateFormat}", - button : "expDateButton", - onSelect : dateSelected - } - ); + YAHOO.util.Event.onDOMReady(function() { + YAHOO.util.Event.addListener($("expDateButton"), + "click", + showArticleCalendar); + }); + function showArticleCalendar() { + var cal = new YAHOO.widget.Calendar("expirationCalContainer", { + close: true + }); + cal.selectEvent.subscribe(articleDateSelected, cal, true); + cal.render(); + cal.show(); + } + + function articleDateSelected(type, args, cal) { + var dates = args[0]; + var date = dates[0]; + var year = date[0], month = date[1], day = date[2]; + $("hiddenDate").value = year + "-" + month + "-" + day; + $('dateShow').innerHTML = formatDate("{jsCalDateFormat}", month, day, year); + cal.hide(); + $('labelSetDate').style.display = 'none'; + $('removeDateLink').style.display = ''; + } + + function removeArticleExpiration() { + $('hiddenDate').value = ''; + $('dateShow').innerHTML = ''; + $('labelSetDate').style.display = ''; + $('removeDateLink').style.display = 'none'; + } + function validateForm(form) { if (form.title.value == '') { alert('You cannot leave the Title field empty'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |