示例#1
0
        /*================================================================================= Mapped Properties */


        /*================================================================================= Override Methods */

        public override NodeHead GetApplication(string actionName)
        {
            if (actionName == "Browse")
            {
                int    appId;
                string appPath = string.Empty;

                Node app = this.BrowseApplication;
                if (app != null)
                {
                    appPath = app.Path;
                }

                if (app == null && this.LinkedContent != null)
                {
                    string appFolderName = "(apps)";
                    var    appQuery      = new SenseNet.ContentRepository.Storage.AppModel.ApplicationQuery(appFolderName, true, false, HierarchyOption.TypeAndPath, true);
                    var    paths         = appQuery.GetAvailablePaths(actionName, this.Path, this.LinkedContent.NodeType);
                    appPath = paths.FirstOrDefault(p => Node.Exists(p));
                }

                if (appPath == "")
                {
                    return(null);
                }

                return(NodeHead.Get(appPath));
            }

            return(null);
        }
示例#2
0
        private static void GatherConfigsForSubscription(Subscription subscription, Dictionary<string, NotificationConfig> configs)
        {
            // go through related events, and gather available configs
            foreach (var @event in subscription.RelatedEvents)
            {
                // config already resolved for this contentpath
                if (configs.ContainsKey(@event.ContentPath))
                    continue;

                // check custom config
                var query = new ApplicationQuery(NotificationConfig.CONFIGFOLDERNAME, false, false, HierarchyOption.Path);
                var configHeads = query.ResolveApplications(NotificationConfig.NOTIFICATIONCONFIGCONTENTNAME, @event.ContentPath, NotificationConfig.NOTIFICATIONCONFIGTYPENAME);
                var targetConfigHead = configHeads.FirstOrDefault();

                NotificationConfig configNode = null;
                if (targetConfigHead != null)
                {
                    configNode = Node.LoadNode(targetConfigHead.Id) as NotificationConfig;
                }
                configs.Add(@event.ContentPath, configNode);
            }
        }