Skip to content

Commit

Permalink
Updated Contacts, Calendar, & Tasks to respond to IA7 (new "keys" fie…
Browse files Browse the repository at this point in the history
…ld in collections.json to pass the collection keys as an argument to any link types)

Modified page_request to get all the arguments from the location and then pass them to the get function. Need to test this to confirm this doesn't break anything as I'm a little unsure of Kevin's coding
Updated the LED clock to work with IA7
  • Loading branch information
hplato committed Apr 6, 2015
1 parent 5879898 commit d8e27c9
Show file tree
Hide file tree
Showing 20 changed files with 179 additions and 48 deletions.
5 changes: 4 additions & 1 deletion data/web/collections.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"106" : {
"link" : "/organizer/calendar.pl",
"name" : "Calendar",
"keys" : "true",
"icon" : "fa-calendar"
},
"52" : {
Expand Down Expand Up @@ -194,6 +195,7 @@
"108" : {
"link" : "/organizer/tasks.pl",
"name" : "TODO List",
"keys" : "true",
"icon" : "fa-list"
},
"94" : {
Expand Down Expand Up @@ -383,7 +385,7 @@
"113" : {
"name" : "LED Clock",
"icon" : "fa-clock-o",
"link" : "/clock"
"link" : "/clock/index.html"
},
"71" : {
"name" : "Camera Files",
Expand Down Expand Up @@ -479,6 +481,7 @@
"107" : {
"link" : "/organizer/contacts.pl",
"icon" : "fa-book",
"keys" : "true",
"name" : "Address Book"
},
"26" : {
Expand Down
56 changes: 40 additions & 16 deletions web/clock/index.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,49 @@
<HEAD>
<TITLE>JavaClock</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ramandeep Singh (ramandeepji@yahoo.com) -->

<!-- <!-- Original: Ramandeep Singh (ramandeepji@yahoo.com) -->
<!-- Web Site: http://hard-drive.hypermart.net -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

<!-- IA7 updates -->
var img_prefix = "";
var img_suffix = "";

var loc = window.location.toString();
if (loc.indexOf("&_collection_key") !== 0) {
img_prefix = "/clock/";
img_suffix = "w";
}


var dn;
c1 = new Image(); c1.src = "numbers/c1.gif";
c2 = new Image(); c2.src = "numbers/c2.gif";
c3 = new Image(); c3.src = "numbers/c3.gif";
c4 = new Image(); c4.src = "numbers/c4.gif";
c5 = new Image(); c5.src = "numbers/c5.gif";
c6 = new Image(); c6.src = "numbers/c6.gif";
c7 = new Image(); c7.src = "numbers/c7.gif";
c8 = new Image(); c8.src = "numbers/c8.gif";
c9 = new Image(); c9.src = "numbers/c9.gif";
c0 = new Image(); c0.src = "numbers/c0.gif";
cb = new Image(); cb.src = "numbers/cb.gif";
cam = new Image(); cam.src = "numbers/cam.gif";
cpm = new Image(); cpm.src = "numbers/cpm.gif";
c1 = new Image(); c1.src = img_prefix+"numbers/c1"+img_suffix+".gif";
c2 = new Image(); c2.src = img_prefix+"numbers/c2"+img_suffix+".gif";
c3 = new Image(); c3.src = img_prefix+"numbers/c3"+img_suffix+".gif";
c4 = new Image(); c4.src = img_prefix+"numbers/c4"+img_suffix+".gif";
c5 = new Image(); c5.src = img_prefix+"numbers/c5"+img_suffix+".gif";
c6 = new Image(); c6.src = img_prefix+"numbers/c6"+img_suffix+".gif";
c7 = new Image(); c7.src = img_prefix+"numbers/c7"+img_suffix+".gif";
c8 = new Image(); c8.src = img_prefix+"numbers/c8"+img_suffix+".gif";
c9 = new Image(); c9.src = img_prefix+"numbers/c9"+img_suffix+".gif";
c0 = new Image(); c0.src = img_prefix+"numbers/c0"+img_suffix+".gif";
cb = new Image(); cb.src = img_prefix+"numbers/cb"+img_suffix+".gif";
cc = new Image(); cc.src = img_prefix+"numbers/colon"+img_suffix+".gif";
cam = new Image(); cam.src = img_prefix+"numbers/cam"+img_suffix+".gif";
cpm = new Image(); cpm.src = img_prefix+"numbers/cpm"+img_suffix+".gif";
function extract(h,m,s,type) {
if (!document.images) return;

document.images.c.src = cc.src;
document.images.c.src = eval("cc.src");
document.images.f.src = cc.src;
document.images.f.src = eval("cc.src");

if (h <= 9) {
document.images.a.src = cb.src;
document.images.b.src = eval("c"+h+".src");
Expand Down Expand Up @@ -78,10 +98,10 @@
<table>
<tr>
<td><a href='javascript:history.go(-1)'> <img src='/graphics/1pixel.gif' width='200' height='150' border=0></a></td>
<td><a href='/' target='_top'> <img src='/graphics/1pixel.gif' width='200' height='150' border=0></a></td>
<td><a href='/ia5/index_menu.shtml' target='_top'> <img src='/graphics/1pixel.gif' width='200' height='150' border=0></a></td>
<td><a href='/' target='_top'> <img src='/graphics/1pixel.gif' width='200' height='150' border=0></a></td>
</tr></table>

<table>
<center>
<img height=100 src="numbers/cb.gif" width=72 name=a>
<img height=100 src="numbers/cb.gif" width=72 name=b>
Expand All @@ -93,12 +113,16 @@
<img height=100 src="numbers/cb.gif" width=72 name=h>
<img height=100 src="numbers/cam.gif" width=72 name=j>
</center>
</table>

<table>
<tr>
<td><a href='/misc/photos.html' target='_top'> <img src='/graphics/1pixel.gif' width='600' height='150' border=0></a></td>
</tr></table>

<script>
show3();
</script>
<!-- Ever seen the TV series 24? :)
<EMBED src='/data/clock_tick2.wav' autostart=true loop=false volume=10 hidden=true>
Expand Down
Binary file added web/clock/numbers/c0w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c1w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c2w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c3w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c4w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c5w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c6w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c7w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c8w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/c9w.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/camw.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/cbw.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/colonw.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/clock/numbers/cpmw.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 36 additions & 2 deletions web/ia7/include/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ function HashtoJSONArgs(URLHash) {
return path + "?" + pairs.join('&');
}

//Gets any arguments in the URL that aren't part of IA7
function HashPathArgs(URLHash) {
var loc = location.href.split('?');
if (loc[1] === undefined) {
return;
}
var pairs = loc[1].split('&');
var rpairs = [];
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split('=');
if (pair[0].indexOf("_") === 0){
//Do not include private arguments
continue;
}
rpairs.push(pair[0]+"="+pair[1]);
}
return rpairs.join('&');
}

//Stores the JSON data in the proper location based on the path requested
function JSONStore (json){
var newJSON = {};
Expand Down Expand Up @@ -132,7 +151,14 @@ function changePage (){
loadVars();
}
else if(URLHash._request == 'page'){
$.get(URLHash.link, function( data ) {
var link = URLHash.link.replace(/\?+.*/,''); //HP for some reason, this often has the first arg with no value, ie ?bob
var args = HashPathArgs(URLHash);
if (args !== undefined) {
link += "?"+args;
}
//alert("link="+link);
//$.get(URLHash.link, function( data ) {
$.get(link, function( data ) {
data = data.replace(/<link[^>]*>/img, ''); //Remove stylesheets
data = data.replace(/<title[^>]*>((\r|\n|.)*?)<\/title[^>]*>/img, ''); //Remove title
data = data.replace(/<meta[^>]*>/img, ''); //Remove meta refresh
Expand Down Expand Up @@ -821,13 +847,21 @@ var loadCollection = function(collection_keys) {
var icon = json_store.collections[collection].icon;
var name = json_store.collections[collection].name;
var mode = json_store.collections[collection].mode;
var keys = json_store.collections[collection].keys; //for legacy CGI scripts to recreate proper URL

if (json_store.collections[collection].iframe !== undefined) {
//strip out http:// if included
link = "/ia7/include/iframe.shtml?"+json_store.collections[collection].iframe;
}
var hidden = "";
if (mode != display_mode && mode != undefined ) hidden = "hidden"; //Hide any simple/advanced buttons
var next_collection_keys = collection_keys + "," + entity_sort[i];
if (keys === "true") {
var arg = "?";
if (link.indexOf("?") >= 0 ) { //already has arguments, so just add one on
arg = "&";
}
link += arg+"ia7="+next_collection_keys;
}
link = buildLink (link, next_collection_keys);
if (json_store.collections[collection].external !== undefined) {
link = json_store.collections[collection].external;
Expand Down
59 changes: 44 additions & 15 deletions web/organizer/calendar.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# or indirectly caused by this software.
#
# Version History
# 1.6.0-4 - 04/05/15 - IA7 Aware
# 1.6.0-3 - 01/04/14 - added support for control calendars (hide them)
# 1.6.0-2 - 11/02/07 - minor bugfix to in icalsync name
# 1.6.0-1 - 09/24/07 - Updated to organizer release 2.5.2 without admin login and ical customization
Expand All @@ -31,7 +32,7 @@
# 1.5.2 - 08/22/01 - added file locking
# ----------------------------------------------------------------------------

my $VERSION = "1.6.0-3";
my $VERSION = "1.6.0-4";

BEGIN {
# $SIG{__WARN__} = \&FatalError;
Expand Down Expand Up @@ -112,6 +113,27 @@ BEGIN
file => $configFilePath,
delimiter => "\t",
);
my ($objCGI) = new CGI;
#my $URL = $ENV{HTTP_QUERY_STRING};
my $ia7_keys = $objCGI->param('ia7');
# want to get the prefix and suffix for creating IA7 URLs
my $web_mode = "IA5";
my $ia7_prefix = "";
my $ia7_suffix = "";
my $img_prefix = "";

#foreach my $key (sort(keys(%ENV))) {
# print "$key = $ENV{$key}<br>\n";
#}
#print "keys=$ia7_keys";
# http://127.0.0.1:8080/ia7/#_request=page&link=/organizer/calendar.pl&_collection_key=0,11,106
if ($ia7_keys) {
$ia7_prefix = "/ia7/#_request=page&link=";
$ia7_suffix = "ia7=" . $ia7_keys . "&_collection_key=" . $ia7_keys;
$web_mode = "IA7";
$img_prefix = "/organizer/";
}

$objConfig->Open;
my ($title) = $objConfig->FieldValue("Title");
my ($bodyTag) = $objConfig->FieldValue("BodyTag");
Expand Down Expand Up @@ -149,7 +171,7 @@ BEGIN
<p>
";
my ($scriptName) = $ENV{'SCRIPT_NAME'} || "calendar.pl";
my ($objCGI) = new CGI;
$scriptName = $ia7_prefix . "/organizer/calendar.pl" if ($web_mode eq "IA7");
my @dateArray = localtime(time);
my ($month) = $objCGI->param('vsMonth') || $dateArray[4]+1;
my ($year) = $objCGI->param('vsYear') || $dateArray[5]+1900;
Expand All @@ -160,6 +182,10 @@ BEGIN

## --- Custom
my ($showDayDetails) = $objCGI->param('vsSD') || 0;
#print "vsSD=$showDayDetails";
#my $URL1 = $objCGI->param('ia7');
#print "URL1=$URL1";

my ($showforAudrey) = $objCGI->param('vsMA') || 0;
my ($noShowDayDetails) = 1;
my ($cellSize) = 25;
Expand Down Expand Up @@ -222,6 +248,7 @@ BEGIN
print "vsLock Module Version " . $objLock->Version;
print "<br>MisterAudrey Version" if ($showforAudrey);
print "<br>ical2vsdb sync 1.0";
print " Web interface: " . $web_mode;
print "
</font><p>
</font>
Expand Down Expand Up @@ -264,20 +291,20 @@ sub PrintDefault {
# display the navigation
print "<form><table width='100%' bgcolor='$dataDarkColor' border='1' cellspacing='0' cellpadding='2'><tr><td align='center'>\n";
print "<font size='2' face='arial,helvetica'><b>\n";
print "<a href='$scriptName?vsSD=$showDayDetails&vsMonth=$month&vsYear=" . ($year - 1) . "'>&lt;&lt;</a>\n";
print "&nbsp;<a href='$scriptName?vsSD=$showDayDetails&vsMonth=$pmonth&vsYear=$pyear'>&lt;</a>\n";
print "<a href='$scriptName?vsSD=$showDayDetails&vsMonth=$month&vsYear=" . ($year - 1) . "&" . $ia7_suffix . "'>&lt;&lt;</a>\n";
print "&nbsp;<a href='$scriptName?vsSD=$showDayDetails&vsMonth=$pmonth&vsYear=$pyear&" . $ia7_suffix . "'>&lt;</a>\n";
print "<select name='month' onchange=\"document.location='$scriptName?vsSD=$showDayDetails&' + this.options[this.selectedIndex].value;return true;\">\n";
print "<option value='vsMonth=$pmonth&vsYear=$pyear'>$pmonth / $pyear</option>\n";
print "<option value='vsMonth=$month&vsYear=$year' selected>$month / $year</option>\n";
print "<option value='vsMonth=$pmonth&vsYear=$pyear&" . $ia7_suffix . "'>$pmonth / $pyear</option>\n";
print "<option value='vsMonth=$month&vsYear=$year&" . $ia7_suffix . "' selected>$month / $year</option>\n";
my ($nM) = $month;
my ($nY) = $year;
for (my $count = 1;$count < 12;$count++) {
NextMonth(\$nM,\$nY);
print "<option value='vsMonth=$nM&vsYear=$nY'>$nM / $nY</option>\n";
print "<option value='vsMonth=$nM&vsYear=$nY&" . $ia7_suffix . "'>$nM / $nY</option>\n";
}
print "</select>\n";
print " <a href='$scriptName?vsSD=$showDayDetails&vsMonth=$nmonth&vsYear=$nyear'>&gt;</a>\n";
print "&nbsp;<a href='$scriptName?vsSD=$showDayDetails&vsMonth=$month&vsYear=" . ($year + 1) . "'>&gt;&gt;</a>\n";
print " <a href='$scriptName?vsSD=$showDayDetails&vsMonth=$nmonth&vsYear=$nyear&" . $ia7_suffix . "'>&gt;</a>\n";
print "&nbsp;<a href='$scriptName?vsSD=$showDayDetails&vsMonth=$month&vsYear=" . ($year + 1) . "&" . $ia7_suffix . "'>&gt;&gt;</a>\n";
print "</b></font>\n";
print "</td></tr></table></form>";

Expand Down Expand Up @@ -347,7 +374,8 @@ sub PrintDay {
my $icon = $detailIcon;
my $source = $objMyDb->FieldValue("SOURCE");
$icon = "images/ical_1.jpg" if ($source =~ /^ical=/);
my $link = "<a href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsCOM=EDIT&vsMonth=$month&vsYear=$year&vsDay=$day&vsID=" . $objMyDb->FieldValue("ID") . "'>";
$icon = $img_prefix . $icon;
my $link = "<a href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsCOM=EDIT&vsMonth=$month&vsYear=$year&vsDay=$day&vsID=" . $objMyDb->FieldValue("ID") . "&" . $ia7_suffix . "'>";
print "<tr $custcolor><td>" . $link . "<img src='$icon' border='0'></a></td>";
print "<td><font size='2' face='arial,helvetica'>" . $objMyDb->FieldValue("TIME") . "&nbsp;</font></td>";
print "<td>" . $link . "<font size='2' face='arial,helvetica'>" . $objMyDb->FieldValue("EVENT") . "&nbsp;</font></td></a></tr>\n";
Expand Down Expand Up @@ -386,9 +414,9 @@ sub PrintMonth {
print "<p>\n";
print "<font face='arial,helvetica' size='2'><b>$months[$month-1] $year</b></font>\n";
if ($showDayDetails) {
print " <font size='1'>[<a href='$scriptName?vsSD=0&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year'>Hide Details</a>]</font>\n"
print " <font size='1'>[<a href='$scriptName?vsSD=0&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&" . $ia7_suffix . "'>Hide Details</a>]</font>\n"
} else {
print " <font size='1'>[<a href='$scriptName?vsSD=1&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year'>Show Details</a>]</font>\n"
print " <font size='1'>[<a href='$scriptName?vsSD=1&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&" . $ia7_suffix . "'>Show Details</a>]</font>\n"
}
print "<table border='1' cellspacing='0' cellpadding='2'>\n";

Expand Down Expand Up @@ -453,16 +481,16 @@ sub PrintMonth {
}

if ($objMyDb->EOF) {
print "<a $style href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&vsDay=$weekDayCount'>$weekDayCount</a><br>";
print "<a $style href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&vsDay=$weekDayCount&" . $ia7_suffix . "'>$weekDayCount</a><br>";
} else {
#$style = "style=\"color:$dataHolidayColor\"" if ($objMyDb->FieldValue("HOLIDAY") eq "on");
print "<b><a $style href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&vsDay=$weekDayCount'>$weekDayCount</a></b><br>";
print "<b><a $style href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&vsDay=$weekDayCount&" . $ia7_suffix . "'>$weekDayCount</a></b><br>";
}

if ($showDayDetails) {
print "<font size='1'>";
while (!$objMyDb->EOF) {
print "<a href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsCOM=EDIT&vsMonth=$month&vsYear=$year&vsDay=$weekDayCount&vsID=" . $objMyDb->FieldValue("ID") . "'>" .$objMyDb->FieldValue("EVENT") . "</a><br>" unless ($objMyDb->FieldValue("CONTROL") eq "on"); #Don't display CONTROL calendars;
print "<a href='$scriptName?vsSD=$showDayDetails&vsMA=$showforAudrey&vsCOM=EDIT&vsMonth=$month&vsYear=$year&vsDay=$weekDayCount&vsID=" . $objMyDb->FieldValue("ID") . "&" . $ia7_suffix . "'>" .$objMyDb->FieldValue("EVENT") . "</a><br>" unless ($objMyDb->FieldValue("CONTROL") eq "on"); #Don't display CONTROL calendars;
$objMyDb->MoveNext;
}
print "</font>";
Expand Down Expand Up @@ -692,6 +720,7 @@ sub PrintCurrentRecord {
print "<input type='submit' value='Delete' onclick=\"if (confirm('Delete This Record?')) {self.location='$scriptName?vsCOM=DELETE&vsSD=$showDayDetails&vsMA=$showforAudrey&vsMonth=$month&vsYear=$year&vsDay=$day&vsID=" . $objMyDB->FieldValue("ID") . "';return false;} else {return false;};\">\n";
} else {
print "<input type='hidden' name='DATE' value='$year.$month.$day'>\n";
print "<input type='hidden' name='ia7' value='$ia7_keys'>\n";
print "<input type='hidden' name='vsCOM' value='INSERT'>\n";
print "<input type='submit' value='Add'>\n";
}
Expand Down
Loading

0 comments on commit d8e27c9

Please sign in to comment.