Example #1
0
        /**
         * Creates the new category root resource (which is the standard root of
         * resource type Category) and, if necessary, deletes the old root (which
         * was a category marked with the IsRoot property).
         */

        private void UpdateCategoryRoot()
        {
            _rootCategory             = _resourceTreeManager.GetRootForType("Category");
            _rootCategory.DisplayName = "Categories";
            _rootCategory.SetProp(Core.Props.Open, 1);
            _resourceTreeManager.SetResourceNodeSort(_rootCategory, "Name");
            _resourceTreeManager.LinkToResourceRoot(_rootCategory, 20);

            IResourceList typedCategories = _store.FindResourcesWithProp("Category", Core.Props.ContentType);

            foreach (IResource res in typedCategories)
            {
                if (res.GetLinkProp("Parent") == _rootCategory)
                {
                    IResource rootForType = GetRootForTypedCategory(res.GetStringProp(Core.Props.ContentType));
                    res.SetProp("Parent", rootForType);
                }
            }
        }
Example #2
0
        void IViewsConstructor.RegisterViewsFirstRun()
        {
            string[] applType = new string[1] {
                "Task"
            };
            IFilterRegistry      fMgr    = Core.FilterRegistry;
            IResourceTreeManager treeMgr = Core.ResourceTreeManager;

            IResource notStarted    = fMgr.CreateStandardCondition(TaskNotStartedName, TaskNotStartedDeep, applType, "Status", ConditionOp.In, "0");
            IResource inProgress    = fMgr.CreateStandardCondition(TaskInProgressName, TaskInProgressDeep, applType, "Status", ConditionOp.In, "1");
            IResource completed     = fMgr.CreateStandardCondition(TaskIsCompletedName, TaskIsCompletedDeep, applType, "Status", ConditionOp.In, "2");
            IResource notCompleted  = fMgr.CreateStandardCondition(TaskIsNotCompletedName, TaskIsNotCompletedDeep, applType, "Status", ConditionOp.Lt, "2");
            IResource overdue       = fMgr.CreateStandardCondition(TaskIsOverdueName, TaskIsOverdueDeep, applType, "Date", ConditionOp.Lt, "Today");
            IResource withReminder  = fMgr.CreateStandardCondition(TaskHasReminderName, TaskHasReminderDeep, applType, "RemindDate", ConditionOp.HasProp);
            IResource remindDateRes = fMgr.CreateConditionTemplate(TaskReminderDatedName, TaskReminderDatedDeep, applType, ConditionOp.Eq, "RemindDate");

            IResource dueToday    = FilterConvertors.InstantiateTemplate(fMgr.Std.ReceivedInTheTimeSpanX, "Today", applType);
            IResource dueTomorrow = FilterConvertors.InstantiateTemplate(fMgr.Std.ReceivedInTheTimeSpanX, "Tomorrow", applType);
            IResource dueThisWeek = FilterConvertors.InstantiateTemplate(fMgr.Std.ReceivedInTheTimeSpanX, "This week", applType);

            fMgr.AssociateConditionWithGroup(notStarted, "Task Conditions");
            fMgr.AssociateConditionWithGroup(inProgress, "Task Conditions");
            fMgr.AssociateConditionWithGroup(completed, "Task Conditions");
            fMgr.AssociateConditionWithGroup(notCompleted, "Task Conditions");
            fMgr.AssociateConditionWithGroup(overdue, "Task Conditions");
            fMgr.AssociateConditionWithGroup(withReminder, "Task Conditions");
            fMgr.AssociateConditionWithGroup(remindDateRes, "Task Conditions");

            IResource viewAll        = fMgr.RegisterView("All Tasks", applType, (IResource[])null, null);
            IResource viewNotStarted = fMgr.RegisterView("Not Started", applType, new IResource[1] {
                notStarted
            }, null);
            IResource viewInProgress = fMgr.RegisterView("In Progress", applType, new IResource[1] {
                inProgress
            }, null);
            IResource viewCompleted = fMgr.RegisterView("Completed", applType, new IResource[1] {
                completed
            }, null);
            IResource viewOverdue = fMgr.RegisterView("Overdue", applType, new IResource[1] {
                overdue
            }, new IResource[1] {
                completed
            });
            IResource viewDueToday = fMgr.RegisterView("Due Today", applType, new IResource[2] {
                dueToday, notCompleted
            }, null);
            IResource viewDueTomorrow = fMgr.RegisterView("Due Tomorrow", applType, new IResource[2] {
                dueTomorrow, notCompleted
            }, null);
            IResource viewDueThisWeek = fMgr.RegisterView("Due This Week", applType, new IResource[2] {
                dueThisWeek, notCompleted
            }, null);

            treeMgr.LinkToResourceRoot(viewAll, 1);
            treeMgr.LinkToResourceRoot(viewNotStarted, 2);
            treeMgr.LinkToResourceRoot(viewInProgress, 3);
            treeMgr.LinkToResourceRoot(viewCompleted, 4);
            treeMgr.LinkToResourceRoot(viewOverdue, 5);
            treeMgr.LinkToResourceRoot(viewDueToday, 6);
            treeMgr.LinkToResourceRoot(viewDueTomorrow, 7);
            treeMgr.LinkToResourceRoot(viewDueThisWeek, 8);

            viewAll.SetProp("DisableDefaultGroupping", true);
            viewNotStarted.SetProp("DisableDefaultGroupping", true);
            viewInProgress.SetProp("DisableDefaultGroupping", true);
            viewCompleted.SetProp("DisableDefaultGroupping", true);
            viewOverdue.SetProp("DisableDefaultGroupping", true);
            viewDueToday.SetProp("DisableDefaultGroupping", true);
            viewDueTomorrow.SetProp("DisableDefaultGroupping", true);
            viewDueThisWeek.SetProp("DisableDefaultGroupping", true);
        }