~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to src/admin/.svn/text-base/iFolderSearch.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: Mike Lasky (mlasky@novell.com)
22
 
 |***************************************************************************/
23
 
 
24
 
namespace Novell.iFolderWeb.Admin
25
 
{
26
 
        using System;
27
 
        using System.Data;
28
 
        using System.Drawing;
29
 
        using System.Resources;
30
 
        using System.Web;
31
 
        using System.Web.UI.WebControls;
32
 
        using System.Web.UI.HtmlControls;
33
 
 
34
 
        /// <summary>
35
 
        ///             Summary description for iFolderSearch.
36
 
        /// </summary>
37
 
        public class iFolderSearch : System.Web.UI.UserControl
38
 
        {
39
 
                #region Class Members
40
 
 
41
 
                /// <summary>
42
 
                /// Resource Manager
43
 
                /// </summary>
44
 
                private ResourceManager rm;
45
 
 
46
 
                /// <summary>
47
 
                /// Search operations.
48
 
                /// </summary>
49
 
                protected DropDownList SearchOpList;
50
 
 
51
 
                /// <summary>
52
 
                /// Search button control.
53
 
                /// </summary>
54
 
                protected Button SearchButton;
55
 
 
56
 
                /// <summary>
57
 
                /// Search text.
58
 
                /// </summary>
59
 
                protected HtmlInputText SearchNameTextBox;
60
 
 
61
 
 
62
 
                /// <summary>
63
 
                /// Label control.
64
 
                /// </summary>
65
 
                protected Label NameLabel;
66
 
 
67
 
 
68
 
                /// <summary>
69
 
                /// Event that notifies consumer that the search button has been clicked.
70
 
                /// </summary>
71
 
                public event EventHandler Click = null;
72
 
 
73
 
                #endregion
74
 
 
75
 
                #region Properties
76
 
 
77
 
                /// <summary>
78
 
                /// Gets the search name value.
79
 
                /// </summary>
80
 
                public string SearchName
81
 
                {
82
 
                        get { return SearchNameTextBox.Value; }
83
 
                }
84
 
 
85
 
                /// <summary>
86
 
                /// Gets the search enumeration operation from the web selection.
87
 
                /// </summary>
88
 
                public SearchOperation SearchOperation
89
 
                {
90
 
                        get
91
 
                        {
92
 
                                SearchOperation searchOp = SearchOperation.BeginsWith;
93
 
                                string attribute = SearchOpList.SelectedValue;
94
 
 
95
 
                                if ( attribute == GetString( "BEGINSWITH" ) )
96
 
                                {
97
 
                                        searchOp = SearchOperation.BeginsWith;
98
 
                                }
99
 
                                else if ( attribute == GetString( "ENDSWITH" ) )
100
 
                                {
101
 
                                        searchOp = SearchOperation.EndsWith;
102
 
                                }
103
 
                                else if ( attribute == GetString( "CONTAINS" ) )
104
 
                                {
105
 
                                        searchOp = SearchOperation.Contains;
106
 
                                }
107
 
                                else
108
 
                                {
109
 
                                        searchOp = SearchOperation.Equals;
110
 
                                }
111
 
 
112
 
                                return searchOp;
113
 
                        }
114
 
                }
115
 
 
116
 
                #endregion
117
 
 
118
 
                #region Private Methods
119
 
 
120
 
                /// <summary>
121
 
                /// Page_Load
122
 
                /// </summary>
123
 
                /// <param name="sender"></param>
124
 
                /// <param name="e"></param>
125
 
                private void Page_Load(object sender, System.EventArgs e)
126
 
                {
127
 
                        // localization
128
 
                        rm = Application[ "RM" ] as ResourceManager;
129
 
 
130
 
                        if ( !IsPostBack )
131
 
                        {
132
 
                                // Initialize the localized fields.
133
 
                                SearchButton.Text = GetString( "SEARCH" );
134
 
                                NameLabel.Text = GetString( "NAME" );
135
 
 
136
 
                                SearchOpList.Items[ 0 ].Text = GetString( "BEGINSWITH" );
137
 
                                SearchOpList.Items[ 1 ].Text = GetString( "ENDSWITH" );
138
 
                                SearchOpList.Items[ 2 ].Text = GetString( "CONTAINS" );
139
 
                                SearchOpList.Items[ 3 ].Text = GetString( "EQUALS" );
140
 
                                SearchOpList.SelectedValue = GetString( "BEGINSWITH" );
141
 
 
142
 
                                // Set focus to the inbox control.
143
 
                                SetFocus( SearchNameTextBox );
144
 
 
145
 
                                // Set the javascript function that will handle key presses.
146
 
                                SearchNameTextBox.Attributes[ "OnKeyPress" ] = "return SubmitKeyDown(event, '" + SearchButton.ClientID + "');";
147
 
                        }
148
 
                }
149
 
 
150
 
                /// <summary>
151
 
                /// Sets focus to the specified control.
152
 
                /// </summary>
153
 
                /// <param name="ctrl"></param>
154
 
                private void SetFocus( System.Web.UI.Control ctrl )
155
 
                {
156
 
                        string s = "<SCRIPT language='javascript'>document.getElementById('" + ctrl.ClientID + "').focus() </SCRIPT>";
157
 
                        Page.RegisterStartupScript( "focus", s );
158
 
                }
159
 
 
160
 
                #endregion
161
 
 
162
 
                #region Protected Methods
163
 
 
164
 
                /// <summary>
165
 
                /// Default action for enter key.
166
 
                /// </summary>
167
 
                /// <returns></returns>
168
 
                protected string GetKeyDown()
169
 
                {
170
 
                        return "SubmitKeyDown(event, " + SearchButton.ClientID + ")";
171
 
                }
172
 
 
173
 
                /// <summary>
174
 
                /// Get a Localized String
175
 
                /// </summary>
176
 
                /// <param name="key">Key to the localized string.</param>
177
 
                /// <returns>Localized string.</returns>
178
 
                protected string GetString( string key )
179
 
                {
180
 
                        return rm.GetString( key );
181
 
                }
182
 
 
183
 
                /// <summary>
184
 
                /// Event handler that gets called when the search button is clicked.
185
 
                /// </summary>
186
 
                /// <param name="source"></param>
187
 
                /// <param name="e"></param>
188
 
                protected void OnSearchButton_Click( object source, EventArgs e )
189
 
                {
190
 
                        if ( Click != null )
191
 
                        {
192
 
                                Click( source, e );
193
 
                        }
194
 
                }
195
 
 
196
 
                #endregion
197
 
 
198
 
                #region Public Methods
199
 
                #endregion
200
 
 
201
 
                #region Web Form Designer generated code
202
 
                
203
 
                /// <summary>
204
 
                /// OnInit
205
 
                /// </summary>
206
 
                /// <param name="e"></param>
207
 
                override protected void OnInit(EventArgs e)
208
 
                {
209
 
                        //
210
 
                        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
211
 
                        //
212
 
                        InitializeComponent();
213
 
                        base.OnInit(e);
214
 
                }
215
 
                
216
 
                /// <summary>
217
 
                ///             Required method for Designer support - do not modify
218
 
                ///             the contents of this method with the code editor.
219
 
                /// </summary>
220
 
                private void InitializeComponent()
221
 
                {
222
 
                        SearchButton.Click += new EventHandler( OnSearchButton_Click );
223
 
                        this.Load += new System.EventHandler(this.Page_Load);
224
 
                }
225
 
                #endregion
226
 
        }
227
 
}