
![]() |
Show Changes |
![]() |
Edit |
![]() |
|
![]() |
Recent Changes |
![]() |
Subscriptions |
![]() |
Lost and Found |
![]() |
Find References |
![]() |
Rename |
![]() |
Administration Page |
| Search |
History
| 7/9/2008 4:37:58 AM |
| 194.29.99.50 |
| 6/30/2008 6:39:40 AM |
| 211.38.131.22 |
| 7/3/2007 7:23:06 AM |
| -85.18.98.13 |
| 7/3/2007 7:21:41 AM |
| -85.18.98.13 |
| 7/7/2006 10:20:40 AM |
| -63.120.62.232 |
![]() |
List all versions |
How to recreate:
If you copy / paste the source from this site, first paste it to notepad, and copy it from there to the surcefiles, otherwise the HTML markup will come along.
windows authentication doesn't seem to work using es.Credentials. Calls to the service hangs and eventually times out. When looking at the log and through fiddler, I get a couple of 401s - I guess this is normal while authenticating - and then a third, visible in fiddler that has no response (or perhaps it's hanging?) - JihoHan [2006-07-07]
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="WikiToHTML.wiki.EditService" value="http://wikisite/editservice.asmx"/> </appSettings> </configuration>
Now with small correction so that it works with the current version of FlexWiki (Namespace/Topic instead of Namespace.Topic) -- UweThomas
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
namespace WikiToHTML
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private WikiToHTML.wiki.EditService es = new WikiToHTML.wiki.EditService();
private System.Windows.Forms.TextBox txtOutputDir;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnCreateHTML;
private System.Windows.Forms.Label lblOutputTo;
private System.Windows.Forms.TextBox txtNamespace;
private System.Windows.Forms.Label label2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnCreateHTML = new System.Windows.Forms.Button();
this.txtOutputDir = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.lblOutputTo = new System.Windows.Forms.Label();
this.txtNamespace = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnCreateHTML
//
this.btnCreateHTML.Location = new System.Drawing.Point(8, 8);
this.btnCreateHTML.Name = "btnCreateHTML";
this.btnCreateHTML.Size = new System.Drawing.Size(88, 24);
this.btnCreateHTML.TabIndex = 0;
this.btnCreateHTML.Text = "Create HTML";
this.btnCreateHTML.Click += new System.EventHandler(this.btnCreateHTML_Click);
//
// txtOutputDir
//
this.txtOutputDir.Location = new System.Drawing.Point(8, 64);
this.txtOutputDir.Name = "txtOutputDir";
this.txtOutputDir.Size = new System.Drawing.Size(352, 20);
this.txtOutputDir.TabIndex = 1;
this.txtOutputDir.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(312, 23);
this.label1.TabIndex = 2;
this.label1.Text = "Outputdirectory. Default: c:\\temp)";
//
// lblOutputTo
//
this.lblOutputTo.Location = new System.Drawing.Point(8, 160);
this.lblOutputTo.Name = "lblOutputTo";
this.lblOutputTo.Size = new System.Drawing.Size(424, 23);
this.lblOutputTo.TabIndex = 3;
//
// txtNamespace
//
this.txtNamespace.Location = new System.Drawing.Point(8, 128);
this.txtNamespace.Name = "txtNamespace";
this.txtNamespace.Size = new System.Drawing.Size(88, 20);
this.txtNamespace.TabIndex = 4;
this.txtNamespace.Text = "MyWiki";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(312, 23);
this.label2.TabIndex = 5;
this.label2.Text = "Namespace. Default: MyWiki";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(448, 189);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtNamespace);
this.Controls.Add(this.lblOutputTo);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtOutputDir);
this.Controls.Add(this.btnCreateHTML);
this.Name = "Form1";
this.Text = "Export Wiki To HTML";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void btnCreateHTML_Click(object sender, System.EventArgs e)
{
string NameSpace;
WikiToHTML.wiki.ContentBase cb = new WikiToHTML.wiki.ContentBase();
NameSpace = txtNamespace.Text;
cb.Namespace = NameSpace;
WriteHTMLTopics(cb);
}
private void WriteHTMLTopics(WikiToHTML.wiki.ContentBase cb)
{
string strHTML="";
string strName="";
string strPathToStoreHTML = "";
string strWikiName="";
strWikiName = System.Configuration.ConfigurationSettings.AppSettings["WikiToHTML.wiki.EditService"];
//http://wikisite/editservice.asmx
//-->
//http://wikisite
strWikiName = strWikiName.Replace("/editservice.asmx","");
foreach(WikiToHTML.wiki.AbsoluteTopicName topicName in es.GetAllTopics(cb))
{
strHTML = es.GetHtmlForTopic(topicName);
strName = topicName.Name;
strPathToStoreHTML = txtOutputDir.Text.ToString();
if (strPathToStoreHTML.Length ==0)
{
strPathToStoreHTML = @"c:\temp";
}
StreamWriter s = new StreamWriter(Path.Combine(strPathToStoreHTML,strName)+ ".html");
strHTML = ChangeLinks(strWikiName, strHTML);
strHTML = ChangePaths(strWikiName, strHTML,"images");
strHTML = ChangePaths(strWikiName, strHTML,"doc");
strHTML = ChangePaths(strWikiName, strHTML,"files");
strHTML = ChangePaths(strWikiName, strHTML,"html");
strHTML = ChangePaths(strWikiName, strHTML,"emoticons");
s.Write(GetHeader() + strHTML+"</HTML>");
s.Close();
}
lblOutputTo.Text = "Output written to:" + strPathToStoreHTML;
}
//search:
//http://wikisite/default.aspx/MyWiki.WikiFile"
//-->
//WikiFile.html
private string ChangeLinks(string strWikiName, string strHTML)
{
string strTemp="";
string strMatch="";
string strBecomes="";
Regex re = new Regex(strWikiName + "/default\\.aspx/"+txtNamespace.Text+@"/.*?[""]",RegexOptions.IgnoreCase);
foreach (Match ma in re.Matches(strHTML))
{
strMatch = ma.ToString();
//result:WikiFile"
strBecomes = strMatch.Replace(strWikiName + @"/default.aspx/"+txtNamespace.Text+@"/","");
//result:WikiFile.html"
//strBecomes = strBecomes.Replace(@"""",@".html""");
strTemp = strHTML.Replace(strMatch, strBecomes);
strHTML = strTemp;
}
return strHTML;
}
//Change paths like "http://wikisite/images
//-->
// /images
private string ChangePaths(string strWikiName, string strHTML, string strPath)
{
string strTemp="";
string strMatch="";
string strBecomes="";
Regex re = new Regex(strWikiName +"/" + strPath, RegexOptions.IgnoreCase);
foreach (Match ma in re.Matches(strHTML))
{
strMatch = ma.ToString();
strBecomes = strMatch.Replace(strMatch,strPath);
strTemp = strHTML.Replace(strMatch, strBecomes);
strHTML = strTemp;
}
return strHTML;
}
private string GetHeader()
{
string strHeader = @"
<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"" >
<HTML>
<HEAD>
<TITLE>
WikiSite
</TITLE>
</HEAD>
<meta name=""vs_targetSchema"" content=""http://schemas.microsoft.com/intellisense/ie5"">
<META name=""description"" content="""">
<LINK href='wiki.css' type='text/css' rel='stylesheet'>";
return strHeader;
}
}
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using System.Net;
namespace WikiToHTML
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private WikiToHTML.wiki.EditService es = new WikiToHTML.wiki.EditService();
private System.Windows.Forms.TextBox txtOutputDir;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnCreateHTML;
private System.Windows.Forms.Label lblOutputTo;
private System.Windows.Forms.TextBox txtNamespace;
private System.Windows.Forms.Label label2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
es.Credentials = new NetworkCredential("username", "password", "domain");
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnCreateHTML = new System.Windows.Forms.Button();
this.txtOutputDir = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.lblOutputTo = new System.Windows.Forms.Label();
this.txtNamespace = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnCreateHTML
//
this.btnCreateHTML.Location = new System.Drawing.Point(8, 8);
this.btnCreateHTML.Name = "btnCreateHTML";
this.btnCreateHTML.Size = new System.Drawing.Size(88, 24);
this.btnCreateHTML.TabIndex = 0;
this.btnCreateHTML.Text = "Create HTML";
this.btnCreateHTML.Click += new System.EventHandler(this.btnCreateHTML_Click);
//
// txtOutputDir
//
this.txtOutputDir.Location = new System.Drawing.Point(8, 64);
this.txtOutputDir.Name = "txtOutputDir";
this.txtOutputDir.Size = new System.Drawing.Size(352, 20);
this.txtOutputDir.TabIndex = 1;
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(312, 23);
this.label1.TabIndex = 2;
this.label1.Text = "Outputdirectory. Default: c:\\temp)";
//
// lblOutputTo
//
this.lblOutputTo.Location = new System.Drawing.Point(8, 160);
this.lblOutputTo.Name = "lblOutputTo";
this.lblOutputTo.Size = new System.Drawing.Size(424, 23);
this.lblOutputTo.TabIndex = 3;
//
// txtNamespace
//
this.txtNamespace.Location = new System.Drawing.Point(8, 128);
this.txtNamespace.Name = "txtNamespace";
this.txtNamespace.Size = new System.Drawing.Size(88, 20);
this.txtNamespace.TabIndex = 4;
this.txtNamespace.Text = "MyWiki";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(312, 23);
this.label2.TabIndex = 5;
this.label2.Text = "Namespace. Default: MyWiki";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(448, 189);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtNamespace);
this.Controls.Add(this.lblOutputTo);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtOutputDir);
this.Controls.Add(this.btnCreateHTML);
this.Name = "Form1";
this.Text = "Export Wiki To HTML";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void btnCreateHTML_Click(object sender, System.EventArgs e)
{
string NameSpace;
WikiToHTML.wiki.ContentBase cb = new WikiToHTML.wiki.ContentBase();
NameSpace = txtNamespace.Text;
cb.Namespace = NameSpace;
WriteHTMLTopics(cb);
}
private void WriteHTMLTopics(WikiToHTML.wiki.ContentBase cb)
{
string strHTML = "";
string strName = "";
string strPathToStoreHTML = "";
string strWikiName = "";
strWikiName = System.Configuration.ConfigurationSettings.AppSettings["WikiToHTML.wiki.EditService"];
//http://wikisite/editservice.asmx
//-->
//http://wikisite
strWikiName = strWikiName.Replace("/editservice.asmx", "");
foreach (WikiToHTML.wiki.AbsoluteTopicName topicName in es.GetAllTopics(cb))
{
strHTML = es.GetHtmlForTopic(topicName);
strName = topicName.Name;
strPathToStoreHTML = txtOutputDir.Text.ToString();
if (strPathToStoreHTML.Length == 0)
{
strPathToStoreHTML = @"c:\temp";
}
StreamWriter s = new StreamWriter(Path.Combine(strPathToStoreHTML, strName) + ".html");
strHTML = ChangeLinks(strWikiName, strHTML);
strHTML = ChangePaths(strWikiName, strHTML, "images");
strHTML = ChangePaths(strWikiName, strHTML, "doc");
strHTML = ChangePaths(strWikiName, strHTML, "files");
strHTML = ChangePaths(strWikiName, strHTML, "html");
strHTML = ChangePaths(strWikiName, strHTML, "emoticons");
s.Write(GetHeader() + strHTML + "</HTML>");
s.Close();
}
lblOutputTo.Text = "Output written to:" + strPathToStoreHTML;
}
//search:
//http://wikisite/default.aspx/MyWiki.WikiFile"
//-->
//WikiFile.html
private string ChangeLinks(string strWikiName, string strHTML)
{
string strTemp = "";
string strMatch = "";
string strBecomes = "";
Regex re = new Regex(strWikiName + "/default\\.aspx/" + txtNamespace.Text + @"/.*?[""]", RegexOptions.IgnoreCase);
foreach (Match ma in re.Matches(strHTML))
{
strMatch = ma.ToString();
//result:WikiFile"
strBecomes = strMatch.Replace(strWikiName + @"/default.aspx/" + txtNamespace.Text + @"/", "");
//result:WikiFile.html"
//strBecomes = strBecomes.Replace(@"""",@".html""");
strTemp = strHTML.Replace(strMatch, strBecomes);
strHTML = strTemp;
}
return strHTML;
}
//Change paths like "http://wikisite/images
//-->
// /images
private string ChangePaths(string strWikiName, string strHTML, string strPath)
{
string strTemp = "";
string strMatch = "";
string strBecomes = "";
Regex re = new Regex(strWikiName + "/" + strPath, RegexOptions.IgnoreCase);
foreach (Match ma in re.Matches(strHTML))
{
strMatch = ma.ToString();
strBecomes = strMatch.Replace(strMatch, strPath);
strTemp = strHTML.Replace(strMatch, strBecomes);
strHTML = strTemp;
}
return strHTML;
}
private string GetHeader()
{
string strHeader = @"
<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"" >
<HTML>
<HEAD>
<TITLE>
WikiSite
</TITLE>
</HEAD>
<meta name=""vs_targetSchema"" content=""http://schemas.microsoft.com/intellisense/ie5"">
<META name=""description"" content="""">
<LINK href='wiki.css' type='text/css' rel='stylesheet'>";
return strHeader;
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}