You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sm...@apache.org on 2006/11/07 22:18:47 UTC
svn commit: r472273 [3/6] - in
/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed: ./ desktop/
widget/ windowicons/ windowthemes/ windowthemes/blueocean/
windowthemes/blueocean/css/ windowthemes/blueocean/images/
windowthemes/blueocean/images/des...
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/manifest.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/manifest.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/manifest.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/manifest.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,60 @@
+dojo.provide("desktop.manifest");
+dojo.require("dojo.string.extras");
+
+
+
+dojo.provide("dojo.namespaces.dojo");
+dojo.require("dojo.ns");
+
+(function(){
+ //mapping of all widget short names to their full package names
+ // This is used for widget autoloading - no dojo.require() is necessary.
+ // If you use a widget in markup or create one dynamically, then this
+ // mapping is used to find and load any dependencies not already loaded.
+ // You should use your own namespace for any custom widgets.
+ // For extra widgets you use, dojo.declare() may be used to explicitly load them.
+ var map = {
+ html: {
+ "editortable": "jetspeed.widget.EditorTable",
+ "multirowheadertable": "jetspeed.widget.MultiRowHeaderTable",
+ "portalaccordioncontainer": "jetspeed.widget.PortalAccordionContainer",
+ "portalaccordionpane": "jetspeed.widget.PortalAccordionPane",
+ "portalmenuoptionlink": "jetspeed.widget.PortalMenuOptionLink",
+ "portaltabcontainer": "jetspeed.widget.PortalTabContainer",
+ "portaltaskbar": "jetspeed.widget.PortalTaskBar",
+ "portaltaskbaritem": "jetspeed.widget.PortalTaskBarItem",
+ "portletdefcontainer": "jetspeed.widget.PortletDefContainer",
+ "portletwindow": "jetspeed.widget.PortletWindow",
+ "portletwindowresizehandle": "jetspeed.widget.PortletWindowResizeHandle",
+ "portletdefcontaineritem": "jetspeed.widget.PortletDefContainerItem"
+ }
+ };
+
+ function jetspeedNamespaceResolver(name, domain){
+ if(!domain){ domain="html"; }
+ if(!map[domain]){ return null; }
+ return map[domain][name];
+ }
+
+ dojo.registerNamespaceResolver("jetspeed", jetspeedNamespaceResolver);
+})();
+
+
+
+
+// This is a full custom namespace example
+// By convention, myns lives in <dojo root>/../myns/,
+// and myns widgets are in myns.widget
+// Convention paths are autodiscovered, and all we would
+// have to do here is register a resolver with
+// dojo.registerNamespaceResolver("myns", <resolver>);
+/*
+dojo.registerNamespaceManifest("jetspeed", "desktop", "jetspeed", "myns.widget",
+ function(name){
+ var module = "myns.widget."+dojo.string.capitalize(name);
+ dojo.debug("resolver returning '"+module+"' for '"+name+"'");
+ return module;
+ }
+);
+
+*/
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,281 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dojo.provide("jetspeed.widget.EditorTable");
+
+dojo.require("dojo.widget.SortableTable");
+
+jetspeed.widget.EditorTable = function()
+{
+ dojo.widget.SortableTable.call(this);
+ this.widgetType = "EditorTable";
+ this.headerSortUpClass="selectedUp";
+ this.headerSortDownClass="selectedDown";
+};
+
+dojo.inherits( jetspeed.widget.EditorTable, dojo.widget.SortableTable);
+
+dojo.lang.extend( jetspeed.widget.EditorTable, {
+ saveWarningDialogWidgetId: null,
+
+ /* derived class protocol - attach-to or override this methods */
+ updateEditor: function( rowData )
+ {
+
+ },
+ saveEntrySubmit: function( selectedRowData, /* boolean */ removeEntry )
+ {
+
+ },
+ clearAndDisableEditor: function()
+ {
+
+ },
+ getNewEntryPrototype: function()
+ {
+ return {};
+ },
+
+ /* base class protocol */
+ render: function(bDontPreserve)
+ {
+ bDontPreserve = true; // for EditorTable, all calls to render should not reset data (i.e. call SortableTable.parseDataFromTable())
+ jetspeed.widget.EditorTable.superclass.render.call( this, bDontPreserve );
+ },
+
+ buildRendering: function(args, frag)
+ {
+ jetspeed.widget.EditorTable.superclass.buildRendering.call( this, args, frag );
+ if ( args.templateCssPath )
+ {
+ dojo.widget.fillFromTemplateCache(this, null, dojo.uri.dojoUri(args.templateCssPath), null, false);
+ }
+ },
+
+
+ /* methods */
+ hasRowChanged: function( rowData )
+ {
+ if ( ! rowData ) return false;
+ var tId = rowData.Id;
+ var masterData = this.getData( this.js_masterdata, tId );
+ var changed = ( rowData.__isNew || rowData.__isModified ) ? true : false;
+ if ( ! changed )
+ {
+ for ( var slotKey in masterData )
+ {
+ if ( rowData[ slotKey ] != masterData[ slotKey ] )
+ {
+ //dojo.debug( "slot " + slotKey + " changed - old: " + masterData[ slotKey ] + " new: " + rowData[ slotKey ] ) ;
+ changed = true;
+ break;
+ }
+ }
+ }
+ return changed;
+ },
+ entryIsNew: function( rowData )
+ {
+ if ( ! rowData ) return false;
+ return rowData.__isNew ;
+ },
+ setModified: function( rowData )
+ {
+ if ( ! rowData ) return;
+ rowData.__isModified = true;
+ },
+ getSelectedRow: function()
+ {
+ if ( this.selected && this.selected.length == 1 )
+ {
+ var tId = this.selected[0].Id;
+ var data = this.getData( this.data, tId );
+ return data;
+ }
+ return null;
+ },
+ getData: function( tableWidgetData, matchId )
+ {
+ if ( ! tableWidgetData ) return null ;
+ for( var i = 0 ; i < tableWidgetData.length; i++ )
+ {
+ if ( tableWidgetData[ i ].Id == matchId )
+ {
+ return tableWidgetData[ i ];
+ }
+ }
+ return null;
+ },
+ getDataIndex: function( tableWidgetData, matchId )
+ {
+ if ( ! tableWidgetData ) return -1;
+ for( var i = 0 ; i < tableWidgetData.length; i++ )
+ {
+ if ( tableWidgetData[ i ].Id == matchId )
+ {
+ return i;
+ }
+ }
+ return -1;
+ },
+ processTableRowEvent: function( e )
+ {
+ var row = dojo.html.getParentByType( e.target, "tr" );
+ var rowData = this.getObjectFromRow( row );
+ this.updateEditor( rowData );
+ },
+
+ checkForChanges: function()
+ {
+ var selectedRowData = this.getSelectedRow();
+
+ if ( ! selectedRowData ) return false;
+ var hasChanged = this.hasRowChanged( selectedRowData );
+ return ( ! hasChanged ? false : ( selectedRowData.__isNew ? "new" : "modified" ) );
+ },
+
+ updateClonedData: function( fromData, toData )
+ {
+ if ( ! fromData || ! toData ) return;
+ for ( var slotKey in fromData )
+ {
+ toData[ slotKey ] = fromData[ slotKey ];
+ }
+ },
+
+ printSelection: function()
+ {
+ if ( this.selected && this.selected.length == 1 )
+ dojo.debug( this.widgetId + " selection: " + jsDebugShallow( this.selected[0] ) );
+ else
+ dojo.debug( this.widgetId + " selection: null" );
+ },
+
+ newEntry: function()
+ {
+ if ( this.saveWarningDialogWidgetId )
+ {
+ if ( this.checkForChanges() )
+ {
+ dojo.widget.byId( this.saveWarningDialogWidgetId ).show();
+ return;
+ }
+ }
+
+ var newEntry = dojo.lang.shallowCopy( this.getNewEntryPrototype() );
+ var tId = 1;
+ for ( var i = 0 ; i < this.js_masterdata.length; i++ )
+ {
+ if ( this.js_masterdata[i].Id >= tId )
+ tId = this.js_masterdata[i].Id + 1;
+ }
+ newEntry.Id = tId;
+ this.js_masterdata.push( dojo.lang.shallowCopy( newEntry ) );
+ newEntry.__isNew = true;
+ this.data.push( newEntry );
+ this.selected = [ dojo.lang.shallowCopy( newEntry ) ];
+
+ this.render(true);
+ this.showSelections();
+
+ this.updateEditor( newEntry );
+ },
+
+ deleteEntry: function()
+ {
+ var selectedRowData = this.getSelectedRow();
+
+ if ( ! selectedRowData ) return;
+ var tId = selectedRowData.Id;
+
+ if ( ! selectedRowData.__isNew )
+ this.saveEntrySubmit( selectedRowData, true );
+
+ var tIndex = this.getDataIndex( this.js_masterdata, tId );
+ if ( tIndex != -1 )
+ this.js_masterdata.splice( tIndex, 1 );
+
+ tIndex = this.getDataIndex( this.data, tId );
+ if ( tIndex != -1 )
+ this.data.splice( tIndex, 1 );
+
+ this.selected = [];
+ this.render(true);
+ this.showSelections();
+
+ this.clearAndDisableEditor();
+ },
+ saveEntry: function()
+ {
+ var selectedRowData = this.getSelectedRow();
+
+ if ( ! selectedRowData ) { dojo.raise( "saveEntry can't find selectedRowData" ) ; return; }
+ var masterData = this.getData( this.js_masterdata, selectedRowData.Id );
+ if ( ! masterData ) { dojo.raise( "saveEntry can't find masterdata" ) ; return; }
+
+ this.saveEntrySubmit( selectedRowData );
+
+ //delete masterData.__isNew;
+ //delete masterData.__isModified;
+ delete selectedRowData.__isNew;
+ delete selectedRowData.__isModified;
+ this.updateClonedData( selectedRowData, masterData );
+ this.updateClonedData( selectedRowData, this.selected[0] );
+ this.updateEditor( selectedRowData );
+ },
+
+ revertEntry: function()
+ {
+ var selectedRowData = this.getSelectedRow();
+
+ if ( ! selectedRowData ) return;
+
+ if ( selectedRowData.__isNew )
+ {
+ deleteEntry();
+ }
+ else
+ {
+ delete selectedRowData.__isModified;
+ var masterData = this.getData( this.js_masterdata, selectedRowData.Id );
+ if ( ! masterData ) return;
+ this.updateClonedData( masterData, selectedRowData );
+ this.updateClonedData( masterData, this.selected[0] );
+ this.render(true);
+ this.showSelections();
+ this.updateEditor( masterData );
+ }
+ },
+
+ okToChangeSelectionOrExit: function( invocation ) // listSelectionChangeOk
+ {
+ if ( this.checkForChanges() )
+ {
+ if ( this.saveWarningDialogWidgetId )
+ {
+ dojo.widget.byId( this.saveWarningDialogWidgetId ).show();
+ return false;
+ }
+ else
+ {
+ this.saveEntry();
+ }
+ }
+ if ( invocation != null )
+ invocation.proceed();
+ return true;
+ }
+});
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.css?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.css (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.css Tue Nov 7 13:18:43 2006
@@ -0,0 +1,150 @@
+
+#jetspeedDesktopCell {
+ vertical-align: top;
+ /* hack of "vertical-align: top" needed by IE once the leftnav was added */
+ width: 100%;
+ /* needed to honor explicit size of left nav column when windowTiling is false */
+}
+
+#jetspeedColumns {
+ width: 100%;
+}
+
+.desktopColumn {
+ float: left;
+ /* background-color: transparent; */
+}
+.desktopColumnClear {
+ float: left;
+ clear: both;
+ /* background-color: transparent; */
+}
+.columnSpacer {
+
+}
+*html .desktopColumn {
+ overflow: hidden;
+ /* background-color: transparent; */
+ /* background-color: #666; */
+}
+
+#pwGhost {
+ border: 1px dashed #F00;
+ margin: 2px;
+}
+
+/********** Outer Window ***************/
+
+.dojoFloatingPane {
+ /* essential css */
+ position: absolute;
+ overflow: hidden; /* dojo says 'visible' with this explanation "so drop shadow is displayed"" */
+ /* we says 'hidden' cause IE likes to kindly expand div to fit content otherwise */
+ z-index: 10;
+
+ /* styling css */
+ border: 1px solid;
+ border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight;
+ background-color: ThreeDFace;
+}
+
+
+/********** Title Bar ****************/
+
+.dojoFloatingPaneTitleBar {
+ vertical-align: top;
+ margin: 2px 2px 2px 2px;
+ z-index: 10;
+ background-color: #7596c6;
+ cursor: move;
+ overflow: hidden;
+ height: 22px;
+ border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight;
+ vertical-align: middle;
+}
+
+.dojoFloatingPaneTitleText {
+ float: left;
+ padding: 2px 4px 2px 2px;
+ white-space: nowrap;
+ color: CaptionText;
+ font: small-caption;
+}
+
+.dojoFloatingPaneActions{
+ float: right;
+ position: absolute;
+ right: 2px;
+ top: 2px;
+ vertical-align: middle;
+}
+
+
+.dojoFloatingPaneActionItem {
+ vertical-align: middle;
+ margin-right: 1px;
+ height: 22px;
+ width: 22px;
+}
+
+.portletWindowActionButton {
+ vertical-align: middle;
+ margin-right: 1px;
+
+ height: 22px;
+ width: 22px;
+
+ float: right;
+
+ background-repeat: no-repeat;
+ background-position: center center;
+}
+
+.dojoFloatingPaneTitleBarIcon {
+ /* essential css */
+ float: left;
+
+ /* styling css */
+ height: 16px;
+ width: 16px;
+ margin-top: 3px;
+ margin-left: 2px;
+ margin-right: 3px;
+}
+
+/* minimize/maximize icons are specified by CSS only */
+.dojoFloatingPaneMinimizeIcon,
+.dojoFloatingPaneMaximizeIcon,
+.dojoFloatingPaneRestoreIcon,
+.dojoFloatingPaneCloseIcon {
+ vertical-align: middle;
+ height: 22px;
+ width: 22px;
+ float: right;
+ cursor: default;
+}
+
+/* bar at bottom of window that holds resize handle */
+.dojoFloatingPaneResizebar {
+ z-index: 10;
+ height: 13px;
+ background-color: ThreeDFace;
+ /*padding: 0px;
+ margin: 0px;*/
+}
+
+/************* Client Area ***************/
+
+.dojoFloatingPaneClient {
+ position: relative;
+ z-index: 10;
+ border: 1px solid;
+ border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow;
+ margin: 2px;
+ background-color: ThreeDFace;
+ padding: 8px;
+ /*font-family: Verdana, Helvetica, Garamond, sans-serif;
+ font-size: 12px;*/
+ overflow: auto;
+}
+
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.html?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.html (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlFloatingPane.html Tue Nov 7 13:18:43 2006
@@ -0,0 +1,19 @@
+<div id="${this.widgetId}" class="dojoFloatingPane" > <!-- dojoAttachEvent="onMouseDown" -->
+ <div id="${this.widgetId}_titleBar" dojoAttachPoint="titleBar" class="dojoFloatingPaneTitleBar" dojoAttachEvent="onMouseDown;onMouseOver:titleMouseOver;onMouseOut:titleMouseOut" style="display:none">
+ <img dojoAttachPoint="titleBarIcon" class="dojoFloatingPaneTitleBarIcon">
+ <!--
+ <div dojoAttachPoint="closeAction" dojoAttachEvent="onClick:closeWindow"
+ class="dojoFloatingPaneCloseIcon"></div>
+ <div dojoAttachPoint="maximizeAction" dojoAttachEvent="onClick:maximizeWindow"
+ class="dojoFloatingPaneMaximizeIcon"></div>
+ <div dojoAttachPoint="restoreAction" dojoAttachEvent="onClick:restoreWindow"
+ class="dojoFloatingPaneRestoreIcon"></div>
+ <div dojoAttachPoint="minimizeAction" dojoAttachEvent="onClick:minimizeWindow"
+ class="dojoFloatingPaneMinimizeIcon"></div> -->
+ <div dojoAttachPoint="titleBarText" class="dojoFloatingPaneTitleText">${this.title}</div>
+ </div>
+
+ <div dojoAttachPoint="containerNode" class="dojoFloatingPaneClient"></div>
+
+ <div dojoAttachPoint="resizeBar" class="dojoFloatingPaneResizebar"></div>
+</div>
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlTaskBarItemTemplate.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlTaskBarItemTemplate.html?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlTaskBarItemTemplate.html (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/HtmlTaskBarItemTemplate.html Tue Nov 7 13:18:43 2006
@@ -0,0 +1 @@
+<table class="portalTaskBarItemTable" cellspacing="0"><tr dojoAttachEvent="onClick"><td class="dojoTaskBarItem"></td><td class="portalTaskBarItemEndCap"></td></tr></table>
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/MultiRowHeaderTable.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/MultiRowHeaderTable.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/MultiRowHeaderTable.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/MultiRowHeaderTable.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dojo.provide("jetspeed.widget.MultiRowHeaderTable");
+
+dojo.require("dojo.widget.SortableTable");
+
+jetspeed.widget.MultiRowHeaderTable = function()
+{
+ dojo.widget.SortableTable.call(this);
+ this.widgetType = "MultiRowHeaderTable";
+ this.headerSortUpClass="selectedUp";
+ this.headerSortDownClass="selectedDown";
+};
+
+dojo.inherits( jetspeed.widget.MultiRowHeaderTable, dojo.widget.SortableTable);
+
+dojo.lang.extend( jetspeed.widget.MultiRowHeaderTable, {
+
+ buildRendering: function(args, frag)
+ {
+ jetspeed.widget.MultiRowHeaderTable.superclass.buildRendering.call( this, args, frag );
+ if ( args.templateCssPath )
+ {
+ dojo.widget.fillFromTemplateCache(this, null, dojo.uri.dojoUri(args.templateCssPath), null, false);
+ }
+ },
+
+ parseColumns:function(/* HTMLTableHeadElement */ node){
+ // summary
+ // parses the passed element to create column objects
+ this.reset();
+ var rows=node.getElementsByTagName("tr");
+ if (rows && rows.length > 0){
+ for(var rowI=0; rowI<rows.length; rowI++){
+ var cells=rows[rowI].getElementsByTagName("td");
+ if (cells.length==0) cells=rows[rowI].getElementsByTagName("th");
+
+ for(var i=0; i<cells.length; i++){
+ var isCol=true;
+ if(dojo.html.hasAttribute(cells[i], "colspan")){
+ colspan=dojo.html.getAttribute(cells[i],"colspan");
+ if(colspan > 1)
+ isCol=false;
+ }
+ if(isCol){
+ var o={
+ domNode:cells[i],
+ field:null,
+ format:null,
+ noSort:false,
+ sortType:"String",
+ dataType:String,
+ sortFunction:null,
+ label:null,
+ align:"left",
+ valign:"middle",
+ getField:function(){ return this.field||this.label; },
+ getType:function(){ return this.dataType; }
+ };
+ // presentation attributes
+ if(dojo.html.hasAttribute(cells[i], "align")){
+ o.align=dojo.html.getAttribute(cells[i],"align");
+ }
+ if(dojo.html.hasAttribute(cells[i], "valign")){
+ o.valign=dojo.html.getAttribute(cells[i],"valign");
+ }
+
+ // sorting features.
+ if(dojo.html.hasAttribute(cells[i], "nosort")){
+ o.noSort=dojo.html.getAttribute(cells[i],"nosort")=="true";
+ }
+ if(dojo.html.hasAttribute(cells[i], "sortusing")){
+ var trans=dojo.html.getAttribute(cells[i],"sortusing");
+ var f=this.getTypeFromString(trans);
+ if (f!=null && f!=window && typeof(f)=="function")
+ o.sortFunction=f;
+ }
+
+ if(dojo.html.hasAttribute(cells[i], "field")){
+ o.field=dojo.html.getAttribute(cells[i],"field");
+ }
+ if(dojo.html.hasAttribute(cells[i], "format")){
+ o.format=dojo.html.getAttribute(cells[i],"format");
+ }
+ if(dojo.html.hasAttribute(cells[i], "dataType")){
+ var sortType=dojo.html.getAttribute(cells[i],"dataType");
+ if(sortType.toLowerCase()=="html"||sortType.toLowerCase()=="markup"){
+ o.sortType="__markup__"; // always convert to "__markup__"
+ o.noSort=true;
+ }else{
+ var type=this.getTypeFromString(sortType);
+ if(type){
+ o.sortType=sortType;
+ o.dataType=type;
+ }
+ }
+ }
+ o.label=dojo.html.renderedTextContent(cells[i]);
+ this.columns.push(o);
+
+ cells[i].className=this.headerClass;
+
+ // check to see if there's a default sort, and set the properties necessary
+ if(dojo.html.hasAttribute(cells[i], "sort")){
+ this.sortIndex=i;
+ var dir=dojo.html.getAttribute(cells[i], "sort");
+ if(!isNaN(parseInt(dir))){
+ dir=parseInt(dir);
+ this.sortDirection=(dir!=0)?1:0;
+ }else{
+ this.sortDirection=(dir.toLowerCase()=="desc")?1:0;
+ }
+ }
+
+ if(!o.noSort){
+ dojo.event.connect(cells[i], "onclick", this, "onHeaderClick");
+ }
+ if(this.sortIndex == i && rowI == 0){
+ if(this.sortDirection==0){
+ cells[i].className=this.headerSortDownClass;
+ }else{
+ cells[i].className=this.headerSortUpClass;
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+
+ onHeaderClick:function(/* DomEvent */ e){
+ // summary
+ // Main handler function for each header column click.
+ var oldIndex=this.sortIndex;
+ var oldDirection=this.sortDirection;
+ var source=e.target;
+ for(var i=0; i<this.columns.length; i++){
+ if(this.columns[i].domNode==source){
+ if(i!=oldIndex){
+ // new col.
+ this.sortIndex=i;
+ this.sortDirection=0;
+ this.columns[i].domNode.className=this.headerSortDownClass
+ }else{
+ this.sortDirection=(oldDirection==0)?1:0;
+ if(this.sortDirection==0){
+ this.columns[i].domNode.className=this.headerSortDownClass;
+ }else{
+ this.columns[i].domNode.className=this.headerSortUpClass;
+ }
+ }
+ }else{
+ // reset the header class.
+ this.columns[i].domNode.className=this.headerClass;
+ }
+ }
+ this.render();
+ },
+
+ postCreate:function(){
+ // summary
+ // overridden from HtmlWidget, initializes and renders the widget.
+ var thead=this.domNode.getElementsByTagName("thead")[0];
+ if(this.headClass.length>0){
+ thead.className=this.headClass;
+ }
+
+ // disable selections
+ dojo.html.disableSelection(this.domNode);
+
+ // parse the columns.
+ this.parseColumns(thead);
+
+ // attach header handlers.
+
+
+ // parse the tbody element and re-render it.
+ var tbody=this.domNode.getElementsByTagName("tbody")[0];
+ if (this.tbodyClass.length>0) {
+ tbody.className=this.tbodyClass;
+ }
+
+ this.parseDataFromTable(tbody);
+ this.render(true);
+ }
+
+});
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dojo.provide("jetspeed.widget.PortalAccordionContainer");
+dojo.provide("jetspeed.widget.PortalMenuOptionLink");
+
+dojo.require("jetspeed.desktop.core");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.TabContainer");
+
+jetspeed.widget.PortalAccordionContainer = function()
+{
+ this.widgetType = "PortalAccordionContainer";
+ this.isContainer = true;
+ //this.templateString = '<div id="navcolumn"><table cellpadding="0" cellspacing="4" border="0" width="100%"><tr><td><div dojoAttachPoint="containerNode" class="toolgroup"></div></td></tr></table></div>';
+ this.templateString = '<div dojoAttachPoint="containerNode" class="toolgroup"></div>';
+ dojo.widget.HtmlWidget.call(this);
+};
+
+dojo.inherits(jetspeed.widget.PortalAccordionContainer, dojo.widget.HtmlWidget);
+
+dojo.lang.extend( jetspeed.widget.PortalAccordionContainer,
+{
+ // dojo.widget.Widget create protocol
+ postMixInProperties: function( args, fragment, parentComp )
+ {
+ this.templateCssPath = new dojo.uri.Uri( jetspeed.prefs.getDesktopThemeRootUrl() + "/css/PortalAccordionContainer.css" ) ;
+ jetspeed.widget.PortalAccordionContainer.superclass.postMixInProperties.call( this, args, fragment, parentComp );
+ },
+ createAndAddPane: function( /* jetspeed.om.MenuOption */ labelMenuOption, accordionPaneProps )
+ {
+ if ( ! accordionPaneProps )
+ accordionPaneProps = {};
+ if ( labelMenuOption )
+ {
+ accordionPaneProps.label = labelMenuOption.getText();
+ if ( labelMenuOption.getHidden() )
+ accordionPaneProps.open = false;
+ else
+ accordionPaneProps.open = true;
+
+ accordionPaneProps.labelNodeClass = "label";
+ accordionPaneProps.containerNodeClass = "FolderList";
+ accordionPaneProps.templatePath = new dojo.uri.Uri( jetspeed.url.basePortalDesktopUrl() + "/javascript/jetspeed/widget/TitlePane.html" ) ;
+ accordionPaneProps.allowCollapse = false;
+ }
+
+ var accordionPaneWidget = dojo.widget.createWidget( "AccordionPane", accordionPaneProps );
+ this.addChild( accordionPaneWidget );
+ return accordionPaneWidget;
+ },
+ addLinksToPane: function( accordionPaneWidget, /* Array */ menuOptions )
+ {
+ if ( ! menuOptions || ! accordionPaneWidget ) return;
+
+ var linkWidget;
+ for ( var i = 0; i < menuOptions.length; i++ )
+ {
+ linkWidget = dojo.widget.createWidget( "jetspeed:PortalMenuOptionLink", { menuOption: menuOptions[i] } );
+ accordionPaneWidget.addChild( linkWidget );
+ }
+ },
+ createJetspeedMenu: function( /* jetspeed.om.Menu */ menuObj )
+ {
+ if ( ! menuObj ) return;
+ var menuOpts = menuObj.getOptions();
+ var currentLinkGroup = [], currentLinkGroupOpt = null, menuOption = null, menuOptIndex = 0;
+ while ( currentLinkGroup != null )
+ {
+ menuOption = null;
+ if ( menuOptIndex < menuOpts.length )
+ { // another one
+ menuOption = menuOpts[menuOptIndex];
+
+ menuOptIndex++;
+ }
+ if ( menuOption == null || menuOption.isSeparator() )
+ {
+ if ( currentLinkGroup != null && currentLinkGroup.length > 0 )
+ { // add pane
+ var accordionPaneWidget = this.createAndAddPane( currentLinkGroupOpt );
+ this.addLinksToPane( accordionPaneWidget, currentLinkGroup );
+ }
+ currentLinkGroupOpt = null;
+ currentLinkGroup = null;
+ if ( menuOption != null )
+ {
+ currentLinkGroupOpt = menuOption;
+ currentLinkGroup = [];
+ }
+ }
+ else if ( menuOption.isLeaf() && menuOption.getUrl() )
+ {
+ currentLinkGroup.push( menuOption );
+ }
+ }
+ }
+});
+
+/*
+jetspeed.widget.PortalAccordionPane = function()
+{
+ dojo.widget.AccordionPane.call(this);
+ this.widgetType = "PortalAccordionPane";
+};
+
+dojo.inherits( jetspeed.widget.PortalAccordionPane, dojo.widget.AccordionPane );
+
+dojo.lang.extend( jetspeed.widget.PortalAccordionPane,
+{
+ setSizes: function()
+ {
+ this.siblingWidgets = []; // to keep label click from collapsing all siblings
+ }
+
+});
+*/
+
+jetspeed.widget.PortalMenuOptionLink = function()
+{
+ dojo.widget.HtmlWidget.call(this);
+
+ this.widgetType = "PortalMenuOptionLink";
+ this.templateString = '<div dojoAttachPoint="containerNode"><a href="" dojoAttachPoint="menuOptionLinkNode" dojoAttachEvent="onClick" class="Link"></a></div>';
+};
+dojo.inherits(jetspeed.widget.PortalMenuOptionLink, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(jetspeed.widget.PortalMenuOptionLink, {
+ fillInTemplate: function()
+ {
+ if ( this.iconSrc )
+ {
+ var img = document.createElement("img");
+ img.src = this.iconSrc;
+ this.menuOptionLinkNode.appendChild( img );
+ }
+ this.menuOptionLinkNode.href = this.menuOption.navigateUrl();
+ this.menuOptionLinkNode.appendChild( document.createTextNode( this.menuOption.getShortTitle() ) );
+ dojo.html.disableSelection( this.domNode );
+ },
+ onClick: function( evt )
+ {
+ this.menuOption.navigateTo();
+ dojo.event.browser.stopEvent( evt );
+ }
+});
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTabContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTabContainer.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTabContainer.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTabContainer.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dojo.provide("jetspeed.widget.PortalTabContainer");
+
+dojo.require("jetspeed.desktop.core");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.TabContainer");
+
+jetspeed.widget.PortalTabContainer = function()
+{
+ this.widgetType = "PortalTabContainer";
+ this.js_addingTab = false;
+ this.doLayout = false; // to keep base class from conducting certain layout behavior (not sure if needed?)
+ this.selectedChildWidget = true; // to keep base class code from setting first tab as selected
+ this.tabsadded = 0;
+ dojo.widget.TabContainer.call( this );
+};
+
+dojo.inherits(jetspeed.widget.PortalTabContainer, dojo.widget.TabContainer);
+
+dojo.lang.extend( jetspeed.widget.PortalTabContainer,
+{
+ // dojo.widget.Widget create protocol
+ postMixInProperties: function( args, fragment, parentComp )
+ {
+ this.templateCssPath = new dojo.uri.Uri( jetspeed.prefs.getDesktopThemeRootUrl() + "/css/PortalTabContainer.css" ) ;
+ jetspeed.widget.PortalTabContainer.superclass.postMixInProperties.call( this, args, fragment, parentComp );
+ },
+ // dojo.widget.Widget create protocol
+ postCreate: function( args, fragment, parentComp )
+ {
+ jetspeed.widget.PortalTabContainer.superclass.postCreate.call( this, args, fragment, parentComp );
+
+ this.contextMenuCreate();
+ },
+ addTab: function( /* jetspeed.om.MenuOption */ menuOpt )
+ {
+ if ( ! menuOpt ) return;
+ this.js_addingTab = true;
+ var tabDomNode = document.createElement( "div" );
+ var tab = new dojo.widget.HtmlWidget(); // create a fake widget so that widget.addedTo doesn't bomb when we call this.addChild() below
+ tab.domNode = tabDomNode;
+ tab.menuOption = menuOpt;
+ tab.label = menuOpt.getShortTitle();
+ tab.closable = false;
+ tab.widgetId = this.widgetId + "-tab-" + this.tabsadded; // to make toString of these widgets a useful hash key (this.tablist.pane2button)
+ this.tabsadded++;
+ this.addChild( tab );
+ //dojo.debug( "PortalTabContainer.addTab" );
+ if ( jetspeed.page.equalsPageUrl( menuOpt.getUrl() ) )
+ {
+ this.selectChild( tab );
+ }
+ this.js_addingTab = false;
+ },
+ _setupChild: function(page){
+ // Summary: Add the given child to this page container
+
+ //page.hide();
+
+ // publish the addChild event for panes added via addChild(), and the original panes too
+ dojo.event.topic.publish(this.widgetId+"-addChild", page);
+ },
+ selectChild: function( tab, _noRefresh )
+ {
+ //jetspeed.widget.PortalTabContainer.superclass.selectTab.call( this, tab );
+
+ if(this.tablist._currentChild){
+ var oldButton=this.tablist.pane2button[this.tablist._currentChild];
+ oldButton.clearSelected();
+ }
+ var newButton=this.tablist.pane2button[tab];
+ newButton.setSelected();
+ this.tablist._currentChild=tab;
+
+ if ( ! this.js_addingTab && ! _noRefresh )
+ {
+ tab.menuOption.navigateTo();
+ }
+ },
+
+ _showChild: function(page) {
+ // size the current page (in case this is the first time it's being shown, or I have been resized)
+ //if(this.doLayout){
+ // var content = dojo.html.getContentBox(this.containerNode);
+ // page.resizeTo(content.width, content.height);
+ //}
+
+ page.selected=true;
+ //page.show();
+ },
+
+ _hideChild: function(page) {
+ page.selected=false;
+ //page.hide();
+ },
+
+ createJetspeedMenu: function( /* jetspeed.om.Menu */ menuObj )
+ {
+ if ( ! menuObj ) return;
+ var menuOpts = menuObj.getOptions();
+ for ( var i = 0 ; i < menuOpts.length ; i++ )
+ {
+ var menuOption = menuOpts[i];
+ if ( menuOption.isLeaf() && menuOption.getUrl() && ! menuOption.isSeparator() )
+ {
+ this.addTab( menuOption );
+ }
+ }
+ },
+ contextMenuCreate: function()
+ {
+ var taskBarContextMenu = dojo.widget.createWidget( "PopupMenu2", { id: "jstc_menu", targetNodeIds: [ this.domNode.id ], contextMenuForWindow: false }, null );
+ //var resetLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstc_menu_item1", caption: "Reset Window Layout"} );
+ //var freeFormLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstc_menu_item2", caption: "Free Flowing Layout"} );
+ //var twoColummLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstc_menu_item3", caption: "Two Column Layout"} );
+ //var threeColummLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstc_menu_item4", caption: "Three Column Layout"} );
+ var openPortletSelectorMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstc_menu_item5", caption: "Portlet Selector"} );
+
+ //dojo.event.connect( resetLayoutMenuItem, "onClick", function(e) { jetspeed.page.resetWindowLayout(); } );
+ //dojo.event.connect( freeFormLayoutMenuItem, "onClick", function(e) { jetspeed.prefs.windowTiling = false; jetspeed.page.resetWindowLayout(); jetspeed.page.reload(); } );
+ //dojo.event.connect( twoColummLayoutMenuItem, "onClick", function(e) { jetspeed.prefs.windowTiling = 2; jetspeed.page.reload(); } );
+ //dojo.event.connect( threeColummLayoutMenuItem, "onClick", function(e) { jetspeed.prefs.windowTiling = 3; jetspeed.page.reload(); } );
+ dojo.event.connect( openPortletSelectorMenuItem, "onClick", function(e) { jetspeed.loadPortletSelector(); } );
+ //taskBarContextMenu.addChild( resetLayoutMenuItem );
+ //taskBarContextMenu.addChild( freeFormLayoutMenuItem );
+ //taskBarContextMenu.addChild( twoColummLayoutMenuItem );
+ //taskBarContextMenu.addChild( threeColummLayoutMenuItem );
+ taskBarContextMenu.addChild( openPortletSelectorMenuItem );
+ document.body.appendChild( taskBarContextMenu.domNode );
+ }
+});
+
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTaskBar.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTaskBar.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTaskBar.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortalTaskBar.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dojo.provide("jetspeed.widget.PortalTaskBar");
+dojo.provide("jetspeed.widget.PortalTaskBarItem");
+
+dojo.require("jetspeed.desktop.core");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.FloatingPane");
+dojo.require("dojo.widget.TaskBar");
+
+jetspeed.widget.PortalTaskBar = function()
+{
+ this.widgetType = "PortalTaskBar";
+
+ dojo.widget.FloatingPane.call( this );
+
+ //dojo.widget.TaskBar.call(this); // can't call with 'this' since the widgetType will kill it 2006-03-31
+
+ this.titleBarDisplay = "none";
+};
+
+dojo.inherits(jetspeed.widget.PortalTaskBar, dojo.widget.FloatingPane);
+
+dojo.lang.extend(jetspeed.widget.PortalTaskBar, {
+
+ // dojo.widget.Widget create protocol
+ postMixInProperties: function( args, fragment, parentComp )
+ {
+ jetspeed.widget.PortalTaskBar.superclass.postMixInProperties.call( this );
+
+ //if ( ! this.widgetId )
+ // this.widgetId = jetspeed.id.TASKBAR;
+
+ var tbProps = {};
+ tbProps.templateCssPath = new dojo.uri.Uri( jetspeed.prefs.getDesktopThemeRootUrl() + "/css/PortalTaskBar.css" ) ;
+ tbProps.templatePath = new dojo.uri.Uri( jetspeed.url.basePortalDesktopUrl() + "/javascript/jetspeed/widget/HtmlTaskBarItemTemplate.html" ) ;
+ // BOZO: improve this junk ^^^
+
+ this.templatePath = jetspeed.ui.getDefaultFloatingPaneTemplate();
+ this.templateCssPath = jetspeed.ui.getDefaultFloatingPaneTemplateCss(); // BOZO: this currently is responsible for assuring that
+ // the base FloatingPane styles get included;
+ // so, if the taskbar is not included and/or an override
+ // css file is needed, the base FloatingPane styles may be absent
+ this.taskbarProps = tbProps ;
+ },
+
+ // dojo.widget.Widget create protocol
+ postCreate: function( args, fragment, parentComp )
+ {
+ jetspeed.widget.PortalTaskBar.superclass.postCreate.call( this );
+
+ //this.domNode.id = "jetspeedTaskbar"; // BOZO: must set the id here - it gets defensively cleared by dojo
+ //this.domNode.style.cssText = "background-color: #666; width: 100%; bottom: 5px; height: 100px";
+ if ( ! this.domNode.id )
+ this.domNode.id = this.widgetId;
+
+ this.contextMenuCreate();
+ },
+
+ addChild: function( child )
+ {
+ var tbiProps = {windowId: child.widgetId, caption: child.title, iconSrc: child.iconSrc, widgetId: child.widgetId + "_tbi" } ;
+ dojo.lang.mixin(tbiProps, this.taskbarProps) ;
+ var tbi = dojo.widget.createWidget("jetspeed:PortalTaskBarItem", tbiProps);
+ jetspeed.widget.PortalTaskBar.superclass.addChild.call(this,tbi);
+ //dojo.debug( "PortalTaskBarItem widgetId=" + tbi.widgetId + " domNode.id=" + tbi.domNode.id + " child.domNode.id=" + child.widgetId ) ;
+ },
+ contextMenuCreate: function()
+ {
+ var taskBarContextMenu = dojo.widget.createWidget( "PopupMenu2", { id: "jstb_menu", targetNodeIds: [ this.domNode.id ], contextMenuForWindow: false }, null );
+ var resetLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstb_menu_item1", caption: "Reset Window Layout"} );
+ var freeFormLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstb_menu_item2", caption: "Free Flowing Layout"} );
+ var twoColummLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstb_menu_item3", caption: "Two Column Layout"} );
+ var threeColummLayoutMenuItem = dojo.widget.createWidget( "MenuItem2", { id: "jstb_menu_item4", caption: "Three Column Layout"} );
+
+ dojo.event.connect( resetLayoutMenuItem, "onClick", function(e) { jetspeed.page.resetWindowLayout(); } );
+ dojo.event.connect( freeFormLayoutMenuItem, "onClick", function(e) { jetspeed.prefs.windowTiling = false; jetspeed.page.resetWindowLayout(); jetspeed.page.reload(); } );
+ dojo.event.connect( twoColummLayoutMenuItem, "onClick", function(e) { jetspeed.prefs.windowTiling = 2; jetspeed.page.reload(); } );
+ dojo.event.connect( threeColummLayoutMenuItem, "onClick", function(e) { jetspeed.prefs.windowTiling = 3; jetspeed.page.reload(); } );
+ taskBarContextMenu.addChild( resetLayoutMenuItem );
+ taskBarContextMenu.addChild( freeFormLayoutMenuItem );
+ taskBarContextMenu.addChild( twoColummLayoutMenuItem );
+ taskBarContextMenu.addChild( threeColummLayoutMenuItem );
+ document.body.appendChild( taskBarContextMenu.domNode );
+ }
+});
+
+
+
+
+jetspeed.widget.PortalTaskBarItem = function(){
+
+ dojo.widget.TaskBarItem( this );
+
+ this.widgetType = "PortalTaskBarItem";
+};
+dojo.inherits(jetspeed.widget.PortalTaskBarItem, dojo.widget.TaskBarItem);
+
+dojo.lang.extend(jetspeed.widget.PortalTaskBarItem, {
+ fillInTemplate: function()
+ {
+ var tdNode = this.domNode.getElementsByTagName( "td" )[0];
+ if ( this.iconSrc != '' ) {
+ var img = document.createElement("img");
+ img.src = this.iconSrc;
+ tdNode.appendChild( img );
+ }
+ tdNode.appendChild( document.createTextNode( this.caption ) );
+ dojo.html.disableSelection( this.domNode );
+ },
+ onClick: function()
+ {
+ var showWindow = this.window;
+ var showWindowNode = showWindow.domNode;
+ var btnNode = this.domNode;
+
+ // sequencing these effects makes IE happier
+ // - we fadeOut the button to 50% opacity
+ // - we fadeIn the button back to normal
+ // - we explode or show the window
+
+ var showWindowCallback = function()
+ {
+ if (dojo.render.html.ie)
+ dojo.lang.setTimeout( function() { showWindow.show(); }, 100 );
+ else
+ showWindow.show();
+ }
+ var explodeCallback = function()
+ {
+ if ( showWindow.windowState == "minimized" )
+ dojo.fx.html.explode( btnNode, showWindowNode, 300, showWindowCallback ) ; // began as 300 in ff
+ else
+ showWindow.show();
+ }
+ var fadeCallback = function()
+ {
+ dojo.fx.html.fade( btnNode, 75, 0.5, 1, explodeCallback );
+ }
+ dojo.fx.html.fade( btnNode, 80, 1, 0.5, fadeCallback );
+ }
+});
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletDefContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletDefContainer.js?view=auto&rev=472273
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletDefContainer.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletDefContainer.js Tue Nov 7 13:18:43 2006
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+dojo.provide("jetspeed.widget.PortletDefContainer");
+dojo.provide("jetspeed.widget.PortletDefContainerItem");
+
+dojo.require("jetspeed.desktop.core");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.FloatingPane");
+
+jetspeed.widget.PortletDefContainer = function()
+{
+ this.widgetType = "PortletDefContainer";
+
+ dojo.widget.ContentPane.call( this );
+};
+
+dojo.inherits(jetspeed.widget.PortletDefContainer, dojo.widget.ContentPane);
+
+dojo.lang.extend(jetspeed.widget.PortletDefContainer, {
+ // dojo.widget.Widget create protocol
+ postMixInProperties: function( args, fragment, parentComp )
+ {
+ this.templatePath = new dojo.uri.dojoUri( jetspeed.url.basePortalWindowThemeUrl( jetspeed.page.getWindowThemeDefault() ) + "/templates/PortletDefContainer.html");
+ this.templateCssPath = new dojo.uri.Uri( jetspeed.url.basePortalWindowThemeUrl( jetspeed.page.getWindowThemeDefault() ) + "/css/PortletDefContainer.css" );
+
+ jetspeed.widget.PortletDefContainer.superclass.postMixInProperties.call( this );
+
+ var pdcProps = {};
+ pdcProps.templateCssPath = new dojo.uri.Uri( jetspeed.url.basePortalWindowThemeUrl( jetspeed.page.getWindowThemeDefault() ) + "/css/PortletDefContainer.css" ) ;
+ pdcProps.templatePath = new dojo.uri.Uri( jetspeed.url.basePortalWindowThemeUrl( jetspeed.page.getWindowThemeDefault() ) + "/templates/PortletDefContainerItemTemplate.html" ) ;
+
+ this.portletDefContainerProps = pdcProps ;
+ },
+
+ // dojo.widget.Widget create protocol
+ postCreate: function( args, fragment, parentComp )
+ {
+ jetspeed.widget.PortletDefContainer.superclass.postCreate.call( this );
+
+ if ( ! this.domNode.id )
+ this.domNode.id = this.widgetId;
+ },
+
+ addChild: function( child )
+ {
+ var pdcProps = {portletDef: child, caption: child.getPortletDisplayName(), iconSrc: "javascript/desktop/windowicons/document.gif" } ;
+ dojo.lang.mixin(pdcProps, this.portletDefContainerProps);
+ var pdc = dojo.widget.createWidget("jetspeed:PortletDefContainerItem", pdcProps);
+ jetspeed.widget.PortletDefContainer.superclass.addChild.call(this,pdc);
+ }
+});
+
+
+dojo.widget.defineWidget(
+ "jetspeed.widget.PortletDefContainerItem",
+ dojo.widget.TaskBarItem,
+ {
+ initializer: function()
+ {
+ this.widgetType = "PortletDefContainerItem";
+ },
+ onClick: function()
+ {
+ },
+ fillInTemplate: function()
+ {
+ var imgNode = this.itemIcon;
+ if ( imgNode )
+ {
+ imgNode.src = this.iconSrc;
+ }
+ var textNode = this.itemText;
+ textNode.appendChild( document.createTextNode( this.caption ) );
+ dojo.html.disableSelection( this.domNode );
+ },
+ /*
+ postCreate: function()
+ {
+ var dragSource = new dojo.dnd.HtmlDragSource(this.domNode, "PortletDef" );
+ //dragSource.constrainingContainer = dojo.byId( jetspeed.id.DESKTOP );
+ //dragSource.constrainToContainer = true;
+
+ //javascript: alert( dojo.html.getBorderBox( dojo.byId( "jetspeedDesktop" ) ).height )
+ //javascript: jetspeed.loadPortletSelector()
+ var dropTarget = new dojo.dnd.HtmlDropTarget( dojo.byId( jetspeed.id.DESKTOP ), ["PortletDef"] );
+ var pdItemWidget = this ;
+ dojo.event.connect( dragSource, "onDragEnd", function(e) {
+ dojo.debug( "PortletDefContainerItem onDragEnd status=" + e.dragStatus );
+ });
+ }
+ */
+ postCreate: function()
+ {
+ var dragSource = new jetspeed.widget.PortletDefDragSource( this.portletDef, this );
+ //var dropTarget = new dojo.dnd.HtmlDropTarget( dojo.byId( jetspeed.id.DESKTOP ), ["PortletDef"] );
+ var pdItemWidget = this ;
+ dojo.event.connect( dragSource, "onDragEnd", function(e) {
+ dojo.debug( "PortletDefContainerItem onDragEnd status=" + e.dragStatus );
+ });
+ }
+ }
+);
+
+//javascript: alert( dojo.html.getBorderBox( dojo.byId( "jetspeedDesktop" ) ).height )
+//javascript: jetspeed.loadPortletSelector()
+
+
+jetspeed.widget.PortletDefDragSource = function( /* jetspeed.om.PortletDef */ portletDef, /* PortletDefContainerItem */ pdcItem )
+{
+ this.portletDef = portletDef;
+ dojo.dnd.HtmlDragMoveSource.call(this, pdcItem.domNode, "PortletDef");
+};
+
+dojo.inherits( jetspeed.widget.PortletDefDragSource, dojo.dnd.HtmlDragMoveSource );
+
+dojo.lang.extend( jetspeed.widget.PortletDefDragSource, {
+ onDragStart: function()
+ {
+ this.windowWidget = this.createPortletWindow( this.portletDef );
+
+ this.windowWidget.makeFreeFloating( this.dragObject );
+ if ( jetspeed.prefs.windowTiling )
+ this.windowWidget.windowPositionStatic = true; // BOZO: shouldn't happen this way!
+
+ var dragObj = new jetspeed.widget.PortletWindowDragMoveObject( this.windowWidget, this.windowWidget.domNode, this.type );
+
+ jetspeed.addNewPortletDefinition( this.portletDef, this.windowWidget.widgetId );
+
+ return dragObj;
+ },
+ createPortletWindow: function( /* jetspeed.om.PortletDef */ portletDef )
+ {
+ var baseWidgetId = jetspeed.id.PORTLET_WINDOW_ID_PREFIX + jetspeed.purifyIdentifier( this.portletDef.getPortletName() );
+ var uniquePart = 1;
+ var widgetId = null;
+ while ( widgetId == null )
+ {
+ widgetId = baseWidgetId + "_" + uniquePart;
+ if ( dojo.widget.byId( widgetId ) != null )
+ {
+ widgetId = null;
+ uniquePart++;
+ }
+ }
+
+ var windowParams = {};
+ windowParams[ jetspeed.id.PORTLET_PROP_WINDOW_POSITION_STATIC ] = true;
+ windowParams[ jetspeed.id.PORTLET_PROP_WINDOW_THEME ] = jetspeed.page.getWindowThemeDefault();
+ windowParams[ jetspeed.id.PORTLET_PROP_WINDOW_TITLE ] = this.portletDef.getPortletDisplayName();
+ windowParams[ jetspeed.id.PORTLET_PROP_WIDGET_ID ] = widgetId;
+ windowParams[ jetspeed.id.PORTLET_PROP_WIDTH ] = jetspeed.prefs.windowWidth;
+ windowParams[ jetspeed.id.PORTLET_PROP_HEIGHT ] = jetspeed.prefs.windowHeight;
+ windowParams[ jetspeed.id.PORTLET_PROP_EXCLUDE_PCONTENT ] = false;
+ windowParams[ jetspeed.id.PORTLET_PROP_CONTENT_RETRIEVER ] = null;
+ var pwWidgetParams = jetspeed.widget.PortletWindow.prototype.staticDefineAsAltInitParameters( null, windowParams );
+ jetspeed.ui.createPortletWindow( pwWidgetParams, null, null );
+
+
+ return dojo.widget.byId( windowParams[ jetspeed.id.PORTLET_PROP_WIDGET_ID ] ) ;
+ },
+ onDragEnd: function()
+ {
+
+ }
+});
+
+
+jetspeed.widget.PortletDefDragObject = function(/* jetspeed.om.PortletDef */ portletDef, node, type)
+{
+ this.portletDef = portletDef;
+ dojo.dnd.HtmlDragObject.call( this, node, type );
+}
+
+dojo.inherits(jetspeed.widget.PortletDefDragObject, dojo.dnd.HtmlDragObject);
+
+dojo.lang.extend(jetspeed.widget.PortletDefDragObject, {
+ createDragNode: function() {
+
+ var windowParams = {};
+ windowParams[ jetspeed.id.PORTLET_PROP_WINDOW_POSITION_STATIC ] = false;
+ windowParams[ jetspeed.id.PORTLET_PROP_WINDOW_THEME ] = "tigris";
+ windowParams[ jetspeed.id.PORTLET_PROP_WINDOW_TITLE ] = this.portletDef.getPortletDisplayName();
+ windowParams[ jetspeed.id.PORTLET_PROP_WIDGET_ID ] = jetspeed.id.PORTLET_WINDOW_ID_PREFIX + "bleep";
+ windowParams[ jetspeed.id.PORTLET_PROP_WIDTH ] = jetspeed.prefs.windowWidth;
+ windowParams[ jetspeed.id.PORTLET_PROP_HEIGHT ] = jetspeed.prefs.windowHeight;
+ windowParams[ jetspeed.id.PORTLET_PROP_EXCLUDE_PCONTENT ] = false;
+ windowParams[ jetspeed.id.PORTLET_PROP_CONTENT_RETRIEVER ] = null;
+ var pwWidgetParams = jetspeed.widget.PortletWindow.prototype.staticDefineAsAltInitParameters( null, windowParams );
+ jetspeed.ui.createPortletWindow( pwWidgetParams, null, null );
+
+
+ var newWidget = dojo.widget.byId( windowParams[ jetspeed.id.PORTLET_PROP_WIDGET_ID ] ) ;
+
+ var node = newWidget.domNode; // this.domNode.cloneNode(true);
+ if(this.dragClass) { dojo.html.addClass(node, this.dragClass); }
+ if(this.opacity < 1) { dojo.html.setOpacity(node, this.opacity); }
+ if(dojo.render.html.ie && this.createIframe){
+ with(node.style) {
+ top="0px";
+ left="0px";
+ }
+ var outer = document.createElement("div");
+ outer.appendChild(node);
+ this.bgIframe = new dojo.html.BackgroundIframe(outer);
+ outer.appendChild(this.bgIframe.iframe);
+ node = outer;
+ }
+ node.style.zIndex = 999;
+ return node;
+ }
+
+});
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org