~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to src/webaccess/.svn/text-base/HomeContext.ascx.cs.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
 |
3
 
 | Copyright (c) 2007 Novell, Inc.
4
 
 | All Rights Reserved.
5
 
 |
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.
9
 
 |
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.
14
 
 |
15
 
 | You should have received a copy of the GNU General Public License
16
 
 | along with this program; if not, contact Novell, Inc.
17
 
 |
18
 
 | To contact Novell about this file by physical or electronic mail,
19
 
 | you may find current contact information at www.novell.com
20
 
 |
21
 
 | Author: Rob
22
 
 |***************************************************************************/
23
 
 
24
 
using System;
25
 
using System.Data;
26
 
using System.Drawing;
27
 
using System.Web;
28
 
using System.Web.UI;
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;
35
 
 
36
 
namespace Novell.iFolderApp.Web
37
 
{
38
 
        /// <summary>
39
 
        ///     Home Context Control
40
 
        /// </summary>
41
 
        public class HomeContextControl : UserControl
42
 
        {
43
 
                /// <summary>
44
 
                /// Home Link
45
 
                /// </summary>
46
 
                protected HyperLink HomeLink;
47
 
                
48
 
                /// <summary>
49
 
                /// Search Category
50
 
                /// </summary>
51
 
                protected DropDownList SearchCategory;
52
 
 
53
 
                /// <summary>
54
 
                /// Search Pattern
55
 
                /// </summary>
56
 
                protected TextBox SearchPattern;
57
 
 
58
 
                /// <summary>
59
 
                /// Resource Manager
60
 
                /// </summary>
61
 
                private ResourceManager rm;
62
 
        
63
 
                /// <summary>
64
 
                /// iFolder Connection
65
 
                /// </summary>
66
 
                private iFolderWeb web;
67
 
 
68
 
                #region Events
69
 
                
70
 
                /// <summary>
71
 
                /// On Search Event
72
 
                /// </summary>
73
 
                public event EventHandler Search;
74
 
                
75
 
                #endregion
76
 
 
77
 
                /// <summary>
78
 
                /// Page Load
79
 
                /// </summary>
80
 
                /// <param name="sender"></param>
81
 
                /// <param name="e"></param>
82
 
                private void Page_Load(object sender, System.EventArgs e)
83
 
                {
84
 
                        // connection
85
 
                        web = (iFolderWeb) Session["Connection"];
86
 
 
87
 
                        // localization
88
 
                        rm = (ResourceManager) Application["RM"];
89
 
 
90
 
                        if (!IsPostBack)
91
 
                        {
92
 
                                // data
93
 
                                BindData();
94
 
 
95
 
                                // strings
96
 
                                HomeLink.Text = GetString("HOME");
97
 
                                
98
 
                                // categories
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()));
103
 
                        }
104
 
                }
105
 
 
106
 
                /// <summary>
107
 
                /// Bind the Data to the Page.
108
 
                /// </summary>
109
 
                private void BindData()
110
 
                {
111
 
                }
112
 
 
113
 
                /// <summary>
114
 
                /// Handle Exceptions
115
 
                /// </summary>
116
 
                /// <param name="e"></param>
117
 
                /// <returns></returns>
118
 
                private bool HandleException(Exception e)
119
 
                {
120
 
                        bool result = true;
121
 
 
122
 
                        string type = WebUtility.GetExceptionType(e);
123
 
 
124
 
                        // types
125
 
                        switch(type)
126
 
                        {
127
 
                                default:
128
 
                                        result = false;
129
 
                                        break;
130
 
                        }
131
 
 
132
 
                        return result;
133
 
                }
134
 
 
135
 
                /// <summary>
136
 
                /// Get a Localized String
137
 
                /// </summary>
138
 
                /// <param name="key"></param>
139
 
                /// <returns></returns>
140
 
                protected string GetString(string key)
141
 
                {
142
 
                        return WebUtility.GetString(key, rm);
143
 
                }
144
 
 
145
 
                #region Properties
146
 
                
147
 
                /// <summary>
148
 
                /// Search Pattern
149
 
                /// </summary>
150
 
                public string Pattern
151
 
                {
152
 
                        get { return SearchPattern.Text; }
153
 
                }
154
 
 
155
 
                /// <summary>
156
 
                /// Search Category
157
 
                /// </summary>
158
 
                public iFolderCategory Category
159
 
                {
160
 
                        get
161
 
                        {
162
 
                                iFolderCategory result = iFolderCategory.All;
163
 
 
164
 
                                if (SearchCategory.SelectedItem != null)
165
 
                                {
166
 
                                        result = (iFolderCategory) Enum.Parse(typeof(iFolderCategory), SearchCategory.SelectedItem.Value);
167
 
                                }
168
 
 
169
 
                                return result;
170
 
                        }
171
 
                }
172
 
 
173
 
                #endregion
174
 
 
175
 
                #region Web Form Designer
176
 
                
177
 
                /// <summary>
178
 
                /// On Intialize
179
 
                /// </summary>
180
 
                /// <param name="e"></param>
181
 
                override protected void OnInit(EventArgs e)
182
 
                {
183
 
                        InitializeComponent();
184
 
                        base.OnInit(e);
185
 
                }
186
 
                
187
 
                /// <summary>
188
 
                /// Initialize Components
189
 
                /// </summary>
190
 
                private void InitializeComponent()
191
 
                {
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);
195
 
                }
196
 
                
197
 
                #endregion
198
 
 
199
 
                /// <summary>
200
 
                /// Search Pattern Changed
201
 
                /// </summary>
202
 
                /// <param name="sender"></param>
203
 
                /// <param name="e"></param>
204
 
                private void SearchPattern_TextChanged(object sender, EventArgs e)
205
 
                {
206
 
                        Search(this, null);
207
 
                }
208
 
 
209
 
                /// <summary>
210
 
                /// Search Category Changed
211
 
                /// </summary>
212
 
                /// <param name="sender"></param>
213
 
                /// <param name="e"></param>
214
 
                private void SearchCategory_SelectedIndexChanged(object sender, EventArgs e)
215
 
                {
216
 
                        Search(this, null);
217
 
                }
218
 
        }
219
 
 
220
 
        /// <summary>
221
 
        /// iFolder Category
222
 
        /// </summary>
223
 
        public enum iFolderCategory
224
 
        {
225
 
                /// <summary>
226
 
                /// All iFolders
227
 
                /// </summary>
228
 
                All,
229
 
 
230
 
                /// <summary>
231
 
                /// Recently Shared iFolders
232
 
                /// </summary>
233
 
                Recent,
234
 
 
235
 
                /// <summary>
236
 
                /// Owned iFolders
237
 
                /// </summary>
238
 
                Owned,
239
 
                
240
 
                /// <summary>
241
 
                /// Shared iFolders
242
 
                /// </summary>
243
 
                Shared
244
 
        }
245
 
}