Updating Map and MapPoint for Moose.
This commit is contained in:
parent
20aff04633
commit
213458d19c
2 changed files with 198 additions and 213 deletions
|
|
@ -16,12 +16,113 @@ package WebGUI::Asset::MapPoint;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Tie::IxHash;
|
use Tie::IxHash;
|
||||||
use base 'WebGUI::Asset';
|
use WebGUI::Definition::Asset;
|
||||||
use WebGUI::Utility;
|
extends 'WebGUI::Asset';
|
||||||
|
aspect assetName => ['assetName', 'Asset_MapPoint'];
|
||||||
|
aspect icon => 'MapPoint.gif';
|
||||||
|
aspect tableName => 'MapPoint';
|
||||||
|
property latitude => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "float",
|
||||||
|
label => ["latitude label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["latitude description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property longitude => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "float",
|
||||||
|
label => ["longitude label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["longitude description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property website => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "text",
|
||||||
|
label => ["website label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["website description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property address1 => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "text",
|
||||||
|
label => ["address1 label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["address1 description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property address2 => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "text",
|
||||||
|
label => ["address2 label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["address2 description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property city => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "text",
|
||||||
|
label => ["city label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["city description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property state => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "text",
|
||||||
|
label => ["state label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["state description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property zipCode => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "text",
|
||||||
|
label => ["zipCode label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["zipCode description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property country => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "country",
|
||||||
|
label => ["country label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["country description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property phone => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "phone",
|
||||||
|
label => ["phone label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["phone description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property fax => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "phone",
|
||||||
|
label => ["fax label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["fax description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property email => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "email",
|
||||||
|
label => ["email label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["email description", 'Asset_MapPoint'],
|
||||||
|
);
|
||||||
|
property storageIdPhoto => (
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "image",
|
||||||
|
forceImageOnly => 1,
|
||||||
|
label => ["storageIdPhoto label", 'Asset_MapPoint'],
|
||||||
|
hoverHelp => ["storageIdPhoto description", 'Asset_MapPoint'],
|
||||||
|
noFormPost => 1,
|
||||||
|
);
|
||||||
|
property userDefined1 => (
|
||||||
|
fieldType => "hidden",
|
||||||
|
noFormPost => 1,
|
||||||
|
);
|
||||||
|
property userDefined2 => (
|
||||||
|
fieldType => "hidden",
|
||||||
|
noFormPost => 1,
|
||||||
|
);
|
||||||
|
property userDefined3 => (
|
||||||
|
fieldType => "hidden",
|
||||||
|
noFormPost => 1,
|
||||||
|
);
|
||||||
|
property userDefined4 => (
|
||||||
|
fieldType => "hidden",
|
||||||
|
noFormPost => 1,
|
||||||
|
);
|
||||||
|
property userDefined5 => (
|
||||||
|
fieldType => "hidden",
|
||||||
|
noFormPost => 1,
|
||||||
|
);
|
||||||
|
|
||||||
# To get an installer for your wobject, add the Installable AssetAspect
|
use WebGUI::Utility;
|
||||||
# See WebGUI::AssetAspect::Installable and sbin/installClass.pl for more
|
|
||||||
# details
|
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -63,107 +164,8 @@ sub definition {
|
||||||
my $definition = shift;
|
my $definition = shift;
|
||||||
my $i18n = WebGUI::International->new( $session, "Asset_MapPoint" );
|
my $i18n = WebGUI::International->new( $session, "Asset_MapPoint" );
|
||||||
tie my %properties, 'Tie::IxHash', (
|
tie my %properties, 'Tie::IxHash', (
|
||||||
latitude => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "float",
|
|
||||||
label => $i18n->get("latitude label"),
|
|
||||||
hoverHelp => $i18n->get("latitude description"),
|
|
||||||
},
|
|
||||||
longitude => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "float",
|
|
||||||
label => $i18n->get("longitude label"),
|
|
||||||
hoverHelp => $i18n->get("longitude description"),
|
|
||||||
},
|
|
||||||
website => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("website label"),
|
|
||||||
hoverHelp => $i18n->get("website description"),
|
|
||||||
},
|
|
||||||
address1 => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("address1 label"),
|
|
||||||
hoverHelp => $i18n->get("address1 description"),
|
|
||||||
},
|
|
||||||
address2 => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("address2 label"),
|
|
||||||
hoverHelp => $i18n->get("address2 description"),
|
|
||||||
},
|
|
||||||
city => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("city label"),
|
|
||||||
hoverHelp => $i18n->get("city description"),
|
|
||||||
},
|
|
||||||
state => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("state label"),
|
|
||||||
hoverHelp => $i18n->get("state description"),
|
|
||||||
},
|
|
||||||
zipCode => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("zipCode label"),
|
|
||||||
hoverHelp => $i18n->get("zipCode description"),
|
|
||||||
},
|
|
||||||
country => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "country",
|
|
||||||
label => $i18n->get("country label"),
|
|
||||||
hoverHelp => $i18n->get("country description"),
|
|
||||||
},
|
|
||||||
phone => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "phone",
|
|
||||||
label => $i18n->get("phone label"),
|
|
||||||
hoverHelp => $i18n->get("phone description"),
|
|
||||||
},
|
|
||||||
fax => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "phone",
|
|
||||||
label => $i18n->get("fax label"),
|
|
||||||
hoverHelp => $i18n->get("fax description"),
|
|
||||||
},
|
|
||||||
email => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "email",
|
|
||||||
label => $i18n->get("email label"),
|
|
||||||
hoverHelp => $i18n->get("email description"),
|
|
||||||
},
|
|
||||||
storageIdPhoto => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "image",
|
|
||||||
forceImageOnly => 1,
|
|
||||||
label => $i18n->get("storageIdPhoto label"),
|
|
||||||
hoverHelp => $i18n->get("storageIdPhoto description"),
|
|
||||||
noFormPost => 1,
|
|
||||||
},
|
|
||||||
userDefined1 => {
|
|
||||||
fieldType => "hidden",
|
|
||||||
},
|
|
||||||
userDefined2 => {
|
|
||||||
fieldType => "hidden",
|
|
||||||
},
|
|
||||||
userDefined3 => {
|
|
||||||
fieldType => "hidden",
|
|
||||||
},
|
|
||||||
userDefined4 => {
|
|
||||||
fieldType => "hidden",
|
|
||||||
},
|
|
||||||
userDefined5 => {
|
|
||||||
fieldType => "hidden",
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
push @{$definition}, {
|
push @{$definition}, {
|
||||||
assetName => $i18n->get('assetName'),
|
|
||||||
icon => 'MapPoint.gif',
|
|
||||||
autoGenerateForms => 1,
|
|
||||||
tableName => 'MapPoint',
|
|
||||||
className => 'WebGUI::Asset::MapPoint',
|
className => 'WebGUI::Asset::MapPoint',
|
||||||
properties => \%properties,
|
properties => \%properties,
|
||||||
};
|
};
|
||||||
|
|
@ -182,7 +184,7 @@ group to edit the parent Map are allowed to edit MapPoint.
|
||||||
sub canEdit {
|
sub canEdit {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $userId = shift || $self->session->user->userId;
|
my $userId = shift || $self->session->user->userId;
|
||||||
return 1 if $userId eq $self->get('ownerUserId');
|
return 1 if $userId eq $self->ownerUserId;
|
||||||
return $self->SUPER::canEdit( $userId );
|
return $self->SUPER::canEdit( $userId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,7 +198,7 @@ Get the workflowId to commit this MapPoint
|
||||||
|
|
||||||
sub getAutoCommitWorkflowId {
|
sub getAutoCommitWorkflowId {
|
||||||
my ( $self ) = @_;
|
my ( $self ) = @_;
|
||||||
return $self->getParent->get('workflowIdPoint');
|
return $self->getParent->workflowIdPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -229,7 +231,7 @@ sub getMapInfo {
|
||||||
$var->{ assetId } = $self->getId;
|
$var->{ assetId } = $self->getId;
|
||||||
my @keys = qw( latitude longitude title );
|
my @keys = qw( latitude longitude title );
|
||||||
for my $key ( @keys ) {
|
for my $key ( @keys ) {
|
||||||
$var->{ $key } = $self->get( $key );
|
$var->{ $key } = $self->$key;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get permissions
|
# Get permissions
|
||||||
|
|
@ -287,11 +289,11 @@ sub getTemplateVarsEditForm {
|
||||||
} )
|
} )
|
||||||
. WebGUI::Form::hidden( $session, {
|
. WebGUI::Form::hidden( $session, {
|
||||||
name => 'latitude',
|
name => 'latitude',
|
||||||
value => $self->get('latitude'),
|
value => $self->latitude,
|
||||||
} )
|
} )
|
||||||
. WebGUI::Form::hidden( $session, {
|
. WebGUI::Form::hidden( $session, {
|
||||||
name => 'longitude',
|
name => 'longitude',
|
||||||
value => $self->get('longitude'),
|
value => $self->longitude,
|
||||||
} )
|
} )
|
||||||
;
|
;
|
||||||
$var->{ form_footer } = WebGUI::Form::formFooter( $session );
|
$var->{ form_footer } = WebGUI::Form::formFooter( $session );
|
||||||
|
|
@ -314,20 +316,20 @@ sub getTemplateVarsEditForm {
|
||||||
$var->{ "form_title" }
|
$var->{ "form_title" }
|
||||||
= WebGUI::Form::text( $session, {
|
= WebGUI::Form::text( $session, {
|
||||||
name => "title",
|
name => "title",
|
||||||
value => $self->get("title"),
|
value => $self->title,
|
||||||
} );
|
} );
|
||||||
$var->{ "form_synopsis" }
|
$var->{ "form_synopsis" }
|
||||||
= WebGUI::Form::textarea( $session, {
|
= WebGUI::Form::textarea( $session, {
|
||||||
name => "synopsis",
|
name => "synopsis",
|
||||||
value => $self->get("synopsis"),
|
value => $self->synopsis,
|
||||||
resizable => 0,
|
resizable => 0,
|
||||||
} );
|
} );
|
||||||
|
|
||||||
# Fix storageIdPhoto because scripts do not get executed in ajax requests
|
# Fix storageIdPhoto because scripts do not get executed in ajax requests
|
||||||
$var->{ "form_storageIdPhoto" }
|
$var->{ "form_storageIdPhoto" }
|
||||||
= '<input type="file" name="storageIdPhoto" />';
|
= '<input type="file" name="storageIdPhoto" />';
|
||||||
if ( $self->get('storageIdPhoto') ) {
|
if ( $self->storageIdPhoto ) {
|
||||||
my $storage = WebGUI::Storage->get( $self->session, $self->get('storageIdPhoto') );
|
my $storage = WebGUI::Storage->get( $self->session, $self->storageIdPhoto );
|
||||||
$var->{ "currentPhoto" }
|
$var->{ "currentPhoto" }
|
||||||
= sprintf '<img src="%s" />', $storage->getUrl($storage->getFiles->[0]);
|
= sprintf '<img src="%s" />', $storage->getUrl($storage->getFiles->[0]);
|
||||||
}
|
}
|
||||||
|
|
@ -371,8 +373,8 @@ sub processAjaxEditForm {
|
||||||
# Photo magic
|
# Photo magic
|
||||||
if ( $form->get('storageIdPhoto') ) {
|
if ( $form->get('storageIdPhoto') ) {
|
||||||
my $storage;
|
my $storage;
|
||||||
if ( $self->get('storageIdPhoto') ) {
|
if ( $self->storageIdPhoto ) {
|
||||||
$storage = WebGUI::Storage->get( $session, $self->get('storageIdPhoto') );
|
$storage = WebGUI::Storage->get( $session, $self->storageIdPhoto );
|
||||||
$storage->deleteFile( $storage->getFiles->[0] );
|
$storage->deleteFile( $storage->getFiles->[0] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -17,121 +17,104 @@ use Tie::IxHash;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use HTML::Entities qw(encode_entities);
|
use HTML::Entities qw(encode_entities);
|
||||||
use base 'WebGUI::Asset::Wobject';
|
use WebGUI::Definition::Asset;
|
||||||
|
extends 'WebGUI::Asset::Wobject';
|
||||||
# To get an installer for your wobject, add the Installable AssetAspect
|
aspect assetName => ['assetName', 'Asset_Map'];
|
||||||
# See WebGUI::AssetAspect::Installable and sbin/installClass.pl for more
|
aspect icon => 'maps.png';
|
||||||
# details
|
aspect tableName => 'Map';
|
||||||
|
property groupIdAddPoint => (
|
||||||
#-------------------------------------------------------------------
|
tab => "security",
|
||||||
|
fieldType => "group",
|
||||||
=head2 definition ( )
|
label => ["groupIdAddPoint label", 'Asset_Map'],
|
||||||
|
hoverHelp => ["groupIdAddPoint description", 'Asset_Map'],
|
||||||
Define asset properties
|
default => '2', # Registered users
|
||||||
|
);
|
||||||
=cut
|
property mapApiKey => (
|
||||||
|
tab => "properties",
|
||||||
sub definition {
|
fieldType => "text",
|
||||||
my $class = shift;
|
label => ["mapApiKey label", 'Asset_Map'],
|
||||||
my $session = shift;
|
hoverHelp => ["mapApiKey description", 'Asset_Map'],
|
||||||
my $definition = shift;
|
builder => '_mapApiKey_builder',
|
||||||
my $i18n = WebGUI::International->new( $session, 'Asset_Map' );
|
lazy => 1,
|
||||||
|
subtext =>
|
||||||
|
);
|
||||||
|
sub _mapApiKey_builder {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->getDefaultApiKey($self->session);
|
||||||
|
}
|
||||||
|
sub _mapApiKey_subtext {
|
||||||
|
my $self = shift;
|
||||||
|
my $session = $self->session;
|
||||||
|
my $i18n = WebGUI::International->new($session, 'Asset_Map');
|
||||||
my $googleApiKeyUrl = 'http://code.google.com/apis/maps/signup.html';
|
my $googleApiKeyUrl = 'http://code.google.com/apis/maps/signup.html';
|
||||||
my $googleApiKeyLink
|
my $googleApiKeyLink
|
||||||
= q{<a href="%s" onclick="window.open('%s'); return false;">%s</a>};
|
= q{<a href="%s" onclick="window.open('%s'); return false;">%s</a>};
|
||||||
|
return sprintf($googleApiKeyLink, ($googleApiKeyUrl)x2, $i18n->get('mapApiKey link') );
|
||||||
tie my %properties, 'Tie::IxHash', (
|
}
|
||||||
groupIdAddPoint => {
|
property mapHeight => (
|
||||||
tab => "security",
|
|
||||||
fieldType => "group",
|
|
||||||
label => $i18n->get("groupIdAddPoint label"),
|
|
||||||
hoverHelp => $i18n->get("groupIdAddPoint description"),
|
|
||||||
defaultValue=> '2', # Registered users
|
|
||||||
},
|
|
||||||
mapApiKey => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "text",
|
|
||||||
label => $i18n->get("mapApiKey label"),
|
|
||||||
hoverHelp => $i18n->get("mapApiKey description"),
|
|
||||||
defaultValue=> $class->getDefaultApiKey($session),
|
|
||||||
subtext => sprintf($googleApiKeyLink, ($googleApiKeyUrl)x2, $i18n->get('mapApiKey link') ),
|
|
||||||
},
|
|
||||||
mapHeight => {
|
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "text",
|
fieldType => "text",
|
||||||
label => $i18n->get("mapHeight label"),
|
label => ["mapHeight label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("mapHeight description"),
|
hoverHelp => ["mapHeight description", 'Asset_Map'],
|
||||||
defaultValue => '400px',
|
default => '400px',
|
||||||
},
|
);
|
||||||
mapWidth => {
|
property mapWidth => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "text",
|
fieldType => "text",
|
||||||
label => $i18n->get("mapWidth label"),
|
label => ["mapWidth label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("mapWidth description"),
|
hoverHelp => ["mapWidth description", 'Asset_Map'],
|
||||||
defaultValue => '100%',
|
default => '100%',
|
||||||
},
|
);
|
||||||
startLatitude => {
|
property startLatitude => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "float",
|
fieldType => "float",
|
||||||
label => $i18n->get("startLatitude label"),
|
label => ["startLatitude label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("startLatitude description"),
|
hoverHelp => ["startLatitude description", 'Asset_Map'],
|
||||||
defaultValue => 43.074719,
|
default => 43.074719,
|
||||||
},
|
);
|
||||||
startLongitude => {
|
property startLongitude => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "float",
|
fieldType => "float",
|
||||||
label => $i18n->get("startLongitude label"),
|
label => ["startLongitude label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("startLongitude description"),
|
hoverHelp => ["startLongitude description", 'Asset_Map'],
|
||||||
defaultValue => -89.384251,
|
default => -89.384251,
|
||||||
},
|
);
|
||||||
startZoom => {
|
property startZoom => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "intSlider",
|
fieldType => "intSlider",
|
||||||
minimum => 1,
|
minimum => 1,
|
||||||
maximum => 19,
|
maximum => 19,
|
||||||
label => $i18n->get("startZoom label"),
|
label => ["startZoom label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("startZoom description"),
|
hoverHelp => ["startZoom description", 'Asset_Map'],
|
||||||
},
|
);
|
||||||
templateIdEditPoint => {
|
property templateIdEditPoint => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "template",
|
fieldType => "template",
|
||||||
namespace => "MapPoint/Edit",
|
namespace => "MapPoint/Edit",
|
||||||
label => $i18n->get("templateIdEditPoint label"),
|
label => ["templateIdEditPoint label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("templateIdEditPoint description"),
|
hoverHelp => ["templateIdEditPoint description", 'Asset_Map'],
|
||||||
},
|
);
|
||||||
templateIdView => {
|
property templateIdView => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "template",
|
fieldType => "template",
|
||||||
namespace => "Map/View",
|
namespace => "Map/View",
|
||||||
label => $i18n->get("templateIdView label"),
|
label => ["templateIdView label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("templateIdView description"),
|
hoverHelp => ["templateIdView description", 'Asset_Map'],
|
||||||
},
|
);
|
||||||
templateIdViewPoint => {
|
property templateIdViewPoint => (
|
||||||
tab => "display",
|
tab => "display",
|
||||||
fieldType => "template",
|
fieldType => "template",
|
||||||
namespace => "MapPoint/View",
|
namespace => "MapPoint/View",
|
||||||
label => $i18n->get("templateIdViewPoint label"),
|
label => ["templateIdViewPoint label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("templateIdViewPoint description"),
|
hoverHelp => ["templateIdViewPoint description", 'Asset_Map'],
|
||||||
},
|
);
|
||||||
workflowIdPoint => {
|
property workflowIdPoint => (
|
||||||
tab => "security",
|
tab => "security",
|
||||||
fieldType => "workflow",
|
fieldType => "workflow",
|
||||||
label => $i18n->get("workflowIdPoint label"),
|
label => ["workflowIdPoint label", 'Asset_Map'],
|
||||||
hoverHelp => $i18n->get("workflowIdPoint description"),
|
hoverHelp => ["workflowIdPoint description", 'Asset_Map'],
|
||||||
type => 'WebGUI::VersionTag',
|
type => 'WebGUI::VersionTag',
|
||||||
},
|
);
|
||||||
);
|
|
||||||
push @{$definition}, {
|
|
||||||
assetName => $i18n->get('assetName'),
|
|
||||||
icon => 'maps.png',
|
|
||||||
autoGenerateForms => 1,
|
|
||||||
tableName => 'Map',
|
|
||||||
className => 'WebGUI::Asset::Wobject::Map',
|
|
||||||
properties => \%properties
|
|
||||||
};
|
|
||||||
return $class->SUPER::definition( $session, $definition );
|
|
||||||
} ## end sub definition
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -150,7 +133,7 @@ sub canAddPoint {
|
||||||
: $self->session->user
|
: $self->session->user
|
||||||
;
|
;
|
||||||
|
|
||||||
return $user->isInGroup( $self->get("groupIdAddPoint") );
|
return $user->isInGroup( $self->groupIdAddPoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -185,7 +168,7 @@ sub canEdit {
|
||||||
: $self->session->user
|
: $self->session->user
|
||||||
;
|
;
|
||||||
|
|
||||||
return $user->isInGroup( $self->get("groupIdEdit") );
|
return $user->isInGroup( $self->groupIdEdit );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,7 +223,7 @@ sub getEditPointTemplate {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
if ( !$self->{_editPointTemplate} ) {
|
if ( !$self->{_editPointTemplate} ) {
|
||||||
my $templateId = $self->get('templateIdEditPoint');
|
my $templateId = $self->templateIdEditPoint;
|
||||||
my $template
|
my $template
|
||||||
= WebGUI::Asset::Template->new( $self->session, $templateId );
|
= WebGUI::Asset::Template->new( $self->session, $templateId );
|
||||||
$template->prepare;
|
$template->prepare;
|
||||||
|
|
@ -263,7 +246,7 @@ sub getViewPointTemplate {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
if ( !$self->{_viewPointTemplate} ) {
|
if ( !$self->{_viewPointTemplate} ) {
|
||||||
my $templateId = $self->get('templateIdViewPoint');
|
my $templateId = $self->templateIdViewPoint;
|
||||||
my $template
|
my $template
|
||||||
= WebGUI::Asset::Template->new( $self->session, $templateId );
|
= WebGUI::Asset::Template->new( $self->session, $templateId );
|
||||||
$self->{_viewPointTemplate} = $template;
|
$self->{_viewPointTemplate} = $template;
|
||||||
|
|
@ -309,7 +292,7 @@ sub loadMapApiTags {
|
||||||
my $style = $self->session->style;
|
my $style = $self->session->style;
|
||||||
my $url = $self->session->url;
|
my $url = $self->session->url;
|
||||||
|
|
||||||
$style->setScript("http://www.google.com/jsapi?key=" . $self->get('mapApiKey'),{type=>"text/javascript"});
|
$style->setScript("http://www.google.com/jsapi?key=" . $self->mapApiKey,{type=>"text/javascript"});
|
||||||
$style->setRawHeadTags(<<'ENDHTML');
|
$style->setRawHeadTags(<<'ENDHTML');
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
google.load("maps", "2", { "other_params" : "sensor=false" });
|
google.load("maps", "2", { "other_params" : "sensor=false" });
|
||||||
|
|
@ -335,11 +318,11 @@ See WebGUI::Asset::prepareView() for details.
|
||||||
sub prepareView {
|
sub prepareView {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->SUPER::prepareView();
|
$self->SUPER::prepareView();
|
||||||
my $template = WebGUI::Asset::Template->new( $self->session, $self->get("templateIdView") );
|
my $template = WebGUI::Asset::Template->new( $self->session, $self->templateIdView );
|
||||||
if (!$template) {
|
if (!$template) {
|
||||||
WebGUI::Error::ObjectNotFound::Template->throw(
|
WebGUI::Error::ObjectNotFound::Template->throw(
|
||||||
error => qq{Template not found},
|
error => qq{Template not found},
|
||||||
templateId => $self->get("templateIdView"),
|
templateId => $self->templateIdView,
|
||||||
assetId => $self->getId,
|
assetId => $self->getId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -368,12 +351,12 @@ sub view {
|
||||||
# Build the map container
|
# Build the map container
|
||||||
my $mapHtml = sprintf '<div id="map_%s" style="height: %s; width: %s"></div>',
|
my $mapHtml = sprintf '<div id="map_%s" style="height: %s; width: %s"></div>',
|
||||||
$self->getId,
|
$self->getId,
|
||||||
$self->get('mapHeight'),
|
$self->mapHeight,
|
||||||
$self->get('mapWidth'),
|
$self->mapWidth,
|
||||||
;
|
;
|
||||||
|
|
||||||
# The script to load the map into the container
|
# The script to load the map into the container
|
||||||
$mapHtml .= sprintf <<'ENDHTML', $self->getId, $self->getUrl, $self->get('startLatitude'), $self->get('startLongitude'), $self->get('startZoom');
|
$mapHtml .= sprintf <<'ENDHTML', $self->getId, $self->getUrl, $self->startLatitude, $self->startLongitude, $self->startZoom;
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
google.setOnLoadCallback( function() {
|
google.setOnLoadCallback( function() {
|
||||||
var mapId = "%s";
|
var mapId = "%s";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue