RDS collections namig fixes

This commit is contained in:
vfedosevich 2015-01-14 03:33:02 -08:00
parent c341c7f58e
commit f19ca9c8c5
8 changed files with 58 additions and 32 deletions

View file

@ -5462,6 +5462,16 @@ CREATE TABLE RDSCollections
) )
GO GO
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RDSCollections' AND COLUMN_NAME = 'DisplayName')
BEGIN
ALTER TABLE [dbo].[RDSCollections]
ADD DisplayName NVARCHAR(255)
END
GO
UPDATE [dbo].[RDSCollections] SET DisplayName = [Name] WHERE DisplayName IS NULL
ALTER TABLE [dbo].[RDSCollectionUsers] ALTER TABLE [dbo].[RDSCollectionUsers]
DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId]
GO GO
@ -5744,7 +5754,8 @@ SELECT
CR.ID, CR.ID,
CR.ItemID, CR.ItemID,
CR.Name, CR.Name,
CR.Description CR.Description,
CR.DisplayName
FROM @RDSCollections AS C FROM @RDSCollections AS C
INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID
WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow' WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow'
@ -5777,7 +5788,8 @@ SELECT
Id, Id,
ItemId, ItemId,
Name, Name,
Description Description,
DisplayName
FROM RDSCollections FROM RDSCollections
WHERE ItemID = @ItemID WHERE ItemID = @ItemID
GO GO
@ -5796,9 +5808,10 @@ SELECT TOP 1
Id, Id,
Name, Name,
ItemId, ItemId,
Description Description,
DisplayName
FROM RDSCollections FROM RDSCollections
WHERE Name = @Name WHERE DisplayName = @Name
GO GO
@ -5815,7 +5828,8 @@ SELECT TOP 1
Id, Id,
ItemId, ItemId,
Name, Name,
Description Description,
DisplayName
FROM RDSCollections FROM RDSCollections
WHERE ID = @ID WHERE ID = @ID
GO GO
@ -5829,7 +5843,8 @@ CREATE PROCEDURE [dbo].[AddRDSCollection]
@RDSCollectionID INT OUTPUT, @RDSCollectionID INT OUTPUT,
@ItemID INT, @ItemID INT,
@Name NVARCHAR(255), @Name NVARCHAR(255),
@Description NVARCHAR(255) @Description NVARCHAR(255),
@DisplayName NVARCHAR(255)
) )
AS AS
@ -5837,13 +5852,15 @@ INSERT INTO RDSCollections
( (
ItemID, ItemID,
Name, Name,
Description Description,
DisplayName
) )
VALUES VALUES
( (
@ItemID, @ItemID,
@Name, @Name,
@Description @Description,
@DisplayName
) )
SET @RDSCollectionID = SCOPE_IDENTITY() SET @RDSCollectionID = SCOPE_IDENTITY()
@ -5860,7 +5877,8 @@ CREATE PROCEDURE [dbo].[UpdateRDSCollection]
@ID INT, @ID INT,
@ItemID INT, @ItemID INT,
@Name NVARCHAR(255), @Name NVARCHAR(255),
@Description NVARCHAR(255) @Description NVARCHAR(255),
@DisplayName NVARCHAR(255)
) )
AS AS
@ -5868,7 +5886,8 @@ UPDATE RDSCollections
SET SET
ItemID = @ItemID, ItemID = @ItemID,
Name = @Name, Name = @Name,
Description = @Description Description = @Description,
DisplayName = @DisplayName
WHERE ID = @Id WHERE ID = @Id
GO GO

View file

@ -4498,7 +4498,7 @@ namespace WebsitePanel.EnterpriseServer
); );
} }
public static int AddRDSCollection(int itemId, string name, string description) public static int AddRDSCollection(int itemId, string name, string description, string displayName)
{ {
SqlParameter rdsCollectionId = new SqlParameter("@RDSCollectionID", SqlDbType.Int); SqlParameter rdsCollectionId = new SqlParameter("@RDSCollectionID", SqlDbType.Int);
rdsCollectionId.Direction = ParameterDirection.Output; rdsCollectionId.Direction = ParameterDirection.Output;
@ -4510,7 +4510,8 @@ namespace WebsitePanel.EnterpriseServer
rdsCollectionId, rdsCollectionId,
new SqlParameter("@ItemID", itemId), new SqlParameter("@ItemID", itemId),
new SqlParameter("@Name", name), new SqlParameter("@Name", name),
new SqlParameter("@Description", description) new SqlParameter("@Description", description),
new SqlParameter("DisplayName", displayName)
); );
// read identity // read identity
@ -4533,10 +4534,10 @@ namespace WebsitePanel.EnterpriseServer
public static void UpdateRDSCollection(RdsCollection collection) public static void UpdateRDSCollection(RdsCollection collection)
{ {
UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description); UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description, collection.DisplayName);
} }
public static void UpdateRDSCollection(int id, int itemId, string name, string description) public static void UpdateRDSCollection(int id, int itemId, string name, string description, string displayName)
{ {
SqlHelper.ExecuteNonQuery( SqlHelper.ExecuteNonQuery(
ConnectionString, ConnectionString,
@ -4545,7 +4546,8 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@Id", id), new SqlParameter("@Id", id),
new SqlParameter("@ItemID", itemId), new SqlParameter("@ItemID", itemId),
new SqlParameter("@Name", name), new SqlParameter("@Name", name),
new SqlParameter("@Description", description) new SqlParameter("@Description", description),
new SqlParameter("@DisplayName", displayName)
); );
} }

View file

@ -271,10 +271,9 @@ namespace WebsitePanel.EnterpriseServer
} }
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
collection.Name = GetFormattedCollectionName(collection.DisplayName, org.OrganizationId);
rds.CreateCollection(org.OrganizationId, collection); rds.CreateCollection(org.OrganizationId, collection);
collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName);
collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description);
foreach (var server in collection.Servers) foreach (var server in collection.Servers)
{ {
@ -1247,5 +1246,10 @@ namespace WebsitePanel.EnterpriseServer
return rds; return rds;
} }
private static string GetFormattedCollectionName(string displayName, string organizationId)
{
return string.Format("{0}-{1}", organizationId, displayName.Replace(" ", "_"));
}
} }
} }

View file

@ -15,7 +15,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
public int ItemId { get; set; } public int ItemId { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string DisplayName { get; set; }
public List<RdsServer> Servers { get; set; } public List<RdsServer> Servers { get; set; }
} }
} }

View file

@ -1123,7 +1123,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private string GetPolicyName(string organizationId, string collectionName, RdsPolicyTypes policyType) private string GetPolicyName(string organizationId, string collectionName, RdsPolicyTypes policyType)
{ {
string policyName = string.Format("{0}-{1}-", organizationId, collectionName); string policyName = string.Format("{0}-", collectionName);
switch (policyType) switch (policyType)
{ {

View file

@ -45,10 +45,10 @@
OnRowCommand="gvRDSCollections_RowCommand" AllowPaging="True" AllowSorting="True" OnRowCommand="gvRDSCollections_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsRDSCollectionsPaged" PageSize="20"> DataSourceID="odsRDSCollectionsPaged" PageSize="20">
<Columns> <Columns>
<asp:TemplateField HeaderText="gvCollectionName" SortExpression="Name"> <asp:TemplateField HeaderText="gvCollectionName" SortExpression="DisplayName">
<ItemStyle Width="40%"></ItemStyle> <ItemStyle Width="40%"></ItemStyle>
<ItemTemplate> <ItemTemplate>
<asp:hyperlink id="lnkCollectionName" meta:resourcekey="lnkApps" runat="server" NavigateUrl='<%# GetCollectionEditUrl(Eval("Id").ToString()) %>'><%# Eval("Name").ToString() %></asp:hyperlink> <asp:hyperlink id="lnkCollectionName" meta:resourcekey="lnkApps" runat="server" NavigateUrl='<%# GetCollectionEditUrl(Eval("Id").ToString()) %>'><%# Eval("DisplayName").ToString() %></asp:hyperlink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="gvServer"> <asp:TemplateField HeaderText="gvServer">

View file

@ -62,7 +62,7 @@ namespace WebsitePanel.Portal.RDS
return; return;
} }
RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" }; RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, DisplayName = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" };
ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection); ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection);
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId)); Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId));
} }

View file

@ -473,12 +473,6 @@ namespace WebsitePanel.Portal.UserControls
private void PrepareEnterpriseStorageMenu(MenuItemCollection enterpriseStorageItems) private void PrepareEnterpriseStorageMenu(MenuItemCollection enterpriseStorageItems)
{ {
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders", @"Icons/enterprisestorage_folders_48.png")); enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageFolders", "enterprisestorage_folders", @"Icons/enterprisestorage_folders_48.png"));
//if (ShortMenu) return;
if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
enterpriseStorageItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
} }
private void PrepareRDSMenuRoot(MenuItemCollection items) private void PrepareRDSMenuRoot(MenuItemCollection items)
@ -507,7 +501,14 @@ namespace WebsitePanel.Portal.UserControls
rdsItems.Add(CreateMenuItem("RDSCollections", "rds_collections", null)); rdsItems.Add(CreateMenuItem("RDSCollections", "rds_collections", null));
if (Utils.CheckQouta(Quotas.RDS_SERVERS, Cntx) && (PanelSecurity.LoggedUser.Role != UserRole.User)) if (Utils.CheckQouta(Quotas.RDS_SERVERS, Cntx) && (PanelSecurity.LoggedUser.Role != UserRole.User))
rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null)); {
rdsItems.Add(CreateMenuItem("RDSServers", "rds_servers", null));
}
if (Utils.CheckQouta(Quotas.ENTERPRICESTORAGE_DRIVEMAPS, Cntx))
{
rdsItems.Add(CreateMenuItem("EnterpriseStorageDriveMaps", "enterprisestorage_drive_maps", @"Icons/enterprisestorage_drive_maps_48.png"));
}
} }
private MenuItem CreateMenuItem(string text, string key) private MenuItem CreateMenuItem(string text, string key)