Apache-SdnFw

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

lib/Apache/SdnFw/bin/run_sql.pl
lib/Apache/SdnFw/bin/sdnstatusd.pl
lib/Apache/SdnFw/bin/teardown
lib/Apache/SdnFw/cron/sdnfw
lib/Apache/SdnFw/css/iphone/style.css
lib/Apache/SdnFw/css/print.css
lib/Apache/SdnFw/css/style.css
lib/Apache/SdnFw/db/install/pg.sql
lib/Apache/SdnFw/db/sql/update_zipcodes.sql
lib/Apache/SdnFw/js/builder.js
lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js
lib/Apache/SdnFw/js/calendar_date_select/format_american.js
lib/Apache/SdnFw/js/calendar_date_select/format_db.js
lib/Apache/SdnFw/js/calendar_date_select/format_euro_24hr.js
lib/Apache/SdnFw/js/calendar_date_select/format_euro_24hr_ymd.js
lib/Apache/SdnFw/js/calendar_date_select/format_finnish.js
lib/Apache/SdnFw/js/calendar_date_select/format_hyphen_ampm.js
lib/Apache/SdnFw/js/calendar_date_select/format_iso_date.js
lib/Apache/SdnFw/js/calendar_date_select/format_italian.js
lib/Apache/SdnFw/js/calendar_date_select/locale/de.js
lib/Apache/SdnFw/js/calendar_date_select/locale/fi.js
lib/Apache/SdnFw/js/calendar_date_select/locale/fr.js
lib/Apache/SdnFw/js/calendar_date_select/locale/pl.js
lib/Apache/SdnFw/js/calendar_date_select/locale/pt.js
lib/Apache/SdnFw/js/calendar_date_select/locale/ru.js
lib/Apache/SdnFw/js/controls.js
lib/Apache/SdnFw/js/dragdrop.js
lib/Apache/SdnFw/js/effects.js
lib/Apache/SdnFw/js/prototype.js
lib/Apache/SdnFw/js/scriptaculous.js
lib/Apache/SdnFw/js/slider.js
lib/Apache/SdnFw/js/sound.js
lib/Apache/SdnFw/js/tinymce/changelog.txt
lib/Apache/SdnFw/js/tinymce/examples/css/content.css
lib/Apache/SdnFw/js/tinymce/examples/css/word.css

lib/Apache/SdnFw/css/style.css  view on Meta::CPAN

	display: block;
	margin: 10px;
	}
table {
	border-collapse: collapse;
	border-spacing: 0px;
	caption-side: top;
	width: 100%;
	margin: 0px 4px 4px 4px;
	}
.calendar, .calendar_full {
	clear: both;
	}
.calendar_full table {
	width: 100%;
	}
.calendar table {
	width: 780px;
	}
.calendar_full td {
	width: 14%;
	}
.calendar td {
	width: 100px;
	height: 100px;
	}
.calendar_today {
	border: 2px solid #000;
	}
.calendar_blank {
	background-color: #eee;
	}
.calendar_day {
	color: #555;
	font-weight: bold;
	}
.calendar_entry {
	width: 100%;
	padding: 2px;
	background-color: #ddd;
	}
table.stable {
	margin: 0px 0px 0px 0px;
	border: 0px;
	}
table.stable td, table.stable th {
	border: 0px;

lib/Apache/SdnFw/css/style.css  view on Meta::CPAN

	}

.nextaction { 
	color: #F00; 
	font-weight: bold;
	}

.action:before, .nextaction:before { content: "["; }
.action:after, .nextaction:after { content: "]"; }

.calendar_date_select {
  color:white;
  border:#777 1px solid;
  display:block;
  width:195px;
  z-index: 1000;
}
/* this is a fun ie6 hack to get drop downs to stay behind the popup window.  This should always be just underneath .calendar_date_select */
iframe.ie6_blocker {
  position: absolute;
  z-index: 999;
}

.calendar_date_select thead th {
  font-weight:bold;
  background-color: #aaa;
  border-top:1px solid #777;
  border-bottom:1px solid #777;
  color: white !important;
}

.calendar_date_select .cds_buttons {
  text-align:center;
  padding:5px 0px;
  background-color: #555;
}

.calendar_date_select .cds_footer {
  background-color: black;
  padding:3px;
  font-size:12px;
  text-align:center;
}

.calendar_date_select table {
  margin: 0px;
  padding: 0px;
}


.calendar_date_select .cds_header {
  background-color: #ccc;
  border-bottom: 2px solid #aaa;
  text-align:center;
}

.calendar_date_select .cds_header span {
  font-size:15px;
  color: black;
  font-weight: bold;
}

.calendar_date_select select { font-size:11px;}

.calendar_date_select .cds_header a:hover {
  color: white;
}
.calendar_date_select .cds_header a {
  width:22px;
  height:20px;
  text-decoration: none;
  font-size:14px;
  color:black !important;
}

.calendar_date_select .cds_header a.prev {
  float:left;
}
.calendar_date_select .cds_header a.next {
  float:right;
}

.calendar_date_select .cds_header a.close {
  float:right;
  display:none;
}

.calendar_date_select .cds_header select.month {
  width:90px;
}

.calendar_date_select .cds_header select.year {
  width:61px;
}
.calendar_date_select .cds_buttons a {
  color: white;
  font-size: 9px;
}

.calendar_date_select td {
  font-size:12px;
  width: 24px;
  height: 21px;
  text-align:center;
  vertical-align: middle;
  background-color: #fff;
}
.calendar_date_select td.weekend {
  background-color: #eee;
  border-left:1px solid #ddd;
  border-right:1px solid #ddd;
}

.calendar_date_select td div {
  color: #000;
}
.calendar_date_select td div.other {
  color: #ccc;
}
.calendar_date_select td.selected div {
  color:white;
}

.calendar_date_select tbody td {
  border-bottom: 1px solid #ddd;
}
.calendar_date_select td.selected {
  background-color:#777;
}

.calendar_date_select td:hover {
  background-color:#ccc;
}

.calendar_date_select td.today {
  border: 1px dashed #999;
}

.calendar_date_select td.disabled div {
  color: #e6e6e6;
}

.fieldWithErrors .calendar_date_select {
  border: 2px solid red;
}

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

// CalendarDateSelect version 1.15 - a prototype based date picker
// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date...
if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required.  If using earlier version of prototype, please use calendar_date_select version 1.8.3");

Element.addMethods({
  purgeChildren: function(element) { $A(element.childNodes).each(function(e){$(e).remove();}); },
  build: function(element, type, options, style) {
    var newElement = Element.buildAndAppend(type, options, style);
    element.appendChild(newElement);
    return newElement;
  }
});

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

  },
  getValue: function() { return $F(this.element)}
}
CalendarDateSelect = Class.create();
CalendarDateSelect.prototype = {
  initialize: function(target_element, options) {
    this.target_element = $(target_element); // make sure it's an element, not a string
    if (!this.target_element) { alert("Target element " + target_element + " not found!"); return false;}
    if (this.target_element.tagName != "INPUT") this.target_element = this.target_element.down("INPUT")
    
    this.target_element.calendar_date_select = this;
    this.last_click_at = 0;
    // initialize the date control
    this.options = $H({
      embedded: false,
      popup: nil,
      time: false,
      buttons: true,
      clear_button: true,
      year_range: 10,
      close_on_click: nil,

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

    if(!this.options.get("embedded")) {
      this.positionCalendarDiv()
      // set the click handler to check if a user has clicked away from the document
      Event.observe(document, "mousedown", this.closeIfClickedOut_handler = this.closeIfClickedOut.bindAsEventListener(this));
      Event.observe(document, "keypress", this.keyPress_handler = this.keyPress.bindAsEventListener(this));
    }
    this.callback("after_show")
  },
  positionCalendarDiv: function() {
    var above = false;
    var c_pos = this.calendar_div.cumulativeOffset(), c_left = c_pos[0], c_top = c_pos[1], c_dim = this.calendar_div.getDimensions(), c_height = c_dim.height, c_width = c_dim.width; 
    var w_top = window.f_scrollTop(), w_height = window.f_height();
    var e_dim = $(this.options.get("popup_by")).cumulativeOffset(), e_top = e_dim[1], e_left = e_dim[0], e_height = $(this.options.get("popup_by")).getDimensions().height, e_bottom = e_top + e_height;
    
    if ( (( e_bottom + c_height ) > (w_top + w_height)) && ( e_bottom - c_height > w_top )) above = true;
    var left_px = e_left.toString() + "px", top_px = (above ? (e_top - c_height ) : ( e_top + e_height )).toString() + "px";
    
    this.calendar_div.style.left = left_px;  this.calendar_div.style.top = top_px;
    
    this.calendar_div.setStyle({visibility:""});
    
    // draw an iframe behind the calendar -- ugly hack to make IE 6 happy
    if(navigator.appName=="Microsoft Internet Explorer") this.iframe = $(document.body).build("iframe", {src: "javascript:false", className: "ie6_blocker"}, { left: left_px, top: top_px, height: c_height.toString()+"px", width: c_width.toString()+"px...
  },
  initCalendarDiv: function() {
    if (this.options.get("embedded")) {
      var parent = this.target_element.parentNode;
      var style = {}
    } else {
      var parent = document.body
      var style = { position:"absolute", visibility: "hidden", left:0, top:0 }
    }
    this.calendar_div = $(parent).build('div', {className: "calendar_date_select"}, style);
    
    var that = this;
    // create the divs
    $w("top header body buttons footer bottom").each(function(name) {
      eval("var " + name + "_div = that." + name + "_div = that.calendar_div.build('div', { className: 'cds_"+name+"' }, { clear: 'left'} ); ");
    });
    
    this.initHeaderDiv();
    this.initButtonsDiv();
    this.initCalendarGrid();
    this.updateFooter("&#160;");
    
    this.refresh();
    this.setUseTime(this.use_time);
  },

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

    if (this.options.get("month_year")=="dropdowns") {
      this.month_select = new SelectBox(header_div, $R(0,11).map(function(m){return [Date.months[m], m]}), {className: "month", onchange: function () { this.navMonth(this.month_select.getValue()) }.bindAsEventListener(this)}); 
      this.year_select = new SelectBox(header_div, [], {className: "year", onchange: function () { this.navYear(this.year_select.getValue()) }.bindAsEventListener(this)}); 
      this.populateYearRange();
    } else {
      this.month_year_label = header_div.build("span")
    }
  },
  initCalendarGrid: function() {
    var body_div = this.body_div;
    this.calendar_day_grid = [];
    var days_table = body_div.build("table", { cellPadding: "0px", cellSpacing: "0px", width: "100%" })
    // make the weekdays!
    var weekdays_row = days_table.build("thead").build("tr");
    Date.weekdays.each( function(weekday) { 
      weekdays_row.build("th", {innerHTML: weekday});
    });
    
    var days_tbody = days_table.build("tbody")
    // Make the days!
    var row_number = 0, weekday;
    for(var cell_index = 0; cell_index<42; cell_index++)
    {
      weekday = (cell_index+Date.first_day_of_week ) % 7;
      if ( cell_index % 7==0 ) days_row = days_tbody.build("tr", {className: 'row_'+row_number++});
      (this.calendar_day_grid[cell_index] = days_row.build("td", {
          calendar_date_select: this,
          onmouseover: function () { this.calendar_date_select.dayHover(this); },
          onmouseout: function () { this.calendar_date_select.dayHoverOut(this) },
          onclick: function() { this.calendar_date_select.updateSelectedDate(this, true); },
          className: (weekday==0) || (weekday==6) ? " weekend" : "" //clear the class
        },
        { cursor: "pointer" }
      )).build("div");
      this.calendar_day_grid[cell_index];
    }
  },
  initButtonsDiv: function()
  {
    var buttons_div = this.buttons_div;
    if (this.options.get("time"))
    {
      var blank_time = $A(this.options.get("time")=="mixed" ? [[" - ", ""]] : []);
      buttons_div.build("span", {innerHTML:"@", className: "at_sign"});
      
      var t = new Date();
      this.hour_select = new SelectBox(buttons_div,
        blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return $A([t.getAMPMHour()+ " " + t.getAMPM(),x])} )),
        { 
          calendar_date_select: this, 
          onchange: function() { this.calendar_date_select.updateSelectedDate( { hour: this.value });},
          className: "hour" 
        }
      );
      buttons_div.build("span", {innerHTML:":", className: "seperator"});
      var that = this;
      this.minute_select = new SelectBox(buttons_div,
        blank_time.concat($R(0,59).select(function(x){return (x % that.options.get('minute_interval')==0)}).map(function(x){ return $A([ Date.padded2(x), x]); } ) ),
        { 
          calendar_date_select: this, 
          onchange: function() { this.calendar_date_select.updateSelectedDate( {minute: this.value }) }, 
          className: "minute" 
        }
      );
      
    } else if (! this.options.get("buttons")) buttons_div.remove();
    
    if (this.options.get("buttons")) {
      buttons_div.build("span", {innerHTML: "&#160;"});
      if (this.options.get("time")=="mixed" || !this.options.get("time")) b = buttons_div.build("a", {
          innerHTML: _translations["Today"],

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

    this.beginning_date.setDate(1 - pre_days + Date.first_day_of_week);
    
    var iterator = new Date(this.beginning_date);
    
    var today = new Date().stripTime();
    var this_month = this.date.getMonth();
    vdc = this.options.get("valid_date_check");
    for (var cell_index = 0;cell_index<42; cell_index++)
    {
      day = iterator.getDate(); month = iterator.getMonth();
      cell = this.calendar_day_grid[cell_index];
      Element.remove(cell.childNodes[0]); div = cell.build("div", {innerHTML:day});
      if (month!=this_month) div.className = "other";
      cell.day = day; cell.month = month; cell.year = iterator.getFullYear();
      if (vdc) { if (vdc(iterator.stripTime())) cell.removeClassName("disabled"); else cell.addClassName("disabled") };
      iterator.setDate( day + 1);
    }
    
    if (this.today_cell) this.today_cell.removeClassName("today");
    
    if ( $R( 0, 41 ).include(days_until = this.beginning_date.stripTime().daysDistance(today)) ) {
      this.today_cell = this.calendar_day_grid[days_until];
      this.today_cell.addClassName("today");
    }
  },
  refreshMonthYear: function() {
    var m = this.date.getMonth();
    var y = this.date.getFullYear();
    // set the month
    if (this.options.get("month_year") == "dropdowns") 
    {
      this.month_select.setValue(m, false);

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

    var hover_date = new Date(this.selected_date);
    hover_date.setYear(element.year); hover_date.setMonth(element.month); hover_date.setDate(element.day);
    this.updateFooter(hover_date.toFormattedString(this.use_time));
  },
  dayHoverOut: function(element) { this.updateFooter(); },
  clearSelectedClass: function() {if (this.selected_cell) this.selected_cell.removeClassName("selected");},
  setSelectedClass: function() {
    if (!this.selection_made) return;
    this.clearSelectedClass()
    if ($R(0,42).include( days_until = this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()) )) {
      this.selected_cell = this.calendar_day_grid[days_until];
      this.selected_cell.addClassName("selected");
    }
  },
  reparse: function() { this.parseDate(); this.refresh(); },
  dateString: function() {
    return (this.selection_made) ? this.selected_date.toFormattedString(this.use_time) : "&#160;";
  },
  parseDate: function()
  {
    var value = $F(this.target_element).strip()

lib/Apache/SdnFw/js/calendar_date_select/calendar_date_select.js  view on Meta::CPAN

  today: function(now) {
    var d = new Date(); this.date = new Date();
    var o = $H({ day: d.getDate(), month: d.getMonth(), year: d.getFullYear(), hour: d.getHours(), minute: d.getMinutes()});
    if ( ! now ) o = o.merge({hour: "", minute:""}); 
    this.updateSelectedDate(o, true);
    this.refresh();
  },
  close: function() {
    if (this.closed) return false;
    this.callback("before_close");
    this.target_element.calendar_date_select = nil;
    Event.stopObserving(document, "mousedown", this.closeIfClickedOut_handler);
    Event.stopObserving(document, "keypress", this.keyPress_handler);
    this.calendar_div.remove(); this.closed = true;
    if (this.iframe) this.iframe.remove();
    if (this.target_element.type != "hidden" && ! this.target_element.disabled) this.target_element.focus();
    this.callback("after_close");
  },
  closeIfClickedOut: function(e) {
    if (! $(Event.element(e)).descendantOf(this.calendar_div) ) this.close();
  },
  keyPress: function(e) {
    if (e.keyCode==Event.KEY_ESC) this.close();
  },
  callback: function(name, param) { if (this.options.get(name)) { this.options.get(name).bind(this.target_element)(param); } }
}

lib/Apache/SdnFw/lib/Core.pm  view on Meta::CPAN

	my @list = $s->db_q("SELECT * FROM $s->{o}{view} ORDER BY $ob",'arrayhash');

	$s->add_action(function => 'create') if (defined($s->{o}{functions}{create}));
	$s->add_action(function => 'sync') if (defined($s->{o}{functions}{sync}));
	$s->add_action(function => 'import') if (defined($s->{o}{functions}{import}));
	$s->add_action(function => 'search') if (defined($s->{o}{functions}{search}));

	$s->tt('list.tt',{ s => $s, list => \@list });
}

sub calendar {
	my $s = shift;
	my $start_day = shift || $s->{datetime}{ymd};
	my $months = shift || 1;

	croak "invalid calendar months value: $months" unless($months =~ m/^\d+$/);
	$months = 12 if ($months > 12);

	my @list = $s->db_q("
		SELECT d.stat_date, extract('dow' from d.stat_date) as dow,
			to_char(d.stat_date, 'Month YYYY') as month_name,
			to_char(d.stat_date, 'DD') as day,
			to_char(d.stat_date, 'YYYY-MM') as month,
			CASE WHEN d.stat_date < date(now()) THEN TRUE ELSE FALSE END as past
		FROM date_values(date(date_trunc('month',date(?))),
			date(date_trunc('month',date(?)) + interval '$months month' - interval '1 day')) d

lib/Apache/SdnFw/lib/Core.pm  view on Meta::CPAN

		}

		$week{month_name} = $ref->{month_name};
		$week{month} = $ref->{month};
		$week{days}{$ref->{dow}}{day} = $ref->{day};
		$week{days}{$ref->{dow}}{date} = $ref->{stat_date};
	}

	push @weeks, { %week };

	my %calendar = (
		weeks => \@weeks,
		dow => {
			0 => { s => 'S', m => 'Sun', l => 'Sunday' },
			1 => { s => 'M', m => 'Mon', l => 'Monday' },
			2 => { s => 'T', m => 'Tue', l => 'Tuesday' },
			3 => { s => 'W', m => 'Wed', l => 'Wednesday' },
			4 => { s => 'T', m => 'Thu', l => 'Thursday' },
			5 => { s => 'F', m => 'Fri', l => 'Friday' },
			6 => { s => 'S', m => 'Sat', l => 'Saturday' },
			},
		);
	return %calendar;
}

####################################
# PRIVATE STUFF
####################################
sub _content_add_menu {
	my $s = shift;

	if ($s->{nomenu}) {
		if ($s->{o}{interface} && $s->{$s->{o}{id}}) {

lib/Apache/SdnFw/lib/Core.pm  view on Meta::CPAN

		$s->{add_js}{prototype} = 1;
	}

	my $return = qq(\n<script type="text/javascript" src="/js/prototype.js"></script>\n)
		if ($s->{add_js}{prototype});

	foreach my $k (keys %{$s->{add_js}}) {
		next if ($k eq 'prototype');
		if ($k eq 'scriptaculous') {
			$return .= qq(<script type="text/javascript" src="/js/scriptaculous.js?effects,controls"></script>\n);
		} elsif ($k eq 'calendar') {
			$return .= qq(<script type="text/javascript" src="/js/calendar_date_select/calendar_date_select.js"></script>\n).
			qq(<script type="text/javascript" src="/js/calendar_date_select/format_iso_date.js"></script>\n);
		} else {
			$return .= qq(<script type="text/javascript" src="/js/$k.js"></script>\n);
		}
	}

	$return .= join "\n", @{$s->{head_js}} if (defined($s->{head_js}));

	return $return;
}

lib/Apache/SdnFw/lib/Core.pm  view on Meta::CPAN

sub html_display_link {
	my $s = shift;
	my $object = shift;
	my $id = shift;
	my $name = shift;
	my $keyfield = shift || 'id';

	return $s->html_a("$s->{ubase}/$object/display?$keyfield=$id",$name);
}

sub html_input_calendar {
	my $s = shift;
	my $key = $s->escape(shift);
	my $value = $s->escape(shift);

	$key = "$s->{acfb}::$key" if ($s->{acfb});

	my $cal = $s->add_calendar($key);
	my $str = qq(<input $cal name="$key" value="$value" autocomplete="off" size="12">);

	return $str;
}

sub add_calendar {
	my $s = shift;
	my $id = shift;

	$s->add_js('calendar');

	return qq|id="$id" onclick="javascript: new CalendarDateSelect( \$('$id'), {close_on_click: true, embedded:true, year_range:1} );"|;
}

sub _head_add_title {
	my $s = shift;

	if (ref $s->{title} eq 'ARRAY') {
		my $t = join ' :: ', @{$s->{title}};
		$s->{title} = $t;

lib/Apache/SdnFw/tt/create.tt  view on Meta::CPAN

	[% ELSIF f.boolean %]
		[% s.html_checkbox(f.k,1) %]
	[% ELSIF f.textarea %]
		[% s.html_textarea(f.k,'',40,10) %]
	[% ELSIF f.v %]
		[% IF f.notnull %]
			[% s.html_select_basic(f.v,f.k) %]
		[% ELSE %]
			[% s.html_select_basic(f.v,f.k,'',1) %]
		[% END %]
	[% ELSIF f.calendar %]
		[% s.html_input_calendar(f.k,'') %]
	[% ELSE %]
		[% s.html_input(f.k,'',f.input_size) %]
	[% END %]
		</td>
	</tr>
	</tbody>
[% END -%]
</table>
<input type="submit" value="Save" style="clear: both;">
</div>

lib/Apache/SdnFw/tt/edit.tt  view on Meta::CPAN

	[% ELSIF f.boolean %]
		[% s.html_checkbox(f.k,1,hash.${f.k}) %]
	[% ELSIF f.textarea %]
		[% s.html_textarea(f.k,hash.${f.k},40,10) %]
	[% ELSIF f.v %]
		[% IF f.notnull %]
			[% s.html_select_basic(f.v,f.k,hash.${f.k}) %]
		[% ELSE %]
			[% s.html_select_basic(f.v,f.k,hash.${f.k},1) %]
		[% END %]
	[% ELSIF f.calendar %]
		[% s.html_input_calendar(f.k,hash.${f.k}) %]
	[% ELSE %]
		[% IF f.verify == 'phone' %]
			[% s.html_input(f.k,s.format_phone(hash.${f.k}),f.input_size) %]
		[% ELSE %]
			[% s.html_input(f.k,hash.${f.k},f.input_size) %]
		[% END %]
	[% END %]
		</td>
	</tr>
	</tbody>



( run in 1.426 second using v1.01-cache-2.11-cpan-5dc5da66d9d )