Combine breadcrumbs & add organizations' selector.

This commit is contained in:
vfedosevich 2014-03-31 05:54:44 +03:00
parent 1c65f669c7
commit e3a18b8665
168 changed files with 813 additions and 2470 deletions

View file

@ -0,0 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SpaceOrganizationsSelector.ascx.cs" Inherits="WebsitePanel.Portal.SkinControls.SpaceOrganizationsSelector" %>
<span id="spanOrgsSelector" style="float:right;padding-right:10px;" runat="server" >
<asp:DropDownList ID="ddlSpaceOrgs" runat="server" CssClass="NormalTextBox" Width="150px" style="vertical-align: middle;"
OnSelectedIndexChanged="ddlSpaceOrgs_SelectedIndexChanged" EnableViewState="true" AutoPostBack="true">
</asp:DropDownList>
</span>

View file

@ -0,0 +1,87 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.WebPortal;
namespace WebsitePanel.Portal.SkinControls
{
public partial class SpaceOrganizationsSelector : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindSpaceOrgs();
}
}
private void BindSpaceOrgs()
{
// organization
bool orgVisible = (PanelRequest.ItemID > 0);
spanOrgsSelector.Visible = orgVisible;
if (orgVisible)
{
OrganizationsHelper helper = new OrganizationsHelper();
ddlSpaceOrgs.DataSource = helper.GetOrganizations(PanelSecurity.PackageId, false);
ddlSpaceOrgs.DataTextField = "ItemName";
ddlSpaceOrgs.DataValueField = "ItemID";
ddlSpaceOrgs.DataBind();
ddlSpaceOrgs.Items.FindByValue(PanelRequest.ItemID.ToString()).Selected = true;
}
}
protected void ddlSpaceOrgs_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect(GetOrganizationEditUrl(ddlSpaceOrgs.SelectedValue));
}
private string GetOrganizationEditUrl(string itemId)
{
return ExchangeHelper.BuildUrl("SpaceID", PanelSecurity.PackageId.ToString(), "organization_home",
"ItemID=" + itemId);
}
}
}

View file

@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.SkinControls {
public partial class SpaceOrganizationsSelector {
/// <summary>
/// spanOrgsSelector control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl spanOrgsSelector;
/// <summary>
/// ddlSpaceOrgs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlSpaceOrgs;
}
}

View file

@ -1,4 +1,5 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserSpaceBreadcrumb.ascx.cs" Inherits="WebsitePanel.Portal.SkinControls.UserSpaceBreadcrumb" %>
<%@ Register TagPrefix="wsp" TagName="SpaceOrgsSelector" Src="SpaceOrganizationsSelector.ascx" %>
<div id="Breadcrumb">
<div class="Path">
<asp:Repeater ID="repUsersPath" runat="server" OnItemDataBound="repUsersPath_ItemDataBound"
@ -15,7 +16,16 @@
<asp:HyperLink ID="lnkSpace" runat="server" Text="SpaceName" NavigateUrl="#"></asp:HyperLink>
</span>
<asp:Image ID="imgSep2" runat="server" SkinID="PathSeparatorWhite" /> <asp:HyperLink ID="lnkCurrentPage" runat="server"></asp:HyperLink>
<asp:Image ID="imgSep2" runat="server" SkinID="PathSeparatorWhite" /> <asp:HyperLink ID="lnkCurrentPage" runat="server"></asp:HyperLink>
<span id="spanOrgn" runat="server">
<asp:Image ID="imgSep3" runat="server" SkinID="PathSeparatorWhite" />
<asp:HyperLink ID="lnkOrgn" runat="server">Organization</asp:HyperLink>
<asp:Image ID="imgSep4" runat="server" SkinID="PathSeparatorWhite" />
<asp:Label ID="lbOrgCurPage" runat="server" ForeColor="#000000">Home</asp:Label>
</span>
<wsp:SpaceOrgsSelector ID="SpaceOrgs" runat="server" />
</div>
<div class="CurrentNode" runat="server" id="CurrentNode">
<asp:Panel ID="pnlViewUser" runat="server">

View file

@ -30,6 +30,7 @@ using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
@ -37,12 +38,19 @@ using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.WebPortal;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal.SkinControls
{
public partial class UserSpaceBreadcrumb : System.Web.UI.UserControl
{
public const string ORGANIZATION_CONTROL_KEY = "organization_home";
public const string EXCHANGE_SERVER_MODULE_DEFINTION_ID = "exchangeserver";
public const string PAGE_NANE_KEY = "Text.PageName";
public const string DM_FOLDER_VIRTUAL_PATH = "~/DesktopModules/";
public bool CurrentNodeVisible
{
get { return CurrentNode.Visible; }
@ -102,6 +110,35 @@ namespace WebsitePanel.Portal.SkinControls
PortalUtils.GetCurrentPageId(), "UserID", PanelSecurity.SelectedUserId.ToString());
}
}
// organization
bool orgVisible = (PanelRequest.ItemID > 0);
//spanOrgsSelector.Visible = spanOrgn.Visible = orgVisible;
spanOrgn.Visible = orgVisible;
if (orgVisible)
{
// load organization details
Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID);
lnkOrgn.NavigateUrl = ExchangeHelper.BuildUrl(
"ItemID", PanelRequest.ItemID.ToString(), ORGANIZATION_CONTROL_KEY,
"SpaceID=" + PanelSecurity.PackageId.ToString());
lnkOrgn.Text = org.Name;
string ctrlKey = Request[DefaultPage.CONTROL_ID_PARAM].ToLower(System.Globalization.CultureInfo.InvariantCulture);
ModuleDefinition definition = PortalConfiguration.ModuleDefinitions[EXCHANGE_SERVER_MODULE_DEFINTION_ID];
ModuleControl control = null;
if (!String.IsNullOrEmpty(ctrlKey) && definition.Controls.ContainsKey(ctrlKey))
control = definition.Controls[ctrlKey];
if (!String.IsNullOrEmpty(control.Src))
{
lbOrgCurPage.Text = ExchangeHelper.GetLocalizedString(DM_FOLDER_VIRTUAL_PATH + control.Src, PAGE_NANE_KEY);
}
}
}
protected void repUsersPath_ItemDataBound(object sender, RepeaterItemEventArgs e)
@ -121,7 +158,7 @@ namespace WebsitePanel.Portal.SkinControls
pnlEditSpace.Visible = true;
pnlViewSpace.Visible = false;
txtName.Text = Server.HtmlDecode(cmdSpaceName.Text);
txtName.Text = Server.HtmlDecode(cmdSpaceName.Text);
}
protected void cmdCancel_Click(object sender, EventArgs e)

View file

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -76,6 +75,60 @@ namespace WebsitePanel.Portal.SkinControls {
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink lnkCurrentPage;
/// <summary>
/// spanOrgn control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl spanOrgn;
/// <summary>
/// imgSep3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image imgSep3;
/// <summary>
/// lnkOrgn control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink lnkOrgn;
/// <summary>
/// imgSep4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image imgSep4;
/// <summary>
/// lbOrgCurPage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbOrgCurPage;
/// <summary>
/// SpaceOrgs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.SkinControls.SpaceOrganizationsSelector SpaceOrgs;
/// <summary>
/// CurrentNode control.
/// </summary>