Merge commit WebGUI_7.6.9-beta into survey-rfe

* commit 'tags/WebGUI_7.6.9-beta': (31 commits)
  Release 7.6.9-beta
  preparing for 7.6.9 release
  fixed: Exporting to static files can leak large amounts of memory
  fixed: HTTP Proxy doesn't serve new content to visitors
  use to_json and from_json in more places instead of encode_json and decode_json
  Document the heretofore missing date template variable in
  Qualify a chained method call when getting Workflow instances.  If the
  Attempt to fix IE6 bug
  fixed: ukplayer example is now loaded with swfobject.js released under the MIT licence, see gotcha's and /extras/ukplayer
  Added a style for printing Alumni pages
  Emails sent about low stock should have status unread, not completed.
  Moved draggable.js to extras/yui-webgui/build/layout since it is now a wrapper around YUI dragdrob
  Attributions in the changelog for a patch provided to fix a bug.
  whups, left in console.logs
  Updated draggable.js to wrap the YUI
  fixed #4137: Calendar Search page has extra head tags in body
  Fix a typo typo in the Operation/Workflow POD.
  Forward port Shelf view fix.  Was not displaying child shelves, only self.
  Forward port the PayDriver bug fixes from 7.5 branch.  Labels are always
  fixed #9264: new slideShow.swf uploaded in extras/ukplayer (United Knowledge/Arjan Widlak)
  ...

Conflicts:
	lib/WebGUI/Asset/Wobject/Survey.pm
This commit is contained in:
Patrick Donelan 2009-01-22 04:39:43 +00:00
commit 1376c8ae92
60 changed files with 999 additions and 1199 deletions

View file

@ -1,3 +1,18 @@
7.6.9
- fixed: ukplayer example is now loaded with swfobject.js released under the
MIT licence, see gotcha's and /extras/ukplayer
- fixed #9264: new slideShow.swf uploaded in extras/ukplayer (United Knowledge/Arjan Widlak)
- fixed #9428: added code to ASSET::get to include keywords when no property name is requested
- marked sbin scripts as executable
- fixed #9492: Problem in passing form variables to Macro SQL inside a snippet
- fixed #9404: Head tags for admin user with admin mode off
- fixed #9507: Navigation: relDepth is calculated with starting point, instead of the first displayed page
- fixed a bug where no Payment Gateway labels show up when checking out.
- fixed #9511: Subcategories displayed incorrectly (Henry Tang, Long Term Results B.v.)
- fixed #4137: Calendar Search page has head tags in body
- fixed: HTTP Proxy doesn't serve new content to visitors
- fixed: Exporting to static files can leak large amounts of memory
7.6.8
- added #!/usr/bin/env perl to all utility scripts
- Updated captcha images to be more legible.

File diff suppressed because one or more lines are too long

View file

@ -7,6 +7,14 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
7.6.9
--------------------------------------------------------------------
* The ukplayer example, slideshow.html in /extras/ukplayer, used
to be loaded with a javascript called AC_RunActiveContent.js.
This file is removed due to licencing issues. If you use this
script in custom HTML, you should replace it with swfobject.js
as is demonstrated in the new example slideshow.html file.
7.6.8
--------------------------------------------------------------------
* Due to an error during the 7.6.6 development cycle, an Itransact template,

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,149 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 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
#-------------------------------------------------------------------
our ($webguiRoot);
BEGIN {
$webguiRoot = "../..";
unshift (@INC, $webguiRoot."/lib");
}
use strict;
use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Shop::Pay;
use WebGUI::Shop::PayDriver;
my $toVersion = '7.6.9';
my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
fixPayDriverLabels($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
# # and here's our code
# print "DONE!\n" unless $quiet;
#}
#----------------------------------------------------------------------------
# Get rid of the duplicate label properties in the PayDrivers.
sub fixPayDriverLabels {
my $session = shift;
print "\tGet rid of the duplicate label properties in the PayDrivers... " unless $quiet;
my $pay = WebGUI::Shop::Pay->new($session);
my $gateways = $pay->getPaymentGateways;
foreach my $gateway (@{ $gateways }) {
my $gatewayId = $gateway->getId;
my $jsonLabel = $gateway->get('label');
next if $jsonLabel;
my $dbLabel = $session->db->quickScalar('select label from paymentGateway where paymentGatewayId=?', [$gatewayId]);
my $properties = $gateway->get();
$properties->{label} = $dbLabel;
$gateway->update($properties);
}
$session->db->write('alter table paymentGateway drop column label');
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------
# Add a package to the import node
sub addPackage {
my $session = shift;
my $file = shift;
# Make a storage location for the package
my $storage = WebGUI::Storage->createTemp( $session );
$storage->addFileFromFilesystem( $file );
# Import the package into the import node
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
# Make the package not a package anymore
$package->update({ isPackage => 0 });
# Set the default flag for templates added
my $assetIds
= $package->getLineage( ['self','descendants'], {
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
} );
for my $assetId ( @{ $assetIds } ) {
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
if ( !$asset ) {
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
next;
}
$asset->update( { isDefault => 1 } );
}
return;
}
#-------------------------------------------------
sub start {
my $configFile;
$|=1; #disable output buffering
GetOptions(
'configFile=s'=>\$configFile,
'quiet'=>\$quiet
);
my $session = WebGUI::Session->open($webguiRoot,$configFile);
$session->user({userId=>3});
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Upgrade to ".$toVersion});
return $session;
}
#-------------------------------------------------
sub finish {
my $session = shift;
updateTemplates($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->commit;
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
$session->close();
}
#-------------------------------------------------
sub updateTemplates {
my $session = shift;
return undef unless (-d "packages-".$toVersion);
print "\tUpdating packages.\n" unless ($quiet);
opendir(DIR,"packages-".$toVersion);
my @files = readdir(DIR);
closedir(DIR);
my $newFolder = undef;
foreach my $file (@files) {
next unless ($file =~ /\.wgpkg$/);
# Fix the filename to include a path
$file = "packages-" . $toVersion . "/" . $file;
addPackage( $session, $file );
}
}
#vim:ft=perl

View file

@ -1,7 +1,7 @@
package WebGUI;
our $VERSION = '7.6.8';
our $VERSION = '7.6.9';
our $STATUS = "beta";

View file

@ -196,8 +196,15 @@ sub www_view {
my @contribs = ();
foreach my $row ( @{$p->getPageData} ) {
my $assetId = $row->{assetId};
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
push(@contribs,$asset->get);
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
my $props = $asset->get;
if (ref $asset eq "WebGUI::Asset::Post") {
$asset = $asset->getThread;
$props = $asset->get;
$props->{className} = "WebGUI::Asset::Post";
}
push(@contribs,$props);
}
my $contribsCount = $p->getRowCount;

View file

@ -753,6 +753,8 @@ sub get {
return $self->{_properties}{$propertyName};
}
my %copyOfHashRef = %{$self->{_properties}};
my $keywords = WebGUI::Keyword->new($self->session)->getKeywordsForAsset({asset => $self});
if( $keywords ne '' ) { $copyOfHashRef{ keywords } = $keywords ; }
return \%copyOfHashRef;
}
@ -1331,7 +1333,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
return undef unless $self->canEdit;
return undef unless $self->canEdit && $self->session->var->isAdminOn;
return $self->{_toolbar}
if (exists $self->{_toolbar});
my $userUiLevel = $self->session->user->profileField("uiLevel");
@ -1430,6 +1432,7 @@ sub getToolbar {
. $self->getUrl("op=assetManager") . '">' . $i18n->get("manage") . '</a></li>';
}
$output .= '</ul></div></div>' . $toolbar . '</div>';
$self->{_toolbar} = $output;
return $output;
}
@ -1986,9 +1989,8 @@ Executes what is necessary to make the view() method work with content chunking.
sub prepareView {
my $self = shift;
if ($self->session->var->isAdminOn) {
$self->{_toolbar} = $self->getToolbar;
}
##Make the toolbar now and stick it in the cache.
$self->getToolbar;
my $style = $self->session->style;
my @keywords = @{WebGUI::Keyword->new($self->session)->getKeywordsForAsset({asset=>$self, asArrayRef=>1})};
if (scalar @keywords) {

View file

@ -19,7 +19,7 @@ use base 'WebGUI::Asset::File::GalleryFile';
use Carp qw( carp croak );
use Image::ExifTool qw( :Public );
use JSON qw/ encode_json decode_json /;
use JSON qw/ to_json from_json /;
use URI::Escape;
use Tie::IxHash;
use List::MoreUtils;
@ -221,7 +221,7 @@ sub getExifData {
# Our processing and eliminating of bad / unparsable keys
# isn't perfect, so handle errors gracefully
my $exif = eval { decode_json( $self->get('exifData') ) };
my $exif = eval { from_json( $self->get('exifData') ) };
if ( $@ ) {
$self->session->errorHandler->warn(
"Could not parse JSON data for EXIF in Photo '" . $self->get('title')
@ -461,7 +461,7 @@ sub updateExifDataFromFile {
}
$self->update({
exifData => encode_json( $info ),
exifData => to_json( $info ),
});
}

View file

@ -194,23 +194,24 @@ sub purgeCache {
sub view {
my $self = shift;
my $calledAsWebMethod = shift;
my $versionTag = WebGUI::VersionTag->getWorking($self->session, 1);
my $session = $self->session;
my $versionTag = WebGUI::VersionTag->getWorking($session, 1);
my $noCache =
$self->session->var->isAdminOn
$session->var->isAdminOn
|| $self->get("cacheTimeout") <= 10
|| ($versionTag && $versionTag->getId eq $self->get("tagId"));
unless ($noCache) {
my $out = WebGUI::Cache->new($self->session,"view_".$calledAsWebMethod."_".$self->getId)->get;
my $out = WebGUI::Cache->new($session,"view_".$calledAsWebMethod."_".$self->getId)->get;
return $out if $out;
}
my $output = $self->get("snippet");
WebGUI::Macro::process($self->session,\$output);
$output = $self->getToolbar.$output if ($self->session->var->isAdminOn && !$calledAsWebMethod);
$output = $self->getToolbar.$output if ($session->var->isAdminOn && !$calledAsWebMethod);
if ($self->getValue("processAsTemplate")) {
$output = WebGUI::Asset::Template->processRaw($self->session, $output, $self->get);
$output = WebGUI::Asset::Template->processRaw($session, $output, $self->get);
}
WebGUI::Macro::process($session,\$output);
unless ($noCache) {
WebGUI::Cache->new($self->session,"view_".$calledAsWebMethod."_".$self->getId)->set($output,$self->get("cacheTimeout"));
WebGUI::Cache->new($session,"view_".$calledAsWebMethod."_".$self->getId)->set($output,$self->get("cacheTimeout"));
}
return $output;
}

View file

@ -2064,14 +2064,9 @@ sub www_search {
});
# This is very bad! It should be $self->processStyle or whatnot.
$self->session->http->sendHeader;
my $template = WebGUI::Asset::Template->new($self->session,$self->get("templateIdSearch"));
my $style = $self->session->style->process($self->getSeparator,$self->get("styleTemplateId"));
my ($head, $foot) = split($self->getSeparator,$style);
$self->session->output->print($head, 1);
$self->session->output->print($self->processTemplate($var, undef, $template));
$self->session->output->print($foot, 1);
return "chunked";
return $self->processStyle(
$self->processTemplate( $var, $self->get('templateIdSearch') )
);
}
#----------------------------------------------------------------------------

View file

@ -178,6 +178,12 @@ sub definition {
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
sub getContentLastModified {
return time;
}
#-------------------------------------------------------------------
sub getCookieJar {
my $self = shift;

View file

@ -234,7 +234,11 @@ sub prepareView {
if ($vars{showAdmin}) {
# under normal circumstances we don't put HTML stuff in our code, but this will make it much easier
# for end users to work with our templates
$session->style->setScript($session->url->extras("draggable.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui/build/yahoo-dom-event/yahoo-dom-event.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui/build/animation/animation-min.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui/build/dragdrop/dragdrop.js"),{ type=>"text/javascript" });
$session->style->setScript($session->url->extras("yui-webgui/build/layout/draggable.js"),{ type=>"text/javascript" });
$session->style->setLink($session->url->extras("draggable.css"),{ type=>"text/css", rel=>"stylesheet", media=>"all" });
$session->style->setRawHeadTags('
<style type="text/css">

View file

@ -439,7 +439,7 @@ sub view {
# build nav variables
$pageData->{"page.rank"} = $asset->getRank;
$pageData->{"page.absDepth"} = $asset->getLineageLength;
$pageData->{"page.relDepth"} = $asset->getLineageLength - $start->getLineageLength;
$pageData->{"page.relDepth"} = $asset->getLineageLength - $absoluteDepthOfFirstPage;
$pageData->{"page.isSystem"} = $asset->get("isSystem");
$pageData->{"page.isHidden"} = $asset->get("isHidden");
$pageData->{"page.isViewable"} = $asset->canView;

View file

@ -192,7 +192,7 @@ sub freezeGraphConfig {
my $self = shift;
my $obj = shift;
return JSON::encode_json($obj);
return JSON::to_json($obj);
}
@ -404,7 +404,7 @@ sub thawGraphConfig {
my $string = shift;
return unless $string;
return JSON::decode_json($string);
return JSON::from_json($string);
}
#-------------------------------------------------------------------

View file

@ -277,7 +277,8 @@ sub view {
my @childShelves = ();
foreach my $child (@{$self->getLineage(['children'],{returnObjects=>1,includeOnlyClasses=>['WebGUI::Asset::Wobject::Shelf']})}) {
my $properties = $child->get;
$child->{url} = $self->getUrl;
$child->{url} = $child->getUrl;
$child->{title} = $child->getTitle;
push @childShelves, $child;
}

View file

@ -299,6 +299,8 @@ sub exportAsHtml {
my $message = sprintf( $i18n->get('bad user privileges') . "\n") . $asset->getUrl;
$self->session->output->print($message);
}
$exportSession->var->end;
$exportSession->close;
next;
}
@ -307,12 +309,16 @@ sub exportAsHtml {
if( !$quiet ) {
$self->session->output->print("$fullPath skipped, not exportable<br />");
}
$exportSession->var->end;
$exportSession->close;
next;
}
# tell the user which asset we're exporting.
unless ($quiet) {
my $message = sprintf $i18n->get('exporting page'), $fullPath;
$exportSession->var->end;
$exportSession->close;
$self->session->output->print($message);
}
@ -322,6 +328,8 @@ sub exportAsHtml {
$returnCode = 0;
$message = $@;
$self->session->output->print("could not export asset with URL " . $asset->getUrl . ": $@");
$exportSession->var->end;
$exportSession->close;
return ($returnCode, $message);
}
@ -332,6 +340,8 @@ sub exportAsHtml {
$returnCode = 0;
$message = $@;
$self->session->output->print("failed to export asset collateral for URL " . $asset->getUrl . ": $@");
$exportSession->var->end;
$exportSession->close;
return ($returnCode, $message);
}

View file

@ -2,7 +2,7 @@ package WebGUI::Content::AssetManager;
use strict;
use JSON qw( decode_json encode_json );
use JSON qw( from_json to_json );
use URI;
use WebGUI::Form;
use WebGUI::Paginator;
@ -221,7 +221,7 @@ sub getMoreMenu {
};
}
return encode_json \@more_fields;
return to_json \@more_fields;
}
#----------------------------------------------------------------------------
@ -309,7 +309,7 @@ sub www_ajaxGetManagerPage {
$session->http->setMimeType( 'application/json' );
return encode_json( $assetInfo );
return to_json( $assetInfo );
}
#----------------------------------------------------------------------------

View file

@ -454,7 +454,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
description => $i18n->get("We welcome your feedback."),
acknowledgement => $i18n->get("Thanks for for your interest in ^c;. We will review your message shortly."),
mailData => 1,
fieldConfiguration => JSON::encode_json(\@fieldConfig),
fieldConfiguration => JSON::to_json(\@fieldConfig),
});
}

View file

@ -35,6 +35,7 @@ our $HELP = {
'variables' => [
{ 'name' => 'title' },
{ 'name' => 'link' },
{ 'name' => 'date' },
{ 'name' => 'category' },
{ 'name' => 'author' },
{ 'name' => 'guid' },

View file

@ -137,7 +137,8 @@ sub generateCloud {
=head2 getKeywordsForAsset ( { asset => $asset } )
Returns a string of keywords separated by spaces.
Returns a string of keywords separated by spaces. If the keyword has spaces in it, it
will be quoted.
=head3 asset

View file

@ -69,7 +69,7 @@ sub www_spectreGetSiteData {
my $cookieName = $session->config->getCookieName;
my @instances = ();
foreach my $instance (@{WebGUI::Workflow::Instance->getAllInstances($session)}) {
next unless $instance->getWorkflow->get("enabled");
next unless $instance->getWorkflow && $instance->getWorkflow->get("enabled");
push(@instances, {
instanceId => $instance->getId,
priority => $instance->get("priority"),

View file

@ -202,7 +202,7 @@ sub www_demoteWorkflowActivity {
=head2 www_editWorkflow ( session, workflow )
Displays displays the editable properties of a workflow.
Displays the editable properties of a workflow.
=cut

View file

@ -42,10 +42,6 @@ back up to the top.
The class of the new PayDriver object to create.
=head4 $label
The label for this instance.
=head4 $options
A list of properties to assign to this PayDriver. See C<definition> for details.
@ -55,17 +51,14 @@ A list of properties to assign to this PayDriver. See C<definition> for details
sub addPaymentGateway {
my $self = shift;
my $requestedClass = shift;
my $label = shift;
my $options = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a class to create an object})
unless defined $requestedClass;
WebGUI::Error::InvalidParam->throw(error => q{The requested class is not enabled in your WebGUI configuration file}, param => $requestedClass)
unless isIn($requestedClass, (keys %{$self->getDrivers}) );
WebGUI::Error::InvalidParam->throw(error => q{Must provide a label to create an object})
unless $label;
WebGUI::Error::InvalidParam->throw(error => q{You must pass a hashref of options to create a new PayDriver object})
unless defined($options) and ref $options eq 'HASH' and scalar keys %{ $options };
my $driver = eval { WebGUI::Pluggable::instanciate($requestedClass, 'create', [ $self->session, $label, $options ]) };
my $driver = eval { WebGUI::Pluggable::instanciate($requestedClass, 'create', [ $self->session, $options ]) };
return $driver;
}

View file

@ -38,7 +38,6 @@ readonly session => my %session;
readonly className => my %className;
readonly paymentGatewayId => my %paymentGatewayId;
readonly options => my %options;
readonly label => my %label;
#-------------------------------------------------------------------
@ -49,7 +48,7 @@ Private method used to build objects, shared by new and create.
=cut
sub _buildObj {
my ($class, $session, $requestedClass, $paymentGatewayId, $label, $options) = @_;
my ($class, $session, $requestedClass, $paymentGatewayId, $options) = @_;
my $self = {};
bless $self, $requestedClass;
register $self;
@ -57,10 +56,9 @@ sub _buildObj {
my $id = id $self;
$session{ $id } = $session;
$paymentGatewayId{ $id } = $paymentGatewayId;
$label{ $id } = $label;
$options{ $id } = $options;
$className{ $id } = $requestedClass;
$paymentGatewayId{ $id } = $paymentGatewayId;
return $self;
}
@ -137,7 +135,7 @@ to do calculations.
#-------------------------------------------------------------------
=head2 create ( $session, $label, $options )
=head2 create ( $session, $options )
Constructor for new WebGUI::Shop::PayDriver objects. Returns a WebGUI::Shop::PayDriver object.
To access driver objects that have already been configured, use C<new>.
@ -146,10 +144,6 @@ To access driver objects that have already been configured, use C<new>.
A WebGUI::Session object.
=head4 $label
A human readable label for this payment.
=head4 $options
A list of properties to assign to this PayDriver. See C<definition> for details.
@ -161,23 +155,21 @@ sub create {
my $session = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a session variable})
unless ref $session eq 'WebGUI::Session';
my $label = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a human readable label in the hashref of options})
unless $label;
my $options = shift;
WebGUI::Error::InvalidParam->throw(error => q{Must provide a hashref of options})
unless ref $options eq 'HASH' and scalar keys %{ $options };
WebGUI::Error::InvalidParam->throw(error => q{Must provide a human readable label in the hashref of options})
unless exists $options->{label} && $options->{label};
# Generate a unique id for this payment
my $paymentGatewayId = $session->id->generate;
# Build object
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $label, $options);
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $options);
# and persist this instance in the db
$session->db->write('insert into paymentGateway (paymentGatewayId, label, className) VALUES (?,?,?)', [
$session->db->write('insert into paymentGateway (paymentGatewayId, className) VALUES (?,?)', [
$paymentGatewayId,
$label,
$class,
]);
@ -550,7 +542,7 @@ sub new {
my $options = from_json($properties->{options});
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $properties->{ label }, $options);
my $self = WebGUI::Shop::PayDriver->_buildObj($session, $class, $paymentGatewayId, $options);
return $self;
}
@ -600,7 +592,7 @@ sub processPropertiesFromFormPost {
);
}
}
$properties{title} = $fullDefinition->[0]{name} if ($properties{title} eq "" || lc($properties{title}) eq "untitled");
$properties{label} = $fullDefinition->[0]{name} if ($properties{label} eq "" || lc($properties{label}) eq "untitled");
$self->update(\%properties);
}

View file

@ -158,7 +158,7 @@ sub get {
$opts = {};
}
else {
$opts = decode_json($opts);
$opts = JSON::from_json($opts);
}
if (defined $param) {
return $opts->{$param};
@ -303,7 +303,7 @@ sub update {
my $options = shift || {};
WebGUI::Error::InvalidParam->throw(error => 'update was not sent a hashref of options to store in the database')
unless ref $options eq 'HASH' and scalar keys %{ $options };
my $jsonOptions = encode_json($options);
my $jsonOptions = JSON::to_json($options);
$options{id $self} = $jsonOptions;
$self->session->db->write('update shipper set options=? where shipperId=?', [$jsonOptions, $self->getId]);
return undef;

View file

@ -128,7 +128,7 @@ sub execute {
if ($belowThreshold) {
my $inbox = WebGUI::Inbox->new($self->session);
$inbox->addMessage({
status => 'completed',
status => 'unread',
subject => $self->get('subject'),
groupId => $self->get('toGroup'),
message => $message,

View file

@ -725,8 +725,8 @@ our $I18N = {
},
'imageDensity description' => {
message => q{The density of the image. Print-quality images are more than three times the size of web-quality images.},
lastUpdated => 0,
message => q{The density of the image. Print-quality images are more than three times the resolution of web-quality images.},
lastUpdated => 1231764657,
context => q{Description of asset property},
},

View file

@ -331,8 +331,8 @@ it would be best to make sure the names are the same.|,
},
'CATEGORY_NAME_loop' => {
message => q|A loop containting attributes and values for those attributes is created for each category in this matrix. The name of the loop is the category name with spaces replaced with hyphens and a _loop added to the end. So if you have a category called "Bells and Whistles" then the loop would be called "bells-and-whistles_loop".|,
lastUpdated => 0,
message => q|A loop containing attributes, and values for those attributes, is created for each category in this matrix. The name of the loop is the category name with spaces replaced with hyphens and a _loop added to the end. So if you have a category called "Bells and Whistles" then the loop would be called "bells-and-whistles_loop".|,
lastUpdated => 1231764520,
context => q|Description of the CATEGORY_NAME_loop tmpl_var for the template help.|,
},

View file

@ -121,6 +121,11 @@ our $I18N = {
lastUpdated => 0,
},
'date' => {
message => q|The publication date for this item.|,
lastUpdated => 0,
},
'author' => {
message => q|The publisher of this item.|,
lastUpdated => 0,

0
sbin/changeIobStatus.pl Normal file → Executable file
View file

0
sbin/diskUsage.pl Normal file → Executable file
View file

0
sbin/fileImport.pl Normal file → Executable file
View file

0
sbin/galleryImport.pl Normal file → Executable file
View file

0
sbin/generateContent.pl Normal file → Executable file
View file

10
sbin/installClass.pl Normal file → Executable file
View file

@ -1,6 +1,16 @@
#!/usr/bin/env perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 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 lib "../lib";
use strict;
use Getopt::Long;

0
sbin/maintenanceMode.pl Normal file → Executable file
View file

0
sbin/purgeWGAccess.pl Normal file → Executable file
View file

0
sbin/rebuildLineage.pl Normal file → Executable file
View file

0
sbin/search.pl Normal file → Executable file
View file

0
sbin/spectre.pl Normal file → Executable file
View file

0
sbin/testCodebase.pl Normal file → Executable file
View file

0
sbin/testEnvironment.pl Normal file → Executable file
View file

0
sbin/thumbnailer.pl Normal file → Executable file
View file

0
sbin/upgrade.pl Normal file → Executable file
View file

0
sbin/userImport.pl Normal file → Executable file
View file

View file

@ -16,7 +16,7 @@ use lib "$FindBin::Bin/../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 14; # increment this value for each test you create
use Test::More tests => 15; # increment this value for each test you create
use WebGUI::Asset::Snippet;
my $session = WebGUI::Test->session;
@ -70,6 +70,24 @@ isnt ($wwwViewOutput, undef, 'www_view returns something');
my $editOutput = $snippet->www_edit;
isnt ($editOutput, undef, 'www_edit returns something');
$snippet->update({
title => "authMethod",
processAsTemplate => 1,
cacheTimeout => 1,
snippet => q|^SQL(select value from settings where name="<tmpl_var title>");|
});
my $sqlMacroAdded = exists $session->config->get('macros')->{'SQL'};
if (! $sqlMacroAdded) {
$session->config->addToHash('macros', 'SQL', 'SQL');
}
is($snippet->view(), 'WebGUI', 'Interpolating macros in works with template in the correct order');
if (! $sqlMacroAdded) {
$session->config->deleteFromHash('macros', 'SQL');
}
TODO: {
local $TODO = "Tests to make later";
ok(0, 'Test indexContent method');

View file

@ -33,7 +33,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 19;
my $tests = 18;
plan tests => 1 + $tests;
#----------------------------------------------------------------------------
@ -106,15 +106,6 @@ throws_deeply ( sub { $gateway = $pay->addPaymentGateway('WebGUI::Shop::PayDrive
'addPaymentGateway croaks without a configured class',
);
throws_deeply ( sub { $gateway = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash'); },
'WebGUI::Error::InvalidParam',
{
error => 'Must provide a label to create an object',
},
'addPaymentGateway requires a label',
);
throws_deeply ( sub { $gateway = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', 'JAL'); },
'WebGUI::Error::InvalidParam',
{
@ -123,7 +114,7 @@ throws_deeply ( sub { $gateway = $pay->addPaymentGateway('WebGUI::Shop::PayDrive
'addPaymentGateway croaks without options to build a object with',
);
throws_deeply ( sub { $gateway = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', 'JAL', {}); },
throws_deeply ( sub { $gateway = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', {}); },
'WebGUI::Error::InvalidParam',
{
error => 'You must pass a hashref of options to create a new PayDriver object',
@ -135,9 +126,9 @@ my $options = {
enabled => 1,
label => 'Cold, stone hard cash',
};
$newDriver = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', 'JAL', $options);
$newDriver = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', $options);
isa_ok($newDriver, 'WebGUI::Shop::PayDriver::Cash', 'added a new, configured Cash driver');
is($newDriver->label, 'JAL', 'label passed correctly to paydriver');
is($newDriver->get('label'), 'Cold, stone hard cash', 'label passed correctly to paydriver');
#TODO: check if options are stored.
@ -212,14 +203,14 @@ my $otherOptions = {
enabled => 1,
label => 'Even harder cash',
};
$anotherDriver = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', 'Pomade', $otherOptions);
$anotherDriver = $pay->addPaymentGateway('WebGUI::Shop::PayDriver::Cash', $otherOptions);
my $gateways = $pay->getPaymentGateways;
my @returnedIds = map {$_->label} @{ $gateways };
my @returnedIds = map {$_->get('label')} @{ $gateways };
cmp_bag(
\@returnedIds,
[
qw/Cash ITransact Pomade JAL/
qw/Cash ITransact/, 'Even harder cash', 'Cold, stone hard cash',
],
'getPaymentGateways returns all create payment drivers',
);

View file

@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 49;
my $tests = 46;
plan tests => 1 + $tests;
#----------------------------------------------------------------------------
@ -150,31 +150,9 @@ cmp_deeply (
'create takes exception to not giving it a session object',
);
eval { $driver = WebGUI::Shop::PayDriver->create($session); };
eval { $driver = WebGUI::Shop::PayDriver->create($session, {}); };
$e = Exception::Class->caught();
isa_ok ($e, 'WebGUI::Error::InvalidParam', 'create takes exception to not giving it a label');
cmp_deeply (
$e,
methods(
error => 'Must provide a human readable label in the hashref of options',
),
'create takes exception to not giving it a hashref of options',
);
eval { $driver = WebGUI::Shop::PayDriver->create($session, 'Very human readable label'); };
$e = Exception::Class->caught();
isa_ok ($e, 'WebGUI::Error::InvalidParam', 'create takes exception to not giving it a hashref of options');
cmp_deeply (
$e,
methods(
error => 'Must provide a hashref of options',
),
'create takes exception to not giving it a hashref of options',
);
eval { $driver = WebGUI::Shop::PayDriver->create($session, 'Very human readable label', {}); };
$e = Exception::Class->caught();
isa_ok ($e, 'WebGUI::Error::InvalidParam', 'create takes exception to not giving it an empty hashref of options');
isa_ok ($e, 'WebGUI::Error::InvalidParam', 'create takes exception to giving it an empty hashref of options');
cmp_deeply (
$e,
methods(
@ -185,7 +163,6 @@ cmp_deeply (
# Test functionality
my $label = 'Human Readable Label';
my $options = {
label => 'Fast and harmless',
enabled => 1,
@ -193,19 +170,18 @@ my $options = {
receiptMessage => 'Pannenkoeken zijn nog lekkerder met spek',
};
$driver = WebGUI::Shop::PayDriver->create( $session, $label, $options );
$driver = WebGUI::Shop::PayDriver->create( $session, $options );
isa_ok ($driver, 'WebGUI::Shop::PayDriver', 'create creates WebGUI::Shop::PayDriver object');
like($driver->getId, $session->id->getValidator, 'driver id is a valid GUID');
my $dbData = $session->db->quickHashRef('select * from paymentGateway where paymentGatewayId=?', [ $driver->getId ]);
#diag ($driver->getId);
cmp_deeply (
$dbData,
{
paymentGatewayId => $driver->getId,
className => ref $driver,
label => $driver->label,
options => q|{"group":3,"receiptMessage":"Pannenkoeken zijn nog lekkerder met spek","label":"Fast and harmless","enabled":1}|,
},
'Correct data written to the db',
@ -213,7 +189,6 @@ cmp_deeply (
#######################################################################
#
# session

View file

@ -378,10 +378,6 @@ ul.topTabs li {
margin:0px;
padding:0px;
list-style-type:none;
position:relative;zoom:1;
width:auto;
Xposition:relative;
}
ul.topTabs li {
display:block;

View file

@ -0,0 +1,3 @@
#ALUM_wrapper #topBar, #ALUM_wrapper #ALUM_doc, #ALUM_wrapper #sddm, #ALUM_wrapper #ALUM_footer {
display: none;
}

View file

@ -1,458 +0,0 @@
//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;
var draggableListOrigClassNames = []; // make sure that we're preserving the locked-asset class, if present
//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) {
var classMatch = new RegExp("\\b" + clazz + "\\b");
while (target.tagName!=topelement && target.className.search(classMatch) == -1){
target=dom? target.parentNode : target.parentElement
}
if (target.className.search(classMatch) != -1){
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");
draggableListOrigClassNames[draggableListOrigClassNames.length] = dragableList[dragableList.length - 1].className;
}
}
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.search(/\bdragTrigger\b/) == -1) {
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";
//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";
}
var url = pageURL + dragable_getContentMap();
//window.alert(url);
document.getElementById("dragSubmitter").src = url;
}
for(i=0;i<dragableList.length;i++) {
dragableList[i].style.top=0+"px";
dragableList[i].style.left=0+"px";
dragableList[i].className = draggableListOrigClassNames[i];
// 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+"px";
draggableObjectList[i].style.left=1+"px";
draggableObjectList[i].style.top=0+"px";
draggableObjectList[i].style.left=0+"px";
}
}
}
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+"px";
blankClone.style.left=0+"px";
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;
}

View file

@ -1,292 +0,0 @@
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
var version;
var axo;
var e;
// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
try {
// version will be set for 7.X or greater players
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
if (!version)
{
try {
// version will be set for 6.X players only
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
// installed player is some revision of 6.0
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
// so we have to be careful.
// default to the first public version
version = "WIN 6,0,21,0";
// throws if AllowScripAccess does not exist (introduced in 6.0r47)
axo.AllowScriptAccess = "always";
// safe to call for 6.0r47 or greater
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 4.X or 5.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 3.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 2.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}
return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
// NS/Opera version >= 3 check for Flash plugin in plugin array
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
// Given "WIN 2,0,0,11"
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString = tempArray[1]; // "2,0,0,11"
versionArray = tempString.split(","); // ['2', '0', '0', '11']
} else {
versionArray = versionStr.split(".");
}
var versionMajor = versionArray[0];
var versionMinor = versionArray[1];
var versionRevision = versionArray[2];
// is the major.revision >= requested major.revision AND the minor version >= requested minor
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}
function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?');
else
return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '<object ';
for (var i in objAttrs)
{
str += i + '="' + objAttrs[i] + '" ';
}
str += '>';
for (var i in params)
{
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
}
str += '</object>';
}
else
{
str += '<embed ';
for (var i in embedAttrs)
{
str += i + '="' + embedAttrs[i] + '" ';
}
str += '> </embed>';
}
document.write(str);
}
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
var ret =
AC_GetArgs
( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
, null
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();
switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblclick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
case "id":
ret.objAttrs[args[i]] = args[i+1];
break;
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}

View file

@ -9,7 +9,7 @@
<image_source>/extras/ukplayer/dummycontent/explain.jpg</image_source>
<duration>5</duration>
<thumb_source>/extras/ukplayer/dummycontent/explain.jpg</thumb_source>
<sound_source>dummycontent/transporter.mp3</sound_source>
<sound_source>/extras/ukplayer/dummycontent/transporter.mp3</sound_source>
</slide>
<slide>
<width>400</width>
@ -19,7 +19,7 @@
<image_source>/extras/ukplayer/dummycontent/united-knowledge-logo.jpg</image_source>
<duration>5</duration>
<thumb_source>/extras/ukplayer/dummycontent/united-knowledge-logo.jpg</thumb_source>
<sound_source>dummycontent/transporter.mp3</sound_source>
<sound_source>/extras/ukplayer/dummycontent/transporter.mp3</sound_source>
</slide>
</slides>
</content>

Binary file not shown.

View file

@ -1,245 +1,250 @@
United Knowledge Slideshow Player - readme.txt
Copyright: United Knowledge, 2008
Under the terms of the GNU General Public License, version 2
**********************************************************************************************
* *
* The configuration XML *
* *
**********************************************************************************************
With the configuration .xml file you can customize the look and the behaviour of the
slideshow. It contains the following properties (the values are example values; there are
default values for most, but we recommend setting ALL properties yourself).
**********************************************************************************************
* Structure of the xml *
**********************************************************************************************
<config>
[properties go here]
</config>
**********************************************************************************************
* General properties *
**********************************************************************************************
<content_url>/someUrl/someXmlFile.xml</content_url>
The url to the .xml file that contains the content.
Value: an absolute or relative url to an xml file
<width>400</width>
<height>300</height>
The width and height of the player itself (this value is overwritten by the flashVars
but the tags need to be here).
Value: number in px
<default_duration>8</default_duration>
The duration of each slide. This can be overwritten by setting the duration per slide
in the content .xml file.
Value: number in seconds
<default_slidewidth>400</default_slidewidth>
<default_slideheight>300</default_slideheight>
If the width or height of a slide is larger than the values specified here, the slide
will be resized proportionally. Slides that are smaller than the slidshow will not be
resized.
Value: number in px
<background_color>0xeeeeee</background_color>
The background color for the slideshow. This will be visible during the transitions
and when a slide is smaller than the slideshow.
Value: 0x followed by hexadecimal color
**********************************************************************************************
* Text properties *
**********************************************************************************************
<font>Verdana</font>
The font of the text in the slideshow.
Value: Verdana, Arial or TimesNewRoman
<font_size>12</font_size>
The font size of the text in the slideshow.
Value: number in px
<font_color>0xffffff</font_color>
The color of the text in the slideshow.
Value: 0x followed by hexadecimal color
<text_border_color>0xffffff</text_border_color>
The color of the border of the textarea.
Value: 0x followed by hexadecimal color
<text_bg_color>0x000000</text_bg_color>
The background color of the textarea.
Value: 0x followed by hexadecimal color
<text_autohide>false</text_autohide>
When set to true the textarea will hide after a few seconds.
Value: true or false
**********************************************************************************************
* Controls properties *
**********************************************************************************************
<controls_color>0xffffff</controls_color>
The color of the buttons.
Value: 0x followed by hexadecimal color
<controls_border_color>0xffffff</controls_border_color>
The color of the border of the area with the buttons.
Value: 0x followed by hexadecimal color
<controls_bg_color>0x000000</controls_bg_color>
The background color of the area with the buttons.
Value: 0x followed by hexadecimal color
<controls_autohide>true</controls_autohide>
When set to true the controls will hide after a few seconds.
Value: true or false
**********************************************************************************************
* Thumbnail properties *
**********************************************************************************************
<thumbnail_width>40</thumbnail_width>
<thumbnail_height>30</thumbnail_height>
The height and width of each thumbnail image in the bar at the bottom of the
slideshow.
Value: number in px
<thumbnail_border_color>0x888888</thumbnail_border_color>
The color of the border of each thumbnail image.
Value: 0x followed by hexadecimal color
<menu_autohide>true</menu_autohide>
When set to true the thumbnail bar will hide after a few seconds.
Value: true or false
<menu_dead_zone_width>160</menu_dead_zone_width>
The width of the area in the center of the thumbnail bar in which the user can hover
the mouse, without the thumbnail bar moving to the left or to the right.
Value: number in px
<menu_gaps>6</menu_gaps>
The width of the gap between two thumbnail images.
Value: number in px
**********************************************************************************************
* Behaviour properties *
**********************************************************************************************
<mute_at_start>true</mute_at_start>
If true the slideshow will start with the sound muted.
Value: true or false
<autostart>false</autostart>
If true the slideshow will start upon loading. If false a play button will be
displayed.
Value: true or false
<autopause>true</autopause>
If true the slideshow will pause when clicking on a thumbnail or clicking the
previous or next buttons.
Value: true or false
<loop>false</loop>
If true the slideshow will loop. If false, when the last slide has been displayed,
the slideshow will move back to the first slide and show a play button.
Value: true or false
**********************************************************************************************
* Error messages *
**********************************************************************************************
<error_message_content><![CDATA[Content Xml not found]]></error_message_content>
<error_message_image><![CDATA[Image not found]]></error_message_image>
Value: any text in CDATA tags: <![CDATA[ ... ]]>
**********************************************************************************************
* *
* The content XML *
* *
**********************************************************************************************
The content .xml file contains the properties for each slide.
**********************************************************************************************
* Structure of the xml *
**********************************************************************************************
<content>
<slides>
<slide>[properties go here]</slide>
<slide>[properties go here]</slide>
...
</slides>
</content>
**********************************************************************************************
* Properties in the slide tag *
**********************************************************************************************
<title><![CDATA[My first slide]]></title>
The title of the slide.
Value: any text in CDATA tags: <![CDATA[ ... ]]>
<description><![CDATA[This is my first slide!]]></description>
The description of the slide.
Value: any text in CDATA tags: <![CDATA[ ... ]]>
<image_source>/someUrl/someImg.jpg</image_source>
The url to the slide image.
Value: an absolute or relative url to a .jpg, .gif or .png file
<thumb_source>/someUrl/someImg_thumb.jpg</thumb_source>
The url to the thumbnail of the slide image.
Value: an absolute or relative url to a .jpg, .gif or .png file
<sound_source>/someUrl/someImg_thumb.jpg</sound_source>
The url to the sound file that will be played when the slide is displayed. It will be
played once for the duration of the slide (if the duration of the sound file is longer
than the set duration of the slide it will be cut off). This property is optional.
Value: an absolute or relative url to a .mp3 file
<duration>8</duration>
The duration for this specific slide. This value will overwrite the duration value set
in the configuration xml. This property is optional.
Value: number in seconds
<width>400</width>
<height>300</height>
The width and height of the slide. This will overwrite the default_slidewidth and
default_slideheight set in the configuration xml. The width and height properties are
optional.
Value: number in px
**********************************************************************************************
* eof *
United Knowledge Slideshow Player - readme.txt
Copyright: United Knowledge, 2008
The Slideshow PLayer is licensed under the terms of the GNU General Public License, version 2
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
SWFObject 2, the code used to display the Slideshow, is licensed under the MIT License
http://www.opensource.org/licenses/mit-license.php
**********************************************************************************************
* *
* The configuration XML *
* *
**********************************************************************************************
With the configuration .xml file you can customize the look and the behaviour of the
slideshow. It contains the following properties (the values are example values; there are
default values for most, but we recommend setting ALL properties yourself).
**********************************************************************************************
* Structure of the xml *
**********************************************************************************************
<config>
[properties go here]
</config>
**********************************************************************************************
* General properties *
**********************************************************************************************
<content_url>/someUrl/someXmlFile.xml</content_url>
The url to the .xml file that contains the content.
Value: an absolute or relative url to an xml file
<width>400</width>
<height>300</height>
The width and height of the player itself (this value is overwritten by the flashVars
but the tags need to be here).
Value: number in px
<default_duration>8</default_duration>
The duration of each slide. This can be overwritten by setting the duration per slide
in the content .xml file.
Value: number in seconds
<default_slidewidth>400</default_slidewidth>
<default_slideheight>300</default_slideheight>
If the width or height of a slide is larger than the values specified here, the slide
will be resized proportionally. Slides that are smaller than the slidshow will not be
resized.
Value: number in px
<background_color>0xeeeeee</background_color>
The background color for the slideshow. This will be visible during the transitions
and when a slide is smaller than the slideshow.
Value: 0x followed by hexadecimal color
**********************************************************************************************
* Text properties *
**********************************************************************************************
<font>Verdana</font>
The font of the text in the slideshow.
Value: Verdana, Arial or TimesNewRoman
<font_size>12</font_size>
The font size of the text in the slideshow.
Value: number in px
<font_color>0xffffff</font_color>
The color of the text in the slideshow.
Value: 0x followed by hexadecimal color
<text_border_color>0xffffff</text_border_color>
The color of the border of the textarea.
Value: 0x followed by hexadecimal color
<text_bg_color>0x000000</text_bg_color>
The background color of the textarea.
Value: 0x followed by hexadecimal color
<text_autohide>false</text_autohide>
When set to true the textarea will hide after a few seconds.
Value: true or false
**********************************************************************************************
* Controls properties *
**********************************************************************************************
<controls_color>0xffffff</controls_color>
The color of the buttons.
Value: 0x followed by hexadecimal color
<controls_border_color>0xffffff</controls_border_color>
The color of the border of the area with the buttons.
Value: 0x followed by hexadecimal color
<controls_bg_color>0x000000</controls_bg_color>
The background color of the area with the buttons.
Value: 0x followed by hexadecimal color
<controls_autohide>true</controls_autohide>
When set to true the controls will hide after a few seconds.
Value: true or false
**********************************************************************************************
* Thumbnail properties *
**********************************************************************************************
<thumbnail_width>40</thumbnail_width>
<thumbnail_height>30</thumbnail_height>
The height and width of each thumbnail image in the bar at the bottom of the
slideshow.
Value: number in px
<thumbnail_border_color>0x888888</thumbnail_border_color>
The color of the border of each thumbnail image.
Value: 0x followed by hexadecimal color
<menu_autohide>true</menu_autohide>
When set to true the thumbnail bar will hide after a few seconds.
Value: true or false
<menu_dead_zone_width>160</menu_dead_zone_width>
The width of the area in the center of the thumbnail bar in which the user can hover
the mouse, without the thumbnail bar moving to the left or to the right.
Value: number in px
<menu_gaps>6</menu_gaps>
The width of the gap between two thumbnail images.
Value: number in px
**********************************************************************************************
* Behaviour properties *
**********************************************************************************************
<mute_at_start>true</mute_at_start>
If true the slideshow will start with the sound muted.
Value: true or false
<autostart>false</autostart>
If true the slideshow will start upon loading. If false a play button will be
displayed.
Value: true or false
<autopause>true</autopause>
If true the slideshow will pause when clicking on a thumbnail or clicking the
previous or next buttons.
Value: true or false
<loop>false</loop>
If true the slideshow will loop. If false, when the last slide has been displayed,
the slideshow will move back to the first slide and show a play button.
Value: true or false
**********************************************************************************************
* Error messages *
**********************************************************************************************
<error_message_content><![CDATA[Content Xml not found]]></error_message_content>
<error_message_image><![CDATA[Image not found]]></error_message_image>
Value: any text in CDATA tags: <![CDATA[ ... ]]>
**********************************************************************************************
* *
* The content XML *
* *
**********************************************************************************************
The content .xml file contains the properties for each slide.
**********************************************************************************************
* Structure of the xml *
**********************************************************************************************
<content>
<slides>
<slide>[properties go here]</slide>
<slide>[properties go here]</slide>
...
</slides>
</content>
**********************************************************************************************
* Properties in the slide tag *
**********************************************************************************************
<title><![CDATA[My first slide]]></title>
The title of the slide.
Value: any text in CDATA tags: <![CDATA[ ... ]]>
<description><![CDATA[This is my first slide!]]></description>
The description of the slide.
Value: any text in CDATA tags: <![CDATA[ ... ]]>
<image_source>/someUrl/someImg.jpg</image_source>
The url to the slide image.
Value: an absolute or relative url to a .jpg, .gif or .png file
<thumb_source>/someUrl/someImg_thumb.jpg</thumb_source>
The url to the thumbnail of the slide image.
Value: an absolute or relative url to a .jpg, .gif or .png file
<sound_source>/someUrl/someImg_thumb.jpg</sound_source>
The url to the sound file that will be played when the slide is displayed. It will be
played once for the duration of the slide (if the duration of the sound file is longer
than the set duration of the slide it will be cut off). This property is optional.
Value: an absolute or relative url to a .mp3 file
<duration>8</duration>
The duration for this specific slide. This value will overwrite the duration value set
in the configuration xml. This property is optional.
Value: number in seconds
<width>400</width>
<height>300</height>
The width and height of the slide. This will overwrite the default_slidewidth and
default_slideheight set in the configuration xml. The width and height properties are
optional.
Value: number in px
**********************************************************************************************
* eof *
**********************************************************************************************

Binary file not shown.

View file

@ -1,70 +1,54 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>slideshow</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="/extras/ukplayer/AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
This is the United Knowledge Player for WebGUI.
It enables you to display foto's as a movie. The
configuration options can be found in the readme
file here:
/extras/ukplayer/readme.txt
There are three example files to show you how to
use this player:
/extras/ukplayer/slideshow.html
/extras/ukplayer/config.xml
/extras/ukplayer/content.xml
This player is Free Software under the GPL v2
Check out the latest source on:
http://195.64.86.55/ukslideshow/trunk .
copyright 2008 United Knowledge http://www.unitedknowledge.nl/
-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '400',
'height', '300',
'src', 'swc/assets',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'slideShow',
'bgcolor', '#ffffff',
'name', 'coverflow',
'menu', 'true',
// note: the width & height in the flashVars below MUST match the width & height set above
'flashVars', 'config=/extras/ukplayer/config.xml&width=400&height=300&backgroundColor=0xCCCCCC&fontColor=&textBorderColor=&textBackgroundColor=&controlsColor=&controlsBorderColor=&controlsBackgroundColor=',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', '/extras/ukplayer/slideShow',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="400" height="300" id="swc/assets" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="flashVars" value="config=/extras/ukplayer/config.xml" />
<param name="movie" value="/extras/ukplayer/slideShow.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /> <embed src="/extras/ukplayer/slideShow.swf" quality="high" bgcolor="#ffffff" width="400" height="300" name="swc/assets" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" flashvars="config=/extras/ukplayer/config.xml" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
<!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Strict/EN" "http:/www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http:/www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>UKplayer Slideshow Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/extras/ukplayer/swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent","9.0.0","/extras/ukplayer/expressInstall.swf");
</script>
</head>
<body>
<!--
This is the United Knowledge Player for WebGUI.
It enables you to display foto's as a movie. The
configuration options can be found in the readme
file here:
/extras/ukplayer/readme.txt
There are three example files to show you how to
use this player:
/extras/ukplayer/slideshow.html
/extras/ukplayer/config.xml
/extras/ukplayer/content.xml
This player is Free Software under the GPL v2
Check out the latest source on:
http:/195.64.86.55/ukslideshow/trunk .
Copyright 2008 United Knowledge http:/www.unitedknowledge.nl/
-->
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="300" id="myFlashContent">
<param name="movie" value="/extras/ukplayer/slideShow.swf" />
<param name="flashvars" value="config=/extras/ukplayer/config.xml" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="/extras/ukplayer/slideShow.swf" width="400" height="300">
<param name="flashvars" value="config=/extras/ukplayer/config.xml" />
<!--<![endif]-->
<a href="http:/www.adobe.com/go/getflashplayer">
<img src="http:/www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
<p>Code generated with the <a href="http:/www.bobbyvandersluis.com/swfobject/generator/index.html">SWFObject 2 HTML and JavaScript generator</a>.</p>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,373 @@
//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();
//Internal Config (Do not Edit)
//browser check
var dom=document.getElementById&&!document.all
var docElement = document.documentElement;
var pageURL = "";
var topelement=dom? "HTML" : "BODY"
var pageHeight=0;
var pageWidth=0;
var scrollJump=50;
var blankCount=1;
var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;
var DDM = YAHOO.util.DragDropMgr;
//goes up the parent tree until class is found. If not found, returns null
function dragable_getObjectByClass(target,clazz) {
var classMatch = new RegExp("\\b" + clazz + "\\b");
while (target.tagName!=topelement && target.className.search(classMatch) == -1){
target=dom? target.parentNode : target.parentElement
}
if (target.className.search(classMatch) != -1){
return target;
}else {
return null;
}
}
YAHOO.webgui = {};
YAHOO.webgui.DDList = function(id, sGroup, config) {
YAHOO.webgui.DDList.superclass.constructor.call(this, id, sGroup, config);
this.logger = this.logger || YAHOO;
var el = this.getDragEl();
Dom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent
this.goingUp = false;
this.lastY = 0;
};
YAHOO.extend(YAHOO.webgui.DDList, YAHOO.util.DDProxy, {
startDrag: function(x, y) {
this.logger.log(this.id + " startDrag");
// make the proxy look like the source element
var dragEl = this.getDragEl();
var clickEl = this.getEl();
Dom.setStyle(clickEl, "visibility", "hidden");
dragEl.innerHTML = clickEl.innerHTML;
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
Dom.setStyle(dragEl, "border", "2px solid gray");
},
//Put things back like they were
onDragOut: function(e,id){
var obj = Dom.get(id);
if (dragable_isBlank(obj)) {
document.getElementById(id).className="blank";
}else if (obj.className == 'draggedOverTop' || obj.className == 'draggedOverBottom') {
document.getElementById(id).className="dragable";
}
},
endDrag: function(e) {
var srcEl = this.getEl();
var proxy = this.getDragEl();
// Show the proxy element and animate it to the src element's location
Dom.setStyle(proxy, "visibility", "");
var a = new YAHOO.util.Motion(
proxy, {
points: {
to: Dom.getXY(srcEl)
}
},
0.2,
YAHOO.util.Easing.easeOut
)
var proxyid = proxy.id;
var thisid = this.id;
// Hide the proxy and show the source element when finished with the animation
a.onComplete.subscribe(function() {
Dom.setStyle(proxyid, "visibility", "hidden");
Dom.setStyle(thisid, "visibility", "");
});
a.animate();
},
onDragDrop: function(e, id) {
var position;
if(this.goingUp){
position = "top";
}else{
position = "bottom";
}
var target = this.getEl().parentNode.parentNode;
var destination = Dom.get(id);
if(!dragable_isBlank(destination)){
destination.className = "dragable";
destination = Dom.get(id).parentNode.parentNode;
}
dragable_moveContent(target, destination ,position);
var url = pageURL + dragable_getContentMap();
document.getElementById("dragSubmitter").src = url;
return;
// If there is one drop interaction, the li was dropped either on the list,
// or it was dropped on the current location of the source element.
if (DDM.interactionInfo.drop.length === 1) {
// The position of the cursor at the time of the drop (YAHOO.util.Point)
var pt = DDM.interactionInfo.point;
// The region occupied by the source element at the time of the drop
var region = DDM.interactionInfo.sourceRegion;
// Check to see if we are over the source element's location. We will
// append to the bottom of the list once we are sure it was a drop in
// the negative space (the area of the list without any list items)
if (!region.intersect(pt)) {
var destEl = Dom.get(id);
var destDD = DDM.getDDById(id);
destEl.appendChild(this.getEl());
destDD.isEmpty = false;
DDM.refreshCache();
}
}
},
onDrag: function(e) {
// Keep track of the direction of the drag for use during onDragOver
var y = Event.getPageY(e);
if (y < this.lastY) {
this.goingUp = true;
} else if (y > this.lastY) {
this.goingUp = false;
}
this.lastY = y;
dragable_adjustScrollBars(e);
},
onDragOver: function(e, id) {
var srcEl = this.getEl();
if(srcEl.id == id){return;}
var obj = Dom.get(id);
// We are only concerned with list items, we ignore the dragover
// notifications for the list.
if (dragable_isBlank(obj)) {
document.getElementById(id).className="blankOver";
}else if (this.goingUp) {
document.getElementById(id).className="draggedOverTop";
}else {
document.getElementById(id).className="draggedOverBottom";
}
/* if (destEl.nodeName.toLowerCase() == "li") {
var orig_p = srcEl.parentNode;
var p = destEl.parentNode;
if (this.goingUp) {
p.insertBefore(srcEl, destEl); // insert above
} else {
p.insertBefore(srcEl, destEl.nextSibling); // insert below
}
DDM.refreshCache();
}
*/
}
});
//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;
//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
var blank_id =dragable_appendBlankRow(tbody[0]);
new YAHOO.util.DDTarget(blank_id);
}else {
for (i = 0; i< children.length;i++) {
draggableObjectList[draggableObjectList.length] = children[i];
new YAHOO.webgui.DDList(document.getElementById(children[i].id + "_div"));
new YAHOO.util.DDTarget(document.getElementById(children[i].id + "_div"));
}
}
obj = document.getElementById("position" + contentCount);
contentCount++;
}
}
//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;
}
}
function dragable_isBlank(td) {
if (td.id.indexOf("blank") != -1) {
return true;
}
return false;
}
//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+"px";
blankClone.style.left=0+"px";
blank.className="hidden";
return blankClone.id;
}
//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) {
var blank_id = dragable_appendBlankRow(fromParent);
new YAHOO.util.DDTarget(blank_id);
}
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;
}