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;
34
using System.Web.Services.Protocols;
36
namespace Novell.iFolderApp.Web
39
/// Home Context Control
41
public class HomeContextControl : UserControl
46
protected HyperLink HomeLink;
51
protected DropDownList SearchCategory;
56
protected TextBox SearchPattern;
61
private ResourceManager rm;
64
/// iFolder Connection
66
private iFolderWeb web;
73
public event EventHandler Search;
80
/// <param name="sender"></param>
81
/// <param name="e"></param>
82
private void Page_Load(object sender, System.EventArgs e)
85
web = (iFolderWeb) Session["Connection"];
88
rm = (ResourceManager) Application["RM"];
96
HomeLink.Text = GetString("HOME");
99
SearchCategory.Items.Add(new ListItem(GetString("ALL"), iFolderCategory.All.ToString()));
100
SearchCategory.Items.Add(new ListItem(GetString("RECENT"), iFolderCategory.Recent.ToString()));
101
SearchCategory.Items.Add(new ListItem(GetString("OWNED"), iFolderCategory.Owned.ToString()));
102
SearchCategory.Items.Add(new ListItem(GetString("SHARED"), iFolderCategory.Shared.ToString()));
107
/// Bind the Data to the Page.
109
private void BindData()
114
/// Handle Exceptions
116
/// <param name="e"></param>
117
/// <returns></returns>
118
private bool HandleException(Exception e)
122
string type = WebUtility.GetExceptionType(e);
136
/// Get a Localized String
138
/// <param name="key"></param>
139
/// <returns></returns>
140
protected string GetString(string key)
142
return WebUtility.GetString(key, rm);
150
public string Pattern
152
get { return SearchPattern.Text; }
158
public iFolderCategory Category
162
iFolderCategory result = iFolderCategory.All;
164
if (SearchCategory.SelectedItem != null)
166
result = (iFolderCategory) Enum.Parse(typeof(iFolderCategory), SearchCategory.SelectedItem.Value);
175
#region Web Form Designer
180
/// <param name="e"></param>
181
override protected void OnInit(EventArgs e)
183
InitializeComponent();
188
/// Initialize Components
190
private void InitializeComponent()
192
this.Load += new System.EventHandler(this.Page_Load);
193
this.SearchPattern.TextChanged += new EventHandler(SearchPattern_TextChanged);
194
this.SearchCategory.SelectedIndexChanged += new EventHandler(SearchCategory_SelectedIndexChanged);
200
/// Search Pattern Changed
202
/// <param name="sender"></param>
203
/// <param name="e"></param>
204
private void SearchPattern_TextChanged(object sender, EventArgs e)
210
/// Search Category Changed
212
/// <param name="sender"></param>
213
/// <param name="e"></param>
214
private void SearchCategory_SelectedIndexChanged(object sender, EventArgs e)
223
public enum iFolderCategory
231
/// Recently Shared iFolders