Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            team = WBTeam.GetFromTeamSite(SPContext.Current);

            if (team == null)
            {
                AreYouSureText.Text  = "You should only be using this form when on a team site.";
                RemoveButton.Enabled = false;
                return;
            }

            if (!team.IsCurrentUserTeamOwnerOrSystemAdmin())
            {
                AreYouSureText.Text  = "Only team owners or system admin can remove users from a team.";
                RemoveButton.Enabled = false;
                return;
            }

            if (!IsPostBack)
            {
                LoginNameOfUserToRemove.Value = Request.QueryString["userLogin"];
                RoleToRemove.Value            = Request.QueryString["role"];

                if (String.IsNullOrEmpty(LoginNameOfUserToRemove.Value) || String.IsNullOrEmpty(RoleToRemove.Value))
                {
                    AreYouSureText.Text  = "Error in the parameters sent to this dialog.";
                    RemoveButton.Enabled = false;
                    return;
                }

                SPUser userToRemove = SPContext.Current.Web.WBxEnsureUserOrNull(LoginNameOfUserToRemove.Value);

                if (userToRemove == null)
                {
                    AreYouSureText.Text  = "Cannot find the user that is to be removed: " + LoginNameOfUserToRemove.Value;
                    RemoveButton.Enabled = false;
                    return;
                }
                else
                {
                    AreYouSureText.Text   = "Are you sure you want to remove the following user:"******": " + userToRemove.Name;
                }

                CancelButton.Focus();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            team = WBTeam.GetFromTeamSite(SPContext.Current);

            if (team == null)
            {
                AreYouSureText.Text = "You should only be using this form when on a team site.";
                AddButton.Enabled   = false;
                return;
            }

            if (!team.IsCurrentUserTeamOwnerOrSystemAdmin())
            {
                AreYouSureText.Text = "Only team owners can add members to a team.";
                AddButton.Enabled   = false;
                return;
            }

            if (!IsPostBack)
            {
                AreYouSureText.Text = "Are you sure you want to add all of the managers reports (all staff below manager) as members of this team?";
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            teams = WBTaxonomy.GetTeams(SPContext.Current.Site);
            team  = WBTeam.GetFromTeamSite(teams, SPContext.Current);

            if (team == null)
            {
                ErrorText.Text = "You do not appear to be viewing this form while on a team site.";
                return;
            }


            if (!team.IsCurrentUserTeamOwnerOrSystemAdmin())
            {
                ErrorText.Text = "Only team owners or system admin can invite individuals to a team.";
                return;
            }


            if (!IsPostBack)
            {
                TeamName.Text = team.Name;

                InviteAsMember.Checked = true;
                InviteAsOwner.Checked  = false;

                SendInviteEmail.Checked = true;
                SendAsOne.Checked       = true;
                CCToYou.Checked         = true;

                EmailSubject.Text = WBFarm.Local.InviteToTeamDefaultEmailSubject;
                EmailBody.Text    = WBFarm.Local.InviteToTeamDefaultEmailBody;

                IndividualsToInviteControl.Focus();
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as WorkBoxExplorer;

            SPWebPartManager webPartManager = (SPWebPartManager)WebPartManager.GetCurrentWebPartManager(this.Page);

            if ((SPContext.Current.FormContext.FormMode == SPControlMode.Edit) ||
                (webPartManager.DisplayMode == WebPartManager.EditDisplayMode))
            {
                InEditMode = true;
            }

            SearchScope = WBUtils.UrlDataEncode(webPart.SearchScope);

            SelectedWorkBoxes.AllowSorting = true;
            SelectedWorkBoxes.Sorting     += new GridViewSortEventHandler(SelectedWorkBoxes_Sorting);

            SelectedWorkBoxes.AllowPaging                   = true;
            SelectedWorkBoxes.PageIndexChanging            += new GridViewPageEventHandler(SelectedWorkBoxes_PageIndexChanging);
            SelectedWorkBoxes.PagerSettings.Mode            = PagerButtons.Numeric;
            SelectedWorkBoxes.PagerSettings.Position        = PagerPosition.Bottom;
            SelectedWorkBoxes.PagerSettings.PageButtonCount = 50;
            SelectedWorkBoxes.PagerSettings.Visible         = true;
            SelectedWorkBoxes.PageSize = 30;

            // this odd statement is required in order to get the pagination to work with an SPGridView!
            SelectedWorkBoxes.PagerTemplate = null;

            CoreResultsWebPart.UseLocationVisualization = false;
            CoreResultsWebPart.PropertiesToRetrieve     = string.Empty;
            CoreResultsWebPart.SelectColumns            = @"<Columns>  <Column Name=""WorkId""/>  <Column Name=""Rank""/>  <Column Name=""Title""/>  <Column Name=""Author""/>  <Column Name=""Size""/>  <Column Name=""Path""/>  <Column Name=""Description""/>  <Column Name=""Write""/>  <Column Name=""SiteName""/>  <Column Name=""CollapsingStatus""/>  <Column Name=""HitHighlightedSummary""/>  <Column Name=""HitHighlightedProperties""/>  <Column Name=""ContentClass""/>  <Column Name=""IsDocument""/>  <Column Name=""PictureThumbnailURL""/>  <Column Name=""PopularSocialTags""/>  <Column Name=""PictureWidth""/>  <Column Name=""PictureHeight""/>  <Column Name=""DatePictureTaken""/>  <Column Name=""ServerRedirectedURL""/>  <Column Name=""SiteTitle""/>  <Column Name=""SPWebURL""/>  <Column Name=""OwningTeam""/>  </Columns>";
            CoreResultsWebPart.XslLink = "/Style Library/WBF/wb-explorer-search-results.xslt";

            //CoreResultsWebPart.DisplayAlertMeLink = true;
            //CoreResultsWebPart.AllowConnect = false;


            SPWeb  web  = SPContext.Current.Web;
            SPSite site = SPContext.Current.Site;

            WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);

            string teamGUIDString = "";

            Team = WBTeam.GetFromTeamSite(SPContext.Current);
            if (Team == null)
            {
                return;
            }

            if (Team.IsCurrentUserTeamOwnerOrSystemAdmin())
            {
                canSaveDefaultView = true;
            }

            // RefinementByOwningTeam = "owningteam%3D%22%23" + (Team.Id.ToString().Replace(" ", "%20").Replace("#", "%23").Replace("-", "%2D")) + "%22";
            // RefinementByOwningTeam = "owningteam%3D%22" + (Team.Name.ToString().Replace(" ", "%20").Replace("#", "%23").Replace("-", "%2D")) + "%22";
            RefinementByOwningTeam = WBUtils.UrlDataEncode("owningteam=\"" + Team.Name + "\"");

            teamGUIDString = WBExtensions.WBxToString(Team.Id);
            string recordsTypesListUrl = Team.RecordsTypesListUrl;

            if (recordsTypesListUrl == null || recordsTypesListUrl == "")
            {
                //recordsTypesListUrl = web.Url + "/Lists/Configure%20Teams%20Records%20Classes";
                NotSetupText = "(<i>The team has no records types list setup yet.</i>)";
                return;
            }

            // urm ... this is a real mess - a hidden field and a view state - it's a mashup mess!!
            String selectedRecordsTypeGUID = Request.QueryString["recordsTypeGUID"];

            if (String.IsNullOrEmpty(selectedRecordsTypeGUID))
            {
                String guidString = HiddenRecordsTypeGUIDField.Value;
                if (guidString != null && guidString != "")
                {
                    SelectedRecordsTypeGUID = guidString;
                }
            }
            else
            {
                SelectedRecordsTypeGUID          = selectedRecordsTypeGUID;
                HiddenRecordsTypeGUIDField.Value = selectedRecordsTypeGUID;
            }



            using (SPWeb configWeb = site.OpenWeb(recordsTypesListUrl))
            {
                ConfigurationList = configWeb.GetList(recordsTypesListUrl);
                if (ConfigurationList != null)
                {
                    if (!ConfigurationList.Fields.ContainsField("Records Class"))
                    {
                        ConfigurationList = null;
                        NotSetupText      = "(<i>The configuration list " + recordsTypesListUrl + " has no 'Records Class' column.</i>)";
                    }
                }
                else
                {
                    NotSetupText = "(<i>The configuration list " + recordsTypesListUrl + " was not set up correctly or does not exist.</i>)";
                }

                if (ConfigurationList != null)
                {
                    TeamAdminRecordsTypesTreeView.Nodes.Clear();
                    OurWorkRecordsTypesTreeView.Nodes.Clear();
                    CouncilWideRecordsTypesTreeView.Nodes.Clear();

                    TeamAdminRecordsTypesFilter.Nodes.Clear();
                    OurWorkRecordsTypesFilter.Nodes.Clear();
                    CouncilWideRecordsTypesFilter.Nodes.Clear();

                    foreach (SPListItem item in ConfigurationList.Items)
                    {
                        try
                        {
                            WBRecordsType recordsClass      = new WBRecordsType(recordsTypesTaxonomy, WBExtensions.WBxGetColumnAsString(item, "Records Class"));
                            TreeNode      createNewNodes    = createNodes(recordsClass, Team, false);
                            TreeNode      forFilteringNodes = createNodes(recordsClass, Team, true);

                            string groupName = item.WBxGetColumnAsString("Records Group");
                            if (groupName.Equals("Team admin"))
                            {
                                addNodesToTreeView(TeamAdminRecordsTypesTreeView, createNewNodes, selectedRecordsTypeGUID);
                                addNodesToTreeView(TeamAdminRecordsTypesFilter, forFilteringNodes, selectedRecordsTypeGUID);
                            }

                            if (groupName.Equals("Our work"))
                            {
                                addNodesToTreeView(OurWorkRecordsTypesTreeView, createNewNodes, selectedRecordsTypeGUID);
                                addNodesToTreeView(OurWorkRecordsTypesFilter, forFilteringNodes, selectedRecordsTypeGUID);
                            }

                            if (groupName.Equals("Council-wide business"))
                            {
                                addNodesToTreeView(CouncilWideRecordsTypesTreeView, createNewNodes, selectedRecordsTypeGUID);
                                addNodesToTreeView(CouncilWideRecordsTypesFilter, forFilteringNodes, selectedRecordsTypeGUID);
                            }
                        }
                        catch (Exception exception)
                        {
                            WBUtils.logMessage("The error message was: " + exception.Message);
                        }
                    }
                }
            }


            if (!IsPostBack)
            {
                List <String> ascendingDescendingOptions = new List <String>();
                ascendingDescendingOptions.Add("Ascending");
                ascendingDescendingOptions.Add("Descending");

                AscendingDescendingChoice.DataSource = ascendingDescendingOptions;
                AscendingDescendingChoice.DataBind();

                List <String> statusOptions = new List <String>();
                statusOptions.Add("Open");
                statusOptions.Add("Closed");
                statusOptions.Add("Deleted");
                statusOptions.Add("Any");

                StatusFilter.DataSource = statusOptions;
                StatusFilter.DataBind();


                List <String> involvementOptions = new List <String>();
                involvementOptions.Add(FILTER_INVOLVEMENT__OWNS);
                involvementOptions.Add(FILTER_INVOLVEMENT__INVOLVED);
                involvementOptions.Add(FILTER_INVOLVEMENT__VISITING);

                InvolvementFilter.DataSource = involvementOptions;
                InvolvementFilter.DataBind();

                if (!LoadDefaultView())
                {
                    SetSortColumn(WBColumn.WorkBoxDateLastModified);
                    GridViewSortDirection        = SortDirection.Descending;
                    SelectedViewStyle            = VIEW_STYLE__ICONS;
                    StatusCheckBox.Checked       = false;
                    RecordsTypeCheckBox.Checked  = true;
                    LastModifiedCheckBox.Checked = true;
                    DateCreatedCheckBox.Checked  = true;

                    StatusFilter.WBxSafeSetSelectedValue("Any");
                }


                WBLogging.Debug("Not in post back so setting guid value to be: " + SelectedRecordsTypeGUID);
                RefreshBoundData();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as TeamDetails;

            if (!IsPostBack)
            {
                WBTeam team = WBTeam.GetFromTeamSite(SPContext.Current);

                if (team == null)
                {
                    // then the SPContext is NOT on a team site
                    ListOfTeamOwners.Text  = "<i>(This web part is only for use in team sites)</i>";
                    ListOfTeamMembers.Text = "<i>(This web part is only for use in team sites)</i>";
                }
                else
                {
                    if (team.IsCurrentUserTeamOwnerOrSystemAdmin())
                    {
                        userIsTeamOwnerOrSystemAdmin = true;
                    }

                    List <String> ownerEmails   = new List <String>();
                    List <String> membersEmails = new List <String>();

                    ListOfTeamOwners.Text  = generateTable(team, team.OwnersGroupName, "Owner", "Team Owners", ownerEmails);
                    ListOfTeamMembers.Text = generateTable(team, team.MembersGroupName, "Member", "Team Members", membersEmails);

                    String teamActionsHTML = "";
                    if (userIsTeamOwnerOrSystemAdmin || webPart.ShowMailToLinks)
                    {
                        teamActionsHTML += "<h3>Team Actions:</h3>\n<ul>";

                        if (webPart.ShowMailToLinks)
                        {
                            teamActionsHTML += "<li>" + WBUtils.GenerateLinkToEmailGroup("Email team owners", ownerEmails) + "</li>";
                            teamActionsHTML += "<li>" + WBUtils.GenerateLinkToEmailGroup("Email team members", membersEmails) + "</li>";
                        }

                        if (userIsTeamOwnerOrSystemAdmin)
                        {
                            teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('InviteToTeamWithEmail.aspx', 0, 0); \">Invite user to team</a></li>";

                            if (team.IsCurrentUserTeamManagerOrSystemAdmin())
                            {
                                teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('ChangeTeamManager.aspx', 0, 0); \">Change team manager</a></li>";
                            }

                            if (webPart.ShowAddManagerReportsLinks)
                            {
                                if (String.IsNullOrEmpty(team.ManagerLogin))
                                {
                                    teamActionsHTML += "<li><i>Add manager's direct reports</i></li>";
                                    teamActionsHTML += "<li><i>Add all manager's reports</i></li>";
                                }
                                else
                                {
                                    teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('AddManagersDirectReports.aspx', 0, 0); \">Add manager's direct reports</a></li>";
                                    teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('AddAllManagersReports.aspx', 0, 0); \">Add all manager's reports</a></li>";
                                }
                            }

                            if (WBFarm.Local.IsCurrentUserSystemAdmin())
                            {
                                teamActionsHTML += "<li><a href=\"javascript: WorkBoxFramework_relativeCommandAction('CheckTeamSync.aspx', 0, 0); \">Check team synchronisation</a></li>";
                            }
                        }
                        teamActionsHTML += "\n</ul>";
                    }
                    TeamActions.Text = teamActionsHTML;
                }
            }
        }