[pLog-svn] r5739 - plog/trunk/js/location
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Jul 27 15:56:17 EDT 2007
Author: oscar
Date: 2007-07-27 15:56:17 -0400 (Fri, 27 Jul 2007)
New Revision: 5739
Modified:
plog/trunk/js/location/location.js
Log:
I forgot this from the previous checkin...
Modified: plog/trunk/js/location/location.js
===================================================================
--- plog/trunk/js/location/location.js 2007-07-27 19:55:46 UTC (rev 5738)
+++ plog/trunk/js/location/location.js 2007-07-27 19:56:17 UTC (rev 5739)
@@ -42,13 +42,6 @@
),
/**
- * messages
- */
- locationLocaleNoMarkerHasBeenSetYet: "No marker has been set yet",
- locationLocaleNoDescriptionError: "Please type a description for the new location",
- locationLocaleEnterNewLocationName: "Name for the new location",
-
- /**
* Used to control whether the marker is already in place or not, please
* do not modify these
*/
@@ -77,6 +70,41 @@
map: null
}
+Lifetype.UI.Location.Selector = function()
+{
+ this.o = null;
+}
+
+Lifetype.UI.Location.Selector.onChangeHandler = function( s )
+{
+ if( s.options[s.selectedIndex].value == -1) {
+ this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), '?op=locationChooser' );
+ this.o.show();
+ }
+}
+
+Lifetype.UI.Location.Selector.displaySelected = function( a )
+{
+ list = Lifetype.Dom.$('locationId');
+ if( list.options[list.selectedIndex].value == 0 )
+ return false;
+
+ locId = list.options[list.selectedIndex].value;
+ url = '?op=adminLocationDisplay&locId=' + locId;
+
+ this.o = new Lifetype.UI.ContentOverlay( YAHOO.util.Dom.generateId(), url );
+ // and bind it to the onclick event
+ this.o.show();
+
+ return( false );
+}
+
+Lifetype.UI.Location.Selector.hide = function()
+{
+ this.o.hide();
+ this.o.destroy();
+}
+
/**
* Initializes and renders the selector
*
@@ -165,17 +193,17 @@
Lifetype.UI.Location.prototype.AddLocation = function()
{
if( !this.markerAdded ) {
- window.alert( this.locationLocaleNoMarkerHasBeenSetYet );
+ window.alert( tr('error_no_marker_set'));
return false;
}
// get the list that holds the locations
- locationList = parent.opener.document.getElementById("locationId");
+ locationList = Lifetype.Dom.$( 'locationId' );
// get the description and quit if empty
- newLocationDesc = window.prompt( this.locationLocaleEnterNewLocationName )
+ newLocationDesc = window.prompt( tr('enter_location_name' ))
if( newLocationDesc == "" || newLocationDesc == null ) {
- window.alert( this.locationLocaleNoDescriptionError );
+ window.alert( tr('error_no_description_set'));
return false;
}
@@ -293,17 +321,19 @@
// get the id of the updated location from the response message
var locId = msg.result.id;
// and the description
- var locDesc = msg.result.desc;
+ var locDesc = msg.result.description;
// get the list that holds the locations and if it's there, then
// update the one that we just moved around
- locationList = parent.opener.document.getElementById("locationId");
+ locationList = Lifetype.Dom.$( 'locationId' );
if( locationList != undefined ) {
for( i = 0; i < locationList.options.length; i++ ) {
if( locationList.options[i].value == locId )
locationList.options[i].text = locDesc;
}
}
+
+ Lifetype.UI.Location.Selector.hide();
}
/**
@@ -328,7 +358,6 @@
// decode the JSon message and get the fields that we need
window.alert(o.responseText);
- var msg = Lifetype.JSon.decode( o.responseText );
var success = msg.success;
var message = msg.message;
@@ -341,18 +370,18 @@
// get the id of the updated location from the response message
var locId = msg.result.id;
// and the description
- var locDesc = msg.result.desc;
+ var locDesc = msg.result.description;
// get the list that holds the locations and if it's there, then
// update the one that we just moved around
- locationList = parent.opener.document.getElementById("locationId");
+ locationList = Lifetype.Dom.$( 'locationId' );
// save the "add_new" option so that it doesn't get removed
addNewText = locationList.options[locationList.selectedIndex].text;
addNewValue = locationList.options[locationList.selectedIndex].value;
// add the new option
- opt = parent.opener.document.createElement( "option" );
+ opt = document.createElement ( 'option' );
opt.text = locDesc;
opt.value = locId;
locationList.options[locationList.options.length - 1] = opt;
@@ -360,15 +389,15 @@
// and select the last but one option (the new one that was added)
locationList.selectedIndex = locationList.options.length - 1;
- locationLatitude = parent.opener.document.getElementById("locationLat");
+ locationLatitude = Lifetype.Dom.$( 'locationLat' );
if( locationLatitude != undefined )
locationLatitude.value = this.markerLat;
- locationLongitude = parent.opener.document.getElementById("locationLong");
+ locationLongitude = Lifetype.Dom.$( 'locationLang' );
if( locationLongitude != undefined )
locationLongitude.value = this.markerLong;
- locationDesc = parent.opener.document.getElementById("locationDesc");
+ locationDesc = Lifetype.Dom.$( 'locationDesc' );
if( locationDesc != undefined )
locationDesc.value = newLocationDesc;
More information about the pLog-svn
mailing list