/// <summary> /// Updates the group's metadata in the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void submitPluginsButton_Click(object sender, EventArgs e) { bool isMod = false; string groupTag = Request.QueryString["grouptag"]; SqlController control = new SqlController(); GroupDAO group = control.RetrieveGroup(groupTag); List<GroupDAO> groupList = control.GetGroupsUserIsModeratorOf(_currentUser.UserID); foreach (GroupDAO x in groupList) { if (x.GroupID == group.GroupID) { isMod = true; } } if (_currentGroup.Owner.UserID != _currentUser.UserID && !isMod) { Response.Redirect(string.Format(@"Index.aspx?error={0}", HttpUtility.UrlEncode(@"You cannot edit plugins in groups you do not own."))); return; } try { IDBController controller = new SqlController(); _currentGroup.EnabledPlugins = ParseFromTextArea(enabledPlugins); control.UpdateGroupPlugins(_currentGroup); } catch (ArgumentNullException) { // Shouldn't happen } catch (CouldNotFindException) { // Shouldn't happen } catch (SqlException ex) { Logger.LogMessage("ManagePlugins.aspx: " + ex.Message, LoggerLevel.SEVERE); Response.Redirect(string.Format("ManagePlugins.aspx?grouptag={0}&error={1}", HttpUtility.UrlEncode(_currentGroup.GroupTag), HttpUtility.UrlEncode("An error occurred connecting to the server. Please try again soon."))); return; } Response.Redirect(string.Format("ManageGroup.aspx?grouptag={0}&success={1}", HttpUtility.UrlEncode(_currentGroup.GroupTag), HttpUtility.UrlEncode("Plugins successfully updated!"))); }