[Rt-commit] r3461 - in rt/branches/3.5-TESTING: . html
html/NoAuth/js
trs at bestpractical.com
trs at bestpractical.com
Mon Jul 11 20:05:38 EDT 2005
Author: trs
Date: Mon Jul 11 20:05:38 2005
New Revision: 3461
Modified:
rt/branches/3.5-TESTING/ (props changed)
rt/branches/3.5-TESTING/html/CalPopup.html
rt/branches/3.5-TESTING/html/NoAuth/js/util.js
Log:
r4982 at wintermute: tom | 2005-07-11 19:13:21 -0400
Unmangling CalPopup
Modified: rt/branches/3.5-TESTING/html/CalPopup.html
==============================================================================
--- rt/branches/3.5-TESTING/html/CalPopup.html (original)
+++ rt/branches/3.5-TESTING/html/CalPopup.html Mon Jul 11 20:05:38 2005
@@ -1,63 +1,61 @@
<& /Elements/Header &>
-%# From /Elements/Header
+ %# From /Elements/Header
</div>
<div id="body">
-<script>
-function updateParent(strItem) {
- window.opener.document.getElementById('<%$field%>').value = strItem;
- window.close();
-}
-</script>
-<a href="javascript: window.close();">close window</a>
-<br><br>
-<div align="center">
-<div class="table-wrapper">
-<table>
- <caption><%$months[$DisplayedMonth]%> <%$DisplayedYear%></caption>
- <tr>
+
+<a href="#" onclick="window.close(); return false;"><&|/l&>Close Window</&></a>
+
+<div class="calendar">
+ <div class="calendar-nav">
+ <a class="prev" href="CalPopup.html?DisplayedMonth=<%$prev_month%>&DisplayedYear=<%$prev_year%>&field=<%$field%>"><&|/l&>Prev</&></a>
+ <a class="next" href="CalPopup.html?DisplayedMonth=<%$next_month%>&DisplayedYear=<%$next_year%>&field=<%$field%>"><&|/l&>Next</&></a>
+ </div>
+
+ <table>
+ <caption><% $months[$DisplayedMonth] %> <% $DisplayedYear %></caption>
+ <tr>
% foreach my $wday (@weekdays) {
- <th><%$wday%></th>
+ <th><%$wday%></th>
% }
- </tr>
+ </tr>
% foreach my $week (@cal) {
- <tr>
+ <tr>
% foreach my $day (@{$week}) {
- <td>
+ <td>
% if ($day) {
% my $datestr = sprintf('%04d-%02d-%02d', $DisplayedYear, $DisplayedMonth+1, $day);
- <dt><a href="javascript: updateParent('<%$datestr%>')"><%$day%></a></dt>
+ <a href="#" onclick="updateParentField('<% $field %>','<% $datestr %>'); return false;"><% $day %></a>
+% } else {
+
% }
- </td>
+ </td>
% } #foreach $day
- </tr>
+ </tr>
% } # foreach $week
- <tr>
- <td colspan="2"><a href="CalPopup.html?DisplayedMonth=<%$prev_month%>&DisplayedYear=<%$prev_year%>&field=<%$field%>">Previous</a></td>
- <td colspan="3"> </td>
- <td colspan="2" align="right"><a href="CalPopup.html?DisplayedMonth=<%$next_month%>&DisplayedYear=<%$next_year%>&field=<%$field%>">Next</a></td>
-</table>
-</div>
+ </table>
</div>
<%init>
use Calendar::Simple;
my @today = localtime(time());
-my @weekdays = (loc('Sun'), loc('Mon'), loc('Tue'), loc('Wed'), loc('Thu'),
- loc('Fri'), loc('Sat'));
-my @months = (loc('January'), loc('February'), loc('March'), loc('April'),
- loc('May'), loc('June'), loc('July'), loc('August'),
- loc('September'), loc('October'), loc('November'),
- loc('December'));
+my @weekdays;
+push @weekdays, loc($_)
+ for qw(Sun Mon Tue Wed Thu Fri Sat);
+
+my @months;
+push @months, loc($_)
+ for qw(January February March April May June July August
+ September October November December);
unless ($DisplayedYear) {
- $DisplayedMonth = $today[4];
- $DisplayedYear = ($today[5] + 1900);
+ $DisplayedMonth = $today[4];
+ $DisplayedYear = ($today[5] + 1900);
}
my ($prev_year, $next_year, $prev_month, $next_month);
$prev_month = $next_month = $DisplayedMonth;
-$prev_year = $next_year = $DisplayedYear;
+$prev_year = $next_year = $DisplayedYear;
$next_month++;
$prev_month--;
@@ -65,20 +63,15 @@
if ($DisplayedMonth == 11) {
$next_year++;
$next_month = 0;
- }
+}
elsif ($DisplayedMonth == 0) {
- $prev_month = 11;
- $prev_year--;
-
-
- }
-
-
-
+ $prev_month = 11;
+ $prev_year--;
+}
my @cal = calendar($DisplayedMonth, $DisplayedYear);
-
</%init>
+
<%args>
$field => 'none'
$DisplayedMonth => undef
Modified: rt/branches/3.5-TESTING/html/NoAuth/js/util.js
==============================================================================
--- rt/branches/3.5-TESTING/html/NoAuth/js/util.js (original)
+++ rt/branches/3.5-TESTING/html/NoAuth/js/util.js Mon Jul 11 20:05:38 2005
@@ -71,6 +71,13 @@
objWindow.focus();
}
+function updateParentField(field, value) {
+ if (window.opener) {
+ window.opener.document.getElementById(field).value = value;
+ window.close();
+ }
+}
+
// onload handlers
var onLoadStack = new Array();
More information about the Rt-commit
mailing list