Exemplo n.º 1
0
        public void Search()
        {
            target(Search);

            String addr = ctx.Post("webAddress");

            if (strUtil.IsNullOrEmpty(addr) || addr.StartsWith("http:") == false)
            {
                set("dirAndFiles", "");
                return;
            }

            IWebContext webContext = MockWebContext.New(ctx.viewer.Id, addr, new StringWriter());

            AdminSecurityUtils.SetSession(webContext);
            try {
                new CoreHandler().ProcessRequest(webContext);
            }
            catch (Exception ex) {
                set("dirAndFiles", "<div class=\"warning\">" + lang("exSearchViews") + "</div><div style=\"border:1px #f2f2f2 solid; margin-top:10px; padding:10px;display:none;\">" + ex.ToString().Replace(Environment.NewLine, "<br/>") + "</div>");
                return;
            }

            List <string> list = CurrentRequest.getItem(Template.loadedTemplates) as List <string>;

            bindResults(list);
        }
Exemplo n.º 2
0
        public void Edit(int postId)
        {
            ContentPost post = postService.GetById(postId, ctx.owner.Id);

            if (post == null)
            {
                echo(lang("exDataNotFound"));
                return;
            }

            target(to(Update, postId) + "?categoryId=" + ctx.GetInt("categoryId"));

            bindEditInfo(post);

            List <ContentSection> sectionList = sectionService.GetInputSectionsByApp(ctx.app.Id);
            String sectionIds = sectionService.GetSectionIdsByPost(postId);

            checkboxList("postSection", sectionList, "Title=Id", 0);
            set("sectionIds", sectionIds);

            //--------------------------上传信息----------------------------------

            //set( "uploadLink", to( new AttachmentController().SaveFlashFile ) ); // 接受上传的网址
            set("attachmentLink", to(new AttachmentController().AdminList, postId));

            set("imgUploadLink", to(SavePic));     //图片上传
            set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));
        }
Exemplo n.º 3
0
        public virtual void UploadForm()
        {
            Boolean isFlash = ("normal".Equals(ctx.Get("type")) == false);

            if (isFlash)
            {
                view("FlashUpload");
                set("uploadLink", to(SaveEditorPic));

                set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));

                String editorName = ctx.Get("editor");
                set("editorName", editorName);

                set("normalLink", to(UploadForm) + "?type=normal&editor=" + editorName);

                // swf上传跨域问题
                set("jsPath", sys.Path.DiskJs);
            }
            else
            {
                target(SavePic);
                String editorName = ctx.Get("editor");
                set("editorName", editorName);
            }
        }
Exemplo n.º 4
0
 private void bindUploadInfo()
 {
     //附件
     set("uploadLink", to(new UserUploadController().SaveMsgAttachment));     // 接受上传的网址
     set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));
     set("jsPath", sys.Path.DiskJs);
 }
Exemplo n.º 5
0
        public void Add()
        {
            set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));
            String uploadUrl = strUtil.Join(ctx.url.SiteUrl, to(SaveUpload));

            set("uploadLink", uploadUrl);


            IList albumList = albumService.GetListByApp(ctx.app.Id);

            if (albumList.Count == 0)
            {
                echoRedirectPart(alang("exAlbumRequire"), to(new AlbumController().Add), 1);
                return;
            }

            target(NewPost, 0);

            List <PhotoSysCategory> categories = categoryService.GetForDroplist();

            dropList("PhotoAlbumId", albumList, "Name=Id", 1);
            dropList("SystemCategoryId", categories, "Name=Id", null);

            set("PhotoAlbumAddUrl", to(new AlbumController().Add));
            //set( "batchUploadLink", to( BatchAdd ) );

            // swf上传跨域问题
            set("jsPath", sys.Path.DiskJs);
        }
Exemplo n.º 6
0
        private void bindAttachmentPanel(BlogPost post)
        {
            //附件
            String dataInfo = string.Format("?dataId={0}&dataType={1}&viewerId={2}&viewerUrl={3}&ownerId={4}&ownerType={5}&ownerUrl={6}",
                                            post.Id,
                                            typeof(BlogPost).FullName,
                                            ctx.viewer.Id,
                                            ctx.viewer.obj.Url,
                                            ctx.owner.Id,
                                            ctx.owner.obj.GetType().FullName,
                                            ctx.owner.obj.Url);

            set("uploadLink", to(new UserUploadController().SaveUserFile));     // 接受上传的网址
            set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));
            set("jsPath", sys.Path.DiskJs);

            set("dataId", post.Id);
            set("dataType", typeof(BlogPost).FullName);

            set("viewerId", ctx.viewer.Id);
            set("viewerUrl", ctx.viewer.obj.Url);

            set("ownerId", ctx.owner.Id);
            set("ownerType", ctx.owner.obj.GetType().FullName);
            set("ownerUrl", ctx.owner.obj.Url);


            bindAttachments(post);
        }
Exemplo n.º 7
0
        public void Add()
        {
            target(Create);

            dropList("categoryId", getRootList(), "Name=Id", "");
            dropList("fileItem.LicenseTypeId", LicenseType.GetAll(), "Name=Id", "");
            dropList("fileItem.Lang", FileLang.GetAll(), "Name=Name", "");
            set("subCategoriesJson", FileCategory.GetSubCatsJson());
            checkboxList("fileItem.PlatformIds", Platform.GetAll(), "Name=Id", "");

            set("authInfo", AdminSecurityUtils.GetAuthCookieJson(ctx));
            set("uploadLink", to(SaveUpload));
            set("jsPath", sys.Path.DiskJs);
        }
Exemplo n.º 8
0
        public virtual void Publisher()
        {
            target(new Microblogs.MicroblogSaveController().Create);

            set("mbTotalCount", MicroblogAppSetting.Instance.MicroblogContentMax);

            set("uploadLink", to(new Microblogs.My.MbSaveController().UploadForm));
            set("getVideoUrl", to(GetVideoInfo));

            set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));

            set("savPicLink", to(new My.MbSaveController().SavePic));

            // swf上传跨域问题
            set("jsPath", sys.Path.DiskJs);
        }
Exemplo n.º 9
0
        public void Edit(int id)
        {
            target(Update, id);

            FileItem f = FileItem.findById(id);

            bind(f);

            dropList("categoryId", getRootList(), "Name=Id", f.ParentCategoryId);
            dropList("fileItem.LicenseTypeId", LicenseType.GetAll(), "Name=Id", f.LicenseTypeId);
            dropList("fileItem.Lang", FileLang.GetAll(), "Name=Name", f.Lang);

            set("subCategoriesJson", FileCategory.GetSubCatsJson());
            checkboxList("fileItem.PlatformIds", Platform.GetAll(), "Name=Id", f.PlatformIds);

            editor("fileItem.Description", f.Description, "200px");

            set("authInfo", AdminSecurityUtils.GetAuthCookieJson(ctx));
            set("uploadLink", to(SaveUpload));
            set("jsPath", sys.Path.DiskJs);
        }
Exemplo n.º 10
0
        private String getAdminCmd()
        {
            String siteAdminCmd = "";

            if (SiteRole.IsInAdminGroup(ctx.viewer.obj.RoleId))
            {
                String lk = string.Format("<img src=\"{0}lock.gif\"/> ", sys.Path.Img);

                siteAdminCmd += string.Format("<a href=\"{0}\" class=\"quickCmd\">采集</a> ", Link.T2(ctx.viewer.obj, new Users.Admin.Spiders.ArticleController().List, 0));

                if (AdminSecurityUtils.HasSession(ctx))
                {
                    siteAdminCmd += string.Format("<a href='{0}'>{2}{1}</a>", Link.T2(Site.Instance, new Admin.MainController().Welcome), lang("siteAdmin"), lk);
                }
                else
                {
                    siteAdminCmd += string.Format("<a href='{0}'>{2}{1}</a>", Link.T2(Site.Instance, new Admin.MainController().Login), lang("siteAdmin"), lk);
                }
            }
            return(siteAdminCmd);
        }
Exemplo n.º 11
0
        //--------------------------------------------------------- 网站 -------------------------------------------------------------------------

        private void checkSitePermission()
        {
            if (!checkSiteAppPermission())
            {
                return;
            }

            if (ctx.route.isAdmin == false)
            {
                return;
            }

            //-------------------------------------------------------------------

            if (ctx.viewer.IsLogin == false)
            {
                redirectUrl(t2(new MainController().Login));
                return;
            }

            if (AdminSecurityUtils.HasSession(ctx) == false)
            {
                redirectUrl(t2(new Admin.MainController().Login) + "?returnUrl=" + ctx.url.EncodeUrl);

                return;
            }

            if (!checkSiteAdminPermission())
            {
                return;
            }

            if (!checkSiteAppAdminPermission())
            {
                return;
            }

            checkUserDataAdminPermission();
        }
Exemplo n.º 12
0
        public void Add(int sectionId)
        {
            target(to(Create) + "?categoryId=" + ctx.GetInt("categoryId") + "&fromList=" + ctx.GetInt("fromList"));

            List <ContentSection> sections = sectionService.GetInputSectionsByApp(ctx.app.Id);

            checkboxList("postSection", sections, "Title=Id", 0);

            set("created", DateTime.Now);

            set("sectionId", sectionId);

            set("width", ctx.GetInt("width"));
            set("height", ctx.GetInt("height"));

            set("uploadLink", to(new AttachmentController().SaveFlashFile)); // 接受上传的网址
            set("imgUploadLink", to(SavePic));                               //图片上传

            set("authJson", AdminSecurityUtils.GetAuthCookieJson(ctx));


            radioList("PickStatus", PickStatus.GetPickStatus(), "0");
        }