Déplacement pour eggification.
[Plinn.git] / Products / Plinn / skins / jscalendar / bugtest-hidden-selects.html
diff --git a/Products/Plinn/skins/jscalendar/bugtest-hidden-selects.html b/Products/Plinn/skins/jscalendar/bugtest-hidden-selects.html
new file mode 100644 (file)
index 0000000..df35337
--- /dev/null
@@ -0,0 +1,108 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ro" lang="ro">\r
+\r
+<head>\r
+<title>Bug</title>\r
+<link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-1.css" title="win2k-1" />\r
+\r
+<!-- import the calendar script -->\r
+<script type="text/javascript" src="calendar.js"></script>\r
+\r
+<!-- import the language module -->\r
+<script type="text/javascript" src="lang/calendar-en.js"></script>\r
+\r
+<!-- helper script that uses the calendar -->\r
+<script type="text/javascript">\r
+// This function gets called when the end-user clicks on some date.\r
+function selected(cal, date) {\r
+  cal.sel.value = date; // just update the date in the input field.\r
+  if (cal.sel.id == "sel1" || cal.sel.id == "sel3")\r
+    // if we add this call we close the calendar on single-click.\r
+    // just to exemplify both cases, we are using this only for the 1st\r
+    // and the 3rd field, while 2nd and 4th will still require double-click.\r
+    cal.callCloseHandler();\r
+}\r
+\r
+// And this gets called when the end-user clicks on the _selected_ date,\r
+// or clicks on the "Close" button.  It just hides the calendar without\r
+// destroying it.\r
+function closeHandler(cal) {\r
+  cal.hide();                        // hide the calendar\r
+}\r
+\r
+// This function shows the calendar under the element having the given id.\r
+// It takes care of catching "mousedown" signals on document and hiding the\r
+// calendar if the click was outside.\r
+function showCalendar(id, format) {\r
+  var el = document.getElementById(id);\r
+  if (calendar != null) {\r
+    // we already have some calendar created\r
+    calendar.hide();                 // so we hide it first.\r
+  } else {\r
+    // first-time call, create the calendar.\r
+    var cal = new Calendar(false, null, selected, closeHandler);\r
+    // uncomment the following line to hide the week numbers\r
+    // cal.weekNumbers = false;\r
+    calendar = cal;                  // remember it in the global var\r
+    cal.setRange(1900, 2070);        // min/max year allowed.\r
+    cal.create();\r
+  }\r
+  calendar.setDateFormat(format);    // set the specified date format\r
+  calendar.parseDate(el.value);      // try to parse the text in field\r
+  calendar.sel = el;                 // inform it what input field we use\r
+  calendar.showAtElement(el);        // show the calendar below it\r
+\r
+  return false;\r
+}\r
+\r
+var MINUTE = 60 * 1000;\r
+var HOUR = 60 * MINUTE;\r
+var DAY = 24 * HOUR;\r
+var WEEK = 7 * DAY;\r
+\r
+// If this handler returns true then the "date" given as\r
+// parameter will be disabled.  In this example we enable\r
+// only days within a range of 10 days from the current\r
+// date.\r
+// You can use the functions date.getFullYear() -- returns the year\r
+// as 4 digit number, date.getMonth() -- returns the month as 0..11,\r
+// and date.getDate() -- returns the date of the month as 1..31, to\r
+// make heavy calculations here.  However, beware that this function\r
+// should be very fast, as it is called for each day in a month when\r
+// the calendar is (re)constructed.\r
+function isDisabled(date) {\r
+  var today = new Date();\r
+  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;\r
+}\r
+</script>\r
+</head>\r
+\r
+<body>\r
+<form>\r
+<b>Date:</b>\r
+<br>\r
+<input type="text" name="date1" id="sel1" size="30">\r
+<input type="button" value="..." onclick="return showCalendar('sel1', 'y-m-d');">\r
+<p>\r
+<br>\r
+<br><b>Visible &lt;select&gt;, hides and unhides as expected</b>\r
+<br>\r
+<select name="foo" multiple>\r
+<option value="1">can use the functions date.getFullYear() -- returns</option>\r
+<option value="2">4 digit number, date.getMonth() -- returns the month</option>\r
+<option value="3">heavy calculations here.  However, beware that this</option>\r
+</select>\r
+\r
+<p>\r
+<br><b>Hidden &lt;select&gt;, it should stay hidden (but doesn't)</b>\r
+<br>\r
+<select name="foo2" multiple style="visibility: hidden">\r
+<option value="1">this should</option>\r
+<option value="2">remain hidden right?</option>\r
+</select>\r
+\r
+<p>\r
+<br><b>Hidden textbox below, it stays hidden as expected</b>\r
+<br>\r
+<input type="text" name="foo3" value="this stays hidden just fine" style="visibility: hidden">\r
+</form>\r
+</body></html>\r