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
|***************************************************************************/
29
using System.Web.UI.WebControls;
30
using System.Web.UI.HtmlControls;
31
using System.Web.Security;
32
using System.Threading;
33
using System.Resources;
35
namespace Novell.iFolderApp.Web
40
public class QuotaControl : UserControl
45
private static readonly WebLogger log = new WebLogger(
46
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);
51
protected Literal Title;
56
protected Literal SpaceUsed;
61
protected Literal SpaceAvailable;
66
private ResourceManager rm;
69
/// iFolder Connection
71
private iFolderWeb web;
76
private string ifolderID;
81
/// <param name="sender"></param>
82
/// <param name="e"></param>
83
private void Page_Load(object sender, System.EventArgs e)
86
ifolderID = Request.QueryString.Get("iFolder");
89
rm = (ResourceManager) Application["RM"];
92
web = (iFolderWeb)Session["Connection"];
100
/// Bind the Data to the Page.
102
private void BindData()
107
if ((ifolderID != null) && (ifolderID.Length != 0))
110
iFolderPolicy policy = web.GetiFolderPolicy(ifolderID);
111
used = policy.SpaceUsed;
112
limit = policy.SpaceLimitEffective;
114
Title.Text = GetString("IFOLDERQUOTA");
119
UserPolicy policy = web.GetAuthenticatedUserPolicy();
120
used = policy.SpaceUsed;
121
limit = policy.SpaceLimitEffective;
123
Title.Text = GetString("HOMEQUOTA");
127
SpaceUsed.Text = WebUtility.FormatSize(used, rm);
133
SpaceAvailable.Text = GetString("NOLIMIT");
138
SpaceAvailable.Text = WebUtility.FormatSize(limit, rm);
143
/// Get a Localized String
145
/// <param name="key"></param>
146
/// <returns></returns>
147
protected string GetString(string key)
149
return WebUtility.GetString(key, rm);
152
#region Web Form Designer
157
/// <param name="e"></param>
158
override protected void OnInit(EventArgs e)
160
InitializeComponent();
165
/// Initialize Components
167
private void InitializeComponent()
169
this.Load += new System.EventHandler(this.Page_Load);
170
this.PreRender += new EventHandler(Quota_PreRender);
178
/// <param name="sender"></param>
179
/// <param name="e"></param>
180
private void Quota_PreRender(object sender, EventArgs e)
183
// NOTE: bind the footer late so modifications can be shown