Example #1
0
        private void generateTableOfAllInvolved()
        {
            WBAction inviteIndividualsAction = WorkBox.GetAction(WBAction.ACTION_KEY__INVITE_INDIVIDUALS);

            if (inviteIndividualsAction.IsEnabled)
            {
                currentUserCanRemoveIndividuals = true;
            }

            WBAction inviteTeamsAction = WorkBox.GetAction(WBAction.ACTION_KEY__INVITE_TEAMS);

            if (inviteTeamsAction.IsEnabled)
            {
                currentUserCanRemoveTeams = true;
            }

            SPServiceContext   serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
            UserProfileManager profileManager = new UserProfileManager(serviceContext);

            Dictionary <String, String> headers = new Dictionary <String, String>();

            headers.Add("body", "\n\nWork Box Title: " + WorkBox.Title + "\nWork Box URL: " + WorkBox.Url);

            string html = "<p>Users Involved with <b>" + WorkBox.Title + "</b></p>\n";

            html += "<table class=\"wbf-dialog-form\">\n";

            if (WorkBox.OwningTeam != null)
            {
                html += "<tr><td class=\"wbf-field-name-panel wbf-wider\"><b>Owning Team:</b><ul><li>";

                html += WBUtils.GenerateLinkToEmailGroup("Email work box owners", WorkBox.GetAllOwners(SPContext.Current.Site).WBxToEmails(), headers);

                html += "</li></ul></td><td class=\"wbf-field-value-panel\">\n";

                html += renderTeamAsFieldSet(profileManager, SPContext.Current.Site, WorkBox.OwningTeam);

                html += "</td></tr>\n";
            }


            html += "<tr><td class=\"wbf-field-name-panel wbf-wider\"><b>Involved Teams:</b><ul><li>";

            html += WBUtils.GenerateLinkToEmailGroup("Email all involved with work box", WorkBox.GetAllInvolved(SPContext.Current.Site).WBxToEmails(), headers);

            html += "</li></ul></td><td class=\"wbf-field-value-panel\">\n";

            if (WorkBox.InvolvedTeams != null && WorkBox.OwningTeam != null)
            {
                foreach (WBTeam involved in WorkBox.InvolvedTeams)
                {
                    if (involved.Id.Equals(WorkBox.OwningTeam.Id))
                    {
                        continue;
                    }

                    html += renderTeamAsFieldSet(profileManager, SPContext.Current.Site, involved, "Involved");
                }
            }

            html += "</td></tr>\n";

            html += "<tr><td class=\"wbf-field-name-panel wbf-wider\"><b>Involved Individuals:</b></td><td class=\"wbf-field-value-panel\"><ul>\n";

            if (WorkBox.InvolvedIndividuals != null)
            {
                foreach (SPUser user in WorkBox.InvolvedIndividuals)
                {
                    html += "<li>" + renderUser(profileManager, user, "Involved") + "</li>";
                }
            }

            html += "</ul>";
            html += "</td></tr>\n";


            html += "<tr><td class=\"wbf-field-name-panel wbf-wider\"><b>Visiting Teams:</b><ul><li>";

            html += WBUtils.GenerateLinkToEmailGroup("Email everyone who can visit the work box", WorkBox.GetAllWhoCanVisit(SPContext.Current.Site).WBxToEmails(), headers);

            html += "</li></ul></td><td class=\"wbf-field-value-panel\">\n";

            if (WorkBox.VisitingTeams != null)
            {
                foreach (WBTeam visiting in WorkBox.VisitingTeams)
                {
                    html += renderTeamAsFieldSet(profileManager, SPContext.Current.Site, visiting, "Visiting");
                }
            }

            html += "</td></tr>\n";

            html += "<tr><td class=\"wbf-field-name-panel wbf-wider\"><b>Visiting Individuals:</b></td><td class=\"wbf-field-value-panel\"><ul>\n";

            if (WorkBox.VisitingIndividuals != null)
            {
                foreach (SPUser user in WorkBox.VisitingIndividuals)
                {
                    html += "<li>" + renderUser(profileManager, user, "Visiting") + "</li>";
                }
            }

            html += "</ul>";
            html += "</td></tr>\n";


            html += "</table>\n";

            GeneratedViewOfAllInvolved.Text = html;
        }