new improved asset manager and context menu

This commit is contained in:
JT Smith 2005-06-19 18:56:27 +00:00
parent 414d6aa386
commit 11321443c4
24 changed files with 221 additions and 1962 deletions

View file

@ -3,6 +3,12 @@
- All form field labels have been internationalized.
- Added hover help. (Special thanks to Colin Kuskie for all his help with
this.)
- Removed long since depricated support for the eopro editor.
- Class icon context menus are now left click enabled rather than right click
enabled because some users were confused by right clicking on a web page,
and mac users, having only one mouse button, couldn't do it.
- Rewrote the asset manager UI to have a little less whiz-bang and a bunch
more user friendliness due to user feedback.
6.6.3
- Fixed a recurring transaction commerce bug.

View file

@ -68,7 +68,6 @@ A lineage is a concatenated series of sequence numbers, each six digits long, th
$hashref= WebGUI::Asset->get();
$AdminConsoleObject= WebGUI::Asset->getAdminConsole();
$arrayRef= WebGUI::Asset->getAssetAdderLinks($string);
$JavaScript= WebGUI::Asset->getAssetManagerControl(\%hashref, $string, $bool);
$arrayRef= WebGUI::Asset->getAssetsInClipboard($boolean, $string);
$arrayRef= WebGUI::Asset->getAssetsInTrash($boolean, $string);
$containerRef= $asset->getContainer();
@ -784,94 +783,6 @@ sub getAssetAdderLinks {
return \@sortedLinks;
}
#-------------------------------------------------------------------
=head2 getAssetManagerControl ( children [,controlType,removeRank] )
Returns a text string of HTML code (Javascript) for the Asset Manager Control Page. English only.
=head3 children
A hashref of the children of the Asset to be managed.
=head3 controlType
An optional string representing the controlType (manager.assetType) to be passed to the assetManager script.
=head3 removeRank
manager.disableDisplay(0) is added to the script if parameter is defined.
=cut
sub getAssetManagerControl {
my $self = shift;
my $children = shift;
my $controlType = shift || "ManageAssets";
my $removeRank = shift;
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Tools.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/ContextMenu.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Asset.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Display.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/EventManager.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/AssetManager.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/AssetManagerAsset.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/CrumbTrailAsset.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/'.$controlType.'.js', {type=>"text/javascript"});# if (defined $controlType);
my $output = '
<div id="contextMenu" class="contextMenu"></div>
<div id="propertiesWindow" class="propertiesWindow"></div>
<div id="crumbtrail"></div>
<div id="workspace">Retrieving Assets...</div>
<div id="dragImage" class="dragIdentifier">hello</div>
';
$output .= "<script>\n";
$output .= "/* assetId, url, title */\nvar crumbtrail = [\n";
my $ancestors = $self->getLineage(["self","ancestors"],{returnQuickReadObjects=>1});
my @dataArray;
foreach my $ancestor (@{$ancestors}) {
my $title = $ancestor->getTitle;
$title =~ s/\'/\\\'/g;
push(@dataArray,"['".$ancestor->getId."','".$ancestor->getUrl."','".$title."']\n");
}
my $i18n = WebGUI::International->new("Asset");
$output .= join(",",@dataArray);
$output .= "];\n";
$output .= "var columnHeadings = ['".$i18n->get("rank")."','".$i18n->get("99")."','".$i18n->get("type")."','".$i18n->get("last updated")."','".$i18n->get("size")."'];\n";
$output .= "/*rank, title, type, lastUpdate, size, url, assetId, icon */\nvar assets = [\n";
@dataArray = ();
foreach my $child (@{$children}) {
my $title = $child->getTitle;
$title =~ s/\'/\\\'/g;
push(@dataArray, '['.$child->getRank.",'".$title."','".$child->getName."','".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))."','".formatBytes($child->get("assetSize"))."','".$child->getUrl."','".$child->getId."','".$child->getIcon(1)."']\n");
#my $hasChildren = "false";
#$hasChildren = "true" if ($child->hasChildren);
#$output .= $hasChildren;
}
$output .= join(",",@dataArray);
$output .= "];\n var labels = new Array();\n";
$output .= "labels['edit'] = '".$i18n->get("edit")."';\n";
$output .= "labels['cut'] = '".$i18n->get("cut")."';\n";
$output .= "labels['copy'] = '".$i18n->get("copy")."';\n";
$output .= "labels['view'] = '".$i18n->get("view")."';\n";
$output .= "labels['delete'] = '".$i18n->get("delete")."';\n";
$output .= "labels['restore'] = '".$i18n->get("restore")."';\n";
$output .= "labels['shortcut'] = '".$i18n->get("create shortcut")."';\n";
$output .= "labels['purge'] = '".$i18n->get("purge")."';\n";
$output .= "labels['go'] = '".$i18n->get("manage")."';\n";
$output .= "labels['editTree'] = '".$i18n->get("edit branch")."';\n";
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);\n";
$output .= "manager.assetType='".$controlType."';\n" if (defined $controlType);
$output .= "manager.disableDisplay(0);\n" if (defined $removeRank);
if ($controlType eq "ManageTrash" || $controlType eq "ManageClipboard") {
$output .= "manager.displayCrumbTrail = false;\n";
# $output .= "manager.sortEnabled = false;\n";
}
$output .= "manager.renderAssets();\n";
$output .= "</script>\n";
return $output;
}
#-------------------------------------------------------------------
@ -1710,15 +1621,15 @@ sub getToolbar {
$toolbar .= shortcutIcon('func=createShortcut',$self->get("url")) unless ($self->get("className") =~ /Shortcut/);
WebGUI::Style::setLink($session{config}{extrasURL}.'/contextMenu/contextMenu.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/contextMenu/contextMenu.js', {type=>"text/javascript"});
#return '<img src="'.$self->getIcon(1).'" border="0" title="'.$self->getName.'" alt="'.$self->getName.'" align="absmiddle">'.$toolbar;
my $i18n = WebGUI::International->new("Asset");
return '<script type="text/javascript">
var contextMenu = new contextMenu_create("'.$self->getIcon(1).'","'.$self->getId.'","'.$self->getName.'");
var contextMenu = new contextMenu_createWithImage("'.$self->getIcon(1).'","'.$self->getId.'","'.$self->getName.'");
contextMenu.addLink("'.$self->getUrl("func=editTree").'","'.$i18n->get("edit branch").'");
contextMenu.addLink("'.$self->getUrl("func=promote").'","'.$i18n->get("promote").'");
contextMenu.addLink("'.$self->getUrl("func=demote").'","'.$i18n->get("demote").'");
contextMenu.addLink("'.$self->getUrl("func=manageAssets").'","'.$i18n->get("manage").'");
contextMenu.addLink("'.$self->getUrl.'","'.$i18n->get("view").'");
contextMenu.draw();
contextMenu.print();
</script>'.$toolbar;
}
@ -3259,12 +3170,57 @@ Main page to manage assets. Renders an AdminConsole with a list of assets. If ca
sub www_manageAssets {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
my $children = $self->getLineage(["children"],{returnObjects=>1});
my $output = $self->getAssetManagerControl($children);
$output .= ' <div class="adminConsoleSpacer">
WebGUI::Style::setLink($session{config}{extrasURL}.'/contextMenu/contextMenu.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/contextMenu/contextMenu.js', {type=>"text/javascript"});
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/assetManager.js', {type=>"text/javascript"});
my $i18n = WebGUI::International->new("Asset");
my $ancestors = $self->getLineage(["self","ancestors"],{returnQuickReadObjects=>1});
my @crumbtrail;
foreach my $ancestor (@{$ancestors}) {
push(@crumbtrail,'<a href="'.$ancestor->getUrl("func=manageAssets").'">'.$ancestor->getTitle.'</a>');
}
my $output = '<div class="am-crumbtrail">'.join(" > ",@crumbtrail).'</div>';
$output .= "
<script type=\"text/javascript\">
var assetManager = new AssetManager();
assetManager.AddColumn('','','center','form');
assetManager.AddColumn('','','center','');
assetManager.AddColumn('".$i18n->get("rank")."','','right','numeric');
assetManager.AddColumn('".$i18n->get("99")."','','left','');
assetManager.AddColumn('".$i18n->get("type")."','','left','');
assetManager.AddColumn('".$i18n->get("last updated")."','','center','');
assetManager.AddColumn('".$i18n->get("size")."','','right','');
assetManager.AddColumn('Locked','','center','');\n";
foreach my $child (@{$self->getLineage(["children"],{returnObjects=>1})}) {
$output .= 'var contextMenu = new contextMenu_createWithLink("'.$child->getId.'","More");
contextMenu.addLink("'.$child->getUrl("func=editTree").'","'.$i18n->get("edit branch").'");
contextMenu.addLink("'.$child->getUrl("func=createShortcut&proceed=manageAssets").'","'.$i18n->get("create shortcut").'");
contextMenu.addLink("'.$child->getUrl("func=promote").'","'.$i18n->get("promote").'");
contextMenu.addLink("'.$child->getUrl("func=demote").'","'.$i18n->get("demote").'");
contextMenu.addLink("'.$child->getUrl.'","'.$i18n->get("view").'"); '."\n";
$output .= "assetManager.AddLine('"
.WebGUI::Form::checkbox({
name=>'assetId',
value=>$child->getId
})
."','<a href=\"".$child->getUrl("func=edit&proceed=manageAssets")."\">Edit</a> | '+contextMenu.draw(),"
.$child->getRank
.",'<a href=\"".$child->getUrl("func=manageAssets")."\">".$child->getTitle
."</a>','<img src=\"".$child->getIcon(1)."\" border=\"0\" alt=\"".$child->getName."\" /> ".$child->getName
."','".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))
."','".formatBytes($child->get("assetSize"))."','');\n";
$output .= "assetManager.AddLineSortData('','','','".$child->getTitle."','".$child->getName
."','".$child->get("lastUpdated")."','".$child->get("assetSize")."','');\n";
}
$output .= 'assetManager.AddButton("'.$i18n->get("delete").'","deleteList");
assetManager.AddButton("'.$i18n->get("cut").'","cutList");
assetManager.AddButton("'.$i18n->get("copy").'","copyList");
assetManager.Write();
</script> <div class="adminConsoleSpacer">
&nbsp;
</div>
<div style="float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.WebGUI::International::get(1083,"Asset").'</legend>';
<div style="float: left; padding-right: 30px; font-size: 14px;width: 28%;"><fieldset><legend>'.WebGUI::International::get(1083,"Asset").'</legend>';
foreach my $link (@{$self->getAssetAdderLinks("proceed=manageAssets","assetContainers")}) {
$output .= '<img src="'.$link->{'icon.small'}.'" align="middle" alt="'.$link->{label}.'" border="0" />
<a href="'.$link->{url}.'">'.$link->{label}.'</a> ';
@ -3295,7 +3251,7 @@ sub www_manageAssets {
$hasClips = 1;
}
if ($hasClips) {
$output .= '<div style="float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.WebGUI::International::get(1082,"Asset").'</legend>'
$output .= '<div style="width: 28%; float: left; padding-right: 30px; font-size: 14px;"><fieldset><legend>'.WebGUI::International::get(1082,"Asset").'</legend>'
.WebGUI::Form::formHeader()
.WebGUI::Form::hidden({name=>"func",value=>"pasteList"})
.WebGUI::Form::checkbox({extras=>'onchange="toggleClipboardSelectAll(this.form);"'})
@ -3325,7 +3281,7 @@ sub www_manageAssets {
$hasPackages = 1;
}
if ($hasPackages) {
$output .= '<div style="float: left; padding-right: 30px; font-size: 14px;"><fieldset>
$output .= '<div style="width: 28%;float: left; padding-right: 30px; font-size: 14px;"><fieldset>
<legend>'.WebGUI::International::get("packages","Asset").'</legend>
'.$packages.' </fieldset></div> ';
}
@ -3366,7 +3322,36 @@ sub www_manageClipboard {
foreach my $assetData (@{$self->getAssetsInClipboard($limit)}) {
push(@assets,WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className}));
}
return $ac->render($self->getAssetManagerControl(\@assets,"ManageClipboard"), $header);
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/assetManager.js', {type=>"text/javascript"});
my $i18n = WebGUI::International->new("Asset");
my $output = "
<script type=\"text/javascript\">
var assetManager = new AssetManager();
assetManager.AddColumn('','','center','form');
assetManager.AddColumn('".$i18n->get("99")."','','left','');
assetManager.AddColumn('".$i18n->get("type")."','','left','');
assetManager.AddColumn('".$i18n->get("last updated")."','','center','');
assetManager.AddColumn('".$i18n->get("size")."','','right','');
\n";
foreach my $child (@assets) {
$output .= "assetManager.AddLine('"
.WebGUI::Form::checkbox({
name=>'assetId',
value=>$child->getId
})
."','<a href=\"".$child->getUrl("func=manageAssets")."\">".$child->getTitle
."</a>','<img src=\"".$child->getIcon(1)."\" border=\"0\" alt=\"".$child->getName."\" /> ".$child->getName
."','".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))
."','".formatBytes($child->get("assetSize"))."');\n";
$output .= "assetManager.AddLineSortData('','".$child->getTitle."','".$child->getName
."','".$child->get("lastUpdated")."','".$child->get("assetSize")."');\n";
}
$output .= 'assetManager.AddButton("'.$i18n->get("delete").'","deleteList");
assetManager.AddButton("'.$i18n->get("restore").'","restoreList");
assetManager.Write();
</script> <div class="adminConsoleSpacer"> &nbsp;</div>';
return $ac->render($output, $header);
}
#-------------------------------------------------------------------
@ -3411,18 +3396,42 @@ sub www_manageTrash {
if ($session{form}{systemTrash} && WebGUI::Grouping::isInGroup(3)) {
$header = WebGUI::International::get(965,"Asset");
$ac->addSubmenuItem($self->getUrl('func=manageTrash'), WebGUI::International::get(10),"Asset");
$ac->addSubmenuItem($self->getUrl('func=emptyTrash&systemTrash=1'), WebGUI::International::get(967,"Asset"),
'onclick="return window.confirm(\''.WebGUI::International::get(651).'\')"',"Asset");
} else {
$ac->addSubmenuItem($self->getUrl('func=manageTrash&systemTrash=1'), WebGUI::International::get(964),"Asset");
$ac->addSubmenuItem($self->getUrl('func=emptyTrash'), WebGUI::International::get(11,"Asset"),
'onclick="return window.confirm(\''.WebGUI::International::get(651).'\')"',"Asset");
$limit = 1;
}
foreach my $assetData (@{$self->getAssetsInTrash($limit)}) {
push(@assets,WebGUI::Asset->newByDynamicClass($assetData->{assetId},$assetData->{className}));
}
return $ac->render($self->getAssetManagerControl(\@assets,"ManageTrash",1), $header);
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/assetManager.js', {type=>"text/javascript"});
my $i18n = WebGUI::International->new("Asset");
my $output = "
<script type=\"text/javascript\">
var assetManager = new AssetManager();
assetManager.AddColumn('','','center','form');
assetManager.AddColumn('".$i18n->get("99")."','','left','');
assetManager.AddColumn('".$i18n->get("type")."','','left','');
assetManager.AddColumn('".$i18n->get("last updated")."','','center','');
assetManager.AddColumn('".$i18n->get("size")."','','right','');
\n";
foreach my $child (@assets) {
$output .= "assetManager.AddLine('"
.WebGUI::Form::checkbox({
name=>'assetId',
value=>$child->getId
})
."','<a href=\"".$child->getUrl("func=manageAssets")."\">".$child->getTitle
."</a>','<img src=\"".$child->getIcon(1)."\" border=\"0\" alt=\"".$child->getName."\" /> ".$child->getName
."','".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))
."','".formatBytes($child->get("assetSize"))."');\n";
$output .= "assetManager.AddLineSortData('','".$child->getTitle."','".$child->getName
."','".$child->get("lastUpdated")."','".$child->get("assetSize")."');\n";
}
$output .= 'assetManager.AddButton("'.$i18n->get("restore").'","restoreList");
assetManager.Write();
</script> <div class="adminConsoleSpacer"> &nbsp;</div>';
return $ac->render($output, $header);
}
@ -3474,24 +3483,6 @@ sub www_promote {
}
#-------------------------------------------------------------------
=head2 www_purgeList ( )
Purges assets from "trash". Returns the Manage Trash asset list.
=cut
sub www_purgeList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
foreach my $id ($session{cgi}->param("assetId")) {
my $asset = WebGUI::Asset->newByDynamicClass($id);
$asset->purge;
}
return $self->www_manageTrash();
}
#-------------------------------------------------------------------
=head2 www_restoreList ( )

View file

@ -289,11 +289,11 @@ sub getToolbar {
my $toolbar = editIcon('func=edit'.$returnUrl,$self->get("url"));
my $i18n = WebGUI::International->new("Asset");
return '<script type="text/javascript">
var contextMenu = new contextMenu_create("'.$self->getIcon(1).'","'.$self->getId.'","'.$self->getName.'");
var contextMenu = new contextMenu_createWithImage("'.$self->getIcon(1).'","'.$self->getId.'","'.$self->getName.'");
contextMenu.addLink("'.$self->getUrl("func=copy").'","'.$i18n->get("copy").'");
contextMenu.addLink("'.$self->getUrl("func=manageAssets").'","'.$i18n->get("manage").'");
contextMenu.addLink("'.$self->getUrl.'","'.$i18n->get("view").'");
contextMenu.draw();
contextMenu.print();
</script>'.$toolbar;
}
return $self->SUPER::getToolbar();

View file

@ -25,12 +25,6 @@ our $I18N = {
context => q|Column heading in asset manager.|
},
'purge' => {
message => q|Purge|,
lastUpdated => 0,
context => q|Used in asset context menus.|
},
'restore' => {
message => q|Restore|,
lastUpdated => 0,
@ -444,10 +438,6 @@ each asset under the tab &quot;Meta&quot; in the asset properties.</p>
lastUpdated => 1073152790,
message => q|Printable Style|
},
'967' => {
lastUpdated => 1052850265,
message => q|Empty system trash.|
},
'959' => {
lastUpdated => 1052850265,
message => q|Empty system clipboard.|
@ -583,10 +573,6 @@ each asset under the tab &quot;Meta&quot; in the asset properties.</p>
lastUpdated => 1031514049,
message => q|Start Date|
},
'651' => {
lastUpdated => 1101514049,
message => q|Emptying your trash will remove these assets from your site forever. Are you sure you want to continue?|
},
'498' => {
lastUpdated => 1031514049,
message => q|End Date|

View file

@ -1840,11 +1840,6 @@ You also cannot import a theme from a version of WebGUI that is newer than the o
lastUpdated => 1031514049
},
'11' => {
message => q|Empty trash.|,
lastUpdated => 1051514049
},
'492' => {
message => q|Profile fields list.|,
lastUpdated => 1031514049

View file

@ -1,233 +0,0 @@
//--------Constructor--------------------
//Creates a new asset object.
/*********************Configuring Assets**********************
To create a new asset, the Asset object must be extended.
The following example creates an asset with the same properties and methods as the Asset object.
function MyNewAsset() {
var asset = new Asset(); return asset;
}
To change the new asset object, properties and methods can be added or overriden
The following example overrides the getContextMenu method, adds a new retore method, and sets the dragEnabled property to false
function MyNewAsset) {
var asset = new Asset(); asset.dragEnabled = false;
asset.getContextMenu = function () {
var arr = new Array(); arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:" + this.evalReference() + ".cut()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["purge"],"javascript:" + this.evalReference() + ".purge()");
return arr; } asset.restore = function() {
location.href = this.parent.getWrappedURL() + "func=postList" + AssetManager_getManager().getSelectedAssetIds(); }
return asset;
}
*************availble asset properties *********************
dragEnabled - Enables or disables making the asset dragable. Defaults to true
allowMultiSelect - Enables or disables multiselection of the asset. Defaults to true;
***************Notes*********************
1. The asset class contains a getWrappedURL() method that return the asset.url property wrapped in "http://hostname" and the paramenter delimiter
2. asset.parent will return the parent asset (on the crumbtrail)
3. The AssetManager_getManager().getSelectedAssetsIds() method will return a parameter string containing all the selected asset Id's
*/
//Constructor
function Asset() {
//properties
this.url = "";
this.rank = 1;
this.labels = new Array();
this.assetId = "";
this.type = "";
this.parent = null;
this.title = "";
this.size = 0;
this.lastUpdate = "";
this.icon = "";
this.div = null;
this.dragEnabled = true;
this.allowMultiSelect = true;
this.isParent=false;
//---------Method Implementations -------------
this.registerEvents = function() {
//if there is a div associated with the asset, register event handlers
if (this.div) {
this.div.ondblclick=Asset_doubleClick;
this.div.onmousedown=Asset_mouseDown;
this.div.oncontextmenu=Asset_rightClick;
}
}
//Moving to a new parent (move)
//----------------------
//url + ?||& + func=setParent&assetId= + assetId
this.setParent = function(asset) {
//parentURL
location.href = this.getWrappedURL() + "func=setParent&assetId="+ asset.assetId;
}
//Set the rank of an asset amongst its siblings (move)
//---------------------------------------------
//url + ?||& + func=setRank&rank= + newRank
this.setRank = function(rank) {
//to child
location.href = this.getWrappedURL() + "func=setRank&rank="+ rank;
}
//url + ?||& + func=editTree
this.editTree = function() {
//parentURL
location.href = this.getWrappedURL() + "func=editTree";
}
//Edit the properties of an asset (edit)
//-------------------------------
//url + ?||& + func=edit
this.edit = function() {
location.href = this.getWrappedURL() + "func=edit&proceed=manageAssets";
}
//Edit the properties of an asset (edit)
//-------------------------------
//url + ?||& + func=edit
this.go = function() {
location.href = this.getWrappedURL() + "func=manageAssets";
}
//View an asset (view)
//-------------
//url + ?||& + func=view
this.view = function() {
location.href = this.getWrappedURL();
}
//returns a string that returns a reference to the asset when evaled
this.evalReference = function() {
return "document.getElementById('" + this.div.id + "').asset";
}
//displays the right click context menu
this.getContextMenu = function () {
var arr = new Array();
if (AssetManager_getManager().display.overObjects.length == 1) {
arr[arr.length] = new ContextMenuItem(this.labels["go"],"javascript:" + this.evalReference() + ".go()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["view"],"javascript:" + this.evalReference() + ".view()");
arr[arr.length] = new ContextMenuItem(this.labels["edit"],"javascript:" + this.evalReference() + ".edit()");
}
arr[arr.length] = new ContextMenuItem(this.labels["delete"],"javascript:" + this.evalReference() + ".remove()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:" + this.evalReference() + ".cut()");
arr[arr.length] = new ContextMenuItem(this.labels["copy"],"javascript:" + this.evalReference() + ".copy()");
if (AssetManager_getManager().display.overObjects.length ==1) {
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["editTree"],"javascript:" + this.evalReference() + ".editTree()");
}
return arr;
}
this.select= function() {
this.div.className="am-grid-row-over";
}
this.deselect = function() {
this.div.className="am-grid-row";
}
//Copy an asset to the clipboard (copy)
//------------------------------
//url + ?||& + func=copy
this.copy = function() {
location.href = this.parent.getWrappedURL() + "func=copyList" + AssetManager_getManager().getSelectedAssetIds();
}
//Cut an asset to the clipboard (cut)
//-----------------------------
//url + ?||& + func=cut
this.cut = function() {
location.href = this.parent.getWrappedURL() + "func=cutList" + AssetManager_getManager().getSelectedAssetIds();
}
//Delete an asset. (delete)
//----------------
//url + ?||& + func=delete (do a javascript confirm on this)
this.remove = function() {
if (window.confirm("Are you sure you want to delete this asset? Click OK to continue, or Cancel if you made a mistake.")) {
location.href = this.parent.getWrappedURL() + "func=deleteList" + AssetManager_getManager().getSelectedAssetIds();
}
}
//adds http, the hostname, and a trailing parameter delimiter to the url
this.getWrappedURL = function() {
if (this.url.indexOf("?") == -1) {
return this.url + "?";
}else {
return this.url + "&";
}
}
}//end object
//Staic Methods
function Asset_doubleClick(e) {
var dom = document.getElementById&&!document.all;
var e=dom? e : event;
var obj =dom? e.target : e.srcElement
AssetManager_getManager().getAsset(obj).go();
}
function Asset_rightClick(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
if (!dom) {
e.cancelBubble = true;
e.returnValue = false;
}
var asset = manager.getAsset(obj);
if (asset) {
manager.display.contextMenu.owner = asset;
manager.displayContextMenu(e.clientX,e.clientY,asset);
}
return false;
}
function Asset_mouseDown(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
//Display_adjustScrollBars(e);
if (e.button==2) {
//this is a hack to get the context menu stuff to work right in IE
if (!dom) {
e.cancelBubble = true;
e.returnValue = false;
EventManager_documentMouseDown(e);
}
}
return false;
}

View file

@ -1,298 +0,0 @@
//--------Constructor--------------------
//Manages an array of assets.
//*****************Configuring the asset manager.*****************
//to create a new asset manager
//var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);
//manager.renderAssets();
//available properties. Properties should be set prior to the render asset call.
//*********************************************************
//assetType - defaults to "Asset"
//The following example starts the asset manager with a different asset type.
//var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);
//manager.assetType="MyNewAsset"
//manager.renderAssets();
//*********************************************************
//sortEnabled = true - enables or disables sorting of the grid. Defaults to true
//The following example starts the asset manager with sorting disabled.
//var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);
//manager.sortEnabled=false;
//manager.renderAssets();
//*********************************************************
//displayCrumbTrail = Enables or disables display of the crumbtrail. Defaults to true
//The following example starts the asset manager with the crumb trail disabled
//var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);
//manager.displayCrumbTrail=false;
//manager.renderAssets();
//**********************************************************
//To disable display item in the grid, the disableDisplay function can be called on the asset manager. The function takes the index of the item to disable from the columnHeadings array.
//The following example disables the rank and title
//var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail);
//manager.disableDisplay(0);
//manager.disableDisplay(1);
//manager.renderAssets();
//Constructor
function AssetManager(assetArrayData,headerArrayData,labels,crumbtrail) {
//create all the objects used by the manager
this.tools = new Tools();
this.contextMenu = new ContextMenu();
this.display = new Display();
this.eventManager = new EventManager();
this.keys = new Array();
this.keys[0] = "rank";
this.keys[1] = "title";
this.keys[2] = "type";
this.keys[3] = "lastUpdate";
this.keys[4] = "size";
this.assetType ="Asset";
this.sortEnabled = true;
this.displayCrumbTrail = true;
this.labels = labels;
this.crumbtrail = crumbtrail;
this.renderAssets = AssetManager_renderAssets;
this.assetArrayData = assetArrayData;
this.columnHeadings = headerArrayData;
this.assets = new Array();
this.getAsset= AssetManager_getAsset;
this.buildCrumbTrail = AssetManager_buildCrumbTrail;
this.displayContextMenu = AssetManager_displayContextMenu;
this.sortGrid = AssetManager_sortGrid;
this.getSelectedAssetIds = AssetManager_getSelectedAssetIds;
this.disabledDisplayItems = new Array();
this.disableDisplay = function(headerIndex) {
this.disabledDisplayItems[this.disabledDisplayItems.length] = headerIndex;
}
}
//returns a reference to the asset manager
function AssetManager_getManager() {
return manager;
}
//renders the full asset manager
function AssetManager_renderAssets() {
var parent = this.buildCrumbTrail();
var gridStr = '<table border="0" cellspacing="0" id="am_grid" class="am-grid"><tbody id="am_grid_body"><tr id="am_grid.headers" class="am-grid-headers">';
var eventStr='';
var id = "";
for (i=0;i<this.columnHeadings.length;i++) {
var disabled = false;
for (j = 0; j<this.disabledDisplayItems.length;j++) {
if (i == this.disabledDisplayItems[j]) {
disabled = true;
}
}
if (disabled) continue;
id = 'am_grid.headers.' + i;
gridStr+= '<td id="' + id + '" class="am-grid-header-' + i + '">' + this.columnHeadings[i] + '</td>';
if (this.sortEnabled) {
eventStr += 'document.getElementById("' + id + '").onclick=AssetManager_getManager().eventManager.gridHeaderClick;';
eventStr += 'document.getElementById("' + id + '").onmouseover=AssetManager_getManager().eventManager.gridHeaderMouseOver;';
eventStr += 'document.getElementById("' + id + '").onmouseout=AssetManager_getManager().eventManager.gridHeaderMouseOut;';
}
}
gridStr+= '</tr>';
for (i=0;i<this.assetArrayData.length;i++) {
id = 'am_grid.row.'+ i;
gridStr += '<tr id="'+ id + '" class="am-grid-row">';
asset = eval("new " + this.assetType + "()");
asset.rank = this.assetArrayData[i][0];
asset.title = this.assetArrayData[i][1];
asset.type = this.assetArrayData[i][2];
asset.lastUpdate = this.assetArrayData[i][3];
asset.size = this.assetArrayData[i][4];
asset.url = this.assetArrayData[i][5];
asset.assetId = this.assetArrayData[i][6];
asset.icon = this.assetArrayData[i][7];
asset.parent = parent;
asset.labels = this.labels;
var assetIndex = this.assets.length;
this.assets[assetIndex]=asset;
eventStr += 'document.getElementById("' + id + '").asset = AssetManager_getManager().assets[' + assetIndex + '];';
eventStr += 'AssetManager_getManager().assets[' + assetIndex + '].div = document.getElementById("' + id + '");';
for (k=0;k<this.columnHeadings.length;k++) {
var disabled = false;
for (j = 0; j<this.disabledDisplayItems.length;j++) {
if (k == this.disabledDisplayItems[j]) {
disabled = true;
}
}
if (disabled) continue;
id = 'am_grid.row' + '.' + i + '.col.' + k;
gridStr+= '<td id="' + id + '" class="am-grid-col-' + k +'">';
if (k == 1) {
gridStr +='<img src="' + asset.icon + '" border="0"/>';
}
gridStr+=this.assetArrayData[i][k] + '</td>';
}
gridStr+='</tr>';
}
gridStr += '</tbody></table>';
document.getElementById("workspace").innerHTML=gridStr;
eval(eventStr);
for (i=0; i< this.assets.length; i++) {
this.assets[i].registerEvents();
}
}
//builds the asset crumb trail
function AssetManager_buildCrumbTrail() {
var crumbtrail = document.getElementById("crumbtrail");
var contents = '<table><tr>';
var parentAssets = new Array();
for (i=0;i<this.crumbtrail.length;i++) {
contents += '<td id="' + this.crumbtrail[i][0] + '" class="am-crumbtrail">' + this.crumbtrail[i][2] + '</td>';
if (i != this.crumbtrail.length -1) {
contents += "<td>&nbsp;/&nbsp;</td>";
}
}
contents += '</tr></table>';
if (this.displayCrumbTrail) {
crumbtrail.innerHTML = contents;
}
//build assets attach the div properties
var lastAsset = null;
for (i=0; i< this.crumbtrail.length; i++ ) {
var asset = new CrumbTrailAsset();
asset.title = this.crumbtrail[i][2];
asset.url = this.crumbtrail[i][1];
asset.assetId = this.crumbtrail[i][0];
asset.parent = lastAsset;
lastAsset = asset;
asset.isParent = true;
asset.labels = this.labels;
if (this.displayCrumbTrail) {
asset.div = document.getElementById(this.crumbtrail[i][0]);
document.getElementById(this.crumbtrail[i][0]).asset = asset;
}
this.assets[this.assets.length] = asset;
}
return this.assets[this.assets.length -1];
}
//returns an asset based on a div object
function AssetManager_getAsset(obj) {
while (obj.tagName!=this.display.topLevelElement && obj.tagName != "HTML" && !obj.asset) {
obj=this.display.dom? obj.parentNode : obj.parentElement
}
return obj.asset;
}
//displays the right click context menu
function AssetManager_displayContextMenu(x,y,asset) {
manager.display.dragStop();
manager.contextMenu.render(asset.getContextMenu(),x,y,asset);
}
//returns the asset IDS of all selected assets
function AssetManager_getSelectedAssetIds() {
var assetIds = "";
for (i=0;i<this.display.overObjects.length;i++) {
assetIds += "&assetId=" + this.display.overObjects[i].assetId;
}
return assetIds;
}
//Sorts the asset grid based on a column index
function AssetManager_sortGrid(columnIndex) {
var prop = this.keys[columnIndex];
var tableBody = document.getElementById("am_grid_body");
//remove the arrows from the other column headers
for (i=0;i< this.columnHeadings.length;i++) {
if (i != columnIndex && document.getElementById('am_grid.headers.' + i)) {
document.getElementById('am_grid.headers.' + i).innerHTML = this.columnHeadings[i];
document.getElementById('am_grid.headers.' + i).sortOrder = "<";
}
}
colHeader = document.getElementById('am_grid.headers.' + columnIndex);
if (!colHeader.sortOrder) {
colHeader.sortOrder = "<";
}
if (colHeader.sortOrder==">") {
colHeader.sortOrder="<";
document.getElementById('am_grid.headers.' + columnIndex).innerHTML = this.columnHeadings[columnIndex] + ' <img src="/extras/assetManager/up.gif" />';
}else {
colHeader.sortOrder=">";
document.getElementById('am_grid.headers.' + columnIndex).innerHTML = this.columnHeadings[columnIndex] + ' <img src="/extras/assetManager/down.gif" />';
}
var rowArray = new Array();
for (i=0; i<tableBody.childNodes.length; i++) {
if (tableBody.childNodes[i].id.indexOf("header") == -1) {
rowArray[rowArray.length] = tableBody.childNodes[i];
}
}
for (j=0;j<rowArray.length;j++) {
for (k=0;k<rowArray.length - 1;k++) {
var swap = eval("rowArray[k].asset." + prop + " " + colHeader.sortOrder + " " + "rowArray[k+1].asset." + prop);
if (swap) {
tmp = rowArray[k];
rowArray[k] = rowArray[k+1];
rowArray[k+1] = tmp;
}
}
}
for (i=0;i<rowArray.length;i++) {
tableBody.removeChild(rowArray[i]);
}
for (i=0;i<rowArray.length;i++) {
tableBody.appendChild(rowArray[i]);
}
}

View file

@ -1,10 +0,0 @@
//--------Constructor--------------------
//Creates a new asset object.
function AssetManagerAsset() {
var asset = new Asset();
return asset;
}

View file

@ -1,91 +0,0 @@
//--------Constructor--------------------
//document.write('<div id="contextMenu" class="contextMenu"></div>');
//Constructor for a context menu
function ContextMenu() {
this.render = ContextMenu_render;
this.hide = ContextMenu_hide;
this.owner = null;
this.contextMenu = document.getElementById("contextMenu");
this.contextMenu.oncontextmenu=new function() {return false;};
this.contextMenu.onmousedown=new function() {return false;};
this.contextMenu.onmouseup=new function() {return false;};
this.nameArray = new Array();
}
//Container used by the render method to delimit context menu items
function ContextMenuItem(cminame,cmilink) {
this.name = cminame;
this.link = cmilink;
}
//---------Method Implementations -------------
//renders the context menu based on the contextMenuItemArray and owner.
function ContextMenu_render(contextMenuItemArray,x,y,owner) {
// manager.tools.showObject(this.contextMenu);
// alert("top = " + this.contextMenu.className);
this.owner = owner;
var html='<table border="0">';
for (var i=0;i<contextMenuItemArray.length;i++) {
var name = "contextMenuItem" + i + new Date().getTime();
html+='<tr>';
html+=' <td>'
if (contextMenuItemArray[i].link == "") {
html+=contextMenuItemArray[i].name;
}else {
html+='<a href="' + contextMenuItemArray[i].link + '"><div id="' + name + '" class="contextMenuTab">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + contextMenuItemArray[i].name + '</div></a>';
}
html+='</td>';
html+='</tr>';
this.nameArray[this.nameArray.length] = name;
}
html+='</table>';
this.contextMenu.innerHTML = html;
for (var k=0;k<this.nameArray.length;k++) {
if (document.getElementById(this.nameArray[k])) {
document.getElementById(this.nameArray[k]).onmouseover=new Function("document.getElementById('" + this.nameArray[k] + "').className='contextMenuTabOver'");
document.getElementById(this.nameArray[k]).onmouseout=new Function("document.getElementById('" + this.nameArray[k] + "').className='contextMenuTab'");
}
}
if (y > parseInt(this.contextMenu.offsetHeight)) {
this.contextMenu.style.top = (y + manager.display.documentElement.scrollTop - this.contextMenu.offsetHeight -1) + "px";
// this.contextMenu.style.top = (y + window.scrollY - this.contextMenu.offsetHeight -1) + "px";
}else {
this.contextMenu.style.top = (y + manager.display.documentElement.scrollTop + 3) + "px";
// this.contextMenu.style.top = (y + window.scrollY + 3) + "px";
}
this.contextMenu.style.left= (x + manager.display.documentElement.scrollLeft) + "px";
// this.contextMenu.style.left= (x + window.scrollX) + "px";
manager.display.bringToFront(this.contextMenu);
//alert(this.contextMenu.style.top);
manager.tools.showObject(this.contextMenu);
}
//hides the context menu
function ContextMenu_hide() {
for (var k=0;k<this.nameArray.length;k++) {
if (document.getElementById(this.nameArray[k])) {
document.getElementById(this.nameArray[k]).onmouseover="";
document.getElementById(this.nameArray[k]).onmouseout="";
}
}
this.contextMenu.style.visibility="hidden";
}

View file

@ -1,32 +0,0 @@
//--------Constructor--------------------
//Creates a new asset object.
function CrumbTrailAsset() {
var asset = new Asset();
asset.dragEnabled = false;
asset.allowMultiSelect = false;
//displays the right click context menu
asset.getContextMenu = function () {
var arr = new Array();
arr[arr.length] = new ContextMenuItem(this.labels["go"],"javascript:" + this.evalReference() + ".go()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["view"],"javascript:" + this.evalReference() + ".view()");
arr[arr.length] = new ContextMenuItem(this.labels["edit"],"javascript:" + this.evalReference() + ".edit()");
return arr;
}
asset.select= function() {
this.div.className="am-crumbtrail-over";
}
asset.deselect = function() {
this.div.className="am-crumbtrail";
}
return asset;
}

View file

@ -1,274 +0,0 @@
//--------Constructor--------------------
//creates a new Display object. The display object manages selected assets, the drag functionality, and highlighting.
function Display() {
this.dom=document.getElementById&&!document.all;
this.documentElement = document.documentElement;
if (document.compatMode == "BackCompat") {
this.documentElement = document.body;
}
this.focusObjects = new Array();
this.overObjects = new Array();
//this.topLevelElement=this.dom? "HTML" : "BODY"
this.topLevelElement="HTML";
this.scrollJump = 25;
this.dragEnabled = false;
this.dragStart = Display_dragStart;
this.adjustScrollBars = Display_adjustScrollBars;
this.dragStop = Display_dragStop;
this.spy = Display_spy;
this.move = Display_move;
this.x = 0;
this.y = 0;
this.shiftKeyDown=false;
this.controlKeyDown=false;
this.contextMenu=new ContextMenu();
this.bringToFront = Display_bringToFront;
this.lastZIndex = 1000;
this.keyDown = Display_keyDown;
this.keyUp = Display_keyUp;
this.selectAsset = Display_selectAsset;
this.isSelected = Display_isSelected;
this.clearSelectedAssets = Display_clearSelectedAssets;
//used for the 3 second left mouse button menu - like a mac
this.leftClickContextMenuPrimed= false;
this.primeLeftClickContextMenu = Display_primeLeftClickContextMenu;
this.resetLeftClickContextMenu = Display_resetLeftClickContextMenu;
this.displayLeftClickContextMenu = Display_displayLeftClickContextMenu;
}
//---------Method Implementations -------------
function Display_primeLeftClickContextMenu() {
this.leftClickContextMenuPrimed = true;
}
function Display_resetLeftClickContextMenu() {
this.leftClickContextMenuPrimed = false;
}
function Display_displayLeftClickContextMenu(x,y) {
if (this.leftClickContextMenuPrimed) {
manager.displayContextMenu(x,y,this.focusObjects[0]);
}
}
//changes the z index of obj to be greater than all other elements
function Display_bringToFront(obj) {
this.lastZIndex++;
obj.style.zIndex = this.lastZIndex;
}
//called to enable dragging on an element
function Display_dragStart(firedobj,xCoordinate,yCoordinate) {
if (!firedobj) return;
if (this.shiftKeyDown || this.controlKeyDown) return;
//traverse up the dom tree until you find the asset
while (firedobj.tagName!=this.topLevelElement && !firedobj.asset) {
firedobj=manager.display.dom? firedobj.parentNode : firedobj.parentElement
}
if ((!firedobj.asset || !firedobj.asset.dragEnabled)) {
return;
}
this.dragEnabled=true;
this.pageHeight = this.documentElement.scrollHeight;
this.pageWidth = this.documentElement.scrollWidth;
this.focusObjects[0]=firedobj.asset;
this.bringToFront(document.getElementById("dragImage"));
document.getElementById("dragImage").innerHTML = "&nbsp;&nbsp;" + firedobj.asset.title + "&nbsp;&nbsp;";
this.x=xCoordinate;
this.y=yCoordinate;
return false;
}
//called on mouse up if dragging was enabled
function Display_dragStop() {
if (this.dragEnabled) {
this.dragEnabled = false;
document.getElementById("dragImage").style.display="none";
if (this.overObjects[0] && this.overObjects[0].assetId && this.overObjects[0] != this.focusObjects[0]) {
if (this.overObjects[0].isParent) {
this.focusObjects[0].setParent(this.overObjects[0]);
}else {
this.focusObjects[0].setRank(this.overObjects[0].rank);
}
}
}
}
//checks to see if an asset is already in the overObjects array
function Display_isSelected(asset) {
//check to see if obj is already in array
var inArray=false;
for (i=0;i<this.overObjects.length;i++) {
if (this.overObjects[i] == asset) {
return true;
}
}
return false;
}
//adds an asset to the overobjects array
function Display_selectAsset(asset) {
if (this.controlKeyDown || this.shiftKeyDown) {
if (!asset.allowMultiSelect) {
return;
}
}
if (!this.controlKeyDown && !this.shiftKeyDown) {
for (i=0;i<this.overObjects.length;i++) {
this.overObjects[i].deselect();
}
this.overObjects=new Array();
}
if (!this.isSelected(asset)) {
this.overObjects[this.overObjects.length] = asset;
asset.select();
}
}
//Clears out the over objects array
function Display_clearSelectedAssets() {
for (i=0;i<this.overObjects.length;i++) {
this.overObjects[i].deselect();
}
this.overObjects=new Array();
}
//called on mouse move. checks to see if mouse cursor is over an asset when dragging
function Display_move(e){
if (this.dragEnabled){
this.adjustScrollBars(e);
var topScroll = this.documentElement.scrollTop;
var leftScroll =this.documentElement.scrollLeft;
var act = this.spy(this.dom? e.pageX: (e.clientX + this.documentElement.scrollLeft),this.dom? e.pageY: (e.clientY + this.documentElement.scrollTop));
if (act && act.asset) {
this.selectAsset(act.asset);
}else {
this.clearSelectedAssets();
}
//change the position of the drag icon box
document.getElementById("dragImage").style.display = "block";
document.getElementById("dragImage").style.top = this.dom? (e.clientY+ 15 + topScroll) + "px" : (event.clientY + 15 + topScroll) + "px";
document.getElementById("dragImage").style.left = this.dom? (e.clientX + 5 + leftScroll) + "px" : (event.clientX + 5 + leftScroll) + "px";
}
return false
}
//check to see if the mouse cursor is over and asset. If so, returns the asset
function Display_spy(x,y) {
var returnObj = null;
for (i=0;i<manager.assets.length;i++) {
obj = manager.assets[i].div;
//this is a hack
if (obj == null || obj == this.focusObjects[0]) continue;
var fObj=obj;
y1=0;
x1=0
while (fObj!=null && fObj.tagName!=this.topLevelElement){
y1+=fObj.offsetTop;
x1+=fObj.offsetLeft;
fObj=fObj.offsetParent;
}
if (x >x1 && x < (x1 + obj.offsetWidth)) {
//add 13 pixels for ie since border widths are included in calculation
var fudge = this.dom? 0:13;
if (y> y1 && y< (y1 + obj.offsetHeight + fudge)) {
return obj;
}
}
}
return returnObj;
}
//called on keyDown. Does the right thing (ex. delete, cut, copy, ect)
function Display_keyDown(e) {
if (e.keyCode==16) {
this.shiftKeyDown = true;
}else if (e.keyCode ==17) {
this.controlKeyDown = true;
}else if (e.keyCode == 46 ) {
manager.remove();
}
}
//called on keyUp. Does the right thing (ex. delete, cut, copy, ect)
function Display_keyUp(e) {
if (e.keyCode==16) {
this.shiftKeyDown = false;
}else if (e.keyCode ==17) {
this.controlKeyDown = false;
}
}
//checks to see if the scroll bars need to be adjusted. Called durring dragging
function Display_adjustScrollBars(e) {
var scrY=0;
var scrX=0;
if (!this.documentElement) return;
var topScroll = this.documentElement.scrollTop;
var leftScroll = this.documentElement.scrollLeft;
var innerHeight = this.documentElement.clientHeight;
var innerWidth = this.documentElement.clientWidth;
if (e.clientY > innerHeight-this.scrollJump) {
if (e.clientY + topScroll < this.pageHeight - (this.scrollJump + 40)) {
scrY=this.scrollJump;
window.scroll(leftScroll,topScroll + scrY);
this.y-=scrY;
}
}else if (e.clientY < this.scrollJump) {
if (topScroll < this.scrollJump) {
scrY = topScroll;
}else {
scrY=this.scrollJump;
}
window.scroll(leftScroll,topScroll - scrY);
this.y+=scrY;
}
if (e.clientX > innerWidth-this.scrollJump) {
if (e.clientX + leftScroll < this.pageWidth - (this.scrollJump + 40)) {
scrX=this.scrollJump;
window.scroll(leftScroll + scrX,topScroll);
this.x-=scrX;
}
}else if (e.clientX < this.scrollJump) {
if (leftScroll < this.scrollJump) {
scrX = leftScroll;
}else {
scrX=this.scrollJump;
}
window.scroll(leftScroll - scrX,topScroll);
this.x+=scrX;
}
}

View file

@ -1,132 +0,0 @@
//--------Constructor--------------------
function EventManager() {
//int document events
document.onmousedown=EventManager_documentMouseDown;
document.onmouseup=EventManager_documentMouseUp;
document.onmousemove=EventManager_documentMouseMove;
document.onkeydown=EventManager_keyDown;
document.onkeyup=EventManager_keyUp;
this.gridHeaderClick = EventManager_gridHeaderClick;
this.gridHeaderMouseOver = EventManager_gridHeaderMouseOver;
this.gridHeaderMouseOut = EventManager_gridHeaderMouseOut;
}
//---------Method Implementations -------------
function EventManager_gridHeaderMouseOver(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
if (!manager.display.dragEnabled) {
var obj =dom? e.target : e.srcElement
var parts = obj.className.split("-");
obj.className="am-grid-header-over-" + parts[parts.length -1];
}
}
function EventManager_gridHeaderMouseOut(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
var obj =dom? e.target : e.srcElement
var parts = obj.className.split("-");
obj.className="am-grid-header-" + parts[parts.length -1];
}
function EventManager_keyDown(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
manager.display.keyDown(e);
return false;
}
function EventManager_keyUp(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
manager.display.keyUp(e);
return false;
}
function EventManager_documentMouseDown(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
obj =dom? e.target : e.srcElement
var asset = manager.getAsset(obj);
if (asset) {
if (e.button != 2) {
manager.display.primeLeftClickContextMenu();
setTimeout("AssetManager_getManager().display.displayLeftClickContextMenu(" + e.clientX + "," + e.clientY + ")",1000);
}
if (e.button != 2 || (e.button == 2 && !manager.display.isSelected(asset))) {
manager.display.selectAsset(asset);
}
if (e.button != 2) {
manager.display.dragStart(asset.div,e.clientX,e.clientY);
return;
}
}
if (e.button != 2) {
manager.display.dragStart(obj,e.clientX,e.clientY);
}
return true;
}
function EventManager_documentMouseUp(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
obj =dom? e.target : e.srcElement
var asset = manager.getAsset(obj);
if ((asset && e.button == 2) || (manager.display.leftClickContextMenuPrimed && manager.contextMenu.owner == manager.display.focusObjects[0])) {
return false;
}
//no longer want the left click context menu
manager.display.resetLeftClickContextMenu();
manager.display.contextMenu.hide();
if (manager.display.contextMenu.owner && (!asset || asset.assetId != manager.display.contextMenu.owner.assetId)) {
manager.display.contextMenu.hide();
}else {
}
if (!asset && obj.id.indexOf("contextMenuItem") == -1) {
manager.display.clearSelectedAssets();
}
manager.display.dragStop();
return false;
}
function EventManager_documentMouseMove(e) {
var dom = document.getElementById&&!document.all;
e=dom? e : event;
//no longer want the left click context menu
manager.display.resetLeftClickContextMenu();
manager.display.move(e);
return false;
}
function EventManager_gridHeaderClick(e) {
var dom = document.getElementById&&!document.all;
var e=dom? e : event;
var obj =dom? e.target : e.srcElement
var parts = obj.id.split(".");
AssetManager_getManager().sortGrid(parts[parts.length-1]);
}

View file

@ -1,86 +0,0 @@
function Grid(headerArray, dataArray,gridId) {
this.headerArray = headerArray;
this.dataArray = dataArray;
this.render = Grid_render;
this.sortColumn = Grid_sortColumn;
this.gridId = gridId;
this.attachEvents = Grid_attachEvents;
//this.attachRowProperty = Grid_attachRowProperty;
//this.attachRowEvent = Grid_attachRowEvent;
}
function Grid_render(div) {
// obj = document.getElementById(key);
// obj.ondblclick=AssetManager_getManager().eventManager.activityDoubleClick;
// obj.oncontextmenu=AssetManager_getManager().eventManager.activityRightClick;
// obj.onmousedown=AssetManager_getManager().eventManager.activityMouseDown;
var gridStr = '<table border="1" id="grid.' + this.gridId + '"><tr id="grid.' + this.gridId + '.headers">';
var eventStr='';
var id = "";
for (i=0;i<this.headerArray.length;i++) {
id = 'grid.' + this.gridId + '.headers.' + i;
gridStr+= '<td id="' + id + '">' + this.headerArray[i] + '</td>';
eventStr += 'document.getElementById("' + id + '").onclick=Grid_headerClicked;';
}
gridStr+= '</tr>';
//['Rank','Title','Type','Last Updated','Size'];
for (i=0;i<this.dataArray.length;i++) {
id = 'grid.' + this.gridId + '.row.' + '.' + i;
gridStr += '<tr id="'+ id + '">';
eventStr += 'document.getElementById("' + id + '").onclick=Grid_rowClicked;';
eventStr += 'document.getElementById("' + id + '").onmouseover=Grid_rowMouseOver;';
eventStr += 'document.getElementById("' + id + '").onmouseout=Grid_rowMouseOut;';
eventStr += 'document.getElementById("' + id + '").ondblclick=Grid_rowDoubleClick;';
eventStr += 'document.getElementById("' + id + '").onmousedown=Grid_rowMouseDown;';
eventStr += 'document.getElementById("' + id + '").oncontextmenu=Grid_rowContextMenu;';
for (k=0;k<this.headerArray.length;k++) {
gridStr+= '<td id="grid.' + this.gridId + '.row.' + '.' + i + '.col.' + k + '">' + this.dataArray[i][k] + '</td>';
}
}
gridStr+='</tr>';
gridStr += '</table>';
div.innerHTML = grid();
}
function Grid_rowClicked(e) {
}
function Grid_rowMouseOver(e) {
}
function Grid_rowMouseOut(e) {
}
function Grid_rowDoubleClick(e) {
}
function Grid_rowMouseDown(e) {
}
function Grid_rowContextMenu(e) {
}
function Grid_sortColumn() {
}

View file

@ -1,32 +0,0 @@
//--------Constructor--------------------
//Creates a new asset object.
function ManageAssets() {
var asset = new Asset();
asset.getContextMenu = function () {
var arr = new Array();
arr[arr.length] = new ContextMenuItem(this.labels["go"],"javascript:" + this.evalReference() + ".go()");
arr[arr.length] = new ContextMenuItem(this.labels["view"],"javascript:" + this.evalReference() + ".view()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["edit"],"javascript:" + this.evalReference() + ".edit()");
arr[arr.length] = new ContextMenuItem(this.labels["editTree"],"javascript:" + this.evalReference() + ".editTree()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:" + this.evalReference() + ".cut()");
arr[arr.length] = new ContextMenuItem(this.labels["copy"],"javascript:" + this.evalReference() + ".copy()");
arr[arr.length] = new ContextMenuItem(this.labels["shortcut"],"javascript:" + this.evalReference() + ".shortcut()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["delete"],"javascript:" + this.evalReference() + ".remove()");
return arr;
}
asset.shortcut = function() {
location.href = this.getWrappedURL() + "func=createShortcut&proceed=manageAssets";
}
return asset;
}

View file

@ -1,27 +0,0 @@
//--------Constructor--------------------
//Creates a new asset object.
function ManageClipboard() {
var asset = new Asset();
asset.dragEnabled = false;
asset.allowMultiSelect = true;
//displays the right click context menu
asset.getContextMenu = function () {
var arr = new Array();
arr[arr.length] = new ContextMenuItem(this.labels["restore"],"javascript:manager.display.contextMenu.owner.restore()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["delete"],"javascript:manager.display.contextMenu.owner.delete()");
return arr;
}
asset.restore = function() {
location.href = this.parent.getWrappedURL() + "func=pasteList" + AssetManager_getManager().getSelectedAssetIds();
}
return asset;
}

View file

@ -1,29 +0,0 @@
//--------Constructor--------------------
//Creates a new asset object.
function ManageTrash() {
var asset = new Asset();
asset.dragEnabled = false;
asset.allowMultiSelect = true;
//displays the right click context menu
asset.getContextMenu = function () {
var arr = new Array();
arr[arr.length] = new ContextMenuItem(this.labels["restore"],"javascript:" + this.evalReference() + ".restore()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["purge"],"javascript:" + this.evalReference() + ".purge()");
return arr;
}
asset.purge = function() {
location.href = this.parent.getWrappedURL() + "func=purgeList" + AssetManager_getManager().getSelectedAssetIds();
}
asset.restore = function() {
location.href = this.parent.getWrappedURL() + "func=restoreList" + AssetManager_getManager().getSelectedAssetIds();
}
return asset;
}

View file

@ -1,125 +0,0 @@
//--------Constructor--------------------
function Tools() {
this.dom=document.getElementById&&!document.all;
this.topLevelElement=this.dom? "HTML" : "BODY"
this.debug = Tools_debug;
this.debugEnabled = false;
this.getElementChildren = Tools_getElementChildren;
this.showObject = Tools_showObject;
this.hideObject = Tools_hideObject;
this.cancelEvent = Tools_cancelEvent;
this.setCookie = Tools_setCookie;
this.getCookie = Tools_getCookie;
this.deleteCookie = Tools_deleteCookie;
this.addParamDelimiter = Tools_addParamDelimiter;
this.getHostName = Tools_getHostName;
document.write('<div id="tools_debugArea" style="position: absolute; display:none; top:0; left:500;z-index:1000;">');
document.write('<form name="tools_debug">');
document.write('<textarea id="out" rows=15 cols=60></textarea>');
document.write('<input type="button" name="clear" value="clear" onClick="document.tools_debug.out.value=\'\'">');
document.write('<input type="button" name="close" value="close" onClick="document.getElementById(\'tools_debugArea\').style.display=\'none\'">');
document.write('</form>');
document.write('</div>');
this.debugArea = document.getElementById("tools_debugArea");
}
function Tools_getHostName(url) {
var serverParts = url.split("/");
return serverParts[2];
}
//returns a ? or & based on contents of url
function Tools_addParamDelimiter(url) {
if (url.indexOf("?") == -1) {
return url + "?";
}else {
return url + "&";
}
}
//---------Method Implementations -------------
//utility method to cancle a build in event.
//ex. Assume you do not want a link to work.
// var tools = new Tools();
// document.getElementById("linkID").onclick=tools.cancleEvent
function Tools_cancelEvent() {
return false;
}
//shows a positionable element by toggling the style display property
function Tools_showObject(obj) {
if (obj) {
obj.style.visibility="visible";
obj.style.display="block";
}
}
//hides a positionable element by toggling the style display property
function Tools_hideObject(obj) {
if (obj) {
obj.style.display="none";
}
}
//gets the element children of a dom object
function Tools_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;
}
//writes debug to the debug window written in the constructor
function Tools_debug(str) {
if (this.debugEnabled) {
this.debugArea.style.display = "block";
document.tools_debug.out.value += "DEBUG: " + str + "\n";
}
}
//set a cookie
function Tools_setCookie(name, value, expires, path, domain, secure) {
var cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = cookie;
}
//get a cookie;
function Tools_getCookie(name) {
var cookie = document.cookie;
var prefix = name + "=";
var begin = cookie.indexOf("; " + prefix);
if (begin == -1) {
begin = cookie.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = cookie.length;
return unescape(cookie.substring(begin + prefix.length, end));
}
//delete a cookie
function Tools_deleteCookie(name, path, domain) {
if (Tools_getCookie(name)) {
document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

View file

@ -1,201 +1,51 @@
.am-grid {
height: 100%;
font: menu;
.am-right { text-align:right; }
.am-left { text-align:left; }
.am-center { text-align:center; }
.am-table {
width: 100%;
font: menu;
font-size: 11px;
}
.am-grid-headers {
background-color:#ffffff;
font-weight: 700;
cursor: pointer;
/*background-color: #BCD4DF; */
.am-headers {
background-color:#ffffff;
font-weight: bold;
}
.am-grid-header-0 {
width: 10px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #7F949F;
padding: 0 10px 0 0;
text-align: right;
}
.am-grid-header-0 img{
padding: 0 3px 0 3px;
}
.am-grid-header-over-0{
width: 10px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #EA5600;
padding: 0 10px 0 0;
text-align: right;
.am-header {
font-size: 10px;
background-color: #F2F3F4;
border-left: 1px solid #ffffff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #7F949F;
text-align: center;
}
.am-grid-header-1 {
width: 200px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #7F949F;
padding: 0 0 0 10px;
}
.am-grid-header-1 img{
padding: 0 3px 0 3px;
.am-header a {
text-decoration: none;
color: black;
}
.am-grid-header-over-1{
width: 200px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #EA5600;
padding: 0 0 0 10px;
.am-row {
color: #000000;
}
.am-grid-header-2 {
width: 50px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #7F949F;
padding: 0 0 0 10px;
}
.am-grid-header-2 img{
padding: 0 3px 0 3px;
}
.am-grid-header-over-2{
width: 50px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #EA5600;
padding: 0 0 0 10px;
}
.am-grid-header-3 {
width: 150px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #7F949F;
padding: 0 0 0 10px;
}
.am-grid-header-3 img{
padding: 0 3px 0 3px;
}
.am-grid-header-over-3{
width: 150px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #EA5600;
padding: 0 0 0 10px;
}
.am-grid-header-4 {
width: 50px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #7F949F;
padding: 0 10px 0 0 ;
text-align: right;
}
.am-grid-header-4 img{
padding: 0 3px 0 3px;
}
.am-grid-header-over-4{
width: 50px;
background-color: #F2F3F4;
border-left: 1px solid #fff;
border-right: 1px solid #7F949F;
border-bottom: 2px solid #EA5600;
padding: 0 10px 0 0;
text-align: right;
}
.am-grid-row {
color: #000000;
}
.am-grid-row-over {
background-color: #C0D2DA;
color: #000000;
}
.am-grid-col-0 {
width: 50px;
cursor:move;
text-align: right;
padding: 0 10px 7px 0;
}
.am-grid-col-1 {
width: 200px;
cursor:move;
padding: 0 0 7px 10px;
vertical-align: middle;
}
.am-grid-col-1 img{
margin: 0px 10px 0 0;
}
.am-grid-col-2 {
cursor:move;
padding: 0 0 7px 10px;
}
.am-grid-col-3 {
cursor:move;
padding: 0 0 7px 10px;
}
.am-grid-col-4 {
cursor:move;
text-align: right;
padding: 0 10px 7px 10px;
}
.am-crumbtrail {
color: #3E697E;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, Arial, sans-serif;
cursor: pointer;
font-size: 11px;
}
.am-crumbtrail-over {
color: #3E697E;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, Arial, sans-serif;
cursor: pointer;
text-decoration: underline;
font-size: 11px;
}
color: black;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, Arial, sans-serif;
}
.am-crumbtrail A {
color: #3E697E;
}
.am-crumbtrail A:hover {
text-decoration: underline;
}
.contextMenu{
position: absolute;
top: 0;
left:0;
font-size: 12px;
display:none;
text-decoration: none;
background-color:#F0F0F0;
border-bottom: 3px groove #999999;
border-top: 0px groove #999999;
border-right: 3px groove #999999;
border-left: 0px groove #999999;}
.contextMenu A{ font-size: 12px; text-decoration: none;}
.contextMenuTabOver{
background-color: #C3CFD4;
text-decoration: none;
width:100%;
color: #154C66;
font-size: 12px;
}
.contextMenuTab, .contextMenuTab A{background-color: #F0F0F0; width:100%; text-decoration: none; font-size: 12px; color:#000000;}
.dragIdentifier{
position:absolute;
display: none;
border: 1px dashed #405F6E;
font-size: 12;}
position:absolute;
display: none;
border: 1px dashed #405F6E;
font-size: 12;}

View file

@ -1,81 +0,0 @@
some basic documentation:
*****************Configuring the asset manager.*****************
//to create a new asset manager
var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.renderAssets();
//available properties. Properties should be set prior to the render asset call.
*********************************************************
assetType - defaults to "Asset"
The following example starts the asset manager with a different asset type.
var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.assetType="MyNewAsset"
manager.renderAssets();
*********************************************************
sortEnabled = true - enables or disables sorting of the grid. Defaults to true
The following example starts the asset manager with sorting disabled.
var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.sortEnabled=false;
manager.renderAssets();
*********************************************************
displayCrumbTrail = Enables or disables display of the crumbtrail. Defaults to true
The following example starts the asset manager with the crumb trail disabled
.
var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.displayCrumbTrail=false;
manager.renderAssets();
**********************************************************
To disable display item in the grid, the disableDisplay function can be called on the asset manager. The function takes the index of the item to disable from the columnHeadings array.
The following example disables the rank and title
var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.disableDisplay(0);
manager.disableDisplay(1);
manager.renderAssets();
*********************Configuring Assets**********************
To create a new asset, the Asset object must be extended. The following example creates an asset with the same properties and methods as the Asset object.
function MyNewAsset() {
var asset = new Asset(); return asset;
} To change the new asset object, properties and methods can be added or overriden
The following example overrides the getContextMenu method, adds a new retore method, and sets the dragEnabled property to false
function MyNewAsset) {
var asset = new Asset();
asset.dragEnabled = false;
asset.getContextMenu = function () {
var arr = new Array(); arr[arr.length] = new ContextMenuItem(this.labels["cut"],"javascript:" + this.evalReference() + ".cut()");
arr[arr.length] = new ContextMenuItem("<img src='/extras/assetManager/breakerLine.gif'>","");
arr[arr.length] = new ContextMenuItem(this.labels["purge"],"javascript:" + this.evalReference() + ".purge()");
return arr; }
asset.restore = function() {
location.href = this.parent.getWrappedURL() + "func=postList" + AssetManager_getManager().getSelectedAssetIds(); }
return asset;
} /*************availble asset properties *********************
dragEnabled - Enables or disables making the asset dragable. Defaults to true
allowMultiSelect - Enables or disables multiselection of the asset. Defaults to true;
***************Notes*********************
1. The asset class contains a getWrappedURL() method that return the asset.url property wrapped in "http://hostname" and the paramenter delimiter
2. asset.parent will return the parent asset (on the crumbtrail)
3. The AssetManager_getManager().getSelectedAssetsIds() method will return a parameter string containing all the selected asset Id's

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

View file

@ -1,18 +1,21 @@
.contextMenu_skin {
position:absolute;
width:120px;
border:2px outset #eeeeee;
font-family: helvetica, arial, sans-serif;
line-height:18px;
width: 100px;
cursor: default;
font-size:12px;
font-size:10px;
z-index:100;
visibility:hidden;
padding: 4px;
background-color: #eeeeee;
background-image: url(bg.jpg);
background-repeat: repeat-x;
font-weight: normal;
text-align: left;
background-color:#F0F0F0;
border-bottom: 3px groove #999999;
border-top: 0px groove #999999;
border-right: 3px groove #999999;
border-left: 0px groove #999999;}
}
.contextMenu_skin A {
font-weight: normal;
@ -20,12 +23,15 @@
color: black;
text-decoration: none;
margin: 1px;
font-size: 10px;
}
.contextMenu_skin A:hover {
text-decoration: none;
font-weight: normal;
color: black;
color: #154c66;
margin: 0px;
background-color: #eeeeee;
border: 1px solid #dddddd;
background-color: #c3cfd4;
border: 1px solid #F0F0F0;
width: 100%;
}

View file

@ -1,11 +1,5 @@
var ie5=document.all&&document.getElementById
var contextMenu_timer = null;
var contextMenu_items = new Array();
function contextMenu_renderLeftClickHold(menuId,e) {
contextMenu_hideAll(e)
contextMenu_timer = setTimeout("contextMenu_show('" + menuId + "', " + contextMenu_getXOffset(e,document.getElementById("menuId")) + "," + contextMenu_getYOffset(e,document.getElementById("menuId")) + ")",1000);
return false;
}
document.onmousedown=contextMenu_hideAll;
@ -22,69 +16,33 @@ function contextMenu_hideAll(e) {
contextMenu_hide();
}
function contextMenu_renderRightClick(menuId,e) {
contextMenu_hideAll(e)
contextMenu_show(menuId,contextMenu_getXOffset(e,document.getElementById("menuId")),contextMenu_getYOffset(e,document.getElementById("menuId")));
function contextMenu_renderLeftClick(menuId,e) {
contextMenu_hideAll(e);
contextMenu_show(menuId,e);
e.cancelBubble=true;
e.returnValue=false;
return false;
}
function contextMenu_getXOffset(e,menu) {
var firedobj = ie5?e.srcElement:e.target;
var tempX = 0;
foundDiv = false;
while (firedobj!=null && firedobj.tagName!="HTML"){
//this is a hack, need to revisit
if (firedobj.tagName == "DIV") foundDiv = true;
tempX+=firedobj.offsetLeft;
firedobj=firedobj.offsetParent;
}
if (foundDiv) {
return e.clientX - tempX;
}else {
return e.clientX;
}
}
function contextMenu_getYOffset(e,menu) {
var firedobj = ie5?e.srcElement:e.target;
var tempY = 0;
foundDiv = false;
while (firedobj!=null && firedobj.tagName!="HTML"){
//this is a hack, need to revisit
if (firedobj.tagName == "DIV") foundDiv = true;
tempY+=firedobj.offsetTop;
firedobj=firedobj.offsetParent;
}
if (foundDiv) {
return e.clientY - tempY;
}else {
return e.clientY;
}
}
function contextMenu_show(menuId,x,y){
function contextMenu_show(menuId,e){
var menuobj=document.getElementById(menuId)
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? document.body.clientWidth-x : window.innerWidth-x
var bottomedge=ie5? document.body.clientHeight-y : window.innerHeight-y
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? document.body.scrollLeft+x-menuobj.offsetWidth : window.pageXOffset+x-menuobj.offsetWidth
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? document.body.scrollLeft+x : window.pageXOffset+x
//same concept with the vertical position
if (bottomedge<menuobj.offsetHeight)
menuobj.style.top=ie5? document.body.scrollTop+y-menuobj.offsetHeight : window.pageYOffset+y-menuobj.offsetHeight
else
menuobj.style.top=ie5? document.body.scrollTop+y : window.pageYOffset+y
var posx = 0;
var posy = 0;
var yoffset = 0;
var xoffset = 0;
var firedobj = ie5?e.srcElement:e.target;
while (firedobj!=null && firedobj.tagName!="HTML"){
//this is a hack, need to revisit
if (firedobj.tagName == "DIV") {
xoffset+=firedobj.offsetLeft;
yoffset+=firedobj.offsetTop;}
firedobj=firedobj.offsetParent;
}
posx = e.clientX - xoffset + (ie5? document.body.scrollLeft : window.pageXOffset);
posy = e.clientY - yoffset + (ie5? document.body.scrollTop : window.pageYOffset);
menuobj.style.left=posx;
menuobj.style.top=posy;
menuobj.style.visibility="visible"
return false
}
@ -96,33 +54,48 @@ function contextMenu_hide(){
return false;
}
function contextMenu_killTimer(){
try {
clearTimeout(contextMenu_timer);
}catch (e) {
}
return false;
}
function contextMenu_create(imagePath, id, name){
function contextMenu_createWithImage(imagePath, id, name){
contextMenu_items.push(id);
this.id = id;
this.name = name;
this.type = "image";
this.imagePath=imagePath;
this.linkLabels = new Array();
this.linkUrls = new Array();
this.draw = contextMenu_draw;
this.print = contextMenu_print;
this.addLink = contextMenu_addLink;
}
function contextMenu_createWithLink(id, name){
contextMenu_items.push(id);
this.id = id;
this.name = name;
this.type = "link";
this.linkLabels = new Array();
this.linkUrls = new Array();
this.draw = contextMenu_draw;
this.print = contextMenu_print;
this.addLink = contextMenu_addLink;
}
function contextMenu_draw(){
document.write('<div id="contextMenu_' + this.id + '_menu" class="contextMenu_skin">');
var output = "";
output += '<div id="contextMenu_' + this.id + '_menu" class="contextMenu_skin">';
for (i=0;i<this.linkUrls.length;i++) {
document.write("<a href=\"" + this.linkUrls[i] + "\">" + this.linkLabels[i] + "</a><br />");
output += "<a href=\"" + this.linkUrls[i] + "\">" + this.linkLabels[i] + "</a><br />";
}
document.write('</div>');
document.write('<img src="' + this.imagePath + '" id="contextMenu_' + this.id + '" onmouseup="contextMenu_killTimer()" oncontextmenu="return contextMenu_renderRightClick(\'contextMenu_' + this.id + '_menu\',event)" onmousedown="contextMenu_renderLeftClickHold(\'contextMenu_' + this.id + '_menu\',event)" alt="' + this.name + '" title="' + this.name + '" align="absmiddle" />');
output += '</div>';
if (this.type == "image") {
output += '<img src="' + this.imagePath + '" id="contextMenu_' + this.id + '" onclick="return contextMenu_renderLeftClick(\'contextMenu_' + this.id + '_menu\',event)" alt="' + this.name + '" title="' + this.name + '" align="absmiddle" />';
} else {
output += '<a href="#" id="contextMenu_' + this.id + '" onclick="return contextMenu_renderLeftClick(\'contextMenu_' + this.id + '_menu\',event)">' + this.name + '</a>';
}
return output;
}
function contextMenu_print(){
document.write(this.draw());
}
function contextMenu_addLink(linkUrl,linkLabel){

View file

@ -1,98 +0,0 @@
<HTML>
<HEAD>
<TITLE>edit-on Pro</TITLE>
<SCRIPT language="JavaScript">
function functSet()
{
// Put the contents from the TEXTAREA field into the editor
//document.myEditor.setHTMLData( "" , document.myForm.myTextArea.value );
}
function functGet()
{
// Get the contents of the editor and copy them into the TEXTAREA field
//document.myForm.myTextArea.value = document.myEditor.getHTMLData( "" );
window.blur();
window.opener.focus();
window.opener.formObj.value = document.myEditor.getHTMLData( "" );
window.close();
}
// This callback function is called after the applet has successfully initialized
function onEditorLoaded(editorapplet)
{
//editorapplet.setHTMLData("http://","<p>Some <b>bold</b> Text</p>");
editorapplet.setHTMLData("http://",window.opener.formObj.value);
};
// This callback function is called after the applet has successfully finished loading HTML dat
function onDataLoaded(editorapplet)
{
//editorapplet.insertHTMLData("http://","<p>Some more <b>bold</b> Text</p>");
};
</SCRIPT>
</HEAD>
<BODY bgcolor="#EEEEEE">
<form>
<APPLET code="EditorApplet" codeBase="./eopro/" id="myEditor" name="myEditor"
archive="edit-on-pro-signed.jar,ssce.jar" width="700" height="400" VIEWASTEXT MAYSCRIPT>
<PARAM NAME="cabbase" VALUE="edit-on-pro-signed.cab,ssce.cab">
<PARAM NAME="locale" VALUE="en_US"> <!-- Change this to change UI language e.g de_DE, fr_FR, es_ES -->
<PARAM NAME="help" VALUE="eophelp/en_US/help_en_US.htm"> <!-- This is relative to CODEBASE, can be changed according to UI language -->
<PARAM NAME="toolbarurl" VALUE="toolbar-sample.xml"> <!-- This is relative to CODEBASE -->
<PARAM NAME="spellcheckproperties" VALUE="sc-americanenglish.txt"> <!-- This is relative to CODEBASE -->
<!-- <PARAM NAME="imageroot" VALUE="http://localhost"> Optional - Set this to the reference base of relative image SRCs -->
<!-- <PARAM NAME="imageproxyurl" VALUE="/cgi-bin/imageproxy.cgi?"> Optional - Set this if you use an unsigned CAB/JAR and want to insert remote images-->
<PARAM NAME="sourceview" VALUE="true">
<PARAM NAME="sourceviewwordwrap" VALUE="true">
<PARAM NAME="startupscreenbackgroundcolor" value="#EEEEEE">
<PARAM NAME="defaultfontcolor" VALUE="black">
<PARAM NAME="defaultbackgroundcolor" VALUE="white">
<PARAM NAME="defaultlinkcolor" VALUE="blue">
<PARAM NAME="defaultfontsize" VALUE="10">
<PARAM NAME="defaultfontface" VALUE="Serif">
<PARAM NAME="bodyonly" VALUE="true">
<PARAM NAME="textmode" VALUE="false">
<PARAM NAME="xhtmlmode" VALUE="true">
<PARAM NAME="inserttext_html" VALUE="TRUE">
<PARAM NAME="gethtmldataurl" VALUE=""> <!-- Absolute URL or relative to DOCBASE -->
<PARAM NAME="sethtmldataurl" VALUE=""> <!-- Absolute URL or relative to DOCBASE -->
<PARAM NAME="simpletable" VALUE="true">
<PARAM NAME="tableNBSPfill" VALUE="true">
<PARAM NAME="table_numrows" VALUE="3">
<PARAM NAME="table_numcols" VALUE="4">
<PARAM NAME="table_overallwidth" VALUE="100%">
<PARAM NAME="table_rowheight" VALUE="10">
<PARAM NAME="table_colwidth" VALUE="25%">
<PARAM NAME="ONEDITORLOADED" VALUE="onEditorLoaded">
<PARAM NAME="ONDATALOADED" VALUE="onDataLoaded">
</APPLET>
<input type="button" value="Done Editing" onClick="functGet()"></form>
</BODY>
</HTML>