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); }
private void RenderPolyCommandItems(HtmlGenerator hg, string jobfn, JobPolyCommand cmd) { hg.BeginUl(); foreach (var c in cmd.Commands) { hg.BeginLi(); RenderCommand(hg, jobfn, c); hg.EndLi(); } hg.EndUl(); }
public override string CreateHtml(AppObject appobj, ConnectionPack connpack, IDictionary <string, object> outnames) { HtmlGenerator gen = new HtmlGenerator(); IPhysicalConnection pconn = appobj.FindPhysicalConnection(connpack); string dbversion = null; if (pconn != null && pconn.SystemConnection != null) { try { dbversion = pconn.SystemConnection.ServerVersion; } catch { dbversion = null; } } IStoredConnection scon = pconn.StoredConnection; gen.BeginHtml(VersionInfo.ProgramTitle, HtmlGenerator.HtmlObjectViewStyle); gen.Heading(Texts.Get("s_properties"), 2); gen.PropsTableBegin(); if (scon != null) { gen.PropTableRow("s_path", scon.FileName); } var attr = XmlTool.GetRegisterAttr(scon); if (attr != null) { gen.PropTableRow("s_database_engine", attr.Title ?? attr.Name); } if (scon != null) { gen.PropTableRow("s_host", scon.GetDataSource()); gen.PropTableRow("s_database", scon.ExplicitDatabaseName); gen.PropTableRow("s_login", scon.GetLogin()); } else { gen.PropTableRow("s_path", pconn.PhysicalFactory.GetDataSource()); } if (dbversion != null) { gen.PropTableRow("s_version", dbversion); } gen.PropsTableEnd(); gen.EndHtml(); return(gen.HtmlText); }
private void RenderCommand(HtmlGenerator hg, string jobfn, JobCommand cmd) { if (cmd is JobPolyCommand) { RenderPolyCommandItems(hg, jobfn, (JobPolyCommand)cmd); } else { hg.Write(cmd.ToString()); hg.Write(" - "); hg.Write("<a href=\"callback://runcmd?job:{1}&cmd:{2}\">{0}</a>", Texts.Get("s_run"), HttpUtility.UrlEncode(jobfn), HttpUtility.UrlEncode(cmd.GroupId)); hg.Write(" | <a href=\"callback://editcmd?job:{1}&cmd:{2}\">{0}</a>", Texts.Get("s_edit"), HttpUtility.UrlEncode(jobfn), HttpUtility.UrlEncode(cmd.GroupId)); } }
protected override void DoLoadData() { if (m_editor != null) { return; } if (m_appobj == null) { m_text = ""; return; } IPhysicalConnection pconn = m_appobj.FindPhysicalConnection(ConnPack); bool dbset = false; HtmlGenerator gen = new HtmlGenerator(); gen.BeginHtml(VersionInfo.ProgramTitle, HtmlGenerator.HtmlObjectViewStyle); if (Widget.Items.Count > 0) { gen.PropsTableBegin(); foreach (var item in Widget.Items) { var dbcache = pconn.Cache.Database(m_appobj.GetObjectPath().DbName); string value = (string)dbcache.Get("dbinfowall", item.Value); if (value == null) { if (!dbset) { pconn.SystemConnection.SafeChangeDatabase(m_appobj.GetObjectPath()); dbset = true; } value = pconn.SystemConnection.ExecuteScalar(item.Value).SafeToString() ?? ""; dbcache.Put("dbinfowall", item.Value, value); } gen.PropTableRow(Texts.Get(item.Name), value); } gen.PropsTableEnd(); } else { gen.Write(Texts.Get("s_no_data")); } gen.EndHtml(); m_text = gen.HtmlText; }
public override string CreateHtml(AppObject appobj, ConnectionPack connpack, IDictionary <string, object> outnames) { var fav = (FavoriteAppObject)appobj; var holder = fav.LoadHolder(); HtmlGenerator gen = new HtmlGenerator(); gen.BeginHtml(holder.Name, HtmlGenerator.HtmlObjectViewStyle); gen.Heading(holder.Name, 2); gen.PropsTableBegin(); gen.PropTableRow("s_name", IOTool.RelativePathTo(Core.FavoritesDirectory, fav.FileName)); holder.Favorite.DisplayProps((n, v) => gen.PropTableRow(n, v)); gen.PropsTableEnd(); gen.BeginUl(); gen.Li(String.Format("<a href='callback://open'>{0}</a>", Texts.Get("s_execute"))); gen.EndUl(); gen.EndHtml(); outnames["open"] = (Action) delegate() { holder.Favorite.Open(); }; return(gen.HtmlText); }
public DatAdminInfoDashboardFrame() { InitializeComponent(); HtmlGenerator gen = new HtmlGenerator(); gen.BeginHtml(VersionInfo.ProgramTitle, HtmlGenerator.HtmlObjectViewStyle); gen.Heading(VersionInfo.ProgramTitle, 2); gen.PropsTableBegin(); gen.PropTableRow("s_version", VersionInfo.VERSION); gen.PropTableRow("s_revision", VersionInfo.SVN_REVISION); gen.PropTableRow("s_build_at", VersionInfo.BuildAt.ToString("d")); gen.PropTableRow("s_edition", LicenseTool.EditionText()); //gen.PropTableRow("s_license_valid_to", LicenseTool. Registration.EditionValidTo != null ? Registration.EditionValidTo.Value.ToString() : ""); gen.PropsTableEnd(); gen.BeginUl(); gen.Li(String.Format("<a href='callback://open_newconn_dialog'>{0}</a>", Texts.Get("s_create_connection"))); gen.Li(String.Format("<a href='callback://licenses'>{0}</a>", Texts.Get("s_licenses"))); gen.Li(String.Format("<a href='http://datadmin.com'>{0}</a>", Texts.Get("s_datadmin_on_web"))); gen.Li(String.Format("<a href='callback://support'>{0}</a>", Texts.Get("s_support"))); gen.EndUl(); bool showlic = true; if (LicenseTool.HidePurchaseLinks() && VersionInfo.HideLicenseInfo) { showlic = false; } if (showlic) { gen.Write(VersionInfo.LicenseInfo); } gen.EndHtml(); htmlPanelEx1.Procedures["open_newconn_dialog"] = (Action) delegate() { MainWindow.Instance.CreateNewConnectionDialog(); }; htmlPanelEx1.Procedures["licenses"] = (Action) delegate() { AboutForm.RunLicenses(); }; htmlPanelEx1.Procedures["support"] = (Action) delegate() { SupportConnector.SupportRequest(); }; htmlPanelEx1.Text = gen.HtmlText; }
public override string CreateHtml(AppObject appobj, ConnectionPack connpack, IDictionary <string, object> outnames) { ObjectPath objpath = appobj.GetObjectPath(); IPhysicalConnection conn = appobj.FindPhysicalConnection(connpack); if (conn != null && conn.IsOpened) { return(conn.InvokeR <string>((Func <string>) delegate() { string rowcount = "???", colcount = "???"; if (conn.SystemConnection != null) { var dbcache = conn.Cache.Database(appobj.GetObjectPath().DbName); var dialect = conn.GetAnyDialect(); bool dbset = false; rowcount = (string)dbcache.Get("htmlinfowidget_rows", objpath.ObjectName.ToString()); if (rowcount == null) { if (!dbset) { conn.SystemConnection.SafeChangeDatabase(objpath); dbset = true; } rowcount = conn.SystemConnection.ExecuteScalar("SELECT COUNT(*) FROM " + dialect.QuoteFullName(objpath.ObjectName)).ToString(); try { int ival = Int32.Parse(rowcount); rowcount = ival.FormatInt(); } catch { } dbcache.Put("htmlinfowidget_rows", objpath.ObjectName.ToString(), rowcount); } colcount = (string)dbcache.Get("htmlinfowidget_cols", objpath.ObjectName.ToString()); if (colcount == null) { if (!dbset) { conn.SystemConnection.SafeChangeDatabase(objpath); dbset = true; } using (var cmd = conn.SystemConnection.CreateCommand()) { cmd.CommandText = "SELECT * FROM " + dialect.QuoteFullName(objpath.ObjectName); using (var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) { colcount = reader.GetSchemaTable().Rows.Count.ToString(); } dbcache.Put("htmlinfowidget_cols", objpath.ObjectName.ToString(), colcount); } } } else { var db = appobj.FindDatabaseConnection(connpack); if (db != null) { var ts = db.InvokeLoadTableStructure(objpath.ObjectName, TableStructureMembers.ColumnNames); colcount = ts.Columns.Count.ToString(); } //var tbl = appobj.FindTableConnection(connpack); //if (tbl != null) //{ // var tabdata = tbl.GetTabularData(); // if (tabdata != null) // { // int? rcnt = tabdata.LoadRowCount(new TableDataSetProperties()); // if (rcnt != null) rowcount = rcnt.ToString(); // } //} } HtmlGenerator gen = new HtmlGenerator(); gen.BeginHtml(objpath.ObjectName.ToString(), HtmlGenerator.HtmlObjectViewStyle); if (ShowTableName) { gen.Heading(objpath.ObjectName.ToString(), 2); } gen.PropsTableBegin(); gen.PropTableRow("s_row_count", rowcount); gen.PropTableRow("s_column_count", colcount); gen.PropsTableEnd(); return gen.HtmlText; })); } return(""); }