+
+ isDirty = false;
+ };
+
+ var previewRakkaPage = function (pageName, source) {
+ Rakka.displayWaitingMessage("Loading... please wait.");
+
+ var url = Rakka.baseURI + "render/" + encodeURI(pageName);
+ $.ajax({
+ type : "POST",
+ url : url,
+ contentType: "text/x-rakka",
+ data : source,
+ processData: false,
+ success : function (resultDoc) {
+ Rakka.hideWaitingMessage();
+ showPreview(resultDoc);
+ },
+ error : function (req) {
+ Rakka.hideWaitingMessage();
+ alert("Error: " + req.status + " " + req.statusText);
+ }
+ });
+ };
+
+ var previewBinaryPage = function (pageName, path) {
+ Rakka.displayWaitingMessage("Loading... please wait.");
+
+ /* Firefox でバイナリを送らうとすると 0x00 の位置で切れてしまふ。*/
+ var bin = Rakka.loadLocalBinaryFile(path);
+ var url = Rakka.baseURI + "render/" + encodeURI(pageName);
+ $.ajax({
+ type : "POST",
+ url : url,
+ contentType: "application/x-rakka-base64-stream",
+ data : Rakka.encodeBase64(bin),
+ processData: false,
+ success : function (resultDoc) {
+ Rakka.hideWaitingMessage();
+ showPreview(resultDoc);
+ },
+ error : function (req) {
+ Rakka.hideWaitingMessage();
+ alert("Error: " + req.status + " " + req.statusText);
+ }
+ });
+ };
+
+ var showPreview = function (doc) {
+ $previewArea.empty();
+
+ $previewHeader.show();
+ $previewArea.show();
+
+ var root = doc.documentElement;
+ var child = root.firstChild;
+ do {
+ if (child.nodeType == 1) {
+ // 要素だったので複製
+ $previewArea.append(child.cloneNode(true));
+ }
+ } while (child = child.nextSibling);
+
+ Rakka.scrollToTopLeft();
+ };
+
+ var submitTextPage = function (pageName, oldRevision, givenPageName, isLocked, mimeType, lang, summary, text) {
+ var doc = document.implementation.createDocument(
+ "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
+
+ var page = doc.documentElement;
+
+ if (oldRevision != null) {
+ // ページ書換時
+ var updateInfo = doc.createElement("updateInfo");
+ updateInfo.setAttribute("oldRevision", oldRevision);
+
+ if (pageName != givenPageName) {
+ var move = doc.createElement("move");
+ move.setAttribute("from", pageName);
+ updateInfo.appendChild(move);
+ }
+
+ page.appendChild(updateInfo);