コード例 #1
0
ファイル: WBAction.cs プロジェクト: OliSharpe/wbf
        private bool enableLogic(WorkBox workBox)
        {
            switch (ActionKey)
            {
            case ACTION_KEY__EDIT_PROPERTIES:
            case ACTION_KEY__INVITE_TEAMS:
            case ACTION_KEY__INVITE_INDIVIDUALS:
            case ACTION_KEY__CHANGE_OWNER:
            case ACTION_KEY__CLOSE:
            {
                if (!workBox.IsOpen)
                {
                    return(false);
                }
                break;
            }

            case ACTION_KEY__REOPEN:
            {
                if (!workBox.IsClosed)
                {
                    return(false);
                }
                break;
            }
            }

            if (workBox.Web.CurrentUser == null)
            {
                return(false);
            }

            if (workBox.CurrentUserIsBusinessAdmin() || workBox.CurrentUserIsSystemAdmin())
            {
                return(true);
            }

            if (workBox.CurrentUserIsOwner() && AllowOwnersToUse)
            {
                return(true);
            }
            if (workBox.CurrentUserIsInvolved() && AllowInvolvedToUse)
            {
                return(true);
            }
            if (workBox.CurrentUserCanVisit() && AllowVisitorsToUse)
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DialogTitle.Text = "An Error Occurred";

            if (!WorkBox.CurrentUserIsOwner() && !WorkBox.CurrentUserIsBusinessAdmin() && !WorkBox.CurrentUserIsSystemAdmin())
            {
                AreYouSureText.Text  = "Only owners or admin can remove teams or individuals from having access to a work box.";
                RemoveButton.Enabled = false;
                return;
            }

            if (!IsPostBack)
            {
                TeamOrIndividual.Value   = Request.QueryString["TeamOrIndividual"];
                InvolvedOrVisiting.Value = Request.QueryString["InvolvedOrVisiting"];

                if (TeamOrIndividual.Value == "Team")
                {
                    GUIDOfTeamToRemove.Value = Request.QueryString["GUIDOfTeamToRemove"];
                }

                if (TeamOrIndividual.Value == "Individual")
                {
                    LoginNameOfUserToRemove.Value = Request.QueryString["LoginNameOfUserToRemove"];
                }

                CancelButton.Focus();
            }

            if (String.IsNullOrEmpty(TeamOrIndividual.Value))
            {
                AreYouSureText.Text = "Error in the parameters sent to this dialog.";
                return;
            }

            AreYouSureText.Text = "Odd error in the parameters sent to this dialog.";

            if (TeamOrIndividual.Value == "Team" && !String.IsNullOrEmpty(GUIDOfTeamToRemove.Value))
            {
                teams = WBTaxonomy.GetTeams(SPContext.Current.Site);

                team = teams.GetTeam(new Guid(GUIDOfTeamToRemove.Value));

                if (!IsPostBack)
                {
                    if (InvolvedOrVisiting.Value == "Involved")
                    {
                        DialogTitle.Text            = "Remove Involved Team";
                        AreYouSureText.Text         = "Are you sure you want to remove the following team from being involved with this work box?";
                        NameOfTeamOrIndividual.Text = "Removing involved team: <b>" + team.Name + "</b>";
                    }
                    else
                    {
                        DialogTitle.Text            = "Remove Visiting Team";
                        AreYouSureText.Text         = "Are you sure you want to remove the following team from being able to visit this work box?";
                        NameOfTeamOrIndividual.Text = "Removing visiting team: <b>" + team.Name + "</b>";
                    }
                }
            }

            if (TeamOrIndividual.Value == "Individual" && !String.IsNullOrEmpty(LoginNameOfUserToRemove.Value))
            {
                user = WorkBox.Web.WBxEnsureUserOrNull(LoginNameOfUserToRemove.Value);

                if (!IsPostBack)
                {
                    if (InvolvedOrVisiting.Value == "Involved")
                    {
                        DialogTitle.Text            = "Remove Involved Individual";
                        AreYouSureText.Text         = "Are you sure you want to remove the following individual from being involved with this work box?";
                        NameOfTeamOrIndividual.Text = "Removing involved individual: <b>" + user.Name + "</b>";
                    }
                    else
                    {
                        DialogTitle.Text            = "Remove Visiting Individual";
                        AreYouSureText.Text         = "Are you sure you want to remove the following individual from being able to visit this work box?";
                        NameOfTeamOrIndividual.Text = "Removing visiting individual: <b>" + user.Name + "</b>";
                    }
                }
            }

            if (!IsPostBack)
            {
                DisposeWorkBox();
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!WorkBox.CurrentUserIsOwner() && !WorkBox.CurrentUserIsBusinessAdmin() && !WorkBox.CurrentUserIsSystemAdmin())
            {
                ErrorText.Text = "Only owners or admin can invite teams to have access to a work box.";
                return;
            }


            teamsTaxonomy = WBTaxonomy.GetTeams(SPContext.Current.Site);

            if (!IsPostBack)
            {
                WorkBoxTitle.Text = WorkBox.Title;

                InviteType.SelectedValue     = "Involved";
                CurrentlySelectedValue.Value = "Involved";

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

                EmailSubject.Text = WorkBox.Template.InviteInvolvedUserEmailSubject;
                EmailBody.Text    = WorkBox.Template.InviteInvolvedUserEmailBody;

                OtherEmailSubject.Value = WorkBox.Template.InviteVisitingUserEmailSubject;
                OtherEmailBody.Value    = WorkBox.Template.InviteVisitingUserEmailBody;

                teamsTaxonomy.InitialiseTaxonomyControl(TeamsToInviteControl, "Teams to invite", true);

                TeamsToInviteControl.Focus();

                DisposeWorkBox();
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!WorkBox.CurrentUserIsOwner() && !WorkBox.CurrentUserIsBusinessAdmin() && !WorkBox.CurrentUserIsSystemAdmin())
            {
                ErrorText.Text = "Only owners or admin can invite individuals to have access to a work box.";
                return;
            }


            if (!IsPostBack)
            {
                WorkBoxTitle.Text = WorkBox.Title;

                InviteType.SelectedValue     = "Involved";
                CurrentlySelectedValue.Value = "Involved";

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

                EmailSubject.Text = WorkBox.Template.InviteInvolvedUserEmailSubject;
                EmailBody.Text    = WorkBox.Template.InviteInvolvedUserEmailBody;

                OtherEmailSubject.Value = WorkBox.Template.InviteVisitingUserEmailSubject;
                OtherEmailBody.Value    = WorkBox.Template.InviteVisitingUserEmailBody;

                IndividualsToInviteControl.Focus();

                DisposeWorkBox();
            }
        }