コード例 #1
0
ファイル: AppQuery.cs プロジェクト: kieran23101/2sxc
        PublicQuery(IInstanceContext context, string appPath, string name, string stream, IBlock block)
        {
            var wrapLog = Log.Call($"path:{appPath}, name:{name}");

            if (string.IsNullOrEmpty(name))
            {
                throw HttpException.MissingParam(nameof(name));
            }
            var appIdentity = AppFinder.GetAppIdFromPath(appPath);
            var queryApp    = Factory.Resolve <Apps.App>().Init(appIdentity,
                                                                ConfigurationProvider.Build(false, false), false, Log);

            // now just run the default query check and serializer
            var result = BuildQueryAndRun(queryApp, name, stream, false, context, Log, block?.EditAllowed ?? false);

            wrapLog(null);
            return(result);
        }
コード例 #2
0
        private void TryToAttachAppFromUrlParams()
        {
            var wrapLog = Log.Call();
            var found   = false;

            try
            {
                var routeAppPath = Route.AppPathOrNull(Request.GetRouteData());
                var appId        = AppFinder.GetAppIdFromPath(routeAppPath).AppId;
                // Look up if page publishing is enabled - if module context is not available, always false
                var publish           = Factory.Resolve <IPagePublishing>().Init(Log);
                var publishingEnabled = Dnn.Module != null && publish.IsEnabled(Dnn.Module.ModuleID);
                Log.Add($"AppId: {appId}, publishing:{publishingEnabled}");
                var app = Sxc.Dnn.Factory.App(appId, publishingEnabled, parentLog: Log);
                DynCode.LateAttachApp(app);
                found = true;
            } catch { /* ignore */ }

            wrapLog(found.ToString());
        }