示例#1
0
        public static String ToAppData(IAppData data, MvcContext ctx)
        {
            if (data == null)
            {
                return("");
            }

            // 1) html
            if (ctx != null && ctx.IsMock && ctx.GetItem("_makeHtml") != null)
            {
                return(HtmlLink.ToAppData(data));
            }

            String controllerPath = getAppDataController(data.GetType().FullName, data.AppId);

            // 2) link map
            String x = LinkMap.To(data.OwnerType, data.OwnerUrl, controllerPath, "Show", data.Id, data.AppId);

            if (x != null)
            {
                return(x);
            }


            // 3)
            return(To(data, controllerPath, "Show", data.Id));
        }
示例#2
0
        /// <summary>
        /// 获取App的网址。最后的效果包括后缀名,比如 /Forum1/Forum/Index.aspx
        /// </summary>
        /// <param name="app"></param>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public static String ToApp(IApp app, MvcContext ctx)
        {
            // 1) html
            if (ctx != null && ctx.IsMock && ctx.GetItem("_makeHtml") != null)
            {
                return(HtmlLink.ToApp(app));
            }

            String appName = strUtil.TrimEnd(app.GetType().Name, "App");

            // 2) link map
            String controller = appName + "/" + appName;
            String x          = LinkMap.To(app.OwnerType, app.OwnerUrl, controller, "Index", app.Id);

            if (x != null)
            {
                return(x);
            }

            // 3)
            String ret = getAppLink(app.OwnerType, app.OwnerUrl, appName, app.Id);

            if (MvcConfig.Instance.IsUrlToLower)
            {
                return(ret.ToLower());
            }
            return(ret);
        }
示例#3
0
        public static String To(IMember member, aActionWithId action, long id, long appId)
        {
            String x = LinkMap.To(member, action, id, appId);

            if (x != null)
            {
                return(x);
            }

            String ownerPath = LinkHelper.GetMemberPathPrefix(member);

            return(LinkHelper.AppendApp(appId, LinkHelper.GetController(action.Target.GetType()), action.Method.Name, id, ownerPath));
        }
示例#4
0
        public static String To(IMember member, String controller, String action, long id, long appId)
        {
            String x = LinkMap.To(member, controller, action, id, appId);

            if (x != null)
            {
                return(x);
            }

            String ownerPath = LinkHelper.GetMemberPathPrefix(member);

            return(LinkHelper.AppendApp(appId, controller, action, id, ownerPath));
        }
示例#5
0
        //-----------------------------------------------------------------------------------------

        public static String ToUserAppFull(IMemberApp app)
        {
            String strApp = strUtil.TrimEnd(app.AppInfo.TypeName, "App");

            // 1) link map
            String controller = strApp + "/" + strApp;
            String x          = LinkMap.To(app.OwnerType, app.OwnerUrl, controller, "Index", app.Id);

            if (x != null)
            {
                return(x);
            }


            // 2)
            if (MvcConfig.Instance.IsUrlToLower)
            {
                strApp = strApp.ToLower();
            }

            return(getAppLink(app.OwnerType, app.OwnerUrl, strApp, app.AppOid));
        }