~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to src/admin/.svn/text-base/iFolders.aspx.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
 
 
25
 
using System;
26
 
using System.Collections;
27
 
using System.ComponentModel;
28
 
using System.Data;
29
 
using System.Drawing;
30
 
using System.Resources;
31
 
using System.Web;
32
 
using System.Web.SessionState;
33
 
using System.Web.Services.Protocols;
34
 
using System.Web.UI;
35
 
using System.Web.UI.WebControls;
36
 
using System.Web.UI.HtmlControls;
37
 
 
38
 
namespace Novell.iFolderWeb.Admin
39
 
{
40
 
        /// <summary>
41
 
        /// Summary description for iFolders.
42
 
        /// </summary>
43
 
        public class iFolders : System.Web.UI.Page
44
 
        {
45
 
                #region Class Members
46
 
 
47
 
                /// <summary>
48
 
                /// iFolder list data grid column indices.
49
 
                /// </summary>
50
 
                private const int iFolderIDColumn = 0;
51
 
                private const int iFolderDisabledColumn = 1;
52
 
                private const int iFolderCheckColumn = 2;
53
 
                private const int iFolderTypeColumn = 3;
54
 
                private const int iFolderNameColumn = 4;
55
 
                private const int iFolderOwnerColumn = 5;
56
 
                private const int iFolderSizeMemberCountColumn = 6;
57
 
                private const int iFolderLastModifiedColumn = 7;
58
 
 
59
 
                /// <summary>
60
 
                /// iFolder list display types.
61
 
                /// </summary>
62
 
                private enum ListDisplayType
63
 
                {
64
 
                
65
 
                                All,
66
 
                                Orphaned
67
 
                }
68
 
 
69
 
                /// <summary>
70
 
                /// iFolder Connection
71
 
                /// </summary>
72
 
                private iFolderAdmin web;
73
 
 
74
 
                /// <summary>
75
 
                /// Resource Manager
76
 
                /// </summary>
77
 
                private ResourceManager rm;
78
 
 
79
 
 
80
 
                /// <summary>
81
 
                /// Top navigation panel control.
82
 
                /// </summary>
83
 
                protected TopNavigation TopNav;
84
 
 
85
 
 
86
 
                /// <summary>
87
 
                /// Control that checks or unchecks all of the ifolders in the current view.
88
 
                /// </summary>
89
 
                protected CheckBox AlliFoldersCheckBox;
90
 
 
91
 
 
92
 
                /// <summary>
93
 
                /// iFolder list controls.
94
 
                /// </summary>
95
 
                protected DataGrid iFolderList;
96
 
 
97
 
                /// <summary>
98
 
                /// iFolder list footer control.
99
 
                /// </summary>
100
 
                protected ListFooter iFolderListFooter;
101
 
 
102
 
 
103
 
                /// <summary>
104
 
                /// Web Controls.
105
 
                /// </summary>
106
 
                protected iFolderSearch iFolderSearch;
107
 
 
108
 
 
109
 
                /// <summary>
110
 
                /// Delete ifolder button control.
111
 
                /// </summary>
112
 
                protected Button DeleteButton;
113
 
 
114
 
                /// <summary>
115
 
                /// Disable ifolder button control.
116
 
                /// </summary>
117
 
                protected Button DisableButton;
118
 
 
119
 
                /// <summary>
120
 
                /// Enable ifolder button control.
121
 
                /// </summary>
122
 
                protected Button EnableButton;
123
 
 
124
 
                /// <summary>
125
 
                /// Create ifolder button control.
126
 
                /// </summary>
127
 
                protected Button CreateButton;
128
 
                
129
 
                /// <summary>
130
 
                /// iFolder list view tab controls.
131
 
                /// </summary>
132
 
                protected LinkButton AlliFoldersLink;
133
 
                
134
 
                /// <summary>
135
 
                /// iFolder list view tab controls.
136
 
                /// </summary>
137
 
                protected LinkButton OrphanediFoldersLink;
138
 
                
139
 
                /// <summary>
140
 
                /// iFolder list view tab controls.
141
 
                /// </summary>
142
 
                protected HtmlGenericControl CurrentTab;
143
 
 
144
 
                #endregion
145
 
 
146
 
                #region Properties
147
 
 
148
 
                /// <summary>
149
 
                /// Gets or sets the ifolders that are checked in the list.
150
 
                /// </summary>
151
 
                private Hashtable CheckediFolders
152
 
                {
153
 
                        get { return ViewState[ "CheckediFolders" ] as Hashtable; }
154
 
                        set { ViewState[ "CheckediFolders" ] = value; }
155
 
                }
156
 
 
157
 
                /// <summary>
158
 
                /// Gets or sets the active ifolder tab.
159
 
                /// </summary>
160
 
                private ListDisplayType ActiveiFolderTab
161
 
                {
162
 
                        get { return ( ListDisplayType )ViewState[ "ActiveTab" ]; }
163
 
                        set { ViewState[ "ActiveTab" ] = value; }
164
 
                }
165
 
 
166
 
                /// <summary>
167
 
                /// Gets or sets the current iFolder offset.
168
 
                /// </summary>
169
 
                private int CurrentiFolderOffset
170
 
                {
171
 
                        get { return ( int )ViewState[ "CurrentiFolderOffset" ]; }
172
 
                        set { ViewState[ "CurrentiFolderOffset" ] = value; }
173
 
                }
174
 
 
175
 
                /// <summary>
176
 
                /// Gets or sets the total number of iFolders contained in
177
 
                /// the last search.
178
 
                /// </summary>
179
 
                private int TotaliFolders
180
 
                {
181
 
                        get { return ( int )ViewState[ "TotaliFolders" ]; }
182
 
                        set { ViewState[ "TotaliFolders" ] = value; }
183
 
                }
184
 
 
185
 
                #endregion
186
 
 
187
 
                #region Private Methods
188
 
 
189
 
                /// <summary>
190
 
                ///  Builds the breadcrumb list for this page.
191
 
                /// </summary>
192
 
                private void BuildBreadCrumbList()
193
 
                {
194
 
                        TopNav.AddBreadCrumb( GetString( "IFOLDERS" ), null );
195
 
                        // Pass this page information to create the help link
196
 
                        TopNav.AddHelpLink(GetString("IFOLDERS"));
197
 
                }
198
 
        
199
 
                /// <summary>
200
 
                /// Creates a list of iFolders where the user is a member.
201
 
                /// </summary>
202
 
                /// <returns>A DataView object containing the iFolder list.</returns>
203
 
                private DataView CreateiFolderList()
204
 
                {
205
 
                        DataTable dt = new DataTable();
206
 
                        DataRow dr;
207
 
 
208
 
                        dt.Columns.Add( new DataColumn( "VisibleField", typeof( bool ) ) );
209
 
                        dt.Columns.Add( new DataColumn( "IDField", typeof( string ) ) );
210
 
                        dt.Columns.Add( new DataColumn( "OwnerIDField", typeof( string ) ) );
211
 
                        dt.Columns.Add( new DataColumn( "SharedField", typeof( bool ) ) );
212
 
                        dt.Columns.Add( new DataColumn( "DisabledField", typeof( bool ) ) );
213
 
                        dt.Columns.Add( new DataColumn( "EncryptedField", typeof( bool ) ) );
214
 
                        dt.Columns.Add( new DataColumn( "NameField", typeof( string ) ) );
215
 
                        dt.Columns.Add( new DataColumn( "OwnerNameField", typeof( string ) ) );
216
 
                        dt.Columns.Add( new DataColumn( "MemberCountField", typeof( string ) ) );
217
 
                        dt.Columns.Add( new DataColumn( "LastModifiedField", typeof( string ) ) );
218
 
                        dt.Columns.Add( new DataColumn( "SizeField", typeof( string ) ) );
219
 
 
220
 
                        // Get the iFolder list for this user.
221
 
                        
222
 
                        iFolderSet list ;
223
 
                        
224
 
                        switch(ActiveiFolderTab)
225
 
                        {
226
 
                                case ListDisplayType.Orphaned:
227
 
                                        list = web.GetOrphanediFolders(iFolderSearch.SearchOperation, 
228
 
                                                        ( iFolderSearch.SearchName == String.Empty) ? "*" : iFolderSearch.SearchName,
229
 
                                                                CurrentiFolderOffset,
230
 
                                                                iFolderList.PageSize);
231
 
                                        break;
232
 
                                        
233
 
                                case ListDisplayType.All:
234
 
                                default:
235
 
                                        list = web.GetiFoldersByName(iFolderSearch.SearchOperation, 
236
 
                                                ( iFolderSearch.SearchName == String.Empty) ? "*" : iFolderSearch.SearchName,
237
 
                                                CurrentiFolderOffset,iFolderList.PageSize);
238
 
                                        break;
239
 
                        }                       
240
 
                        
241
 
 
242
 
                        foreach( iFolder folder in list.Items )
243
 
                        {
244
 
                                bool encrypted = false;
245
 
                                
246
 
                                iFolder ifolder = web.GetiFolder(folder.ID);
247
 
                                string EncryptionAlgorithm = ifolder.EncryptionAlgorithm;
248
 
                                if(!(EncryptionAlgorithm == null || (EncryptionAlgorithm == String.Empty)))
249
 
                                {
250
 
                                        // It is an encrypted ifolder 
251
 
                                        encrypted = true;
252
 
                                }
253
 
 
254
 
                                dr = dt.NewRow();
255
 
                                dr[ 0 ] = true;
256
 
                                dr[ 1 ] = folder.ID;
257
 
                                dr[ 2 ] = folder.OwnerID;
258
 
                                dr[ 3 ] = ( folder.MemberCount > 1 ) ? true : false;
259
 
                                dr[ 4 ] = !folder.Enabled;
260
 
                                dr[ 5 ] = ( encrypted ) ? true : false;
261
 
                                dr[ 6 ] = folder.Name;
262
 
                                dr[ 7 ] = folder.OwnerFullName;
263
 
                                dr[ 8 ] = folder.MemberCount.ToString();
264
 
                                dr[ 9 ] = Utils.ToDateTimeString( "d", folder.LastModified );
265
 
 
266
 
                                dt.Rows.Add( dr );
267
 
                        }
268
 
 
269
 
                        // If the page size is not full, finish it with empty entries.
270
 
                        for ( int i = dt.Rows.Count; i < iFolderList.PageSize; ++i )
271
 
                        {
272
 
                                dr = dt.NewRow();
273
 
                                dr[ 0 ] = false;
274
 
                                dr[ 1 ] = String.Empty;
275
 
                                dr[ 2 ] = String.Empty;
276
 
                                dr[ 3 ] = false;
277
 
                                dr[ 4 ] = false;
278
 
                                dr[ 5 ] = false;
279
 
                                dr[ 6 ] = String.Empty;
280
 
                                dr[ 7 ] = String.Empty;
281
 
                                dr[ 8 ] = String.Empty;
282
 
                                dr[ 9 ] = String.Empty;
283
 
 
284
 
                                dt.Rows.Add( dr );
285
 
                        }
286
 
 
287
 
                        // Remember the total number of users.
288
 
                        TotaliFolders = list.Total;
289
 
 
290
 
                        // Build the data view from the table.
291
 
                        return new DataView( dt );
292
 
                }
293
 
 
294
 
                /// <summary>
295
 
                /// Gets the iFolders for the current user.
296
 
                /// </summary>
297
 
                private void GetiFolders()
298
 
                {
299
 
                        // Create a data source containing the iFolders.
300
 
                        iFolderList.DataSource = CreateiFolderList();
301
 
                        iFolderList.DataBind();
302
 
                        SetPageButtonState();
303
 
                }
304
 
 
305
 
                /// <summary>
306
 
                /// Page_Load
307
 
                /// </summary>
308
 
                /// <param name="sender"></param>
309
 
                /// <param name="e"></param>
310
 
                private void Page_Load( object sender, System.EventArgs e )
311
 
                {
312
 
                        // connection
313
 
                        web = Session[ "Connection" ] as iFolderAdmin;
314
 
 
315
 
                        // localization
316
 
                        rm = Application[ "RM" ] as ResourceManager;
317
 
 
318
 
                        if ( !IsPostBack )
319
 
                        {
320
 
                                // Initialize the localized fields.
321
 
                                DeleteButton.Text = GetString( "DELETE" );
322
 
                                DisableButton.Text = GetString( "DISABLE" );
323
 
                                EnableButton.Text = GetString( "ENABLE" );
324
 
                                CreateButton.Text = GetString( "CREATE" );
325
 
                                
326
 
                                AlliFoldersLink.Text = GetString( "ALL" );
327
 
                                OrphanediFoldersLink.Text = GetString( "ORPHANED" );
328
 
 
329
 
                                // Initialize state variables.
330
 
                                CurrentiFolderOffset = 0;
331
 
                                TotaliFolders = 0;
332
 
                                AlliFoldersCheckBox.Checked = false;
333
 
                                CheckediFolders = new Hashtable();
334
 
                                
335
 
                                //Set the active ifolder tab
336
 
                                ActiveiFolderTab = ListDisplayType.All;
337
 
                                
338
 
                        }
339
 
                        // Set the active ifolder display tab
340
 
                        SetActiveiFolderListTab( ActiveiFolderTab );
341
 
                }
342
 
 
343
 
                /// <summary>
344
 
                /// Page_PreRender
345
 
                /// </summary>
346
 
                /// <param name="sender"></param>
347
 
                /// <param name="e"></param>
348
 
                private void Page_PreRender(object sender, EventArgs e)
349
 
                {
350
 
                        BuildBreadCrumbList();
351
 
                        GetiFolders();
352
 
                }
353
 
 
354
 
                /// <summary>
355
 
                /// Enables or disables the ifolder action buttons.
356
 
                /// </summary>
357
 
                private void SetActionButtons()
358
 
                {
359
 
                        Hashtable ht = CheckediFolders;
360
 
                        DeleteButton.Enabled = ( ht.Count > 0 ) ? true : false;
361
 
                        DisableButton.Enabled = ht.ContainsValue( Boolean.FalseString );
362
 
                        EnableButton.Enabled = ht.ContainsValue( Boolean.TrueString );
363
 
                }
364
 
                
365
 
                /// <summary>
366
 
                /// Sets the active ifolder list display tab.
367
 
                /// </summary>
368
 
                /// <param name="activeTab"></param>
369
 
                /// <returns>The active list tab.</returns>
370
 
                private void SetActiveiFolderListTab( ListDisplayType activeTab )
371
 
                {
372
 
                        ActiveiFolderTab = activeTab;
373
 
                        CurrentTab.ID = activeTab.ToString();
374
 
                }
375
 
 
376
 
                /// <summary>
377
 
                /// Sets the page button state of the ifolder list.
378
 
                /// </summary>
379
 
                private void SetPageButtonState()
380
 
                {
381
 
                        iFolderListFooter.SetPageButtonState( 
382
 
                                iFolderList, 
383
 
                                CurrentiFolderOffset, 
384
 
                                TotaliFolders, 
385
 
                                GetString( "IFOLDERS" ),
386
 
                                GetString( "IFOLDER" ) );
387
 
                }
388
 
 
389
 
                /// <summary>
390
 
                /// Sets the ifolder synchronization status on all selected ifolders.
391
 
                /// </summary>
392
 
                /// <param name="syncStatus">If true then all selected ifolders will be enabled.</param>
393
 
                private void SetSelectediFolderStatus( bool syncStatus )
394
 
                {
395
 
                        foreach( string ifolderID in CheckediFolders.Keys )
396
 
                        {
397
 
                                // Don't set the status if already set.
398
 
                                if ( CheckediFolders[ ifolderID ] as string != syncStatus.ToString() )
399
 
                                {
400
 
                                        iFolderPolicy policy = Utils.GetiFolderPolicyObject( ifolderID );
401
 
                                        policy.Locked = syncStatus;
402
 
                                        try
403
 
                                        {
404
 
                                                web.SetiFolderPolicy( policy );
405
 
                                        }
406
 
                                        catch ( Exception ex )
407
 
                                        {
408
 
                                                TopNav.ShowError( GetString( "ERRORCANNOTSETIFOLDERSTATUS" ), ex );
409
 
                                                return;
410
 
                                        }
411
 
                                }
412
 
                        }
413
 
 
414
 
                        // Clear the checked members.
415
 
                        CheckediFolders.Clear();
416
 
                        AlliFoldersCheckBox.Checked = false;
417
 
 
418
 
                        // Set the action buttons.
419
 
                        SetActionButtons();
420
 
 
421
 
                        // Rebind the data source with the new data.
422
 
                        GetiFolders();
423
 
                }
424
 
 
425
 
                #endregion
426
 
 
427
 
                #region Protected Methods
428
 
                
429
 
                /// <summary>
430
 
                /// Event handler that gets called when the all ifolders tab is clicked.
431
 
                /// </summary>
432
 
                /// <param name="sender"></param>
433
 
                /// <param name="e"></param>
434
 
                protected void AlliFolders_Clicked( Object sender, EventArgs e )
435
 
                {
436
 
                        SetActiveiFolderListTab( ListDisplayType.All );
437
 
                        CreateButton.Enabled = true;
438
 
                        GetiFolders();
439
 
                }
440
 
                
441
 
                
442
 
                /// <summary>
443
 
                /// Event handler that gets called when the orphaned ifolders tab is clicked.
444
 
                /// </summary>
445
 
                /// <param name="sender"></param>
446
 
                /// <param name="e"></param>
447
 
                protected void OrphanediFolders_Clicked( Object sender, EventArgs e )
448
 
                {
449
 
                        SetActiveiFolderListTab( ListDisplayType.Orphaned );
450
 
                        CreateButton.Enabled = false;
451
 
                        GetiFolders();
452
 
                }
453
 
                
454
 
                /// <summary>
455
 
                /// Gets the image representing the iFolder type.
456
 
                /// </summary>
457
 
                /// <param name="disabled"></param>
458
 
                /// <param name="shared"></param>
459
 
                /// <returns></returns>
460
 
                protected string GetiFolderImage( object disabled, object shared , object encrypted)
461
 
                {
462
 
                        if( (bool) disabled)
463
 
                                return "images/ifolder_16-gray.gif";
464
 
                        else if( (bool) encrypted)      
465
 
                                return "images/encrypt_ilock2_16.gif";
466
 
                        
467
 
                        return ( bool )shared ? "images/ifolder_user_16.gif" : "images/ifolder.png";
468
 
                }
469
 
 
470
 
                /// <summary>
471
 
                /// Returns the checked state for the specified member.
472
 
                /// </summary>
473
 
                /// <param name="id">ID of the ifolder</param>
474
 
                /// <returns>True if ifolder is checked.</returns>
475
 
                protected bool GetMemberCheckedState( Object id )
476
 
                {
477
 
                        return CheckediFolders.ContainsKey( id ) ? true : false;
478
 
                }
479
 
 
480
 
                /// <summary>
481
 
                /// Gets the navigation url for the owner of the ifolder if the owner
482
 
                /// is not the current user.
483
 
                /// </summary>
484
 
                /// <param name="ownerID">The ID of the owner of the ifolder.</param>
485
 
                /// <returns>The URL to navigate to the owner of the ifolder.</returns>
486
 
                protected string GetOwnerUrl( Object ownerID )
487
 
                {
488
 
                        return String.Format( "UserDetails.aspx?id={0}", ownerID );
489
 
                }
490
 
 
491
 
                /// <summary>
492
 
                /// Get a Localized String
493
 
                /// </summary>
494
 
                /// <param name="key"></param>
495
 
                /// <returns></returns>
496
 
                protected string GetString( string key )
497
 
                {
498
 
                        return rm.GetString( key );
499
 
                }
500
 
 
501
 
                /// <summary>
502
 
                /// Event handler that gets called when the check all iFolders checkbox is selected.
503
 
                /// </summary>
504
 
                /// <param name="source"></param>
505
 
                /// <param name="e"></param>
506
 
                protected void OnAlliFoldersChecked( object source, EventArgs e )
507
 
                {
508
 
                        CheckBox checkBox = source as CheckBox;
509
 
                        foreach( DataGridItem item in iFolderList.Items )
510
 
                        {
511
 
                                // In order to be checked, the row must not be empty.
512
 
                                string ifolderID = item.Cells[ 0 ].Text;
513
 
                                if ( ifolderID != "&nbsp;" )
514
 
                                {
515
 
                                        if ( checkBox.Checked )
516
 
                                        {
517
 
                                                CheckediFolders[ ifolderID ] = item.Cells[ iFolderDisabledColumn ].Text;
518
 
                                        }
519
 
                                        else
520
 
                                        {
521
 
                                                // Remove this ifolder the list.
522
 
                                                CheckediFolders.Remove( ifolderID );
523
 
                                        }
524
 
                                }
525
 
                        }
526
 
 
527
 
                        // Set the action buttons appropriately.
528
 
                        SetActionButtons();
529
 
 
530
 
                        // Rebind the data source with the new data.
531
 
                        GetiFolders();
532
 
                }
533
 
 
534
 
                /// <summary>
535
 
                /// Event handler that gets called with the create ifolder button is clicked.
536
 
                /// </summary>
537
 
                /// <param name="source"></param>
538
 
                /// <param name="e"></param>
539
 
                protected void OnCreateButton_Click( object source, EventArgs e )
540
 
                {
541
 
                        Page.Response.Redirect( "CreateiFolder.aspx", true );
542
 
                }
543
 
 
544
 
                /// <summary>
545
 
                /// Event handler that gets called with the delete ifolder button is clicked.
546
 
                /// </summary>
547
 
                /// <param name="source"></param>
548
 
                /// <param name="e"></param>
549
 
                protected void OnDeleteButton_Click( object source, EventArgs e )
550
 
                {
551
 
                        foreach( string ifolderID in CheckediFolders.Keys )
552
 
                        {
553
 
                                try
554
 
                                {
555
 
                                        web.DeleteiFolder( ifolderID );
556
 
                                }
557
 
                                catch ( Exception ex )
558
 
                                {
559
 
                                        TopNav.ShowError( GetString( "ERRORCANNOTDELETEIFOLDER" ), ex );
560
 
                                        return;
561
 
                                }
562
 
                        }
563
 
 
564
 
                        // Clear the checked members.
565
 
                        CheckediFolders.Clear();
566
 
                        AlliFoldersCheckBox.Checked = false;
567
 
 
568
 
                        // Set the action buttons.
569
 
                        SetActionButtons();
570
 
 
571
 
                        // Rebind the data source with the new data.
572
 
                        GetiFolders();
573
 
                }
574
 
 
575
 
                /// <summary>
576
 
                /// Event handler that gets called with the disable ifolder button is clicked.
577
 
                /// </summary>
578
 
                /// <param name="source"></param>
579
 
                /// <param name="e"></param>
580
 
                protected void OnDisableButton_Click( object source, EventArgs e )
581
 
                {
582
 
                        SetSelectediFolderStatus( true );
583
 
                }
584
 
 
585
 
                /// <summary>
586
 
                /// Event handler that gets called with the enable ifolder button is clicked.
587
 
                /// </summary>
588
 
                /// <param name="source"></param>
589
 
                /// <param name="e"></param>
590
 
                protected void OnEnableButton_Click( object source, EventArgs e )
591
 
                {
592
 
                        SetSelectediFolderStatus( false );
593
 
                }
594
 
 
595
 
                /// <summary>
596
 
                /// Event handler that gets called when an ifolder is checked.
597
 
                /// </summary>
598
 
                /// <param name="source"></param>
599
 
                /// <param name="e"></param>
600
 
                protected void OniFolderChecked( object source, EventArgs e )
601
 
                {
602
 
                        // Get the data grid row for this member.
603
 
                        CheckBox checkBox = source as CheckBox;
604
 
                        DataGridItem item = checkBox.Parent.Parent as DataGridItem;
605
 
                        string ifolderID = item.Cells[ iFolderIDColumn ].Text;
606
 
                        if ( ifolderID != "&nbsp;" )
607
 
                        {
608
 
                                // iFolder is being added.
609
 
                                if ( checkBox.Checked )
610
 
                                {
611
 
                                        CheckediFolders[ ifolderID ] = item.Cells[ iFolderDisabledColumn ].Text;
612
 
                                }
613
 
                                else
614
 
                                {
615
 
                                        // Remove this ifolder from the list.
616
 
                                        CheckediFolders.Remove( ifolderID );
617
 
                                }
618
 
                        }
619
 
 
620
 
                        // Set the ifolder action buttons.
621
 
                        SetActionButtons();
622
 
                }
623
 
 
624
 
                /// <summary>
625
 
                /// Event handler that gets called when the ifolder search button is clicked.
626
 
                /// </summary>
627
 
                /// <param name="source"></param>
628
 
                /// <param name="e"></param>
629
 
                protected void OnSearchButton_Click( object source, EventArgs e )
630
 
                {
631
 
                        // Always search from the beginning.
632
 
                        CurrentiFolderOffset = 0;
633
 
                        GetiFolders();
634
 
                }
635
 
 
636
 
                /// <summary>
637
 
                /// Event that first when the PageFirstButton is clicked.
638
 
                /// </summary>
639
 
                /// <param name="source"></param>
640
 
                /// <param name="e"></param>
641
 
                protected void PageFirstButton_Click( object source, ImageClickEventArgs e)
642
 
                {
643
 
                        // Set to get the first ifolders.
644
 
                        CurrentiFolderOffset = 0;
645
 
                        GetiFolders();
646
 
                }
647
 
 
648
 
                /// <summary>
649
 
                /// Event that first when the PagePreviousButton is clicked.
650
 
                /// </summary>
651
 
                /// <param name="source"></param>
652
 
                /// <param name="e"></param>
653
 
                protected void PagePreviousButton_Click( object source, ImageClickEventArgs e)
654
 
                {
655
 
                        CurrentiFolderOffset -= iFolderList.PageSize;
656
 
                        if ( CurrentiFolderOffset < 0 )
657
 
                        {
658
 
                                CurrentiFolderOffset = 0;
659
 
                        }
660
 
 
661
 
                        // Rebind the data source with the new data.
662
 
                        GetiFolders();
663
 
                }
664
 
 
665
 
                /// <summary>
666
 
                /// Event that first when the PageNextButton is clicked.
667
 
                /// </summary>
668
 
                /// <param name="source"></param>
669
 
                /// <param name="e"></param>
670
 
                protected void PageNextButton_Click( object source, ImageClickEventArgs e)
671
 
                {
672
 
                        CurrentiFolderOffset += iFolderList.PageSize;
673
 
 
674
 
                        // Rebind the data source with the new data.
675
 
                        GetiFolders();
676
 
                }
677
 
 
678
 
                /// <summary>
679
 
                /// Event that first when the PageLastButton is clicked.
680
 
                /// </summary>
681
 
                /// <param name="source"></param>
682
 
                /// <param name="e"></param>
683
 
                protected void PageLastButton_Click( object source, ImageClickEventArgs e)
684
 
                {
685
 
                        CurrentiFolderOffset = ( ( TotaliFolders - 1 ) / iFolderList.PageSize ) * iFolderList.PageSize;
686
 
 
687
 
                        // Rebind the data source with the new data.
688
 
                        GetiFolders();
689
 
                }
690
 
 
691
 
                #endregion
692
 
 
693
 
                #region Web Form Designer generated code
694
 
 
695
 
                /// <summary>
696
 
                /// OnInit
697
 
                /// </summary>
698
 
                /// <param name="e"></param>
699
 
                override protected void OnInit(EventArgs e)
700
 
                {
701
 
                        //
702
 
                        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
703
 
                        //
704
 
                        InitializeComponent();
705
 
                        base.OnInit(e);
706
 
                }
707
 
                
708
 
                /// <summary>
709
 
                /// Required method for Designer support - do not modify
710
 
                /// the contents of this method with the code editor.
711
 
                /// </summary>
712
 
                private void InitializeComponent()
713
 
                {    
714
 
                        if ( !Page.IsPostBack )
715
 
                        {
716
 
                                // Set the render event to happen only on page load.
717
 
                                Page.PreRender += new EventHandler( Page_PreRender );
718
 
                        }
719
 
 
720
 
                        iFolderListFooter.PageFirstClick += new ImageClickEventHandler( PageFirstButton_Click );
721
 
                        iFolderListFooter.PagePreviousClick += new ImageClickEventHandler( PagePreviousButton_Click );
722
 
                        iFolderListFooter.PageNextClick += new ImageClickEventHandler( PageNextButton_Click );
723
 
                        iFolderListFooter.PageLastClick += new ImageClickEventHandler( PageLastButton_Click );
724
 
 
725
 
                        iFolderSearch.Click += new System.EventHandler( OnSearchButton_Click );
726
 
                        this.Load += new System.EventHandler(this.Page_Load);
727
 
                }
728
 
 
729
 
                #endregion
730
 
        }
731
 
}