Added: Google map asset.
Added a way for authors to prevent debugging output on page requests
This commit is contained in:
parent
77a273c954
commit
25ff0dae0e
9 changed files with 513 additions and 98 deletions
BIN
docs/upgrades/packages-7.7.7/home_map_map-templates(3).wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.7/home_map_map-templates(3).wgpkg
Normal file
Binary file not shown.
|
|
@ -35,6 +35,7 @@ alterVATNumberTable( $session );
|
|||
addRedirectAfterLoginUrlToSettings( $session );
|
||||
addSurveyTestResultsTemplateColumn( $session );
|
||||
fixSMSUserProfileI18N($session);
|
||||
addMapAsset( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -104,7 +105,67 @@ sub addSurveyTestResultsTemplateColumn {
|
|||
$session->db->write("alter table Survey add column `testResultsTemplateId` char(22)");
|
||||
|
||||
print "Done\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the map asset
|
||||
sub addMapAsset {
|
||||
my $session = shift;
|
||||
print "\tAdding Google Map asset..." unless $quiet;
|
||||
|
||||
# Map asset
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS Map (
|
||||
assetId CHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
groupIdAddPoint CHAR(22) BINARY,
|
||||
mapApiKey TEXT,
|
||||
mapHeight CHAR(12),
|
||||
mapWidth CHAR(12),
|
||||
startLatitude FLOAT,
|
||||
startLongitude FLOAT,
|
||||
startZoom TINYINT UNSIGNED,
|
||||
templateIdEditPoint CHAR(22) BINARY,
|
||||
templateIdView CHAR(22) BINARY,
|
||||
templateIdViewPoint CHAR(22) BINARY,
|
||||
workflowIdPoint CHAR(22) BINARY,
|
||||
PRIMARY KEY (assetId, revisionDate)
|
||||
);
|
||||
ENDSQL
|
||||
|
||||
# MapPoint asset
|
||||
$session->db->write(<<'ENDSQL');
|
||||
CREATE TABLE IF NOT EXISTS MapPoint (
|
||||
assetId CHAR(22) BINARY NOT NULL,
|
||||
revisionDate BIGINT NOT NULL,
|
||||
latitude FLOAT,
|
||||
longitude FLOAT,
|
||||
website VARCHAR(255),
|
||||
address1 VARCHAR(255),
|
||||
address2 VARCHAR(255),
|
||||
city VARCHAR(255),
|
||||
state VARCHAR(255),
|
||||
zipCode VARCHAR(255),
|
||||
country VARCHAR(255),
|
||||
phone VARCHAR(255),
|
||||
fax VARCHAR(255),
|
||||
email VARCHAR(255),
|
||||
storageIdPhoto CHAR(22) BINARY,
|
||||
userDefined1 TEXT,
|
||||
userDefined2 TEXT,
|
||||
userDefined3 TEXT,
|
||||
userDefined4 TEXT,
|
||||
userDefined5 TEXT,
|
||||
PRIMARY KEY (assetId, revisionDate)
|
||||
);
|
||||
ENDSQL
|
||||
|
||||
# Add to assets
|
||||
$session->config->addToHash( "assets", 'WebGUI::Asset::Wobject::Map', {
|
||||
"category" => "basic",
|
||||
});
|
||||
|
||||
print "Done!\n" unless $quiet;
|
||||
}
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
|
|
|||
|
|
@ -642,6 +642,9 @@
|
|||
},
|
||||
"WebGUI::Asset::Template" : {
|
||||
"category" : "utilities"
|
||||
},
|
||||
'WebGUI::Asset::Wobject::Map' : {
|
||||
"category" : "basic"
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ package WebGUI::Asset::MapPoint;
|
|||
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use base 'WebGUI::AssetAspect::Installable','WebGUI::Asset';
|
||||
use base 'WebGUI::Asset';
|
||||
use WebGUI::Utility;
|
||||
|
||||
# To get an installer for your wobject, add the Installable AssetAspect
|
||||
|
|
@ -63,86 +63,84 @@ sub definition {
|
|||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new( $session, "Asset_MapPoint" );
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
latitude => {
|
||||
latitude => {
|
||||
tab => "properties",
|
||||
fieldType => "float",
|
||||
label => $i18n->echo("Latitude"),
|
||||
hoverHelp => $i18n->echo("The latitude of the point"),
|
||||
noFormPost => 1,
|
||||
label => $i18n->get("latitude label"),
|
||||
hoverHelp => $i18n->get("latitude description"),
|
||||
},
|
||||
longitude => {
|
||||
longitude => {
|
||||
tab => "properties",
|
||||
fieldType => "float",
|
||||
label => $i18n->echo("Longitude"),
|
||||
hoverHelp => $i18n->echo("The longitude of the point"),
|
||||
noFormPost => 1,
|
||||
label => $i18n->get("longitude label"),
|
||||
hoverHelp => $i18n->get("longitude description"),
|
||||
},
|
||||
website => {
|
||||
website => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Website"),
|
||||
hoverHelp => $i18n->echo("The URL to the location's website"),
|
||||
label => $i18n->get("website label"),
|
||||
hoverHelp => $i18n->get("website description"),
|
||||
},
|
||||
address1 => {
|
||||
address1 => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Address 1"),
|
||||
hoverHelp => $i18n->echo("The first line of the address"),
|
||||
label => $i18n->get("address1 label"),
|
||||
hoverHelp => $i18n->get("address1 description"),
|
||||
},
|
||||
address2 => {
|
||||
address2 => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Address 2"),
|
||||
hoverHelp => $i18n->echo("The second line of the address"),
|
||||
label => $i18n->get("address2 label"),
|
||||
hoverHelp => $i18n->get("address2 description"),
|
||||
},
|
||||
city => {
|
||||
city => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("City"),
|
||||
hoverHelp => $i18n->echo("The city the point is located in"),
|
||||
label => $i18n->get("city label"),
|
||||
hoverHelp => $i18n->get("city description"),
|
||||
},
|
||||
state => {
|
||||
state => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("State/Province"),
|
||||
hoverHelp => $i18n->echo("The state/provice the point is located in"),
|
||||
label => $i18n->get("state label"),
|
||||
hoverHelp => $i18n->get("state description"),
|
||||
},
|
||||
zipCode => {
|
||||
zipCode => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Zip/Postal Code"),
|
||||
hoverHelp => $i18n->echo("The zip/postal code the point is located in"),
|
||||
label => $i18n->get("zipCode label"),
|
||||
hoverHelp => $i18n->get("zipCode description"),
|
||||
},
|
||||
country => {
|
||||
country => {
|
||||
tab => "properties",
|
||||
fieldType => "country",
|
||||
label => $i18n->echo("Country"),
|
||||
hoverHelp => $i18n->echo("The country the point is located in"),
|
||||
label => $i18n->get("country label"),
|
||||
hoverHelp => $i18n->get("country description"),
|
||||
},
|
||||
phone => {
|
||||
phone => {
|
||||
tab => "properties",
|
||||
fieldType => "phone",
|
||||
label => $i18n->echo("Phone"),
|
||||
hoverHelp => $i18n->echo("The phone number of the location"),
|
||||
label => $i18n->get("phone label"),
|
||||
hoverHelp => $i18n->get("phone description"),
|
||||
},
|
||||
fax => {
|
||||
fax => {
|
||||
tab => "properties",
|
||||
fieldType => "phone",
|
||||
label => $i18n->echo("Fax"),
|
||||
hoverHelp => $i18n->echo("The fax number of the location"),
|
||||
label => $i18n->get("fax label"),
|
||||
hoverHelp => $i18n->get("fax description"),
|
||||
},
|
||||
email => {
|
||||
email => {
|
||||
tab => "properties",
|
||||
fieldType => "email",
|
||||
label => $i18n->echo("E-mail"),
|
||||
hoverHelp => $i18n->echo("The e-mail address of the location"),
|
||||
label => $i18n->get("email label"),
|
||||
hoverHelp => $i18n->get("email description"),
|
||||
},
|
||||
storageIdPhoto => {
|
||||
storageIdPhoto => {
|
||||
tab => "properties",
|
||||
fieldType => "image",
|
||||
forceImageOnly => 1,
|
||||
label => $i18n->echo("Photo"),
|
||||
hoverHelp => $i18n->echo("A photo of the location"),
|
||||
label => $i18n->get("storageIdPhoto label"),
|
||||
hoverHelp => $i18n->get("storageIdPhoto description"),
|
||||
noFormPost => 1,
|
||||
},
|
||||
userDefined1 => {
|
||||
|
|
@ -190,6 +188,19 @@ sub canEdit {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
||||
Get the workflowId to commit this MapPoint
|
||||
|
||||
=cut
|
||||
|
||||
sub getAutoCommitWorkflowId {
|
||||
my ( $self ) = @_;
|
||||
return $self->getParent->get('workflowIdPoint');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getMapInfo ( )
|
||||
|
||||
Get a hash of info to be put into the parent Map. Must include
|
||||
|
|
@ -274,6 +285,14 @@ sub getTemplateVarsEditForm {
|
|||
value => $self->getId,
|
||||
defaultValue => 'new',
|
||||
} )
|
||||
. WebGUI::Form::hidden( $session, {
|
||||
name => 'latitude',
|
||||
value => $self->get('latitude'),
|
||||
} )
|
||||
. WebGUI::Form::hidden( $session, {
|
||||
name => 'longitude',
|
||||
value => $self->get('longitude'),
|
||||
} )
|
||||
;
|
||||
$var->{ form_footer } = WebGUI::Form::formFooter( $session );
|
||||
|
||||
|
|
@ -346,9 +365,7 @@ sub processAjaxEditForm {
|
|||
$self->update( $prop );
|
||||
|
||||
# Photo magic
|
||||
$session->log->info("BEEP!");
|
||||
if ( $form->get('storageIdPhoto') ) {
|
||||
$session->log->info("BOOP!");
|
||||
my $storage;
|
||||
if ( $self->get('storageIdPhoto') ) {
|
||||
$storage = WebGUI::Storage->get( $session, $self->get('storageIdPhoto') );
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use strict;
|
|||
use Tie::IxHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Utility;
|
||||
use base 'WebGUI::AssetAspect::Installable','WebGUI::Asset::Wobject';
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
|
||||
# To get an installer for your wobject, add the Installable AssetAspect
|
||||
# See WebGUI::AssetAspect::Installable and sbin/installClass.pl for more
|
||||
|
|
@ -36,47 +36,52 @@ sub definition {
|
|||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_Map' );
|
||||
|
||||
my $googleApiKeyUrl = 'http://code.google.com/apis/maps/signup.html';
|
||||
my $googleApiKeyLink
|
||||
= q{<a href="%s" onclick="window.open('%s'); return false;">%s</a>};
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
groupIdAddPoint => {
|
||||
tab => "security",
|
||||
fieldType => "group",
|
||||
label => $i18n->echo("Group to Add Points"),
|
||||
hoverHelp => $i18n->echo("Group that is allowed to add points to the map"),
|
||||
label => $i18n->get("groupIdAddPoint label"),
|
||||
hoverHelp => $i18n->get("groupIdAddPoint description"),
|
||||
defaultValue=> '2', # Registered users
|
||||
},
|
||||
mapApiKey => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Google Maps API Key"),
|
||||
hoverHelp => $i18n->echo("The generated Google Maps API key for this site"),
|
||||
label => $i18n->get("mapApiKey label"),
|
||||
hoverHelp => $i18n->get("mapApiKey description"),
|
||||
defaultValue=> $class->getDefaultApiKey($session),
|
||||
subtext => $i18n->echo(q{<a href="http://code.google.com/apis/maps/signup.html" onclick="window.open('http://code.google.com/apis/maps/signup.html');return false">Get your Google Maps API key</a>}),
|
||||
subtext => sprintf($googleApiKeyLink, ($googleApiKeyUrl)x2, $i18n->get('mapApiKey link') ),
|
||||
},
|
||||
mapHeight => {
|
||||
tab => "display",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Map Height"),
|
||||
hoverHelp => $i18n->echo("The height of the generated map"),
|
||||
label => $i18n->get("mapHeight label"),
|
||||
hoverHelp => $i18n->get("mapHeight description"),
|
||||
defaultValue => '400px',
|
||||
},
|
||||
mapWidth => {
|
||||
tab => "display",
|
||||
fieldType => "text",
|
||||
label => $i18n->echo("Map Width"),
|
||||
hoverHelp => $i18n->echo("The width of the generated map"),
|
||||
label => $i18n->get("mapWidth label"),
|
||||
hoverHelp => $i18n->get("mapWidth description"),
|
||||
defaultValue => '100%',
|
||||
},
|
||||
startLatitude => {
|
||||
tab => "display",
|
||||
fieldType => "float",
|
||||
label => $i18n->echo("Starting Latitude"),
|
||||
hoverHelp => $i18n->echo("Latitude of the default starting point of the map"),
|
||||
label => $i18n->get("startLatitude label"),
|
||||
hoverHelp => $i18n->get("startLatitude description"),
|
||||
defaultValue => 43.074719,
|
||||
},
|
||||
startLongitude => {
|
||||
tab => "display",
|
||||
fieldType => "float",
|
||||
label => $i18n->echo("Starting Longitude"),
|
||||
hoverHelp => $i18n->echo("Longitude of the default starting point of the map"),
|
||||
label => $i18n->get("startLongitude label"),
|
||||
hoverHelp => $i18n->get("startLongitude description"),
|
||||
defaultValue => -89.384251,
|
||||
},
|
||||
startZoom => {
|
||||
|
|
@ -84,35 +89,36 @@ sub definition {
|
|||
fieldType => "intSlider",
|
||||
minimum => 1,
|
||||
maximum => 19,
|
||||
label => $i18n->echo("Starting Zoom Level"),
|
||||
hoverHelp => $i18n->echo("Zoom level of the default starting point of the map"),
|
||||
label => $i18n->get("startZoom label"),
|
||||
hoverHelp => $i18n->get("startZoom description"),
|
||||
},
|
||||
templateIdEditPoint => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
namespace => "MapPoint/Edit",
|
||||
label => $i18n->echo("Template to Edit Map Point"),
|
||||
hoverHelp => $i18n->echo("Template to edit a map point."),
|
||||
label => $i18n->get("templateIdEditPoint label"),
|
||||
hoverHelp => $i18n->get("templateIdEditPoint description"),
|
||||
},
|
||||
templateIdView => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
namespace => "Map/View",
|
||||
label => $i18n->echo("Template to View"),
|
||||
hoverHelp => $i18n->echo("Template to view the map"),
|
||||
label => $i18n->get("templateIdView label"),
|
||||
hoverHelp => $i18n->get("templateIdView description"),
|
||||
},
|
||||
templateIdViewPoint => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
namespace => "MapPoint/View",
|
||||
label => $i18n->echo("Template to View Map Point"),
|
||||
hoverHelp => $i18n->echo("Template to view a map point. Will pop-up a box inside the map."),
|
||||
label => $i18n->get("templateIdViewPoint label"),
|
||||
hoverHelp => $i18n->get("templateIdViewPoint description"),
|
||||
},
|
||||
workflowIdPoint => {
|
||||
tab => "security",
|
||||
fieldType => "workflow",
|
||||
label => $i18n->echo("Workflow for Adding Points"),
|
||||
hoverHelp => $i18n->echo("Commit workflow for adding points"),
|
||||
label => $i18n->get("workflowIdPoint label"),
|
||||
hoverHelp => $i18n->get("workflowIdPoint description"),
|
||||
type => 'WebGUI::VersionTag',
|
||||
},
|
||||
);
|
||||
push @{$definition}, {
|
||||
|
|
@ -211,8 +217,7 @@ sub getDefaultApiKey {
|
|||
my $session = shift;
|
||||
|
||||
# Get the API key used in other Maps on the site
|
||||
eval {
|
||||
# Map may not exist yet!
|
||||
eval { # Map may not exist yet!
|
||||
my $defaultApiKey = $session->db->quickScalar(
|
||||
"SELECT mapApiKey FROM Map LIMIT 1"
|
||||
);
|
||||
|
|
@ -313,7 +318,7 @@ ENDHTML
|
|||
$style->setScript($url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'),{type=>'text/javascript'});
|
||||
$style->setScript($url->extras('yui/build/connection/connection-min.js'),{type=>'text/javascript'});
|
||||
$style->setScript($url->extras('yui/build/json/json-min.js'),{type=>'text/javascript'});
|
||||
$style->setScript($url->extras('map/map.js'),{type=>'text/javascript'});
|
||||
$style->setScript($url->extras('yui-webgui/build/map/map.js'),{type=>'text/javascript'});
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -429,14 +434,14 @@ ENDHTML
|
|||
# Button to add a map point
|
||||
$var->{ button_addPoint }
|
||||
= WebGUI::Form::Button( $session, {
|
||||
value => $i18n->echo("Add Point"),
|
||||
value => $i18n->get("add point label"),
|
||||
id => sprintf( 'addPoint_%s', $self->getId ),
|
||||
} );
|
||||
|
||||
# Button to set the map's default view
|
||||
$var->{ button_setCenter }
|
||||
= WebGUI::Form::Button( $session, {
|
||||
value => $i18n->echo("Set Default Viewing Area"),
|
||||
value => $i18n->get("set default viewing area label"),
|
||||
id => sprintf( 'setCenter_%s', $self->getId ),
|
||||
} );
|
||||
|
||||
|
|
@ -454,14 +459,15 @@ Immediately remove a point from the map.
|
|||
sub www_ajaxDeletePoint {
|
||||
my ( $self ) = @_;
|
||||
my $session = $self->session;
|
||||
my $assetId = $self->session->form->get('assetId');
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_Map' );
|
||||
my $assetId = $session->form->get('assetId');
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return JSON->new->encode({error => 'You are not allowed to remove this point'})
|
||||
$session->http->setMimeType('application/json');
|
||||
return JSON->new->encode({error => $i18n->get('error delete unauthorized')})
|
||||
unless $asset && $asset->canEdit;
|
||||
|
||||
$asset->purge;
|
||||
return JSON->new->encode({message => 'Point deleted'});
|
||||
return JSON->new->encode({message => $i18n->get('message delete success')});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -489,6 +495,7 @@ sub www_ajaxEditPoint {
|
|||
|
||||
my $output = $self->getEditPointTemplate->process( $asset->getTemplateVarsEditForm );
|
||||
WebGUI::Macro::process( $session, \$output );
|
||||
$session->log->preventDebugOutput;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -504,13 +511,15 @@ sub www_ajaxEditPointSave {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_Map' );
|
||||
|
||||
$session->http->setMimeType("text/html");
|
||||
$session->http->setMimeType("text/html");
|
||||
$session->log->preventDebugOutput;
|
||||
|
||||
my $assetId = $form->get('assetId');
|
||||
my $asset;
|
||||
if ( $assetId eq "new" ) {
|
||||
return JSON->new->encode({message => "Error"})
|
||||
return JSON->new->encode({message => $i18n->get("error add unauthorized")})
|
||||
unless $self->canAddPoint;
|
||||
|
||||
$asset = $self->addChild( {
|
||||
|
|
@ -519,12 +528,18 @@ sub www_ajaxEditPointSave {
|
|||
}
|
||||
else {
|
||||
$asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
return JSON->new->encode({message => "Error"})
|
||||
return JSON->new->encode({message => $i18n->get("error edit unauthorized")})
|
||||
unless $asset && $asset->canEdit;
|
||||
$asset = $asset->addRevision;
|
||||
}
|
||||
|
||||
my $errors = $asset->processAjaxEditForm;
|
||||
|
||||
# Commit!
|
||||
if ($asset->getAutoCommitWorkflowId && $self->hasBeenCommitted) {
|
||||
$asset->requestAutoCommit;
|
||||
}
|
||||
|
||||
return JSON->new->encode($asset->getMapInfo);
|
||||
}
|
||||
|
||||
|
|
@ -544,7 +559,7 @@ sub www_ajaxSetCenter {
|
|||
|
||||
$session->http->setMimeType("application/json");
|
||||
|
||||
return JSON->new->encode({message => $i18n->echo("No permissions")})
|
||||
return JSON->new->encode({message => $i18n->get("error set center unauthorized")})
|
||||
unless $self->canEdit;
|
||||
|
||||
$self->update({
|
||||
|
|
@ -553,7 +568,7 @@ sub www_ajaxSetCenter {
|
|||
startZoom => $form->get("startZoom"),
|
||||
});
|
||||
|
||||
return JSON->new->encode({message => $i18n->echo("Success!")});
|
||||
return JSON->new->encode({message => $i18n->get("message set center success")});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -574,12 +589,14 @@ sub www_ajaxSetPointLocation {
|
|||
|
||||
my $assetId = $form->get('assetId');
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
return JSON->new->encode({message => $i18n->get("error edit unauthorized")})
|
||||
unless $asset && $asset->canEdit;
|
||||
$asset->update( {
|
||||
latitude => $form->get('latitude'),
|
||||
longitude => $form->get('longitude'),
|
||||
} );
|
||||
|
||||
return JSON->new->encode( {message => $i18n->echo("Success!")} );
|
||||
return JSON->new->encode( {message => $i18n->get("message set point location")} );
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ sub canShowDebug {
|
|||
##This check prevents in infinite loop during startup.
|
||||
return 0 unless ($self->session->hasSettings);
|
||||
|
||||
# Allow programmers to stop debugging output for certain requests
|
||||
return 0 if $self->{_preventDebugOutput};
|
||||
|
||||
my $canShow = $self->session->setting->get("showDebug")
|
||||
&& $self->canShowBasedOnIP('debugIp');
|
||||
$self->{_canShowDebug} = $canShow;
|
||||
|
|
@ -325,6 +328,22 @@ sub new {
|
|||
bless {_queryCount=>0, _logger=>$logger, _session=>$session}, $class;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 preventDebugOutput ( )
|
||||
|
||||
Prevent this session from sending debugging output even if we're supposed to.
|
||||
|
||||
Some times we need to use 'text/html' to send non-html content (these may be
|
||||
browser limitations, but we need to work with them).
|
||||
|
||||
=cut
|
||||
|
||||
sub preventDebugOutput {
|
||||
my ( $self ) = @_;
|
||||
$self->{_preventDebugOutput} = 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 query ( sql )
|
||||
|
|
|
|||
|
|
@ -3,6 +3,166 @@ package WebGUI::i18n::English::Asset_Map;
|
|||
use strict;
|
||||
|
||||
our $I18N = {
|
||||
'groupIdAddPoint label' => {
|
||||
message => 'Group to Add Points',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'groupIdAddPoint description' => {
|
||||
message => 'Group that is allowed to add points to the map',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'mapApiKey label' => {
|
||||
message => "Google Maps API Key",
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'mapApiKey description' => {
|
||||
message => 'The generated Google Maps API key for this site',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'mapApiKey link' => {
|
||||
message => 'Get your Google Maps API key',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for link to create a Google Maps API key',
|
||||
},
|
||||
'mapHeight label' => {
|
||||
message => 'Map Height',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'mapHeight description' => {
|
||||
message => 'The height of the generated map. Make sure to include the units (px = pixels or % = percent).',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'mapWidth label' => {
|
||||
message => 'Map Width',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'mapWidth description' => {
|
||||
message => 'The width of the generated map. Make sure to include the units (px = pixels or % = percent).',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'startLatitude label' => {
|
||||
message => 'Starting Latitude',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'startLatitude description' => {
|
||||
message => 'Latitude of the default starting point of the map.',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'startLongitude label' => {
|
||||
message => 'Starting Longitude',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'startLongitude description' => {
|
||||
message => 'Longitude of the default starting point of the map',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'startZoom label' => {
|
||||
message => 'Starting Zoom Level',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'startZoom description' => {
|
||||
message => 'Zoom level of the default starting point of the map',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'templateIdEditPoint label' => {
|
||||
message => 'Template to Edit Point',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'templateIdEditPoint description' => {
|
||||
message => 'Template to edit a map point. Will appear inside of the map.',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'templateIdView label' => {
|
||||
message => 'Template to View Map',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'templateIdView description' => {
|
||||
message => 'Template to view the map.',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'templateIdViewPoint label' => {
|
||||
message => 'Template to View Point',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'templateIdViewPoint description' => {
|
||||
message => 'Template to view a map point. Will appear inside the map.',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'workflowIdPoint label' => {
|
||||
message => 'Workflow to Commit Map Points',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'workflowIdPoint description' => {
|
||||
message => 'The workflow that will be run when a map point is added or edited.',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'add point label' => {
|
||||
message => "Add Point",
|
||||
lastUpdated => 0,
|
||||
context => 'Label for button to add point',
|
||||
},
|
||||
'set default viewing area label' => {
|
||||
message => 'Set Default Viewing Area',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for button to set starting latitude, longitude, and zoom level',
|
||||
},
|
||||
'error delete unauthorized' => {
|
||||
message => 'You are not allowed to remove this point',
|
||||
lastUpdated => 0,
|
||||
context => 'Error message for user not allowed to remove a point',
|
||||
},
|
||||
'message delete success' => {
|
||||
message => 'Point deleted',
|
||||
lastUpdated => 0,
|
||||
context => 'Message when point deleted successfully',
|
||||
},
|
||||
'error add unauthorized' => {
|
||||
message => 'You are not allowed to add points',
|
||||
lastUpdated => 0,
|
||||
context => 'Error for user not allowed to add a point',
|
||||
},
|
||||
'error edit unauthorized' => {
|
||||
message => 'You are not allowed to edit this point',
|
||||
lastUpdated => 0,
|
||||
context => 'Error for user not allowed to edit a point',
|
||||
},
|
||||
'error set center unauthorized' => {
|
||||
message => 'You are not allowed to set the default viewing area',
|
||||
lastUpdated => 0,
|
||||
context => 'Error message',
|
||||
},
|
||||
'message set center success' => {
|
||||
message => 'Default viewing area set successfully',
|
||||
lastUpdated => 0,
|
||||
context => "Success message",
|
||||
},
|
||||
'message set point location' => {
|
||||
message => 'Point location saved',
|
||||
lastUpdated => 0,
|
||||
context => 'Success message',
|
||||
},
|
||||
'assetName' => {
|
||||
message => "Map",
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,136 @@ package WebGUI::i18n::English::Asset_MapPoint;
|
|||
use strict;
|
||||
|
||||
our $I18N = {
|
||||
|
||||
'latitude label' => {
|
||||
message => 'Latitude',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'latitude description' => {
|
||||
message => 'The latitude of the point',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'longitude label' => {
|
||||
message => 'Longitude',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'longitude description' => {
|
||||
message => 'The longitude of the point',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'website label' => {
|
||||
message => 'Website URL',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'website description' => {
|
||||
message => 'A website URL',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'address1 label' => {
|
||||
message => 'Address 1',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'address1 description' => {
|
||||
message => 'The first line of the address',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'address2 label' => {
|
||||
message => 'Address 2',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'address2 description' => {
|
||||
message => 'The second line of the address',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'city label' => {
|
||||
message => 'City',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'city description' => {
|
||||
message => 'The city the point is in',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'state label' => {
|
||||
message => 'State/Province',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'state description' => {
|
||||
message => 'The state/province the point is in',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'zipCode label' => {
|
||||
message => 'Zip/Postal Code',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'zipCode description' => {
|
||||
message => 'The zip/postal code the point is in',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'country label' => {
|
||||
message => 'Country',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'country description' => {
|
||||
message => 'The country the point is in',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'phone label' => {
|
||||
message => 'Phone',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'phone description' => {
|
||||
message => 'The phone number of the location',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'fax label' => {
|
||||
message => 'Fax',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'fax description' => {
|
||||
message => 'The fax number of the location',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'email label' => {
|
||||
message => 'E-mail',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'email description' => {
|
||||
message => 'The e-mail address of the location',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'storageIdPhoto label' => {
|
||||
message => 'Photo',
|
||||
lastUpdated => 0,
|
||||
context => 'Label for asset property',
|
||||
},
|
||||
'storageIdPhoto description' => {
|
||||
message => 'A photo of the location',
|
||||
lastUpdated => 0,
|
||||
context => 'Description of asset property',
|
||||
},
|
||||
'assetName' => {
|
||||
message => "MapPoint",
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// Initialize namespace
|
||||
if (typeof WebGUI == "undefined") {
|
||||
var WebGUI = {};
|
||||
|
|
@ -53,6 +52,7 @@ WebGUI.Map.editPoint
|
|||
// Callback should open the window with the form
|
||||
var callback = function (text, code) {
|
||||
marker.openInfoWindowHtml( text );
|
||||
|
||||
GEvent.addListener( marker, "infowindowbeforeclose", function () {
|
||||
WebGUI.Map.editPointSave( map, mgr, mapUrl, marker );
|
||||
});
|
||||
|
|
@ -71,26 +71,40 @@ WebGUI.Map.editPointSave
|
|||
var iwin = map.getInfoWindow();
|
||||
var form = iwin.getContentContainers()[0].getElementsByTagName('form')[0];
|
||||
|
||||
// Add the lat/long to the form
|
||||
var lat = marker.getLatLng().lat();
|
||||
var lng = marker.getLatLng().lng();
|
||||
form.elements['latitude'].value = lat;
|
||||
form.elements['longitude'].value = lng;
|
||||
|
||||
// Make ajax request
|
||||
var callback = {
|
||||
upload: function (o) {
|
||||
// Update marker info
|
||||
console.log(o.responseText);
|
||||
var point = YAHOO.lang.JSON.parse( o.responseText );
|
||||
marker.assetId = point.assetId;
|
||||
GEvent.clearListeners( marker, "click" );
|
||||
GEvent.clearListeners( marker, "infowindowbeforeclose" );
|
||||
|
||||
// Set the marker's title
|
||||
marker.kh.title = point.title;
|
||||
// I hate the google maps API.
|
||||
|
||||
var infoWin = document.createElement( "div" );
|
||||
infoWin.innerHTML = point.content;
|
||||
marker.infoWin = infoWin;
|
||||
|
||||
if ( point.canEdit ) {
|
||||
var divButton = document.createElement('div');
|
||||
infoWin.appendChild( divButton );
|
||||
|
||||
var editButton = document.createElement("input");
|
||||
editButton.type = "button";
|
||||
editButton.value = "Edit";
|
||||
GEvent.addDomListener( editButton, "click", function () {
|
||||
WebGUI.Map.editPoint( map, mgr, mapUrl, marker );
|
||||
} );
|
||||
infoWin.appendChild( editButton );
|
||||
divButton.appendChild( editButton );
|
||||
|
||||
var deleteButton = document.createElement("input");
|
||||
deleteButton.type = "button";
|
||||
|
|
@ -103,14 +117,9 @@ WebGUI.Map.editPointSave
|
|||
divButton.appendChild( deleteButton );
|
||||
}
|
||||
marker.bindInfoWindow( infoWin );
|
||||
|
||||
// Make sure the point has a Lat/Lng in case the user doesn't
|
||||
// move it after initially creating it.
|
||||
if ( marker.assetId == "new" ) {
|
||||
marker.assetId = point.assetId;
|
||||
WebGUI.Map.setPointLocation( marker, marker.getLatLng(), mapUrl );
|
||||
}
|
||||
marker.assetId = point.assetId;
|
||||
GEvent.addListener( marker, "dragend", function (latlng) {
|
||||
WebGUI.Map.setPointLocation( marker, latlng, mapUrl );
|
||||
} );
|
||||
}
|
||||
};
|
||||
// In case our form does not have a file upload in it
|
||||
|
|
@ -127,10 +136,10 @@ WebGUI.Map.editPointSave
|
|||
WebGUI.Map.focusOn
|
||||
= function ( assetId ) {
|
||||
var marker = WebGUI.Map.markers[assetId];
|
||||
var map = marker.map;
|
||||
var infoWin = marker.infoWin;
|
||||
var map = marker.map;
|
||||
var infoWin = marker.infoWin;
|
||||
if ( map.getZoom() < 5 ) {
|
||||
map.setZoom(6);
|
||||
map.setZoom(6);
|
||||
}
|
||||
map.panTo( marker.getLatLng() );
|
||||
marker.openInfoWindow( marker.infoWin );
|
||||
Loading…
Add table
Add a link
Reference in a new issue