/// <summary> /// Event handler that gets called when the check all iFolders checkbox is selected. /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void OnAlliFoldersChecked(object source, EventArgs e) { CheckBox checkBox = source as CheckBox; foreach (DataGridItem item in iFolderList.Items) { // In order to be checked, the row must not be empty. string ifolderID = item.Cells[0].Text; if (ifolderID != " ") { if (checkBox.Checked) { CheckediFolders[ifolderID] = item.Cells[iFolderDisabledColumn].Text; } else { // Remove this ifolder the list. CheckediFolders.Remove(ifolderID); } } } // Set the action buttons appropriately. SetActionButtons(); // Rebind the data source with the new data. GetiFolders(); }
/// <summary> /// Event handler that gets called when the check all iFolders checkbox is selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnAlliFoldersChecked(object sender, EventArgs e) { CheckBox checkBox = sender as CheckBox; foreach (DataGridItem item in iFolderList.Items) { string ifolderID = item.Cells[iFolderIDColumn].Text; if (ifolderID != " ") { if (checkBox.Checked) { CheckediFolders[ifolderID] = item.Cells[iFolderDisabledColumn].Text; } else { // Remove this iFolder from the list. CheckediFolders.Remove(ifolderID); } } } // Set the ifolder action buttons. SetActionButtons(); // Rebind the data source with the new data. GetiFolders(checkBox.Checked); }
/// <summary> /// Sets the ifolder synchronization status on all selected ifolders. /// </summary> /// <param name="syncStatus">If true then all selected ifolders will be enabled.</param> private void SetSelectediFolderStatus(bool syncStatus) { foreach (string ifolderID in CheckediFolders.Keys) { /// Check for rights... int preference = GetRightsForiFolder(ifolderID); if (preference == -1) { preference = 0xffff; } UserGroupAdminRights rights = new UserGroupAdminRights((int)preference); if (!rights.EnableDisableiFolderAllowed) { continue; } // Don't set the status if already set. if (CheckediFolders[ifolderID] as string != syncStatus.ToString()) { iFolderPolicy policy = Utils.GetiFolderPolicyObject(ifolderID); policy.Locked = syncStatus; string ifolderLocation = web.GetiFolderLocation(ifolderID); UriBuilder remoteurl = new UriBuilder(ifolderLocation); remoteurl.Path = (new Uri(web.Url)).PathAndQuery; web.Url = remoteurl.Uri.ToString(); try { web.SetiFolderPolicy(policy); } catch (Exception ex) { TopNav.ShowError(GetString("ERRORCANNOTSETIFOLDERSTATUS"), ex); web.Url = currentServerURL; return; } } } // Clear the checked members. CheckediFolders.Clear(); AlliFoldersCheckBox.Checked = false; // Set the action buttons. SetActionButtons(); web.Url = currentServerURL; // Rebind the data source with the new data. GetiFolders(); }
/// <summary> /// Event handler that gets called when an ifolder is checked. /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void OniFolderChecked(object source, EventArgs e) { // Get the data grid row for this member. CheckBox checkBox = source as CheckBox; DataGridItem item = checkBox.Parent.Parent as DataGridItem; string ifolderID = item.Cells[iFolderIDColumn].Text; if (ifolderID != " ") { // iFolder is being added. if (checkBox.Checked) { CheckediFolders[ifolderID] = item.Cells[iFolderDisabledColumn].Text; } else { // Remove this ifolder from the list. CheckediFolders.Remove(ifolderID); } } // Set the ifolder action buttons. SetActionButtons(); }
/// <summary> /// Event handler that gets called with the delete ifolder button is clicked. /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void OnDeleteButton_Click(object source, EventArgs e) { string skippediFolderNames = ""; foreach (string ifolderID in CheckediFolders.Keys) { try { int rights = GetRightsForiFolder(ifolderID); if (rights == -1) { rights = 0xffff; } UserGroupAdminRights adminRights = new UserGroupAdminRights(rights); string ownerID = GetiFolderOwnerID(ifolderID); /*Condition for skipping iFolders for deletion. We allow the owner to * delete his own iFolder. */ if (userID != ownerID) { if (!adminRights.DeleteiFolderAllowed) { string ifolderName = GetiFolderName(ifolderID); if (skippediFolderNames.Length > 0) //Just for adding a comma. { skippediFolderNames += ", " + ifolderName; } else { skippediFolderNames += ifolderName; } continue; } } string ifolderLocation = web.GetiFolderLocation(ifolderID); UriBuilder remoteurl = new UriBuilder(ifolderLocation); remoteurl.Path = (new Uri(web.Url)).PathAndQuery; web.Url = remoteurl.Uri.ToString(); web.DeleteiFolder(ifolderID); } catch (Exception ex) { TopNav.ShowError(GetString("ERRORCANNOTDELETEIFOLDER"), ex); web.Url = currentServerURL; return; } } web.Url = currentServerURL; // Clear the checked members. CheckediFolders.Clear(); AlliFoldersCheckBox.Checked = false; // Set the action buttons. SetActionButtons(); // Rebind the data source with the new data. GetiFolders(); //If we have skipped some iFolders, tell the admin. if (skippediFolderNames.Length > 0) { TopNav.ShowError(string.Format(GetString("ERRORCANNOTDELETEIFOLDER"), skippediFolderNames)); } }
/// <summary> /// Returns the checked state for the specified member. /// </summary> /// <param name="id">ID of the ifolder</param> /// <returns>True if ifolder is checked.</returns> protected bool GetMemberCheckedState(Object id) { return(CheckediFolders.ContainsKey(id) ? true : false); }