Exemplo n.º 1
0
        // 如果不是针对某个特定app的更新,则需要移除所有缓存
        private void removeAllCache(IMember owner)
        {
            List <ContentApp> siteApps = ContentApp.find("OwnerId=" + owner.Id + " and OwnerType=:otype")
                                         .set("otype", owner.GetType().FullName)
                                         .list();

            foreach (ContentApp app in siteApps)
            {
                String cacheKey = getCacheKey(owner, app.Id);

                CacheManager.GetApplicationCache().Remove(cacheKey);
            }
        }
Exemplo n.º 2
0
        private static bool isHtmlDirUsed(string dirName)
        {
            List <ContentApp> appList = ContentApp.find("OwnerType=:otype")
                                        .set("otype", typeof(Site).FullName)
                                        .list();

            foreach (ContentApp app in appList)
            {
                if (dirName.Equals(app.GetSettingsObj().StaticDir))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        public void List()
        {
            set("addUrl", to(Add, 0));
            set("sortAction", to(SaveSort));

            List <SpiderTemplate> dataSrc = templateService.GetAll();
            List <ContentApp>     apps    = ContentApp.find("OwnerType=:otype").set("otype", typeof(Site).FullName).list();

            List <SpiderImport> list = importService.GetAll();
            IBlock block             = getBlock("list");

            foreach (SpiderImport it in list)
            {
                block.Set("s.Id", it.Id);
                block.Set("s.Name", it.Name);
                block.Set("s.DeleteUrl", to(Delete, it.Id));
                block.Set("s.ShowUrl", to(Show, it.Id));
                block.Set("s.EditUrl", to(Add, it.Id));

                block.Set("s.RefreshUrl", to(DoRefresh, it.Id));

                String approveInfo = it.IsApprove == 1 ? "<span class=\"approveInfo\">需审核</span>" : "";
                block.Set("s.ApproveInfo", approveInfo);

                String desc = getImportDescription(it, dataSrc);
                block.Set("s.Description", desc);

                String cmd;
                if (it.IsDelete == 1)
                {
                    cmd = string.Format("<span class=\"cmdStart\" href=\"{0}\">启动</span>", to(Start, it.Id));
                    block.Set("rowStatus", "stopped");
                }
                else
                {
                    cmd = string.Format("<span class=\"cmdStop\" href=\"{0}\">暂停</span>", to(Stop, it.Id));
                }
                block.Set("s.Cmd", cmd);


                block.Next();
            }

            set("page", "");
        }
Exemplo n.º 4
0
        public virtual void Execute()
        {
            logger.Info("begin execute");
            List <ContentApp> apps = ContentApp.find("OwnerType=:otype").set("otype", typeof(Site).FullName).list();

            foreach (ContentApp app in apps)
            {
                ContentSetting setting = app.GetSettingsObj();
                if (setting.IsAutoHtml == 0)
                {
                    logger.Info("skip home, appId=" + app.Id);
                    continue;
                }

                HtmlMaker.GetHome().Process(app.Id);
                logger.Info("make home, appId=" + app.Id);
            }
        }
Exemplo n.º 5
0
        private List <ContentApp> getApps(Service service)
        {
            List <ContentSection> sections = ContentSection.find("ServiceId=" + service.Id).list();

            if (sections.Count == 0)
            {
                return(new List <ContentApp>());
            }

            String ids = strUtil.GetIds(sections);

            if (strUtil.IsNullOrEmpty(ids))
            {
                return(new List <ContentApp>());
            }

            return(ContentApp.find("Id in (" + ids + ")").list());
        }
Exemplo n.º 6
0
        public void Add(int id)
        {
            if (id > 0)
            {
                SpiderImport item = importService.GetById(id);
                if (item == null)
                {
                    echoRedirect(lang("exDataNotFound"));
                    return;
                }
                set("itemJson", Json.ToString(new ImportJson(item)));
            }
            else
            {
                set("itemJson", "{Id:0}");
            }

            set("step3Action", to(Save));
            set("returnUrl", to(List));

            List <SpiderTemplate> list = templateService.GetAll();

            checkboxList("dataSrc", list, "SiteName=Id", null);

            //dataTarget
            List <ContentApp> apps  = ContentApp.find("OwnerType=:otype").set("otype", typeof(Site).FullName).list();
            IBlock            block = getBlock("apps");

            foreach (ContentApp app in apps)
            {
                block.Set("appId", app.Id);

                IMemberApp ma = appService.GetByApp(app);
                if (ma == null)
                {
                    continue;
                }

                block.Set("appName", ma.Name);
                List <ContentSection> sections = ContentSection.find("AppId=" + app.Id).list();
                block.Set("dataTarget", Html.CheckBoxList(sections, "dataTarget", "Title", "Id", null));
                block.Next();
            }
        }
Exemplo n.º 7
0
        public void TransSection()
        {
            runsql("update ContentPostSection set SaveStatus=0");
            runsql("update microblog set SaveStatus=0");

            List <ContentApp> apps = ContentApp.find("").list();

            foreach (ContentApp app in apps)
            {
                // 获取所有Post
                List <ContentPost> list = ContentPost.find("AppId=" + app.Id).list();
                foreach (ContentPost x in list)
                {
                    transSectionOne(x);
                }
            }

            echoRedirect(lang("opok"));
        }
Exemplo n.º 8
0
        public override void UpdateCache(MvcContext ctx)
        {
            IApp app = ctx.app.obj as IApp;

            if (app != null)
            {
                base.updateAllUrl(alink.ToApp(app, ctx), ctx);
            }
            else
            {
                List <ContentApp> apps = ContentApp.find("OwnerId=" + Site.Instance.Id + " and OwnerType=:otype")
                                         .set("otype", typeof(Site).FullName)
                                         .list();

                foreach (ContentApp a in apps)
                {
                    base.updateAllUrl(alink.ToApp(a, ctx), ctx);
                }
            }
        }
Exemplo n.º 9
0
        public void Trans()
        {
            target(TransSave);

            String ids = ctx.GetIdList("ids");

            set("ids", ids);

            List <ContentApp> apps  = ContentApp.find("OwnerType=:otype order by Id").set("otype", typeof(Site).FullName).list();
            IBlock            block = getBlock("apps");
            List <Dictionary <String, String> > xlist = new List <Dictionary <String, String> >();

            foreach (ContentApp app in apps)
            {
                block.Set("app.Id", app.Id);

                IMemberApp ma = appService.GetByApp(app);
                if (ma == null)
                {
                    continue;
                }

                block.Set("app.Name", ma.Name);
                List <ContentSection> sections = ContentSection.find("AppId=" + app.Id + " order by Id").list();
                if (sections.Count == 0)
                {
                    continue;
                }

                Dictionary <String, String> obj = new Dictionary <String, String>();
                obj["Id"]   = app.Id.ToString();
                obj["Name"] = ma.Name;
                xlist.Add(obj);

                block.Set("dataTarget", Html.CheckBoxList(sections, "dataTarget", "Title", "Id", null));
                block.Next();
            }

            bindList("xlist", "x", xlist);
        }