Skip to content

Commit

Permalink
a new and improved date widget
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsetsystems committed Jun 28, 2006
1 parent 4864f9b commit 86e1d47
Show file tree
Hide file tree
Showing 5 changed files with 636 additions and 19 deletions.
43 changes: 24 additions & 19 deletions interface/main/calendar/add_edit_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@
td { font-size:10pt; }
</style>

<style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
<script type="text/javascript" src="../../../library/topdialog.js"></script>
<script type="text/javascript" src="../../../library/dialog.js"></script>
<script type="text/javascript" src="../../../library/overlib_mini.js"></script>
<script type="text/javascript" src="../../../library/calendar.js"></script>
<script type="text/javascript" src="../../../library/textformat.js"></script>
<script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
<script type="text/javascript" src="../../../library/dynarch_calendar_en.js"></script>
<script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>

<script language="JavaScript">

Expand Down Expand Up @@ -388,7 +390,7 @@ function set_repeat() {
f.form_enddate.disabled = isdisabled;
document.getElementById('tdrepeat1').style.color = mycolor;
document.getElementById('tdrepeat2').style.color = mycolor;
document.getElementById('imgrepeat').style.visibility = myvisibility;
document.getElementById('img_enddate').style.visibility = myvisibility;
}

// This is for callback by the find-available popup.
Expand Down Expand Up @@ -427,9 +429,6 @@ function validate() {

<body <?echo $top_bg_line;?> onunload='imclosing()'>

<!-- Required for the popup date selectors -->
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>

<form method='post' name='theform' action='add_edit_event.php?eid=<? echo $eid ?>'
onsubmit='return validate()'>
<center>
Expand Down Expand Up @@ -460,13 +459,13 @@ function validate() {
<b><? xl('Date','e'); ?>:</b>
</td>
<td nowrap>
<input type='text' size='10' name='form_date'
<input type='text' size='10' name='form_date' id='form_date'
value='<? echo $eid ? $row['pc_eventDate'] : $date ?>'
title='yyyy-mm-dd event date or starting date'
onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
<a href="javascript:show_calendar('theform.form_date')"
title="Click here to choose a date"
><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' border='0' alt='[?]'></a>
<img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
id='img_date' border='0' alt='[?]' style='cursor:pointer'
title='Click here to choose a date'>
</td>
<td nowrap>
&nbsp;&nbsp;
Expand Down Expand Up @@ -615,13 +614,13 @@ function validate() {
<td nowrap id='tdrepeat2'><? xl('until','e'); ?>
</td>
<td nowrap>
<input type='text' size='10' name='form_enddate' value='<? echo $row['pc_endDate'] ?>'
<input type='text' size='10' name='form_enddate' id='form_enddate'
value='<? echo $row['pc_endDate'] ?>'
onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
title='yyyy-mm-dd last date of this event' />
<a href="javascript:show_calendar('theform.form_enddate')"
title="Click here to choose a date"
><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
border='0' alt='[?]' id='imgrepeat' /></a>
<img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
id='img_enddate' border='0' alt='[?]' style='cursor:pointer'
title='Click here to choose a date'>
</td>
</tr>

Expand Down Expand Up @@ -649,12 +648,12 @@ function validate() {
<b><font color='red'><? xl('DOB is missing, please enter if possible','e'); ?>:</font></b>
</td>
<td nowrap>
<input type='text' size='10' name='form_dob'
<input type='text' size='10' name='form_dob' id='form_dob'
title='yyyy-mm-dd date of birth'
onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
<a href="javascript:show_calendar('theform.form_dob')"
title="Click here to choose a date"
><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' border='0' alt='[?]'></a>
<img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
id='img_dob' border='0' alt='[?]' style='cursor:pointer'
title='Click here to choose a date'>
</td>
</tr>

Expand All @@ -671,6 +670,7 @@ function validate() {
</p>
</center>
</form>

<script language='JavaScript'>
<? if ($eid) { ?>
set_display();
Expand All @@ -679,6 +679,11 @@ function validate() {
<? } ?>
set_allday();
set_repeat();

Calendar.setup({inputField:"form_date", ifFormat:"%Y-%m-%d", button:"img_date"});
Calendar.setup({inputField:"form_enddate", ifFormat:"%Y-%m-%d", button:"img_enddate"});
Calendar.setup({inputField:"form_dob", ifFormat:"%Y-%m-%d", button:"img_dob"});
</script>

</body>
</html>
271 changes: 271 additions & 0 deletions library/dynarch_calendar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
/* The main calendar widget. DIV containing a table. */

.calendar {
position: relative;
display: none;
border-top: 2px solid #fff;
border-right: 2px solid #000;
border-bottom: 2px solid #000;
border-left: 2px solid #fff;
font-size: 11px;
color: #000;
cursor: default;
background: #d4d0c8;
font-family: tahoma,verdana,sans-serif;
}

.calendar table {
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
font-size: 11px;
color: #000;
cursor: default;
background: #d4d0c8;
font-family: tahoma,verdana,sans-serif;
}

/* Header part -- contains navigation buttons and day names. */

.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
text-align: center;
padding: 1px;
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
}

.calendar .nav {
background: transparent url(menuarrow.gif) no-repeat 100% 100%;
}

.calendar thead .title { /* This holds the current "month, year" */
font-weight: bold;
padding: 1px;
border: 1px solid #000;
background: #848078;
color: #fff;
text-align: center;
}

.calendar thead .headrow { /* Row <TR> containing navigation buttons */
}

.calendar thead .daynames { /* Row <TR> containing the day names */
}

.calendar thead .name { /* Cells <TD> containing the day names */
border-bottom: 1px solid #000;
padding: 2px;
text-align: center;
background: #f4f0e8;
}

.calendar thead .weekend { /* How a weekend day name shows in header */
color: #f00;
}

.calendar thead .hilite { /* How do the buttons in header appear when hover */
border-top: 2px solid #fff;
border-right: 2px solid #000;
border-bottom: 2px solid #000;
border-left: 2px solid #fff;
padding: 0px;
background-color: #e4e0d8;
}

.calendar thead .active { /* Active (pressed) buttons in header */
padding: 2px 0px 0px 2px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
background-color: #c4c0b8;
}

/* The body part -- contains all the days in month. */

.calendar tbody .day { /* Cells <TD> containing month days dates */
width: 2em;
text-align: right;
padding: 2px 4px 2px 2px;
}
.calendar tbody .day.othermonth {
font-size: 80%;
color: #aaa;
}
.calendar tbody .day.othermonth.oweekend {
color: #faa;
}

.calendar table .wn {
padding: 2px 3px 2px 2px;
border-right: 1px solid #000;
background: #f4f0e8;
}

.calendar tbody .rowhilite td {
background: #e4e0d8;
}

.calendar tbody .rowhilite td.wn {
background: #d4d0c8;
}

.calendar tbody td.hilite { /* Hovered cells <TD> */
padding: 1px 3px 1px 1px;
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
}

.calendar tbody td.active { /* Active (pressed) cells <TD> */
padding: 2px 2px 0px 2px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
}

.calendar tbody td.selected { /* Cell showing selected date */
font-weight: bold;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
padding: 2px 2px 0px 2px;
background: #e4e0d8;
}

.calendar tbody td.weekend { /* Cells showing weekend days */
color: #f00;
}

.calendar tbody td.today { /* Cell showing today date */
font-weight: bold;
color: #00f;
}

.calendar tbody .disabled { color: #999; }

.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
visibility: hidden;
}

.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
display: none;
}

/* The footer part -- status bar and "Close" button */

.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
}

.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
background: #f4f0e8;
padding: 1px;
border: 1px solid #000;
background: #848078;
color: #fff;
text-align: center;
}

.calendar tfoot .hilite { /* Hover style for buttons in footer */
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
padding: 1px;
background: #e4e0d8;
}

.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
padding: 2px 0px 0px 2px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
}

/* Combo boxes (menus that display months/years for direct selection) */

.calendar .combo {
position: absolute;
display: none;
width: 4em;
top: 0px;
left: 0px;
cursor: default;
border-top: 1px solid #fff;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #fff;
background: #e4e0d8;
font-size: 90%;
padding: 1px;
z-index: 100;
}

.calendar .combo .label,
.calendar .combo .label-IEfix {
text-align: center;
padding: 1px;
}

.calendar .combo .label-IEfix {
width: 4em;
}

.calendar .combo .active {
background: #c4c0b8;
padding: 0px;
border-top: 1px solid #000;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-left: 1px solid #000;
}

.calendar .combo .hilite {
background: #048;
color: #fea;
}

.calendar td.time {
border-top: 1px solid #000;
padding: 1px 0px;
text-align: center;
background-color: #f4f0e8;
}

.calendar td.time .hour,
.calendar td.time .minute,
.calendar td.time .ampm {
padding: 0px 3px 0px 4px;
border: 1px solid #889;
font-weight: bold;
background-color: #fff;
}

.calendar td.time .ampm {
text-align: center;
}

.calendar td.time .colon {
padding: 0px 2px 0px 3px;
font-weight: bold;
}

.calendar td.time span.hilite {
border-color: #000;
background-color: #766;
color: #fff;
}

.calendar td.time span.active {
border-color: #f00;
background-color: #000;
color: #0f0;
}
14 changes: 14 additions & 0 deletions library/dynarch_calendar.js

Large diffs are not rendered by default.

Loading

0 comments on commit 86e1d47

Please sign in to comment.