예제 #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
        private String addWorkBoxResults(WBCollection collection, SPListItemCollection workBoxResults)
        {
            if (workBoxResults == null || workBoxResults.Count == 0)
            {
                return("");
            }

//            String html = "<table cellpadding=\"2\">\n";
            String html = "";

            foreach (SPListItem item in workBoxResults)
            {
                using (WorkBox workBox = new WorkBox(collection, item))
                {
                    bool include = false;

                    if (ShowAllUserCanVisit && workBox.CurrentUserCanVisit())
                    {
                        include = true;
                    }
                    else if (ShowAllUserInvolved && workBox.CurrentUserIsInvolved())
                    {
                        include = true;
                    }
                    else if (workBox.CurrentUserIsOwner())
                    {
                        include = true;
                    }

                    if (include)
                    {
                        html += string.Format("<tr class=\"wbf-work-box\"><td><img src=\"{0}\"/></td><td><a href=\"{1}\">{2}</a></td><td><a href=\"{3}\">{4}</a></td><td>{5}</td></tr>\n",
                                              "/_layouts/images/WorkBoxFramework/work-box-16.png",
                                              workBox.Url,
                                              workBox.Title,
                                              workBox.OwningTeam.TeamSiteUrl,
                                              workBox.OwningTeam.Name,
                                              workBox.DateCreated.ToString("d"));
                    }
                }
            }

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

            return(html);
        }