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 at...@apache.org on 2007/03/27 01:55:41 UTC
svn commit: r522665 [27/29] - in /portals/jetspeed-2/branches/J2-M2-REDUX:
./ components/ components/jetspeed-cm/
components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/general/
components/jetspeed-cm/src/test/resources/ components/jetspeed-cm/...
Added: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PageEditor.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PageEditor.js?view=auto&rev=522665
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PageEditor.js (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PageEditor.js Mon Mar 26 16:53:34 2007
@@ -0,0 +1,713 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ * author: Steve Milek
+ */
+
+dojo.provide("jetspeed.widget.PageEditor");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.io.*");
+dojo.require("dojo.event.*");
+dojo.require("dojo.string.extras");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.widget.Dialog");
+dojo.require("dojo.widget.Select");
+dojo.require("dojo.widget.Button");
+dojo.require("dojo.widget.Spinner");
+
+dojo.require("dojo.html.common");
+dojo.require("dojo.html.display");
+
+jetspeed.widget.PageEditor = function()
+{
+}
+
+dojo.widget.defineWidget(
+ "jetspeed.widget.PageEditor",
+ dojo.widget.HtmlWidget,
+ {
+ // template parameters
+ deletePortletDialog: null,
+ deletePortletDialogBg: null,
+ deletePortletDialogFg: null,
+
+ deleteLayoutDialog: null,
+ deleteLayoutDialogBg: null,
+ deleteLayoutDialogFg: null,
+
+ columnSizeDialog: null,
+ columnSizeDialogBg: null,
+ columnSizeDialogFg: null,
+
+
+ detail: null,
+
+
+ // fields
+ editorInitiatedFromDesktop: false,
+
+ isContainer: true,
+ widgetsInTemplate: true,
+
+
+ // protocol - dojo.widget.Widget create
+
+ postMixInProperties: function( args, fragment, parent )
+ {
+ jetspeed.widget.PageEditor.superclass.postMixInProperties.apply( this, arguments );
+
+ this.templateCssPath = new dojo.uri.Uri( jetspeed.url.basePortalDesktopUrl() + "/javascript/jetspeed/widget/PageEditor.css" ) ;
+ this.templatePath = new dojo.uri.Uri( jetspeed.url.basePortalDesktopUrl() + "/javascript/jetspeed/widget/PageEditor.html" ) ;
+ },
+
+ fillInTemplate: function( args, fragment )
+ {
+ var self = this;
+
+ this.deletePortletDialog = dojo.widget.createWidget( "dialog", { widgetsInTemplate: true, deletePortletConfirmed: function() { this.hide(); self.deletePortletConfirmed( this.portletEntityId ); } }, this.deletePortletDialog );
+ this.deletePortletDialog.setCloseControl( this.deletePortletDialog.deletePortletCancel.domNode );
+
+ this.deleteLayoutDialog = dojo.widget.createWidget( "dialog", { widgetsInTemplate: true, deleteLayoutConfirmed: function() { this.hide(); self.deleteLayoutConfirmed( this.portletEntityId ); } }, this.deleteLayoutDialog );
+ this.deleteLayoutDialog.setCloseControl( this.deleteLayoutDialog.deleteLayoutCancel.domNode );
+
+ var columnSizeParams = {};
+ columnSizeParams.widgetsInTemplate = true;
+ columnSizeParams.columnSizeConfirmed = function()
+ {
+ var columnSizesSum = 0;
+ var columnSizes = new Array();
+ for ( var i = 0 ; i < this.columnCount; i++ )
+ {
+ var spinnerWidget = this[ "spinner" + i ];
+ var colSize = new Number( spinnerWidget.getValue() );
+ columnSizes.push( colSize );
+ columnSizesSum += colSize;
+ }
+
+ if ( columnSizesSum > 100 )
+ {
+ alert( "Sum of column sizes cannot exceed 100." );
+ }
+ else
+ {
+ this.hide();
+ self.columnSizeConfirmed( this.layoutId, columnSizes );
+ }
+ };
+
+ this.columnSizeDialog = dojo.widget.createWidget( "dialog", columnSizeParams, this.columnSizeDialog );
+ this.columnSizeDialog.setCloseControl( this.columnSizeDialog.columnSizeCancel.domNode );
+
+ jetspeed.widget.PageEditor.superclass.fillInTemplate.call( this );
+ },
+
+ postCreate: function( args, fragment, parent )
+ {
+ this.editPageInitiate();
+ },
+
+ // initialization
+ editPageInitiate: function()
+ {
+ var themesContentManager = null;
+ if ( this.editorInitiatedFromDesktop )
+ themesContentManager = new jetspeed.widget.EditPageGetThemesContentManager( this, false, false, true, true, true );
+ else
+ themesContentManager = new jetspeed.widget.EditPageGetThemesContentManager( this, true, true, true, false, false );
+ themesContentManager.getContent();
+ },
+ editPageBuild: function()
+ {
+ //actionButton.style.backgroundImage = "url(" + jetspeed.prefs.getLayoutRootUrl() + "/images/desktop/" + actionName + ".gif)";
+ var layoutImagesUrl = jetspeed.prefs.getLayoutRootUrl() + "/images/desktop/";
+
+ var pageEditorWidgets = new Array();
+ var layoutEditPaneWidgets = new Array();
+ var pageEditPaneWidget = dojo.widget.createWidget( "jetspeed:PageEditPane", { layoutDecoratorDefinitions: jetspeed.page.themeDefinitions.pageDecorations, portletDecoratorDefinitions: jetspeed.page.themeDefinitions.portletDecorations, layoutImagesRoot: layoutImagesUrl } );
+ pageEditPaneWidget.pageEditorWidget = this;
+ dojo.dom.insertAfter( pageEditPaneWidget.domNode, this.domNode );
+ pageEditorWidgets.push( pageEditPaneWidget );
+
+ var rootLayoutEditPaneWidget = dojo.widget.createWidget( "jetspeed:LayoutEditPane", { widgetId: "layoutEdit_root", layoutId: jetspeed.page.rootFragmentId, isRootLayout: true, layoutDefinitions: jetspeed.page.themeDefinitions.layouts, layoutImagesRoot: layoutImagesUrl } );
+ rootLayoutEditPaneWidget.pageEditorWidget = this;
+ dojo.dom.insertAfter( rootLayoutEditPaneWidget.domNode, pageEditPaneWidget.domNode );
+ pageEditorWidgets.push( rootLayoutEditPaneWidget );
+ layoutEditPaneWidgets.push( rootLayoutEditPaneWidget );
+
+ if ( jetspeed.prefs.windowTiling )
+ {
+ for ( var i = 0 ; i < jetspeed.page.columns.length; i++ )
+ {
+ var col = jetspeed.page.columns[i];
+ if ( col.layoutHeader )
+ {
+ var layoutEditPaneWidget = dojo.widget.createWidget( "jetspeed:LayoutEditPane", { widgetId: "layoutEdit_" + i, layoutId: col.layoutId, layoutDefinitions: jetspeed.page.themeDefinitions.layouts, layoutImagesRoot: layoutImagesUrl } );
+ layoutEditPaneWidget.pageEditorWidget = this;
+ if ( col.domNode.firstChild != null )
+ col.domNode.insertBefore( layoutEditPaneWidget.domNode, col.domNode.firstChild );
+ else
+ col.domNode.appendChild( layoutEditPaneWidget.domNode );
+ layoutEditPaneWidget.initializeDrag();
+ pageEditorWidgets.push( layoutEditPaneWidget );
+ layoutEditPaneWidgets.push( layoutEditPaneWidget );
+ }
+ }
+ }
+ this.pageEditorWidgets = pageEditorWidgets;
+ this.layoutEditPaneWidgets = layoutEditPaneWidgets;
+ this.editPageSyncPortletActions();
+ },
+ editPageSyncPortletActions: function()
+ {
+ var portlets = jetspeed.page.getPortletArray()
+ if ( portlets != null )
+ {
+ for ( var i = 0 ; i < portlets.length ; i++ )
+ {
+ portlets[i].syncActions();
+ }
+ }
+ },
+ editPageHide: function()
+ {
+ if ( this.pageEditorWidgets != null )
+ {
+ for ( var i = 0 ; i < this.pageEditorWidgets.length ; i++ )
+ {
+ this.pageEditorWidgets[i].hide();
+ }
+ }
+ this.hide();
+ this.editPageSyncPortletActions();
+ },
+ editPageShow: function()
+ {
+ if ( this.pageEditorWidgets != null )
+ {
+ for ( var i = 0 ; i < this.pageEditorWidgets.length ; i++ )
+ {
+ this.pageEditorWidgets[i].show();
+ }
+ }
+ this.show();
+ this.editPageSyncPortletActions();
+ },
+
+
+ // methods
+
+ deletePortlet: function( portletEntityId, portletTitle )
+ {
+ this.deletePortletDialog.portletEntityId = portletEntityId;
+ this.deletePortletDialog.portletTitle = portletTitle;
+ this.deletePortletTitle.innerHTML = portletTitle;
+ this.deletePortletDialog.show();
+ },
+ deletePortletConfirmed: function( portletEntityId )
+ {
+ var removePortletContentManager = new jetspeed.widget.RemovePortletContentManager( portletEntityId, this );
+ removePortletContentManager.getContent();
+ },
+ deleteLayout: function( layoutId )
+ {
+ this.deleteLayoutDialog.layoutId = layoutId;
+ this.deleteLayoutDialog.layoutTitle = layoutId;
+ this.deleteLayoutTitle.innerHTML = layoutId;
+ this.deleteLayoutDialog.show();
+ },
+ deleteLayoutConfirmed: function()
+ {
+ var removePortletContentManager = new jetspeed.widget.RemoveLayoutContentManager( this.deleteLayoutDialog.layoutId, this );
+ removePortletContentManager.getContent();
+ },
+ openColumnSizesEditor: function( layoutId )
+ {
+ var currentLayout = null;
+ if ( layoutId != null )
+ currentLayout = jetspeed.page.layouts[ layoutId ];
+
+ if ( currentLayout != null && currentLayout.columnSizes != null && currentLayout.columnSizes.length > 0 )
+ {
+ var spinnerMax = 5; // 5 is current max
+ var spinnerCount = 0;
+ for ( var i = 0 ; i < spinnerMax; i++ )
+ {
+ var spinnerWidget = this.columnSizeDialog[ "spinner" + i ];
+ var spinnerFieldDiv = this[ "spinner" + i + "Field" ];
+ if ( i < currentLayout.columnSizes.length )
+ {
+ spinnerWidget.setValue( currentLayout.columnSizes[i] );
+ spinnerFieldDiv.style.display = "block";
+ spinnerWidget.show();
+ spinnerCount++;
+ }
+ else
+ {
+ spinnerFieldDiv.style.display = "none";
+ spinnerWidget.hide();
+ }
+ }
+ this.columnSizeDialog.layoutId = layoutId;
+ this.columnSizeDialog.columnCount = spinnerCount;
+ this.columnSizeDialog.show();
+ }
+ },
+ columnSizeConfirmed: function( layoutId, columnSizes )
+ {
+ if ( layoutId != null && columnSizes != null && columnSizes.length > 0 )
+ { // layout name is currently required by updatepage/update-fragment
+ var currentLayout = jetspeed.page.layouts[ layoutId ];
+
+ var currentLayoutName = null;
+ if ( currentLayout != null )
+ currentLayoutName = currentLayout.name;
+
+ if ( currentLayoutName != null )
+ {
+ var colSizesStr = "";
+ for ( var i = 0 ; i < columnSizes.length ; i++ )
+ {
+ if ( i > 0 )
+ colSizesStr += ",";
+ colSizesStr += columnSizes[i] + "%";
+ }
+ var updateFragmentContentManager = new jetspeed.widget.UpdateFragmentContentManager( layoutId, currentLayoutName, colSizesStr, this );
+ updateFragmentContentManager.getContent();
+ }
+ }
+ },
+
+ refreshPage: function()
+ {
+ dojo.lang.setTimeout( this, this._doRefreshPage, 10 );
+ },
+ _doRefreshPage: function()
+ {
+ var pageUrl = jetspeed.page.getPageUrl();
+ pageUrl = jetspeed.url.addQueryParameter( pageUrl, "editPage", "true", true );
+ window.location.href = pageUrl.toString();
+ },
+
+ editModeNormal: function()
+ {
+ // restore all portlets (that were not previously minimized)
+ var portletArray = jetspeed.page.getPortletArray();
+ for ( var i = 0; i < portletArray.length; i++ )
+ {
+ var portletWindow = portletArray[i].getPortletWindow();
+ if ( portletWindow != null )
+ {
+ portletWindow.restoreFromMinimizeWindowTemporarily();
+ }
+ }
+ if ( this.layoutEditPaneWidgets != null )
+ {
+ for ( var i = 0 ; i < this.layoutEditPaneWidgets.length ; i++ )
+ {
+ var lepWidget = this.layoutEditPaneWidgets[i];
+ if ( lepWidget.layoutMoveContainer != null )
+ lepWidget.layoutMoveContainer.domNode.style.display = "none";
+ }
+ }
+ },
+ editModeLayoutMove: function()
+ {
+ // minimize all portlets
+ var portletArray = jetspeed.page.getPortletArray();
+ for ( var i = 0; i < portletArray.length; i++ )
+ {
+ var portletWindow = portletArray[i].getPortletWindow();
+ if ( portletWindow != null )
+ {
+ portletWindow.minimizeWindowTemporarily();
+ }
+ }
+ // display layout-move-handle widget
+ if ( this.layoutEditPaneWidgets != null )
+ {
+ for ( var i = 0 ; i < this.layoutEditPaneWidgets.length ; i++ )
+ {
+ var lepWidget = this.layoutEditPaneWidgets[i];
+ if ( ! lepWidget.isRootLayout && lepWidget.layoutMoveContainer != null )
+ lepWidget.layoutMoveContainer.domNode.style.display = "block"
+ }
+ }
+ }
+ }
+);
+
+
+// ... jetspeed.widget.EditPageGetThemesContentManager
+jetspeed.widget.EditPageGetThemesContentManager = function( pageEditorWidget, pageDecorations, portletDecorations, layouts, desktopPageDecorations, desktopPortletDecorations )
+{
+ this.pageEditorWidget = pageEditorWidget;
+ var getThemeTypes = new Array();
+ if ( pageDecorations )
+ getThemeTypes.push( [ "pageDecorations" ] );
+ if ( portletDecorations )
+ getThemeTypes.push( [ "portletDecorations" ] );
+ if ( layouts )
+ getThemeTypes.push( [ "layouts" ] );
+ if ( desktopPageDecorations )
+ getThemeTypes.push( [ "desktopPageDecorations", "pageDecorations" ] );
+ if ( desktopPortletDecorations )
+ getThemeTypes.push( [ "desktopPortletDecorations", "portletDecorations" ] );
+ this.getThemeTypes = getThemeTypes;
+ this.getThemeTypeNextIndex = 0;
+};
+jetspeed.widget.EditPageGetThemesContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.getThemeTypes != null && this.getThemeTypes.length > this.getThemeTypeNextIndex )
+ {
+ var queryString = "?action=getthemes&type=" + this.getThemeTypes[ this.getThemeTypeNextIndex ][0] + "&format=json";
+ var getThemesUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "getthemes", { } );
+ var bindArgs = {};
+ bindArgs.url = getThemesUrl;
+ bindArgs.mimetype = "text/json";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ else
+ {
+ this.pageEditorWidget.editPageBuild();
+ }
+ },
+ notifySuccess: function( /* JSON */ getThemesData, /* String */ requestUrl, domainModelObject )
+ {
+ if ( jetspeed.page.themeDefinitions == null )
+ jetspeed.page.themeDefinitions = {};
+ var themeDefKey = ( ( this.getThemeTypes[ this.getThemeTypeNextIndex ].length > 1 ) ? this.getThemeTypes[ this.getThemeTypeNextIndex ][1] : this.getThemeTypes[ this.getThemeTypeNextIndex ][0]);
+ jetspeed.page.themeDefinitions[ themeDefKey ] = getThemesData;
+ this.getThemeTypeNextIndex++;
+ this.getContent();
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, domainModelObject )
+ {
+ dojo.raise( "EditPageGetThemesContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.RemovePageContentManager
+jetspeed.widget.RemovePageContentManager = function( pageEditorWidget )
+{
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.RemovePageContentManager.prototype =
+{
+ getContent: function()
+ {
+ var queryString = "?action=updatepage&method=remove";
+ var removePageUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "updatepage-remove-page", { } );
+ var bindArgs = {};
+ bindArgs.url = removePageUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "updatepage-remove-page" ) )
+ {
+ var pageUrl = jetspeed.page.makePageUrl( "/" );
+ pageUrl += "?" + jetspeed.id.PAGE_EDITOR_INITIATE_PARAMETER + "=true";
+ window.location.href = pageUrl;
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "RemovePageContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.AddPageContentManager
+jetspeed.widget.AddPageContentManager = function( pageRealPath, pagePath, pageName, layoutName, pageTitle, pageShortTitle, pageEditorWidget )
+{
+ this.pageRealPath = pageRealPath;
+ this.pagePath = pagePath;
+ this.pageName = pageName;
+ if ( layoutName == null )
+ {
+ if ( jetspeed.page.themeDefinitions != null && jetspeed.page.themeDefinitions.layouts != null && jetspeed.page.themeDefinitions.layouts.length > 0 && jetspeed.page.themeDefinitions.layouts[0] != null && jetspeed.page.themeDefinitions.layouts[0].length == 2 )
+ layoutName = jetspeed.page.themeDefinitions.layouts[0][1];
+ }
+ this.layoutName = layoutName;
+ this.pageTitle = pageTitle;
+ this.pageShortTitle = pageShortTitle;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.AddPageContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.pageRealPath != null && this.pageName != null )
+ {
+ var queryString = "?action=updatepage&method=add&path=" + escape( this.pageRealPath ) + "&name=" + escape( this.pageName );
+ if ( this.layoutName != null )
+ queryString += "&defaultLayout=" + escape( this.layoutName );
+ if ( this.pageTitle != null )
+ queryString += "&title=" + escape( this.pageTitle );
+ if ( this.pageShortTitle != null )
+ queryString += "&short-title=" + escape( this.pageShortTitle );
+ var addPageUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "updatepage-add-page", { } );
+ var bindArgs = {};
+ bindArgs.url = addPageUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "updatepage-add-page" ) )
+ {
+ var pageUrl = jetspeed.page.makePageUrl( this.pagePath );
+ if ( ! dojo.string.endsWith( pageUrl, ".psml", true ) )
+ pageUrl += ".psml";
+ pageUrl += "?" + jetspeed.id.PAGE_EDITOR_INITIATE_PARAMETER + "=true";
+ window.location.href = pageUrl;
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "AddPageContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+
+// ... jetspeed.widget.MoveLayoutContentManager
+jetspeed.widget.MoveLayoutContentManager = function( layoutId, moveToLayoutId, column, row, pageEditorWidget )
+{
+ this.layoutId = layoutId;
+ this.moveToLayoutId = moveToLayoutId;
+ this.column = column;
+ this.row = row;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.MoveLayoutContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.layoutId != null && this.moveToLayoutId != null )
+ {
+ var queryString = "?action=moveabs&id=" + this.layoutId + "&layoutid=" + this.moveToLayoutId;
+ if ( this.column != null )
+ queryString += "&col=" + this.column;
+ if ( this.row != null )
+ queryString += "&row=" + this.row;
+ var psmlMoveActionUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "moveabs-layout", this.layoutId );
+ var bindArgs = {};
+ bindArgs.url = psmlMoveActionUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "moveabs-layout" ) )
+ {
+
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "MoveLayoutContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.UpdateFragmentContentManager
+jetspeed.widget.UpdateFragmentContentManager = function( layoutId, layoutName, layoutSizes, pageEditorWidget )
+{
+ this.layoutId = layoutId;
+ this.layoutName = layoutName;
+ this.layoutSizes = layoutSizes;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.UpdateFragmentContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.layoutId != null )
+ {
+ var queryString = "?action=updatepage&method=update-fragment&id=" + this.layoutId;
+ if ( this.layoutName != null )
+ queryString += "&layout=" + escape( this.layoutName );
+ if ( this.layoutSizes != null )
+ queryString += "&sizes=" + escape( this.layoutSizes );
+ var updatePageUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "updatepage-update-fragment", { } );
+ var bindArgs = {};
+ bindArgs.url = updatePageUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "updatepage-update-fragment" ) )
+ {
+ this.pageEditorWidget.refreshPage();
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "UpdateFragmentContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.UpdateFragmentContentManager
+jetspeed.widget.UpdatePageInfoContentManager = function( layoutDecorator, portletDecorator, pageEditorWidget )
+{
+ this.refreshPage = ( ( pageEditorWidget.editorInitiatedFromDesktop ) ? true : false ) ;
+ this.layoutDecorator = layoutDecorator;
+ this.portletDecorator = portletDecorator;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.UpdatePageInfoContentManager.prototype =
+{
+ getContent: function()
+ {
+ var queryString = "?action=updatepage&method=info";
+ if ( this.layoutDecorator != null )
+ queryString += "&layout-decorator=" + escape( this.layoutDecorator );
+ if ( this.portletDecorator != null )
+ queryString += "&portlet-decorator=" + escape( this.portletDecorator );
+ var updatePageUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "updatepage-info", { } );
+ var bindArgs = {};
+ bindArgs.url = updatePageUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "updatepage-info" ) )
+ {
+ if ( this.refreshPage )
+ this.pageEditorWidget.refreshPage();
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "UpdatePageInfoContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.RemovePortletContentManager
+jetspeed.widget.RemovePortletContentManager = function( portletEntityId, pageEditorWidget )
+{
+ this.portletEntityId = portletEntityId;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.RemovePortletContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.portletEntityId != null )
+ {
+ var queryString = "?action=remove&id=" + this.portletEntityId;
+ var removePortletUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "removeportlet", { } );
+ var bindArgs = {};
+ bindArgs.url = removePortletUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "removeportlet" ) )
+ {
+ this.pageEditorWidget.refreshPage();
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "RemovePortletContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.RemoveLayoutContentManager
+jetspeed.widget.RemoveLayoutContentManager = function( layoutId, pageEditorWidget )
+{
+ this.layoutId = layoutId;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.RemoveLayoutContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.layoutId != null )
+ {
+ var queryString = "?action=updatepage&method=remove-fragment&id=" + this.layoutId;
+ var removeLayoutUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "removelayout", { } );
+ var bindArgs = {};
+ bindArgs.url = removeLayoutUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "removeportlet" ) )
+ {
+ this.pageEditorWidget.refreshPage();
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "RemoveLayoutContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
+
+// ... jetspeed.widget.AddLayoutContentManager
+jetspeed.widget.AddLayoutContentManager = function( parentLayoutId, layoutName, pageEditorWidget )
+{
+ this.parentLayoutId = parentLayoutId;
+ this.layoutName = layoutName;
+ this.pageEditorWidget = pageEditorWidget;
+};
+jetspeed.widget.AddLayoutContentManager.prototype =
+{
+ getContent: function()
+ {
+ if ( this.parentLayoutId != null )
+ {
+ var queryString = "?action=updatepage&method=add-fragment&layoutid=" + this.parentLayoutId + ( this.layoutName != null ? ( "&layout=" + this.layoutName ) : "" );
+ var addLayoutUrl = jetspeed.url.basePortalUrl() + jetspeed.url.path.AJAX_API + jetspeed.page.getPath() + queryString ;
+ var ajaxApiContext = new jetspeed.om.Id( "addlayout", { } );
+ var bindArgs = {};
+ bindArgs.url = addLayoutUrl;
+ bindArgs.mimetype = "text/xml";
+ jetspeed.url.retrieveContent( bindArgs, this, ajaxApiContext, jetspeed.debugContentDumpIds );
+ }
+ },
+ notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "addportlet" ) )
+ {
+ this.pageEditorWidget.refreshPage();
+ }
+ },
+ notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl, /* Portlet */ portlet )
+ {
+ dojo.raise( "AddLayoutContentManager notifyFailure url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+ }
+};
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PageEditor.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PageEditor.js
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js?view=auto&rev=522665
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js Mon Mar 26 16:53:34 2007
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ * author: Steve Milek
+ */
+
+dojo.provide("jetspeed.widget.PortalAccordionContainer");
+dojo.provide("jetspeed.widget.PortalMenuOptionLink");
+
+dojo.require("jetspeed.desktop.core");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.AccordionContainer");
+
+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.getLayoutRootUrl() + "/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.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.menuOption.type == "page" )
+ this.menuOptionLinkNode.className = "LinkPage";
+ else if ( this.menuOption.type == "folder" )
+ this.menuOptionLinkNode.className = "LinkFolder";
+ 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 );
+ }
+});
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalAccordionContainer.js
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalBreadcrumbContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalBreadcrumbContainer.js?view=auto&rev=522665
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalBreadcrumbContainer.js (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalBreadcrumbContainer.js Mon Mar 26 16:53:34 2007
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ * author: Steve Milek
+ */
+
+dojo.provide("jetspeed.widget.PortalBreadcrumbContainer");
+dojo.provide("jetspeed.widget.PortalBreadcrumbLink");
+dojo.provide("jetspeed.widget.PortalBreadcrumbLinkSeparator");
+
+dojo.require("jetspeed.desktop.core");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.TabContainer");
+
+jetspeed.widget.PortalBreadcrumbContainer = function()
+{
+ this.widgetType = "PortalBreadcrumbContainer";
+ this.isContainer = true;
+
+ //this.templateString = '<div id="breadcrumbs"><div dojoAttachPoint="containerNode" class="FolderList"></div><div id="jetspeedPageControls"></div></div>';
+ //this.templateString = '<div dojoAttachPoint="containerNode" class="toolgroup"></div>';
+ dojo.widget.HtmlWidget.call(this);
+};
+
+dojo.inherits(jetspeed.widget.PortalBreadcrumbContainer, dojo.widget.HtmlWidget);
+
+dojo.lang.extend( jetspeed.widget.PortalBreadcrumbContainer,
+{
+ // dojo.widget.Widget create protocol
+ postMixInProperties: function( args, fragment, parentComp )
+ {
+ this.templateCssPath = new dojo.uri.Uri( jetspeed.prefs.getLayoutRootUrl() + "/css/PortalBreadcrumbContainer.css" ) ;
+ this.templatePath = new dojo.uri.dojoUri( jetspeed.prefs.getLayoutRootUrl() + "/templates/PortalBreadcrumbContainer.html");
+ jetspeed.widget.PortalBreadcrumbContainer.superclass.postMixInProperties.call( this, args, fragment, parentComp );
+ },
+
+ // dojo.widget.Widget create protocol
+ fillInTemplate: function( args, frag )
+ {
+ // Copy style info from input node to output node
+ var source = this.getFragNodeRef( frag );
+ dojo.html.copyStyle( this.domNode, source );
+ jetspeed.widget.PortalBreadcrumbContainer.superclass.fillInTemplate.apply( this, arguments );
+ },
+
+ createJetspeedMenu: function( /* jetspeed.om.Menu */ menuObj )
+ {
+ if ( ! menuObj ) return;
+ var menuOpts = menuObj.getOptions();
+ var breadcrumbLinks = [], menuOption = null;
+ for ( var i = 0 ; i < menuOpts.length ; i++ )
+ {
+ menuOption = menuOpts[ i ];
+ if ( menuOption != null && ! menuOption.isSeparator() )
+ {
+ breadcrumbLinks.push( menuOption );
+ }
+ }
+ if ( breadcrumbLinks != null && breadcrumbLinks.length > 0 )
+ {
+ var linkWidget, linkSepWidget;
+ var bcLen = breadcrumbLinks.length;
+ for ( var i = 0 ; i < bcLen ; i++ )
+ {
+ if ( i > 0 )
+ {
+ linkSepWidget = dojo.widget.createWidget( "jetspeed:PortalBreadcrumbLinkSeparator" );
+ this.containerNode.appendChild( linkSepWidget.domNode );
+ }
+ if ( i == (bcLen -1) )
+ {
+ var currentLinkNode = document.createElement( "span" );
+ currentLinkNode.appendChild( document.createTextNode( breadcrumbLinks[i].getShortTitle() ) );
+ this.containerNode.appendChild( currentLinkNode );
+ }
+ else
+ {
+ linkWidget = dojo.widget.createWidget( "jetspeed:PortalBreadcrumbLink", { menuOption: breadcrumbLinks[i] } );
+ this.containerNode.appendChild( linkWidget.domNode );
+ }
+ }
+ }
+ }
+});
+
+jetspeed.widget.PortalBreadcrumbLink = function()
+{
+ dojo.widget.HtmlWidget.call(this);
+
+ this.widgetType = "PortalBreadcrumbLink";
+ this.templateString = '<span dojoAttachPoint="containerNode"><a href="" dojoAttachPoint="menuOptionLinkNode" dojoAttachEvent="onClick" class="Link"></a></span>';
+};
+dojo.inherits(jetspeed.widget.PortalBreadcrumbLink, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(jetspeed.widget.PortalBreadcrumbLink, {
+ fillInTemplate: function()
+ {
+ if ( this.menuOption.type == "page" )
+ this.menuOptionLinkNode.className = "LinkPage";
+ else if ( this.menuOption.type == "folder" )
+ this.menuOptionLinkNode.className = "LinkFolder";
+ 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 );
+ }
+});
+
+
+jetspeed.widget.PortalBreadcrumbLinkSeparator = function()
+{
+ dojo.widget.HtmlWidget.call(this);
+
+ this.widgetType = "PortalBreadcrumbLinkSeparator";
+ this.templatePath = new dojo.uri.dojoUri( jetspeed.prefs.getLayoutRootUrl() + "/templates/PortalBreadcrumbLinkSeparator.html");
+};
+dojo.inherits(jetspeed.widget.PortalBreadcrumbLinkSeparator, dojo.widget.HtmlWidget);
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalBreadcrumbContainer.js
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTabContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTabContainer.js?view=auto&rev=522665
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTabContainer.js (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTabContainer.js Mon Mar 26 16:53:34 2007
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ * author: Steve Milek
+ */
+
+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.getLayoutRootUrl() + "/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 );
+ }
+});
+
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTabContainer.js
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTaskBar.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTaskBar.js?view=auto&rev=522665
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTaskBar.js (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTaskBar.js Mon Mar 26 16:53:34 2007
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.getLayoutRootUrl() + "/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 );
+ }
+});
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortalTaskBar.js
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortletDefContainer.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortletDefContainer.js?view=auto&rev=522665
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortletDefContainer.js (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortletDefContainer.js Mon Mar 26 16:53:34 2007
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ *
+ * author: Steve Milek
+ */
+
+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.prefs.getPortletDecorationBaseUrl( jetspeed.page.getPortletDecorationDefault() ) + "/templates/PortletDefContainer.html");
+ this.templateCssPath = new dojo.uri.Uri( jetspeed.prefs.getPortletDecorationBaseUrl( jetspeed.page.getPortletDecorationDefault() ) + "/css/PortletDefContainer.css" );
+
+ jetspeed.widget.PortletDefContainer.superclass.postMixInProperties.call( this );
+
+ var pdcProps = {};
+ pdcProps.templateCssPath = new dojo.uri.Uri( jetspeed.prefs.getPortletDecorationBaseUrl( jetspeed.page.getPortletDecorationDefault() ) + "/css/PortletDefContainer.css" ) ;
+ pdcProps.templatePath = new dojo.uri.Uri( jetspeed.prefs.getPortletDecorationBaseUrl( jetspeed.page.getPortletDecorationDefault() ) + "/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_DECORATION ] = jetspeed.page.getPortletDecorationDefault();
+ 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_DECORATION ] = "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;
+ }
+
+});
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-portal-resources/src/main/resources/webapp/javascript/jetspeed/widget/PortletDefContainer.js
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org