1
/****************************************************************************
3
| Copyright (c) 2007 Novell, Inc.
6
| This program is free software; you can redistribute it and/or
7
| modify it under the terms of version 2 of the GNU General Public License as
8
| published by the Free Software Foundation.
10
| This program is distributed in the hope that it will be useful,
11
| but WITHOUT ANY WARRANTY; without even the implied warranty of
12
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
| GNU General Public License for more details.
15
| You should have received a copy of the GNU General Public License
16
| along with this program; if not, contact Novell, Inc.
18
| To contact Novell about this file by physical or electronic mail,
19
| you may find current contact information at www.novell.com
22
|***************************************************************************/
25
using System.Collections;
26
using System.ComponentModel;
30
using System.Web.SessionState;
32
using System.Web.UI.WebControls;
33
using System.Web.UI.HtmlControls;
34
using System.Resources;
35
using System.Web.Services.Protocols;
38
namespace Novell.iFolderApp.Web
43
public class DetailsPage : Page
46
/// Property Actions Container
48
protected HtmlContainerControl PropertyActions;
53
protected DataGrid PropertyData;
56
/// Property Edit Link
58
protected HyperLink PropertyEditLink;
61
/// Policy Actions Container
63
protected HtmlContainerControl PolicyActions;
68
protected DataGrid PolicyData;
73
protected HyperLink PolicyEditLink;
78
protected MessageControl Message;
83
protected HeaderControl Head;
88
protected TabControl Tabs;
91
/// iFolder Connection
93
private iFolderWeb web;
98
private ResourceManager rm;
103
private string ifolderID;
108
/// <param name="sender"></param>
109
/// <param name="e"></param>
110
private void Page_Load(object sender, EventArgs e)
113
ifolderID = Request.QueryString.Get("iFolder");
116
web = (iFolderWeb) Session["Connection"];
119
rm = (ResourceManager) Application["RM"];
124
iFolder ifolder = web.GetiFolder(ifolderID);
126
//Load this page only if passphrase was provided for the encrypted iFolder
127
if(! IfDetailsEnabled())
129
// Return to Browse page, if passphrase was not provided for that encrypted ifolder.
131
Response.Redirect(String.Format("Browse.aspx?iFolder={0}", ifolderID));
134
string EncryptionAlgorithm = ifolder.EncryptionAlgorithm;
135
if(!(EncryptionAlgorithm == null || (EncryptionAlgorithm == String.Empty)))
137
// It is an encrypted ifolder , Make the Members tab invisible
138
Tabs.MakeMembersLinkInvisible();
145
PropertyEditLink.Text = GetString("EDIT");
146
PolicyEditLink.Text = GetString("EDIT");
149
PropertyEditLink.NavigateUrl = "iFolderEdit.aspx?iFolder=" + ifolderID;
150
PolicyEditLink.NavigateUrl = "iFolderPolicyEdit.aspx?iFolder=" + ifolderID;
155
/// Determine to show the details tab or not for encrypted folders
157
private bool IfDetailsEnabled()
159
string PassPhrase = Session["SessionPassPhrase"] as string;
160
ifolderID = Request.QueryString.Get("iFolder");
161
iFolder ifolder = web.GetiFolder(ifolderID);
162
string EncryptionAlgorithm = ifolder.EncryptionAlgorithm;
163
return web.ShowTabDetails(PassPhrase, EncryptionAlgorithm);
167
/// Bind the Data to the Page.
169
private void BindData()
173
// Pass this page information to create the help link
174
Head.AddHelpLink(GetString("DETAILS"));
178
/// Bind the Data to the Page.
180
private void BindPropertyData()
183
DataTable propertyTable = new DataTable();
184
propertyTable.Columns.Add("Label");
185
propertyTable.Columns.Add("Value");
190
iFolderDetails ifolder = web.GetiFolderDetails(ifolderID);
193
PropertyActions.Visible = (ifolder.MemberRights == Rights.Admin);
195
propertyTable.Rows.Add(new object[] { GetString("NAME"), ifolder.Name });
196
propertyTable.Rows.Add(new object[] { GetString("DESCRIPTION"), ifolder.Description });
197
propertyTable.Rows.Add(new object[] { GetString("LASTMODIFIED"), WebUtility.FormatDate(ifolder.LastModified, rm) });
198
propertyTable.Rows.Add(new object[] { GetString("CREATED"), WebUtility.FormatDate(ifolder.Created, rm) });
199
propertyTable.Rows.Add(new object[] { GetString("RIGHTS"), ifolder.MemberRights });
200
propertyTable.Rows.Add(new object[] { GetString("OWNER"), ifolder.OwnerFullName });
201
propertyTable.Rows.Add(new object[] { GetString("SIZE"), WebUtility.FormatSize(ifolder.Size, rm) });
202
propertyTable.Rows.Add(new object[] { GetString("MEMBERS"), ifolder.MemberCount.ToString() });
203
propertyTable.Rows.Add(new object[] { GetString("FILES"), ifolder.FileCount.ToString() });
204
propertyTable.Rows.Add(new object[] { GetString("FOLDERS"), ifolder.DirectoryCount.ToString() });
205
propertyTable.Rows.Add(new object[] { GetString("LOCKED"), WebUtility.FormatYesNo(!ifolder.Enabled, rm) });
207
catch(SoapException ex)
209
if (!HandleException(ex)) throw;
213
PropertyData.DataSource = propertyTable;
214
PropertyData.DataBind();
218
/// Bind the Data to the Page.
220
private void BindPolicyData()
223
DataTable policyTable = new DataTable();
224
policyTable.Columns.Add("Label");
225
policyTable.Columns.Add("Value");
230
iFolderPolicy policy = web.GetiFolderPolicy(ifolderID);
233
//PolicyActions.Visible = (ifolder.Rights == Rights.Admin);
234
PolicyActions.Visible = false;
236
policyTable.Rows.Add(new object[] { GetString("SYNCINTERVAL"), policy.SyncIntervalEffective });
238
catch(SoapException ex)
240
if (!HandleException(ex)) throw;
244
PolicyData.DataSource = policyTable;
245
PolicyData.DataBind();
249
/// Handle Exceptions
251
/// <param name="e"></param>
252
/// <returns></returns>
253
private bool HandleException(Exception e)
257
string type = WebUtility.GetExceptionType(e);
262
case "AccessException":
263
Message.Text = GetString("ENTRY.ACCESSEXCEPTION");
275
/// Get a Localized String
277
/// <param name="key"></param>
278
/// <returns></returns>
279
protected string GetString(string key)
281
return WebUtility.GetString(key, rm);
284
#region Web Form Designer
289
/// <param name="e"></param>
290
override protected void OnInit(EventArgs e)
292
InitializeComponent();
297
/// Initialize Components
299
private void InitializeComponent()
301
this.Load += new System.EventHandler(this.Page_Load);