Adding new files for Dashboard and ancillary wobjects.

This commit is contained in:
Matthew Wilson 2005-11-29 18:52:56 +00:00
parent 72619fb9c0
commit e1f3c61946
136 changed files with 2751 additions and 0 deletions

224
lib/WebGUI/Asset/Field.pm Normal file
View file

@ -0,0 +1,224 @@
package WebGUI::Asset::Field;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use JSON;
use WebGUI::Asset;
use WebGUI::Asset::Template;
use WebGUI::Privilege;
use WebGUI::ErrorHandler;
use WebGUI::Form;
use Tie::IxHash;
use WebGUI::SQL;
use WebGUI::Macro;
use WebGUI::Session;
our @ISA = qw(WebGUI::Asset);
#-------------------------------------------------------------------
sub canManage {
my $self = shift;
return 1 if ($self->canEdit || (ref $self->getParent eq 'WebGUI::Asset::Shortcut' && $self->getParent->canManage));
return 0;
}
#-------------------------------------------------------------------
sub canPersonalize {
my $self = shift;
return (ref $self->getParent->getParent eq 'WebGUI::Asset::Wobject::Dashboard' && WebGUI::Grouping::isInGroup($self->getParent->getParent->get("usersGroupId")));
}
#-------------------------------------------------------------------
=head2 definition ( definition )
Defines the properties of this asset.
=head3 definition
A hash reference passed in from a subclass definition.
=cut
sub definition {
my $class = shift;
my $definition = shift;
my $fieldName;
unless ($session{form}{isUserPref} eq '1') {
$fieldName = 'The unique name of the field in the asset that you are overriding.'; } else { $fieldName = 'The unique name of a user preference parameter you are inventing.';}
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
# formTemplateId=>{fieldType=>'template',defaultValue=>''},
# valueTemplateId=>{fieldType=>'template',defaultValue=>''},
isUserPref=>{fieldType=>'hidden',defaultValue=>$session{form}{isUserPref},label=>'Is This Field a User Preference?'},
fieldName=>{fieldType=>'text',defaultValue=>'',label=>$fieldName},
fieldLabel=>{fieldType=>'text',defaultValue=>'',label=>'Label for This Field.'},
fieldDescription=>{fieldType=>'HTMLArea',defaultValue=>'',label=>'Hover Help (Description) for this Field.'},
fieldType=>{fieldType=>'fieldType',defaultValue=>'',label=>'Type of Field'},
# overrideForm=>{fieldType=>'yesNo',defaultValue=>0},
# overrideValue=>{fieldType=>'yesNo',defaultValue=>0},
possibleValues=>{fieldType=>'textarea',defaultValue=>'',label=>'Possible values for this Field. Only applies to selectList and checkList.'},
defaultValue=>{fieldType=>'text',defaultValue=>'',label=>'Default Value for this field.'}
);
push(@{$definition}, {
assetName=>"Field",
tableName=>'wgField',
autoGenerateForms=>1,
className=>'WebGUI::Asset::Field',
properties=>\%properties
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getEditForm ()
Returns the TabForm object that will be used in generating the edit page for this wobject.
=cut
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
foreach my $definition (reverse @{$self->definition}) {
my $properties = $definition->{properties};
next unless ($definition->{autoGenerateForms});
foreach my $fieldname (keys %{$properties}) {
my %params;
foreach my $key (keys %{$properties->{$fieldname}}) {
next if ($key eq "tab");
$params{$key} = $properties->{$fieldname}{$key};
}
$params{value} = $self->getValue($fieldname);
$params{name} = $fieldname;
my $tab = $properties->{$fieldname}{tab} || "properties";
$tabform->getTab($tab)->dynamicField(%params);
}
}
return $tabform;
}
#-------------------------------------------------------------------
sub getFieldName {
my $self = shift;
my $name = $self->get("fieldName") || "blankPlaceHolderWillOverrideNothing";
return $name;
}
#-------------------------------------------------------------------
sub getFieldValue {
my $self = shift;
my $value;
if ($self->get("isUserPref")) {
} else {
#is an override proper
$value = $self->get("defaultValue");
}
#This returns the user preference value, whether it's an admin override or a user preference,
#and whether or not it's template processed.
#process for fieldNames so people don't have to type the FieldIds into the getUserPrefValue macro
my $dashlet = $self->getParent;
if (ref $dashlet eq 'WebGUI::Asset::Shortcut') {
my @fellowFields = $dashlet->getUserPrefs;
foreach my $field (@fellowFields) {
my $id = $field->getId;
my $fieldName = $field->getFieldName;
my $fieldValue = $self->getUserPref($id);
unless ($self->getId eq $id) {
$value =~ s/\<tmpl_var\sshortcut\.field\.${fieldName}\.value\>/$fieldValue/g;
#prevent macro loops. A Field cannot be self referential.
} else {
$value =~ s/\<tmpl_var\sshortcut\.field\.${fieldName}\.value\>//g;
}
}
}
$value = WebGUI::Asset::Template->processRaw($value);
return $value;
}
#-------------------------------------------------------------------
sub getUserPref {
#This is a class method. Is called from the getDashletUserPref macro
my $class = shift; #ignored when called from within this package/module.
my $fieldId = shift;
my $userId = shift || 'autoDerive';
my $field;
if ($userId eq 'autoDerive') {
$field = WebGUI::Asset->newByDynamicClass($fieldId);
$userId = ($field->canManage && WebGUI::Session::isAdminOn()) ? '1' : $session{user}{userId};
}
my $returnDataType = shift || 'string';
my $returnDataFormat = shift || 'raw';
my $sql = "select userValue from wgFieldUserData where assetId=".quote($fieldId)." and userId=".quote($userId);
#WebGUI::ErrorHandler::warn($sql);
my ($userValue) = WebGUI::SQL->quickArray($sql);
unless ($userValue) {
return '' if $fieldId eq 'skipThisRequest';
$field = WebGUI::Asset->newByDynamicClass($fieldId) unless $field;
return '' unless $field;
$userValue = $field->get("defaultValue");
}
if ($returnDataType eq 'string' && $returnDataFormat eq 'raw') {
return $userValue;
}
}
#-------------------------------------------------------------------
sub setUserPref {
#This is a class method. Is called from the getDashletUserPref macro
my $class = shift; #ignored when called from within this package/module.
my $fieldId = shift;
my $valueToSet = shift;
return 0 unless $valueToSet;
my $userId = shift || 'autoDerive';
my $field;
if ($userId eq 'autoDerive') {
$field = WebGUI::Asset->newByDynamicClass($fieldId);
$userId = ($field->canManage && WebGUI::Session::isAdminOn()) ? '1' : $session{user}{userId};
}
my $returnDataType = shift || 'string';
my $returnDataFormat = shift || 'raw';
my $sql = "delete from wgFieldUserData where assetId=".quote($fieldId)." and userId=".quote($userId);
#WebGUI::ErrorHandler::warn($sql);
WebGUI::SQL->write($sql);
my $sql2 = "insert into wgFieldUserData values (".quote($fieldId).",".quote($userId).",".quote($valueToSet).")";
return WebGUI::SQL->write($sql2);
}
#-------------------------------------------------------------------
sub www_edit {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canManage;
$self->getAdminConsole->setHelp("field add/edit","Asset_Shortcut");
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get(2,"Asset_Shortcut"));
}
#-------------------------------------------------------------------
sub www_view {
my $self = shift;
return WebGUI::Privilege::noAccess() unless $self->canView;
$session{asset} = $self->getParent->getParent;
return $self->getParent->getParent->www_view;
}
1;

View file

@ -0,0 +1,257 @@
package WebGUI::Asset::Wobject::Dashboard;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use Tie::IxHash;
use WebGUI::International;
use WebGUI::Utility;
use WebGUI::Session;
use WebGUI::Grouping;
use WebGUI::Privilege;
use WebGUI::ErrorHandler;
use Time::HiRes;
use WebGUI::Asset::Field;
use WebGUI::Style;
use WebGUI::Asset::Wobject;
our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
sub canManage {
my $self = shift;
return WebGUI::Grouping::isInGroup($self->get("adminsGroupId"));
}
#-------------------------------------------------------------------
sub canPersonalize {
my $self = shift;
return WebGUI::Grouping::isInGroup($self->get("usersGroupId"));
}
#-------------------------------------------------------------------
sub definition {
my $class = shift;
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
templateId =>{
fieldType=>"template",
defaultValue=>'DashboardViewTmpl00001',
namespace=>"Dashboard"
},
adminsGroupId =>{
fieldType=>"group",
defaultValue=>4
},
usersGroupId =>{
fieldType=>"group",
defaultValue=>2
},
mapFieldId =>{
fieldType=>"text",
defaultValue=>''
}
);
push(@{$definition}, {
assetName=>WebGUI::International::get('assetName',"Asset_Dashboard"),
icon=>'dashboard.gif',
tableName=>'Dashboard',
className=>'WebGUI::Asset::Wobject::Dashboard',
properties=>\%properties
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
sub getContentPositions {
my $self = shift;
my $dummy = $self->initializeDashletFields unless $self->get("mapFieldId");
return WebGUI::Asset::Field->getUserPref($self->get("mapFieldId"));
}
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new("Asset_Dashboard");
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-namespace=>"Dashboard",
-label=>$i18n->get('dashboard template field label'),
-hoverHelp=>$i18n->get('dashboard template description'),
);
$tabform->getTab("security")->group(
-name=>"adminsGroupId",
-label=>$i18n->get('dashboard adminsGroupId field label'),
-hoverHelp=>$i18n->get('dashboard adminsGroupId description'),
-value=>[$self->get("adminsGroupId")]
);
$tabform->getTab("security")->group(
-name=>"usersGroupId",
-label=>$i18n->get('dashboard usersGroupId field label'),
-hoverHelp=>$i18n->get('dashboard usersGroupId description'),
-value=>[$self->get("usersGroupId")]
);
return $tabform;
}
#-------------------------------------------------------------------
sub initializeDashletFields {
my $self = shift;
my $child = $self->addChild({
className=>'WebGUI::Asset::Field',
title=>'Dashboard User Preference - Content Positions',
menuTitle=>'Dashboard User Preference - Content Positions',
isHidden=>1,
startDate=>$self->get("startDate"),
endDate=>$self->get("endDate"),
ownerUserId=>$self->get("ownerUserId"),
groupIdEdit=>$self->get("groupIdEdit"),
groupIdView=>$self->get("groupIdView"),
url=>'Dashboard User Preference - Content Positions',
isUserPref=>1,
fieldName=>'contentPositions'
});
$self->update({mapFieldId=>$child->getId});
}
#-------------------------------------------------------------------
sub isManaging {
my $self = shift;
return 1 if ($self->canManage && WebGUI::Session::isAdminOn());
return 0;
}
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
if ($session{form}{assetId} eq "new" && $session{form}{class} eq 'WebGUI::Asset::Wobject::Dashboard') {
$self->initializeDashletFields;
$self->update({styleTemplateId=>'PBtmplBlankStyle000001'});
}
}
#-------------------------------------------------------------------
sub view {
my $self = shift;
my %vars = $self->get();
my $templateId = $self->get("templateId");
my $children = $self->getLineage( ["children"], { returnObjects=>1, excludeClasses=>["WebGUI::Asset::Field","WebGUI::Asset::Wobject::Layout","WebGUI::Asset::Wobject::Dashboard"] });
my %vars;
# I'm sure there's a more efficient way to do this. We'll figure it out someday.
my @positions = split(/\./,$self->getContentPositions);
my @hidden = split("\n",$self->get("assetsToHide"));
foreach my $child (@{$children}) {
push(@hidden,$child->get('shortcutToAssetId')) if ref $child eq 'WebGUI::Asset::Shortcut';
}
my $i = 1;
my $templateAsset = WebGUI::Asset->newByDynamicClass($templateId) || WebGUI::Asset->getImportNode;
my $template = $templateAsset->get("template");
my $numPositions = 1;
foreach my $j (2..15) {
$numPositions = $j if $template =~ m/position${j}\_loop/;
}
my @found;
my $showPerformance = WebGUI::ErrorHandler::canShowPerformanceIndicators();
foreach my $position (@positions) {
my @assets = split(",",$position);
foreach my $asset (@assets) {
foreach my $child (@{$children}) {
if ($asset eq $child->getId) {
unless (isIn($asset,@hidden) || !($child->canView)) {
WebGUI::Style::setRawHeadTags($child->getExtraHeadTags);
my $t = [Time::HiRes::gettimeofday()] if ($showPerformance);
my $view = $child->view;
$view .= "Asset:".Time::HiRes::tv_interval($t) if ($showPerformance);
$child->{_properties}{title} = $child->getShortcut->get("title") if ref $child eq 'WebGUI::Asset::Shortcut';
if ($i > $numPositions) {
push(@{$vars{"position1_loop"}},{
id=>$child->getId,
content=>$view,
dashletTitle=>$child->get("title")
});
} else {
push(@{$vars{"position".$i."_loop"}},{
id=>$child->getId,
content=>$view,
dashletTitle=>$child->get("title")
});
}
}
push(@found, $child->getId);
}
}
}
$i++;
}
# deal with unplaced children
foreach my $child (@{$children}) {
unless (isIn($child->getId, @found)||isIn($child->getId,@hidden)) {
if ($child->canView) {
my $t = [Time::HiRes::gettimeofday()] if ($showPerformance);
my $view = $child->view;
$view .= "Asset:".Time::HiRes::tv_interval($t) if ($showPerformance);
push(@{$vars{"position1_loop"}},{
id=>$child->getId,
content=>$view,
dashletTitle=>$child->get("title")
});
}
}
}
$vars{showAdmin} = ($session{var}{adminOn} && $self->canEdit);
WebGUI::Style::setScript($session{config}{extrasURL}."/wobject/Dashboard/draggable.js",{ type=>"text/javascript" });
WebGUI::Style::setLink($session{config}{extrasURL}."/wobject/Dashboard/draggable.css",{ type=>"text/css", rel=>"stylesheet", media=>"all" });
$vars{"dragger.init"} = '
<script type="text/javascript">
dragable_init("'.$self->getUrl.'");
</script>
';
return $self->processTemplate(\%vars, $templateId);
}
#-------------------------------------------------------------------
sub www_setContentPositions {
my $self = shift;
return WebGUI::Privilege::insufficient() unless ($self->canPersonalize);
return '' unless $self->get("mapFieldId");
my $success = WebGUI::Asset::Field->setUserPref($self->get("mapFieldId"),$session{form}{map});
return "Map set: ".$session{form}{map} if $success;
return "Map failed to set.";
}
#-------------------------------------------------------------------
=head2 www_view ( )
Returns the view() method of the asset object if the requestor canView.
=cut
sub www_view {
my $self = shift;
return $self->SUPER::www_view(1);
}
1;

View file

@ -0,0 +1,94 @@
package WebGUI::Asset::Wobject::MultiSearch;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
Portions of the below are originally from Weather::Underground,
and are not included in this copyright.
=cut
use strict;
use Tie::CPHash;
use Tie::IxHash;
use JSON;
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Asset::Wobject;
use WebGUI::Utility;
our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
=head2 definition
defines wobject properties for MultiSearch instances
=cut
sub definition {
my $class = shift;
my $definition = shift;
my $properties = {
templateId =>{
fieldType=>"template",
tab=>"display",
defaultValue=>'MultiSearchTmpl0000001',
namespace=>"MultiSearch",
hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
label=>WebGUI::International::get(72,"Asset_Article")
},
predefinedSearches=>{
fieldType=>"textarea",
defaultValue=>"WebGUI",
tab=>"properties",
hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
label=>WebGUI::International::get(72,"Asset_Article")
},
};
push(@{$definition}, {
tableName=>'MultiSearch',
className=>'WebGUI::Asset::Wobject::MultiSearch',
assetName=>'MultiSearch',
# icon=>'MultiSearch.gif',
autoGenerateForms=>1,
properties=>$properties
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 view ( )
method called by the www_view method. Returns a processed template
to be displayed within the page style
=cut
sub view {
my $self = shift;
my %var = $self->get();
#Set some template variables
#Build list of stocks as an array
my $defaults = $self->getValue("predefinedSearches");
return $self->processTemplate(\%var, $self->get("templateId"));
}
1;

View file

@ -0,0 +1,476 @@
package WebGUI::Asset::Wobject::StockData;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::ErrorHandler;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::URL;
use WebGUI::Utility;
use WebGUI::Asset::Wobject;
use Finance::Quote;
our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
=head2 _appendStockVars ( hash, data, symbol )
Appends stock variables for the symbol passed in to the hash passed in
=head3 hash
hash to append stock variables to
=head3 data
hash reference in the format passed by the fetch method from Finance::Quote
=head3 symbol
stock symbol to append variables for
=cut
sub _appendStockVars {
my $self = shift;
my $hash = $_[0];
my $data = $_[1];
my $symbol = $_[2];
$hash->{'stocks.symbol'} = _na($symbol);
$hash->{'stocks.name'} = _na($data->{$symbol,"name"});
$hash->{'stocks.last'} = _na($data->{$symbol,"last"});
$hash->{'stocks.high'} = _na($data->{$symbol,"high"});
$hash->{'stocks.low'} = _na($data->{$symbol,"low"});
$hash->{'stocks.date'} = _na($data->{$symbol,"date"});
$hash->{'stocks.time'} = _na($data->{$symbol,"time"});
$hash->{'stocks.net'} = _na($data->{$symbol,"net"});
$hash->{'stocks.net.isDown'} = $hash->{'stocks.net'} < 0;
$hash->{'stocks.net.isUp'} = $hash->{'stocks.net'} > 0;
$hash->{'stocks.net.noChange'} = $hash->{'stocks.net'} == 0;
$hash->{'stocks.net.icon'} = "nc.gif";
if($hash->{'stocks.net.isDown'}) {
$hash->{'stocks.net.icon'} = "down.gif";
} elsif($hash->{'stocks.net.isUp'}) {
$hash->{'stocks.net.icon'} = "up.gif";
}
$hash->{'stocks.p_change'} = _na($data->{$symbol,"p_change"});
$hash->{'stocks.volume'} = _na($data->{$symbol,"volume"});
$hash->{'stocks.volume.millions'} = _na(WebGUI::Utility::round(($hash->{'stocks.volume'}/1000000),2));
$hash->{'stocks.avg_vol'} = _na($data->{$symbol,"avg_vol"});
$hash->{'stocks.bid'} = _na($data->{$symbol,"bid"});
$hash->{'stocks.ask'} = _na(WebGUI::Utility::commify($data->{$symbol,"ask"}));
$hash->{'stocks.close'} = _na($data->{$symbol,"close"});
$hash->{'stocks.open'} = _na($data->{$symbol,"open"});
$hash->{'stocks.day_range'} = _na($data->{$symbol,"day_range"});
$hash->{'stocks.year_range'} = _na($data->{$symbol,"year_range"});
my ($yrLo,$yrHi) = split("-",$hash->{'stocks.year_range'});
$hash->{'stocks.year_high'} = _na($self->_trim($yrHi));
$hash->{'stocks.year_low'} = _na($self->_trim($yrLo));
$hash->{'stocks.eps'} = _na($data->{$symbol,"eps"});
$hash->{'stocks.pe'} = _na($data->{$symbol,"pe"});
$hash->{'stocks.div_date'} = _na($data->{$symbol,"div_date"});
$hash->{'stocks.div'} = _na($data->{$symbol,"div"});
$hash->{'stocks.div_yield'} = _na($data->{$symbol,"div_yield"});
$hash->{'stocks.cap'} = _na(lc($data->{$symbol,"cap"}));
$hash->{'stocks.ex_div'} = _na($data->{$symbol,"ex_div"});
$hash->{'stocks.nav'} = _na($data->{$symbol,"nav"});
$hash->{'stocks.yield'} = _na($data->{$symbol,"yield"});
$hash->{'stocks.exchange'} = _na($data->{$symbol,"exchange"});
$hash->{'stocks.success'} = _na($data->{$symbol,"success"});
$hash->{'stocks.errormsg'} = _na($data->{$symbol,"errormsg"});
$hash->{'stocks.method'} = _na($data->{$symbol,"method"});
}
#-------------------------------------------------------------------
=head2 _na( string )
If string passed in is empty, returns N/A
=head3 string
a string
=cut
sub _na {
my $str = $_[0];
unless($str) {
$str = "N/A";
}
return $str;
}
#-------------------------------------------------------------------
=head2 _appendZero( intger )
Appends a zero to an integer if it is 0-9
=head3 integer
an integer
=cut
sub _appendZero {
my $self = shift;
my $num = $_[0];
if (length($num) == 1) {
$num = "0".$num;
}
return $num;
}
#-------------------------------------------------------------------
=head2 _clearStockEditSession ( )
Clears the session variables from session used by the stock list edit form
=cut
sub _clearStockEditSession {
my $self = shift;
$session{form}{symbol} = "";
$session{form}{stockId} = "";
}
#-------------------------------------------------------------------
=head2 _convertToEpoch (date,time)
Converts the date and time returned by Finance::Quote to an epoch
=head3 date
date format returned by Finance::Quote
=head3 time
time format returned by Finance::Quote
=cut
sub _convertToEpoch {
my $self = shift;
my $date = $_[0];
my $time = $_[1];
my ($month,$day,$year) = split("/",$date);
$month = $self->_appendZero($month);
$day = $self->_appendZero($day);
my $tfixed = substr($time,0,-2);
my ($hour,$minute) = split(":",$tfixed);
if($time =~ m/pm/i) {
$hour += 12;
}
$hour = $self->_appendZero($hour);
$minute - $self->_appendZero($minute);
return WebGUI::DateTime::humanToEpoch("$year-$month-$day $hour:$minute:00");
}
#-------------------------------------------------------------------
=head2 _getStocks ( stocks )
Private method which retrieves stock information from the Finance::Quote package
=head3 stocks
list of stock symbols to find passed in as an array reference. stock symbols should all be uppercase
=cut
sub _getStocks {
my $self = shift;
my $stocks = $_[0];
#Create a new Finance::Quote object
my $q = Finance::Quote->new;
#Disable failover if specified
unless ($self->getValue("failover")) {
$q->failover(0);
}
#Fetch the stock information and return the results
return $q->fetch($self->getValue("source"),@{$stocks});
}
#-------------------------------------------------------------------
=head2 _getStockSources ( )
Private method which retrieves the list of available stock sources from Finance::Quote package
and returns the results as a hash reference for the selectList Form API
=cut
sub _getStockSources {
my $self = shift;
#Instantiate Finance::Quote
my $q = Finance::Quote->new;
#Retrieve array of available sources and sort them
my @srcs = sort $q->sources;
#Create a hash reference with the name referencing itself
my %sources;
#Tie to IxHash to preserve alphabetical order
tie %sources, "Tie::IxHash";
foreach my $src (@srcs) {
$sources{$src} = $src;
}
return \%sources;
}
#-------------------------------------------------------------------
=head2 _submenu
renders the admin console view
=cut
sub _submenu {
my $self = shift;
my $workarea = shift;
my $title = shift;
my $help = shift;
my $ac = WebGUI::AdminConsole->new("editstocks");
$ac->setHelp($help) if ($help);
$ac->setIcon($self->getIcon);
return $ac->render($workarea, $title);
}
#-------------------------------------------------------------------
=head2 _trim (str)
Trims whitespace form front and end of a string
=head3 str
a string to trim
=cut
sub _trim {
my $self = shift;
my $str = $_[0];
$str =~ s/^\s//;
$str =~ s/\s$//;
return $str;
}
#-------------------------------------------------------------------
=head2 definition
defines wobject properties for Stock Data instances
=cut
sub definition {
my $class = shift;
my $definition = shift;
my $properties = {
templateId =>{
fieldType=>"template",
defaultValue=>'StockDataTMPL000000001'
},
displayTemplateId=>{
fieldType=>"template",
defaultValue=>'StockDataTMPL000000002'
},
defaultStocks=>{
fieldType=>"textarea",
defaultValue=>"DELL\nMSFT\nORCL\nSUNW\nYHOO"
},
source=>{
fieldType=>"selectList",
defaultValue=>"usa"
},
failover=>{
fieldType=>"checkbox",
defaultValue=>undef
}
};
push(@{$definition}, {
tableName=>'StockData',
className=>'WebGUI::Asset::Wobject::StockData',
icon=>'stockData.gif',
assetName=>WebGUI::International::get("app_name","Asset_StockData"),
properties=>$properties
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getEditForm
returns the tabform object that will be used in generating the edit page for Stock Lists
=cut
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->get("templateId"),
-label=>WebGUI::International::get("template_label","Asset_StockData"),
-namespace=>"StockData"
);
$tabform->getTab("display")->template(
-value=>$self->get("displayTemplateId"),
-label=>WebGUI::International::get("display_template_label","Asset_StockData"),
-namespace=>"StockData/Display"
);
$tabform->getTab("properties")->textarea(
-name => "defaultStocks",
-label=> WebGUI::International::get("default_stock_label","Asset_StockData"),
-value=> $self->getValue("defaultStocks")
);
$tabform->getTab("properties")->selectList(
-name => "source",
-label=> WebGUI::International::get("stock_source","Asset_StockData"),
-options=>$self->_getStockSources(),
-value=> [$self->getValue("source")],
-hoverHelp=>WebGUI::International::get("stock_source_description","Asset_StockData")
);
$tabform->getTab("properties")->yesNo(
-name=> "failover",
-label=> WebGUI::International::get("failover_label","Asset_StockData"),
-value=>$self->getValue("failover"),
-hoverHelp=> WebGUI::International::get("failover_description","Asset_StockData")
);
return $tabform;
}
#-------------------------------------------------------------------
=head2 purge ( )
removes collateral data associated with a StockData when the system
purges it's data.
=cut
sub purge {
my $self = shift;
return $self->SUPER::purge;
}
#-------------------------------------------------------------------
=head2 view ( )
method called by the www_view method. Returns a processed template
to be displayed within the page style
=cut
sub view {
my $self = shift;
my $var = {};
#Set some template variables
$var->{'extrasFolder'} = $session{config}{extrasURL}."/wobject/StockData";
$var->{'editUrl'} = $self->getUrl("func=editStocks");
$var->{'isVisitor'} = $session{user}{userId} eq 1;
$var->{'stock.display.url'} = $self->getUrl("func=displayStock&symbol=");
#Build list of stocks as an array
my $defaults = $self->getValue("defaultStocks");
#replace any windows newlines
$defaults =~ s/\r//;
my @array = split("\n",$defaults);
#trim default stocks of whitespace
for (my $i = 0; $i < scalar(@array); $i++) {
$array[$i] = $self->_trim($array[$i]);
}
my $data = $self->_getStocks(\@array);
my @stocks = ();
foreach my $symbol (@array) {
my $hash = {};
#Append Template Variables for stock symbol
$self->_appendStockVars($hash,$data,$symbol);
#Create last update date formats
unless ($var->{'lastUpdate.default'}) {
my $luEpoch = $self->_convertToEpoch($hash->{'stocks.date'},$hash->{'stocks.time'});
$var->{'lastUpdate.intl'} = WebGUI::DateTime::epochToHuman($luEpoch,"%y-%m-%d %j:%n");
$var->{'lastUpdate.us'} = WebGUI::DateTime::epochToHuman($luEpoch,"%m/%d/%y %h:%n %p");
$var->{'lastUpdate.default'} = WebGUI::DateTime::epochToHuman($luEpoch,"%C %d %H:%n %P");
}
push (@stocks, $hash);
}
$var->{'stocks.loop'} = \@stocks;
return $self->processTemplate($var, $self->get("templateId"));
}
#-------------------------------------------------------------------
=head2 www_displayStock ( )
Web facing method which allows users to view details about their stocks
=cut
sub www_displayStock {
my $self = shift;
my $var = {};
return WebGUI::Privilege::noAccess() unless $self->canView();
$var->{'extrasFolder'} = $session{config}{extrasURL}."/wobject/StockData";
my $symbol = $session{form}{symbol};
my $data = $self->_getStocks([$symbol]);
#Append Template Variables for stock symbol
$self->_appendStockVars($var,$data,$symbol);
#Configure last update dates
my $luEpoch = $self->_convertToEpoch($var->{'stocks.date'},$var->{'stocks.time'});
$var->{'lastUpdate.intl'} = WebGUI::DateTime::epochToHuman($luEpoch,"%y-%m-%d");
$var->{'lastUpdate.us'} = WebGUI::DateTime::epochToHuman($luEpoch,"%m/%d/%y");
$session{setting}{showDebug} = 0;
return $self->processTemplate($var, $self->get("displayTemplateId"));
}
#-------------------------------------------------------------------
=head2 www_edit ( )
Web facing method which is the default edit page
=cut
sub www_edit {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("stock_list_add_edit","Asset_StockData");
return $self->getAdminConsole->render($self->getEditForm->print,
WebGUI::International::get("edit_title","Asset_StockData"));
}
#-------------------------------------------------------------------
=head2 www_view ( )
Overwrite www_view method and call the superclass object, passing in a 1 to disable cache
=cut
sub www_view {
my $self = shift;
$self->SUPER::www_view(1);
}
1;

View file

@ -0,0 +1,221 @@
package WebGUI::Asset::Wobject::WeatherData;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
Portions of the below are originally from Weather::Underground,
and are not included in this copyright.
=cut
use strict;
use LWP::UserAgent qw($ua);
use Tie::CPHash;
use Tie::IxHash;
use JSON;
use WebGUI::Cache;
use WebGUI::DateTime;
use WebGUI::International;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Asset::Wobject;
use WebGUI::Utility;
our @ISA = qw(WebGUI::Asset::Wobject);
#-------------------------------------------------------------------
=head2 definition
defines wobject properties for WeatherData instances
=cut
sub definition {
my $class = shift;
my $definition = shift;
my $properties = {
templateId =>{
fieldType=>"template",
tab=>"display",
defaultValue=>'WeatherDataTmpl0000001',
namespace=>"WeatherData",
hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
label=>WebGUI::International::get(72,"Asset_Article")
},
locations=>{
fieldType=>"textarea",
defaultValue=>"Grayslake,IL",
tab=>"properties",
hoverHelp=>WebGUI::International::get('article template description','Asset_Article'),
label=>WebGUI::International::get(72,"Asset_Article")
},
};
push(@{$definition}, {
tableName=>'WeatherData',
className=>'WebGUI::Asset::Wobject::WeatherData',
assetName=>'WeatherData',
icon=>'weatherData.gif',
autoGenerateForms=>1,
properties=>$properties
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 _getLocationData
Accepts an array ref of locations, and returns
=cut
sub _getLocationData {
my $self = shift;
my $location = shift;
my $cache = WebGUI::Cache->new(["weatherLocation",$location]);
my $locData = $cache->get;
unless ($locData->{cityState}) {
my $oldagent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$oldagent = $ua->agent();
$ua->agent($session{env}{HTTP_USER_AGENT}); # Act as a proxy.
my $response = $ua->get('http://www.srh.noaa.gov/port/port_zc.php?inputstring='.$location);
my $document = $response->content;
$document =~ s/\n/ /g;
$document =~ s/\s+/ /g;
$document =~ m!<hr>\s<div\salign="center">\s(.*?)<br>.*?<br>.*?<br>.*?<br>\s(.*?):\s(.*?) &deg;F<br>!;
$locData = {
query => $location,
cityState => $1,
sky => $2,
tempF => $3,
iconUrl => $session{config}{extrasURL}.'/wobject/WeatherData/'.$self->_chooseWeatherConditionsIcon($2).'.jpg'
};
$cache->set($locData, 60*60) if $locData->{cityState};
}
return $locData;
# return $cityState.'<br />'.$sky.'<br />'.$ftemp.'&deg;F<br /><img src="'.$iconUrl.'" />';
}
#-------------------------------------------------------------------
=head2 _chooseWeatherConditionsIcon ( currentSkyConditionsEnglish )
Accepts a string that represents the current sky conditions. Taken
largely from http://www.weather.gov/data/current_obs/weather.php
=cut
sub _chooseWeatherConditionsIcon {
my $self = shift;
my $currCond = shift;
if (isIn($currCond,'Mostly Cloudy','Mostly Cloudy with Haze','Mostly Cloudy and Breezy')) {return 'bkn';}
if (isIn($currCond,'Fair','Clear','Fair with Haze','Clear with Haze','Fair and Breezy','Clear and Breezy')) {return 'skc';}
if (isIn($currCond,'A Few Clouds','A Few Clouds with Haze','A Few Clouds and Breezy')) {return 'few';}
if (isIn($currCond,'Partly Cloudy','Party Cloudy with Haze','Partly Cloudy and Breezy')) {return 'sct';}
if (isIn($currCond,'Overcast','Overcast with Haze','Overcast and Breezy')) {return 'ovc';}
if (isIn($currCond,'Fog/Mist','Fog','Freezing Fog','Shallow Fog','Partial Fog','Patches of Fog','Fog in Vicinity','Freezing Fog in Vicinity','Shallow Fog in Vicinity','Partial Fog in Vicinity','Patches of Fog in Vicinity','Showers in Vicinity Fog','Light Freezing Fog','Heavy Freezing Fog')) {return 'nfg';}
if (isIn($currCond,'Smoke')) {return 'smoke';}
if (isIn($currCond,'Freezing Rain','Freezing Drizzle','Light Freezing Rain','Light Freezing Drizzle','Heavy Freezing Rain','Heavy Freezing Drizzle','Freezing Rain in Vicinity','Freezing Drizzle in Vicinity')) {return 'fzra';}
if (isIn($currCond,'Ice Pellets','Light Ice Pellets','Heavy Ice Pellets','Ice Pellets in Vicinity','Showers Ice Pellets','Thunderstorm Ice Pellets','Ice Crystals','Hail','Small Hail/Snow Pellets','Light Small Hail/Snow Pellets','Heavy Small Hail/Snow Pellets','Showers Hail','Hail Showers')) {return 'ip';}
if (isIn($currCond,'Freezing Rain Snow','Light Freezing Rain Snow','Heavy Freezing Rain Snow','Freezing Drizzle Snow','Light Freezing Drizzle Snow','Heavy Freezing Drizzle Snow','Snow Freezing Rain| Light Snow Freezing Rain','Heavy Snow Freezing Rain','Snow Freezing Drizzle','Light Snow Freezing Drizzle','Heavy Snow Freezing Drizzle')) {return 'mix';}
if (isIn($currCond,'Rain Ice Pellets','Light Rain Ice Pellets','Heavy Rain Ice Pellets','Drizzle Ice Pellets','Light Drizzle Ice Pellets','Heavy Drizzle Ice Pellets','Ice Pellets Rain','Light Ice Pellets Rain','Heavy Ice Pellets Rain','Ice Pellets Drizzle','Light Ice Pellets Drizzle','Heavy Ice Pellets Drizzle')) {return 'raip';}
if (isIn($currCond,'Rain Snow','Light Rain Snow','Heavy Rain Snow','Snow Rain','Light Snow Rain','Heavy Snow Rain','Drizzle Snow','Light Drizzle Snow','Heavy Drizzle Snow','Snow Drizzle','Light Snow Drizzle','Heavy Snow Drizzle')) {return 'rasn';}
if (isIn($currCond,'Rain Showers','Light Rain Showers','Heavy Rain Showers','Rain Showers in Vicinity','Light Showers Rain','Heavy Showers Rain','Showers Rain','Showers Rain in Vicinity','Rain Showers Fog/Mist','Light Rain Showers Fog/Mist','Heavy Rain Showers Fog/Mist','Rain Showers in Vicinity Fog/Mist','Light Showers Rain Fog/Mist','Heavy Showers Rain Fog/Mist','Showers Rain Fog/Mist','Showers Rain in Vicinity Fog/Mist')) {return 'shra';}
if (isIn($currCond,'Thunderstorm','Light Thunderstorm Rain','Heavy Thunderstorm Rain','Thunderstorm Rain Fog/Mist','Light Thunderstorm Rain Fog/Mist','Heavy Thunderstorm Rain Fog/Mist','Thunderstorm Showers in Vicinity','| Light Thunderstorm Rain Haze','Heavy Thunderstorm Rain Haze','Thunderstorm Fog','Light Thunderstorm Rain Fog','Heavy Thunderstorm Rain Fog','Thunderstorm Light Rain','Thunderstorm Heavy Rain','Thunderstorm Rain Fog/Mist','Thunderstorm Light Rain Fog/Mist','Thunderstorm Heavy Rain Fog/Mist','Thunderstorm in Vicinity Fog/Mist','Thunderstorm Showers in Vicinity','Thunderstorm in Vicinity','Thunderstorm in Vicinity Haze','Thunderstorm Haze in Vicinity','Thunderstorm Light Rain Haze','Thunderstorm Heavy Rain Haze','Thunderstorm Fog','Thunderstorm Light Rain Fog','Thunderstorm Heavy Rain Fog','Thunderstorm Hail','Light Thunderstorm Rain Hail','Heavy Thunderstorm Rain Hail','Thunderstorm Rain Hail Fog/Mist','Light Thunderstorm Rain Hail Fog/Mist','Heavy Thunderstorm Rain Hail Fog/Mist','Thunderstorm Showers in Vicinity Hail','| Light Thunderstorm Rain Hail Haze','Heavy Thunderstorm Rain Hail Haze','Thunderstorm Hail Fog','Light Thunderstorm Rain Hail Fog','Heavy Thunderstorm Rain Hail Fog','Thunderstorm Light Rain Hail','Thunderstorm Heavy Rain Hail','Thunderstorm Rain Hail Fog/Mist','Thunderstorm Light Rain Hail Fog/Mist','Thunderstorm Heavy Rain Hail Fog/Mist','Thunderstorm in Vicinity Hail Fog/Mist','Thunderstorm Showers in Vicinity Hail','Thunderstorm in Vicinity Hail','Thunderstorm in Vicinity Hail Haze','Thunderstorm Haze in Vicinity Hail','Thunderstorm Light Rain Hail Haze','Thunderstorm Heavy Rain Hail Haze','Thunderstorm Hail Fog','Thunderstorm Light Rain Hail Fog','Thunderstorm Heavy Rain Hail Fog','Thunderstorm Small Hail/Snow Pellets','Thunderstorm Rain Small Hail/Snow Pellets','Light Thunderstorm Rain Small Hail/Snow Pellets','Heavy Thunderstorm Rain Small Hail/Snow Pellets')) {return 'tsra';}
if (isIn($currCond,'Snow','Light Snow','Heavy Snow','Snow Showers','Light Snow Showers','Heavy Snow Showers','Showers Snow','Light Showers Snow','Heavy Showers Snow','Snow Fog/Mist','Light Snow Fog/Mist','Heavy Snow Fog/Mist','Snow Showers Fog/Mist','Light Snow Showers Fog/Mist','Heavy Snow Showers Fog/Mist','Showers Snow Fog/Mist','Light Showers Snow Fog/Mist','Heavy Showers Snow Fog/Mist','Snow Fog','Light Snow Fog','Heavy Snow Fog','Snow Showers Fog','Light Snow Showers Fog','Heavy Snow Showers Fog','Showers Snow Fog','Light Showers Snow Fog','Heavy Showers Snow Fog','Showers in Vicinity Snow','Snow Showers in Vicinity','Snow Showers in Vicinity Fog/Mist','Snow Showers in Vicinity Fog','Low Drifting Snow','Blowing Snow','Snow Low Drifting Snow','Snow Blowing Snow','Light Snow Low Drifting Snow','Light Snow Blowing Snow','Heavy Snow Low Drifting Snow','Heavy Snow Blowing Snow','Thunderstorm Snow','Light Thunderstorm Snow','Heavy Thunderstorm Snow','Snow Grains','Light Snow Grains','Heavy Snow Grains','Heavy Blowing Snow','Blowing Snow in Vicinity')) {return 'sn';}
if (isIn($currCond,'Windy','Fair and Windy','A Few Clouds and Windy','Partly Cloudy and Windy','Mostly Cloudy and Windy','Overcast and Windy')) {return 'wind';}
if (isIn($currCond,'Showers in Vicinity','Showers in Vicinity Fog/Mist','Showers in Vicinity Fog','Showers in Vicinity Haze')) {return 'hi_shwrs';}
if (isIn($currCond,'Freezing Rain Rain','Light Freezing Rain Rain','Heavy Freezing Rain Rain','Rain Freezing Rain','Light Rain Freezing Rain','Heavy Rain Freezing Rain','Freezing Drizzle Rain','Light Freezing Drizzle Rain','Heavy Freezing Drizzle Rain','Rain Freezing Drizzle','Light Rain Freezing Drizzle','Heavy Rain Freezing Drizzle')) {return 'fzrara';}
if (isIn($currCond,'Thunderstorm in Vicinity','Thunderstorm in Vicinity Fog/Mist','Thunderstorm in Vicinity Fog','Thunderstorm Haze in Vicinity','Thunderstorm in Vicinity Haze')) {return 'hi_tsra';}
if (isIn($currCond,'Light Rain','Drizzle','Light Drizzle','Heavy Drizzle','Light Rain Fog/Mist','Drizzle Fog/Mist','Light Drizzle Fog/Mist','Heavy Drizzle Fog/Mist','Light Rain Fog','Drizzle Fog','Light Drizzle Fog','Heavy Drizzle Fog')) {return 'ra1';}
if (isIn($currCond,'Rain','Heavy Rain','Rain Fog/Mist','Heavy Rain Fog/Mist','Rain Fog','Heavy Rain Fog')) {return 'ra';}
if (isIn($currCond,'Funnel Cloud','Funnel Cloud in Vicinity','Tornado/Water Spout')) {return 'nsvrtsra';}
if (isIn($currCond,'Dust','Low Drifting Dust','Blowing Dust','Sand','Blowing Sand','Low Drifting Sand','Dust/Sand Whirls','Dust/Sand Whirls in Vicinity','Dust Storm','Heavy Dust Storm','Dust Storm in Vicinity','Sand Storm','Heavy Sand Storm','Sand Storm in Vicinity')) {return 'dust';}
if (isIn($currCond,'Haze')) {return 'mist.jpg';}
}
#-------------------------------------------------------------------
=head2 _na( string )
If string passed in is empty, returns N/A
=head3 string
a string
=cut
sub _na {
my $str = $_[0];
unless($str) {
$str = "N/A";
}
return $str;
}
#-------------------------------------------------------------------
=head2 _trim (str)
Trims whitespace form front and end of a string
=head3 str
a string to trim
=cut
sub _trim {
my $self = shift;
my $str = $_[0];
$str =~ s/^\s//;
$str =~ s/\s$//;
return $str;
}
#-------------------------------------------------------------------
=head2 view ( )
method called by the www_view method. Returns a processed template
to be displayed within the page style
=cut
sub view {
my $self = shift;
my $var = $self->get();
#Set some template variables
#Build list of locations as an array
my $defaults = $self->getValue("locations");
#replace any windows newlines
$defaults =~ s/\r//;
my @array = split("\n",$defaults);
#trim locations of whitespace
for (my $i = 0; $i < scalar(@array); $i++) {
$array[$i] = $self->_trim($array[$i]);
}
my $data = $self->_getLocationData(\@array);
my @locs = ();
foreach my $location (@array) {
push (@locs, $self->_getLocationData($location));
}
$var->{'locations.loop'} = \@locs;
return $self->processTemplate($var, $self->get("templateId"));
}
1;

View file

@ -0,0 +1 @@
1;

View file

@ -0,0 +1,116 @@
package WebGUI::Help::StockList;
our $HELP = {
'stock_list_add_edit' => {
title => 'help_add_edit_stocklist_title',
body => 'help_add_edit_stocklist_body',
fields => [
{
title => 'template_label',
description => 'template_label_description',
namespace => 'StockList',
},
{
title => 'display_template_label',
description => 'display_template_label_description',
namespace => 'StockList',
},
{
title => 'default_stock_label',
description => 'default_stock_label_description',
namespace => 'StockList',
},
{
title => 'stock_source',
description => 'stock_source_description',
namespace => 'StockList',
},
{
title => 'failover_label',
description => 'failover_label_description',
namespace => 'StockList',
},
],
related => [
{
tag => 'stock list user edit',
namespace => 'StockList'
},
{
tag => 'stock list template',
namespace => 'StockList'
},
{
tag => 'stock list display template',
namespace => 'StockList'
},
{
tag => 'wobjects using',
namespace => 'Wobject'
},
{
tag => 'asset fields',
namespace => 'Asset'
},
],
},
'stock list user edit' => {
title => 'help_add_edit_stock_title',
body => 'help_add_edit_stock_description',
fields => [
{
title => 'symbol_label',
description => 'symbol_label_description',
namespace => 'StockList',
},
],
related => [
{
tag => 'stock list display template',
namespace => 'StockList'
},
]
},
'stock list template' => {
title => 'help_stock_list_template',
body => 'help_stock_list_template_description',
fields => [
],
related => [
{
tag => 'stock list display template',
namespace => 'StockList'
},
{
tag => 'pagination template variables',
namespace => 'WebGUI'
},
{
tag => 'wobject template',
namespace => 'Wobject'
}
]
},
'stock list display template' => {
title => 'help_stock_list_display_template',
body => 'help_stock_list_display_template_description',
fields => [
],
related => [
{
tag => 'stock list template',
namespace => 'StockList'
},
{
tag => 'pagination template variables',
namespace => 'WebGUI'
},
{
tag => 'wobject template',
namespace => 'Wobject'
}
]
},
};
1;

View file

@ -0,0 +1,69 @@
package WebGUI::i18n::English::Asset_Dashboard;
our $I18N = {
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template description' => {
message => q|Choose a Dashboard/Portal Layout template. The default is the <b>Three Column Layout</b>.|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'assetName' => {
message => q|Dashboard|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard adminsGroupId description' => {
message => q|Which group may administer this Dashboard: Add/Edit/Remove Available Dashlets, Preferences, and Templates|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard adminsGroupId field label' => {
message => q|Who can manage?|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard usersGroupId field label' => {
message => q|Who can personalize?|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard usersGroupId description' => {
message => q|The group whose users may save their personalizations/preferences to the site. If someone is in the "Who can view?" group but not in this group, they can personalize the arrangement of the Dashlets (whose positions will be saved in cookies), but they will not be able to edit the preferences of any particular Dashlet.|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
'dashboard template field label' => {
message => q|Dashboard Template|,
lastUpdated => 1136008800 #Dec 31, 2005
},
};
1;

View file

@ -0,0 +1,512 @@
package WebGUI::i18n::English::Asset_StockData;
our $I18N = {
'template_label' => {
message => q|Stock List Template|,
lastUpdated => 1121703035,
},
'display_template_label' => {
message => q|Stock Display Template|,
lastUpdated => 1121703035,
},
'app_name' => {
message => q|Stock Data|,
lastUpdated => 1119068745
},
'default_stock_label' => {
message => q|Default Stocks|,
lastUpdate => 1119068745
},
'default_stock_description' => {
message => q|Enter the default stocks you wish to show visitors and users who do not have their stock lists personalized. One stock symbol per line|,
lastUpdate => 1119068745
},
'edit_title' => {
message => q|Edit Stock List|,
lastUpdate => 1119068745
},
'add_button_label' => {
message => q|Add >>|,
lastUpdate => 1119068745
},
'finish_button_label' => {
message => q|Finish|,
lastUpdate => 1119068745
},
'symbol_label' => {
message => q|Stock Symbol|,
lastUpdate => 1119068745
},
'symbol_header' => {
message => q|Stock Symbol List|,
lastUpdate => 1119068745
},
'symbol_edit_label' => {
message => q|Add/Edit Stock Symbols|,
lastUpdate => 1119068745
},
'stock_source' => {
message => q|Primary Source|,
lastUpdate => 1119068745
},
'stock_source_description' => {
message => q|The Stock List application gets stock quotes from various internet sources. Choose the primary source you wish to have stocks returned from. Choosing the market most of your users will choose stocks from greatly improves the performance of stock retrieval|,
lastUpdate => 1119068745
},
'failover_label' => {
message => q|Use Multiple Sources|,
lastUpdate => 1119068745
},
'failover_description' => {
message => q|If this option is marked yes, all available stock sources will be searched (starting with the primary source). If marked no, only the primary source selected will be searched. This will reduce the number of available stocks available to your users, but will greatly improve the performance of stock retrieval.|,
lastUpdate => 1119068745
},
'no_symbol' => {
message => q|Symbol %s could not be found from the list available market search sources.|,
lastUpdate => 1119068745
},
'no_symbol_error' => {
message => q|"You have not entered a stock symbol to add to your list"|,
lastUpdate => 1119068745
},
'symbol_exists' => {
message => q|Symbol %s is already in your Stock List.|,
lastUpdate => 1119068745
},
'delete_confirm' => {
message => q|Are you sure you wish to remove %s from your Stock List?|,
lastUpdate => 1119068745
},
#Help Messages
'help_add_edit_stocklist_title' => {
message => q|Stock List, Add/Edit|,
lastUpdated => 1066583066
},
'help_add_edit_stocklist_body' => {
message => q|<P>Stock Lists allow users to track stocks on your site. Data is retrieved from various sources on the internet and displayed in tabluar format. This application allows any registered user to configure stock lists as well as to set a default stock list for visitors or for users who have not configured one themselves<P>|,
lastUpdated => 1119066571,
},
'template_label_description' => {
message => q|Select a template from the list to layout your Stock List. Each Stock List may only use templates with namespace "StockList".|,
lastUpdated => 1119066250
},
'display_template_label_description' => {
message => q|Select a template from the list to layout the display for individual Stocks. Stock List Display templates use templates with namespace "StockList/Display".|,
lastUpdated => 1119066250
},
'default_stock_label_description' => {
message => q|Enter a list of default stocks (one per line) to display in cases where the user is not logged in or the user has not personalized the Stock List|,
lastUpdated => 1119066250
},
'stock_source_description' => {
message => q|Choose the primary source from which to retrieve stocks. This is the first internet location the application will search. Choosing the source that contains stocks which the majority of your users will be watching greatly increases the performance of the Stock List.|,
lastUpdated => 1119066250
},
'failover_label_description' => {
message => q|Choosing yes indicates that all available internet sources will be searched to find each stock. Choosing no restricts the search to your primary source. This greatly improves the performance of searchs, but limits your users to stocks available from only once source.|,
lastUpdated => 1119066250
},
'help_add_edit_stock_title' => {
message => q|Stock List, Add/Edit Stocks|,
lastUpdated => 1119066250
},
'help_add_edit_stock_description' => {
message => q|<p>The stock edit page allows you to customize your stock lists. Add to, remove from, and order your personalized list of stocks to display on the site</p>|,
lastUpdated => 1119066250
},
'symbol_label_description' => {
message => q|Enter a valid stock symbol. If your symbol cannot be found, contact your administrator. It is likely that your site restricts stocks to a certain market (US market, European market, etc)|,
lastUpdated => 1119066250
},
'help_stock_list_template' => {
message => q|Stock List Template|,
lastUpdated => 1119066250
},
'help_stock_list_template_description' => {
message => q|<p>The following describes the list of available template variables for building StockList templates</p>
<b>extrasFolder</b><br>
The url to the extras folder containing css files and images used by the Stock List application
<p>
<b>editUrl</b><br>
The url to the page where users can customize stocks
<p>
<b>isVisitor</b><br>
Whether or not the current user is a visitor. This returns true if the users is authenticated against the system
<p>
<b>stock.display.url</b><br>
General url to the page that displays details for individual stocks. A stock symbol must be added to the end of this url
<p>
<b>lastUpdate.default</b><br>
default date and time format for the date and time stocks were updated by the returning sources
<p>
<b>lastUpdate.intl</b><br>
international date and time format for the date and time stocks were updated by the returning sources
<p>
<b>lastUpdate.us</b><br>
US date and time format for the date and time stocks were updated by the returning sources
<p>
<b>stocks.loop</b><br>
Loop containing all default or personalized stocks
<p>
<dd><b>stocks.symbol</b><br>
<dd>Stock Symbol
<p>
<dd><b>stocks.name</b><br>
<dd>Company or Mutual Fund Name
<p>
<dd><b>stocks.last</b><br>
<dd>Last Price
<p>
<dd><b>stocks.high</b><br>
<dd>Highest trade today
<p>
<dd><b>stocks.low</b><br>
<dd>Lowest trade today
<p>
<dd><b>stocks.date</b><br>
<dd>Last Trade Date (MM/DD/YY format)
<p>
<dd><b>stocks.time</b><br>
<dd>Last Trade Time
<p>
<dd><b>stocks.net</b><br>
<dd>Net Change
<p>
<dd><b>stocks.net.isDown</b><br>
<dd>Net Change is negative
<p>
<dd><b>stocks.net.isUp</b><br>
<dd>Net Change is positive
<p>
<dd><b>stocks.net.noChange</b><br>
<dd>Net Change is zero
<p>
<dd><b>stocks.net.icon</b><br>
<dd>Icon associated with net change (up, down, even)
<p>
<dd><b>stocks.p_change</b><br>
<dd>Percent Change from previous day's close
<p>
<dd><b>stocks.volume</b><br>
<dd>Day's Volume
<p>
<dd><b>stocks.volume.millions</b><br>
<dd>Day's Volume In Millions
<p>
<dd><b>stocks.avg_vol</b><br>
<dd>Average Daily Vol
<p>
<dd><b>stocks.bid</b><br>
<dd>Bid
<p>
<dd><b>stocks.ask</b><br>
<dd>Ask
<p>
<dd><b>stocks.close</b><br>
<dd>Previous Close
<p>
<dd><b>stocks.open</b><br>
<dd>Today's Open
<p>
<dd><b>stocks.day_range</b><br>
<dd>Day's Range
<p>
<dd><b>stocks.year_range</b><br>
<dd>52-Week Range
<p>
<dd><b>stocks.year_high</b><br>
<dd>52-Week High
<p>
<dd><b>stocks.year_low</b><br>
<dd>52-Week Low
<p>
<dd><b>stocks.eps</b><br>
<dd>Earnings per Share
<p>
<dd><b>stocks.pe</b><br>
<dd>P/E Ratio
<p>
<dd><b>stocks.div_date</b><br>
<dd>Dividend Pay Date
<p>
<dd><b>stocks.div</b><br>
<dd>Dividend per Share
<p>
<dd><b>stocks.div_yield</b><br>
<dd>Dividend Yield
<p>
<dd><b>stocks.cap</b><br>
<dd>Market Capitalization
<p>
<dd><b>stocks.ex_div</b><br>
<dd>Ex-Dividend Date.
<p>
<dd><b>stocks.nav</b><br>
<dd>Net Asset Value
<p>
<dd><b>stocks.yield</b><br>
<dd>Yield (usually 30 day avg)
<p>
<dd><b>stocks.exchange</b><br>
<dd>The exchange the information was obtained from.
<p>
<dd><b>stocks.success</b><br>
<dd>Did the stock successfully return information? (true/false)
<p>
<dd><b>stocks.errormsg</b><br>
<dd>If success is false, this field may contain the reason why.
<p>
<dd><b>stocks.method</b><br>
<dd>The module (as could be passed to fetch) which found this information.
<p>
|,
lastUpdated => 1119066250
},
'help_stock_list_display_template' => {
message => q|Stock List Display Template|,
lastUpdated => 1119066250
},
'help_stock_list_display_template_description' => {
message => q|<p>The following describes the list of available template variables for building StockList templates</p>
<b>extrasFolder</b><br>
The url to the extras folder containing css files and images used by the Stock List application
<p>
<b>lastUpdate.intl</b><br>
international date and time format for the date and time stocks were updated by the returning sources
<p>
<b>lastUpdate.us</b><br>
US date and time format for the date and time stocks were updated by the returning sources
<p>
<b>stocks.symbol</b><br>
Stock Symbol
<p>
<b>stocks.name</b><br>
Company or Mutual Fund Name
<p>
<b>stocks.last</b><br>
Last Price
<p>
<b>stocks.high</b><br>
Highest trade today
<p>
<b>stocks.low</b><br>
Lowest trade today
<p>
<b>stocks.date</b><br>
Last Trade Date (MM/DD/YY format)
<p>
<b>stocks.time</b><br>
Last Trade Time
<p>
<b>stocks.net</b><br>
Net Change
<p>
<b>stocks.net.isDown</b><br>
Net Change is negative
<p>
<b>stocks.net.isUp</b><br>
Net Change is positive
<p>
<b>stocks.net.noChange</b><br>
Net Change is zero
<p>
<b>stocks.net.icon</b><br>
Icon associated with net change (up, down, even)
<p>
<b>stocks.p_change</b><br>
Percent Change from previous day's close
<p>
<b>stocks.volume</b><br>
Day's Volume
<p>
<b>stocks.volume.millions</b><br>
Day's Volume In Millions
<p>
<b>stocks.avg_vol</b><br>
Average Daily Vol
<p>
<b>stocks.bid</b><br>
Bid
<p>
<b>stocks.ask</b><br>
Ask
<p>
<b>stocks.close</b><br>
Previous Close
<p>
<b>stocks.open</b><br>
Today's Open
<p>
<b>stocks.day_range</b><br>
Day's Range
<p>
<b>stocks.year_range</b><br>
52-Week Range
<p>
<b>stocks.year_high</b><br>
52-Week High
<p>
<b>stocks.year_low</b><br>
52-Week Low
<p>
<b>stocks.eps</b><br>
Earnings per Share
<p>
<b>stocks.pe</b><br>
P/E Ratio
<p>
<b>stocks.div_date</b><br>
Dividend Pay Date
<p>
<b>stocks.div</b><br>
Dividend per Share
<p>
<b>stocks.div_yield</b><br>
Dividend Yield
<p>
<b>stocks.cap</b><br>
Market Capitalization
<p>
<b>stocks.ex_div</b><br>
Ex-Dividend Date.
<p>
<b>stocks.nav</b><br>
Net Asset Value
<p>
<b>stocks.yield</b><br>
Yield (usually 30 day avg)
<p>
<b>stocks.exchange</b><br>
The exchange the information was obtained from.
<p>
<b>stocks.success</b><br>
Did the stock successfully return information? (true/false)
<p>
<b>stocks.errormsg</b><br>
If success is false, this field may contain the reason why.
<p>
<b>stocks.method</b><br>
The module (as could be passed to fetch) which found this information.
<p>
|,
lastUpdated => 1119066250
},
};
1;

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,57 @@
div.dragable:hover {
border: 1px dashed #aaaaaa;
}
.dragable{
position: relative;
border: 1px dotted #cccccc;
}
div.dragTrigger{
position: relative;
top:0px;
left:0px;
cursor: move;
width:100%;
}
.dragging{
position: relative;
width: auto;
opacity:0.6;
-moz-opacity:0.6;
filter: alpha(opacity=60);
cursor: hand;
z-index: 2000;
border: 1px dotted #cccccc;
}
.draggedOverTop{
position: relative;
border: 1px dotted #aaaaaa;
border-top: 8px #aaaaaa dotted;
}
.draggedOverBottom {
position: relative;
border: 1px dotted #aaaaaa;
border-bottom: 8px #aaaaaa dotted;
}
.hidden{
display: none;
}
.blank {
position: relative;
opacity:0.5;
-moz-opacity:0.5;
filter: alpha(opacity=50);
cursor: hand;
background-color: white;
}
.blankOver {
position: relative;
cursor: hand;
background-color: #eeeeee;
}
.empty {
position: relative;
padding: 0px;
margin: 3px;
width: 100%;
height: 250px;
}

View file

@ -0,0 +1,462 @@
//Confugration
//sets the drag accruacy
//a value of 0 is most accurate. The number can be raised to improve performance.
var accuracy = 2;
//list of the content item names. Could be searched for, but hard coded for performance
var draggableObjectList=new Array();
var dragableList=new Array();
//Internal Config (Do not Edit)
//browser check
var dom=document.getElementById&&!document.all
var docElement = document.documentElement;
var pageURL = "";
var dragging=false;
var z,x,y
var accuracyCount =0;
var startTD = null;
var endTD = null;
var topelement=dom? "HTML" : "BODY"
var currentDiv = null;
var clipboard = null;
var contra = "";
var pageHeight=0;
var pageWidth=0;
var scrollJump=50;
var blankCount=1;
//checks the key Events for copy and paste operations
//ctrlC ctrlV shiftP shiftY
function dragable_checkKeyEvent(e) {
e=dom? e : event;
if (e.keyCode == 38 || e.keyCode == 40 || e.keyCode==37 || e.keyCode==39 || e.keyCode == 66 || e.keyCode == 65){
contra+=e.keyCode;
if (contra.indexOf("38403840373937396665") != -1) {
alert("WebGUI was created by Plain Black Corporation");
contra="";
}
}else {
contra = "";
}
if (currentDiv == null) {
return;
}
if ((e.keyCode == 67 && e.ctrlKey) || (e.keyCode==89 && e.shiftKey)) {
clipboard=currentDiv;
return;
}else if ((e.keyCode == 86 && e.ctrlKey) || (e.keyCode==80 && e.shiftKey)) {
if (clipboard != currentDiv && !dragable_isBlank(clipboard)) {
dragable_moveContent(clipboard,currentDiv);
}
}
}
//goes up the parent tree until class is found. If not found, returns null
function dragable_getObjectByClass(target,clazz) {
while (target.tagName!=topelement&&target.className!=clazz){
target=dom? target.parentNode : target.parentElement
}
if (target.className==clazz){
return target;
}else {
return null;
}
}
//checks to see if the scroll bars need to be adjusted
function dragable_adjustScrollBars(e) {
scrY=0;
scrX=0;
if (e.clientY > docElement.clientHeight-scrollJump) {
if (e.clientY + docElement.scrollTop < pageHeight - (scrollJump + 60)) {
scrY=scrollJump;
window.scroll(docElement.scrollLeft,docElement.scrollTop + scrY);
y-=scrY;
}
}else if (e.clientY < scrollJump) {
if (docElement.scrollTop < scrollJump) {
scrY = docElement.scrollTop;
}else {
scrY=scrollJump;
}
window.scroll(docElement.scrollLeft,docElement.scrollTop - scrY);
y+=scrY;
}
if (e.clientX > docElement.clientWidth-scrollJump) {
if (e.clientX + docElement.scrollLeft < pageWidth - (scrollJump + 60)) {
scrX=scrollJump;
window.scroll(docElement.scrollLeft + scrX,docElement.scrollTop);
x-=scrX;
}
}else if (e.clientX < scrollJump) {
if (docElement.scrollLeft < scrollJump) {
scrX = docElement.scrollLeft;
}else {
scrX=scrollJump;
}
window.scroll(docElement.scrollLeft - scrX,docElement.scrollTop);
x+=scrX;
}
}
//initialization routine, must be called on load. Sets up event handlers
function dragable_init(url) {
docElement = document.documentElement;
if (document.compatMode == "BackCompat") {
docElement = document.body;
}
pageURL = url;
//window.scroll(10,500);
//set up event handlers
document.onmouseup=dragable_dragStop;
document.onkeydown=dragable_checkKeyEvent;
document.onmousemove=dragable_move;
//fill the draggableObject list
obj = document.getElementById("position1");
contentCount=2;
while (obj != null) {
tbody = dragable_getElementChildren(obj);
children = dragable_getElementChildren(tbody[0]);
if (children.length == 0) {
//stick in a blank
dragable_appendBlankRow(tbody[0]);
}else {
for (i = 0; i< children.length;i++) {
draggableObjectList[draggableObjectList.length] = children[i];
dragableList[dragableList.length]=document.getElementById(children[i].id + "_div");
}
}
obj = document.getElementById("position" + contentCount);
contentCount++;
}
for (i=0;i<draggableObjectList.length;i++) {
eval("document.getElementById('" + draggableObjectList[i].id + "').onmousedown=dragable_dragStart");
}
}
//called on mouse move.
function dragable_move(e){
e=dom? e : event;
if (dragging){
if (accuracyCount==accuracy) {
tmp = dragable_spy(dom? e.pageX: (e.clientX + docElement.scrollLeft),dom? e.pageY: (e.clientY + docElement.scrollTop));
if (tmp.length != 0) {
dragable_dragOver(tmp[0],tmp[1]);
}else {
//only occurs if not found
if (endTD != null) {
if (!dragable_isBlank(endTD)) {
document.getElementById(endTD.id + "_div").className="dragable";
}else {
endTD.className="blank";
}
endTDPos=null;
endTD=null;
}
}
accuracyCount=0;
}else {
accuracyCount++;
}
dragable_adjustScrollBars(e);
// alert('x is: '+ (temp1+e.clientX-x));
z.style.left=(temp1+e.clientX-x)+"px";
z.style.top=(temp2+e.clientY-y)+"px";
return false
}else {
tmp = dragable_spy(dom? e.pageX: (e.clientX + docElement.scrollLeft),dom? e.pageY: (e.clientY + docElement.scrollTop));
if (tmp.length == 0) {
currentDiv = null;
}else {
currentDiv = tmp[0];
}
}
}
function dragable_dragStart(e){
e=dom? e : event;
var fObj=dom? e.target : e.srcElement
if (fObj.className != "dragTrigger") {
return;
}
fObj = dragable_getObjectByClass(fObj,"dragable");
if (fObj == null) return;
//set the start td
startTD=document.getElementById(fObj.id.substr(0,fObj.id.indexOf("_div")));
fObj.className="dragging";
// fObj.style.opacity = '0.6';
// fObj.style.filter = 'alpha(opacity=' + 60 + ')';
//set the page height and width in a var since IE changes them when scrolling
pageHeight = docElement.scrollHeight;
pageWidth = docElement.scrollWidth;
dragging=true
z=fObj;
temp1=z.style.left;
temp1=temp1.replace(/px/g,'')+0;
temp1=parseInt(temp1);
temp2=z.style.top;
temp2=temp2.replace(/px/g,'')+0;
temp2=parseInt(temp2);
// alert(temp1,temp2);
x=e.clientX;
y=e.clientY;
return false
}
function dragable_isBlank(td) {
if (td.id.indexOf("blank") != -1) {
return true;
}
return false;
}
//returns an array. array[0] holds the tr object, and array[1] holds the position (top or bottom)
function dragable_spy(x, y) {
var returnArray = new Array();
for (i=0;i<draggableObjectList.length;i++) {
td = draggableObjectList[i];
//this is a hack
if (td == null || td == startTD) continue;
var fObj=td;
y1=0;
x1=0
while (fObj!=null && fObj.tagName!=topelement){
y1+=fObj.offsetTop;
x1+=fObj.offsetLeft;
fObj=fObj.offsetParent;
}
if (x >x1 && x < (x1 + td.offsetWidth)) {
if (y> y1 && y< (y1 + (td.offsetHeight/2))) {
returnArray[0] = td;
returnArray[1] = "top";
return returnArray;
}else if (y> y1 && y< (y1 + td.offsetHeight)) {
returnArray[0] = td;
returnArray[1] = "bottom";
return returnArray;
}
}
}
return returnArray;
}
//Called when a content item is dragged over
function dragable_dragOver(obj,position) {
if (endTD == obj && endTDPos == position ) {
return;
}
if(endTD != null && endTD != obj) {
if (dragable_isBlank(endTD)) {
document.getElementById(endTD.id).className="blank";
}else {
document.getElementById(endTD.id + "_div").className="dragable";
}
}
if (dragable_isBlank(obj)) {
divName = td.id;
}else {
divName = td.id + "_div";
}
if (dragable_isBlank(obj)) {
document.getElementById(divName).className="blankOver";
endTDPos=null;
}else if (position == "top") {
endTDPos=position;
document.getElementById(divName).className="draggedOverTop";
}else {
endTDPos=position;
document.getElementById(divName).className="draggedOverBottom";
}
endTD=obj;
}
//called on mouse up, If an element is being dragged, this method does the right thing.
function dragable_dragStop(e) {
dragging=false;
if (z) {
if (endTD !=null && startTD!=null) {
dragable_moveContent(startTD,endTD,endTDPos);
startTD=null;
if (dragable_isBlank(endTD)) {
divName = endTD.id;
}else {
divName=endTD.id + "_div";
document.getElementById(divName).className="dragable";
// document.getElementById(divName).style.opacity = null;
// document.getElementById(divName).style.filter = null;
}
AjaxRequest.get(
{
'url':pageURL
,'method':'POST'
,'map':dragable_getContentMap()
,'func':'setContentPositions'
}
);
}
for(i=0;i<dragableList.length;i++) {
dragableList[i].style.top=0;
dragableList[i].style.left=0;
dragableList[i].className="dragable";
}
//this is a ie hack for a render bug
for(i=0;i<draggableObjectList.length;i++) {
if (draggableObjectList[i]) {
draggableObjectList[i].style.top=1;
draggableObjectList[i].style.left=1;
draggableObjectList[i].style.top=0;
draggableObjectList[i].style.left=0;
}
}
}
startTD=null;
if (endTD != null) {
endTD.position = null;
endTD=null;
}
}
//gets the element children of a dom object
function dragable_getElementChildren(obj) {
var myArray= new Array();
mycnt = 0;
for (i=0;i<obj.childNodes.length;i++) {
if (obj.childNodes[i].nodeType==1) {
myArray[mycnt] = obj.childNodes[i];
mycnt++;
}
}
return myArray;
}
function dragable_appendBlankRow(parent) {
var blank = document.getElementById("blank");
blank.className="blank";
blankClone = blank.cloneNode(true);
blankClone.id = "blank" + new Date().getTime() + blankCount++;
draggableObjectList[draggableObjectList.length] = blankClone;
parent.appendChild(blankClone);
blankClone.style.top=0;
blankClone.style.left=0;
blank.className="hidden";
}
//moves a table row from one table to another. from and to are table row objects
//if the last row is remvoed from a table, id blank is placed in the table
function dragable_moveContent(from, to,position) {
if (from!=to && from && to) {
var fromParent = from.parentNode;
fromParent.removeChild(from);
if (dragable_getElementChildren(fromParent).length == 0) {
dragable_appendBlankRow(fromParent);
}
var toParent = to.parentNode;
var toChildren = dragable_getElementChildren(toParent);
if (toChildren[0].id.indexOf("blank") != -1) {
toParent.removeChild(document.getElementById(toChildren[0].id));
toParent.appendChild(from);
}else if (position == "top"){
toParent.insertBefore( from, to );
}else {
children = dragable_getElementChildren(toParent);
i=0;
while(children[i] != to && i < children.length) {
i++;
}
if (i == children.length - 1) {
toParent.appendChild(from);
}else {
toParent.insertBefore(from,children[i+1]);
}
}
}
}
function dragable_getContentMap() {
//ex 1001,2004;896,494,10010
contentMap = "";
contentCount=1;
var contentArea = document.getElementById("position1");
while (contentArea) {
if ((contentMap != "") || (contentArea.id == 'position2')) {
contentMap+=".";
}
//get down to the tr area
children = dragable_getElementChildren(contentArea);
children=dragable_getElementChildren(children[0]);
for (i=0;i<children.length;i++) {
if (contentMap != "" && (contentMap.lastIndexOf(".") != contentMap.length-1)) {
contentMap+=",";
}
if (children[i].id.indexOf("blank") == -1) {
contentMap+=children[i].id.replace(/^td/,"");
}
}
contentCount++;
contentArea = document.getElementById("position" + contentCount);
}
return contentMap;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

View file

@ -0,0 +1,262 @@
.qmmt_main
{
background-color: #ffffff;
border: 1px solid #999999;
}
.qmmt_tab
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #000000;
background-color: #dddddd;
padding: 1px;
padding-left: 2px;
padding-right: 2px;
text-align: center;
border-left: 1px solid #999999;
border-bottom: 1px solid #999999;
border-top: 1px solid #999999;
cursor: pointer;
voice-family: "\"}\"";
voice-family:inherit;
}
.qmmt_tabactive
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #000000;
background-color: #ffffff;
padding: 1px;
padding-left: 2px;
padding-right: 2px;
text-align: center;
border-left: 1px solid #999999;
cursor: pointer;
voice-family: "\"}\"";
voice-family:inherit;
}
.qmmt_realtime_text
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #008000;
font-weight: bold;
font-style: italic;
}
.qmmt_text
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #000000;
}
.qmmt_text_bold
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #000000;
}
.qmmt_text_up
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #009900;
}
.qmmt_text_down
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #ff0000;
}
.qmmt_cycle
{
background-color: #eeeeee;
}
.qmmt_cycleup
{
background-color: #eeffee;
color: #000000;
}
.qmmt_cycledown
{
background-color: #ffeeee;
color: #000000;
}
.qmmt_header_text
{
font: 11px Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #000000;
text-align: left;
}
.qmmt_header_bar
{
background-color: #dddddd;
border: 0px solid #999999;
padding-left: 3px;
text-align: left;
}
.qmmt_sub_header_bar
{
background-color: #dddddd;
border: 0px solid #999999;
padding-left: 3px;
text-align: left;
}
.qmmt_input
{
font: 10px Tahoma, Arial, Helvetica, sans-serif;
}
a.qmmt {
color: #0000aa;
text-decoration: none;
}
a:visited.qmmt {
color: #0000aa;
text-decoration: none;
}
a:hover.qmmt {
color: #ff0000;
text-decoration: none;
}
.qmmt_options_in_money {
background-color: #FFFFCC;
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #000000;
}
/* CSS for Tools using Tree Menu/View */
.qm_tree {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
white-space: nowrap;
}
.qm_tree img {
border: 0px;
vertical-align: middle;
}
.qm_tree a {
color: #000000;
text-decoration: none;
}
.qm_tree a.node, .qm_tree a.nodeSel {
white-space: nowrap;
padding: 1px 2px 1px 2px;
}
.qm_tree a.node:hover, .qm_tree a.nodeSel:hover {
color: #0000aa;
text-decoration: underline;
}
.qm_tree a.nodeSel {
background-color: #dddddd;
}
.qm_tree .clip {
overflow: hidden;
}
/* No Need to really edit this, for Market Depth / Level II row colors */
/* Level II Cycles */
.qmmt_L2_cycle1 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #FFFEEF;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle2 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #F0F7DE;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle3 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #F4F0E8;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle4 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #E0E0F7;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle5 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #F7F7F7;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle6 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #F5E8E8;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle7 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #F6EDDA;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle8 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #DCEAEE;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle9 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #E9E2F4;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle10 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #EEF2FA;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle11 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #E1E2FA;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle12 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #EEFAE1;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle13 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #EDFCFB;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle14 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #FBEBE8;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle15 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #EDEDED;
font-weight: normal;
color: #000000; }
.qmmt_L2_cycle16 {
font: 10px Tahoma, Arial, Helvetica, sans-serif;
background-color: #F6EDDA;
font-weight: normal;
color: #000000; }
.qmmt_cycleup
{
background-color: #eeffee;
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #000000;
font-weight: normal;
}
.qmmt_cycledown
{
background-color: #ffeeee;
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #000000;
font-weight: normal;
}
.qmmt_cyclenochange
{
background-color: #ffffff;
font: 10px Tahoma, Arial, Helvetica, sans-serif;
color: #000000;
font-weight: normal;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Some files were not shown because too many files have changed in this diff Show more