예제 #1
0
        public override string GetHtml()
        {
            var hg = new HtmlGenerator();

            hg.BeginHtml("s_saved_jobs", HtmlGenerator.HtmlObjectViewStyle);
            hg.Heading("s_saved_jobs", 1);
            foreach (string fn in Directory.GetFiles(Core.JobsDirectory, "*.djb", SearchOption.AllDirectories).Sorted())
            {
                string relfn = IOTool.RelativePathTo(Core.JobsDirectory, fn);
                try
                {
                    Job job = Job.LoadFromFile(fn);
                    hg.Heading(relfn, 2);
                    hg.Write("<a href=\"callback://runjob?job:{0}\">{1}</a>", HttpUtility.UrlEncode(fn), Texts.Get("s_run"));
                    hg.Write(" | <a href=\"callback://deletejob?job:{0}\">{1}</a>", HttpUtility.UrlEncode(fn), Texts.Get("s_delete"));
                    RenderCommand(hg, fn, job.Root);
                    hg.HorizontalRule();
                }
                catch (Exception err)
                {
                    hg.Heading(relfn, 2);
                    hg.Write("{0}:{1}", Texts.Get("s_error"), err.Message);
                }
            }
            hg.EndHtml();
            return(hg.HtmlText);
        }