var $area = Rakka.switchScreen();
Rakka.displayWaitingMessage("Loading... please wait.");
-
+
// XML 版のページを取得する。
$.ajax({
url : Rakka.baseURI + pageName + ".xml",
: $page.find("textData").text()
;
var summary = $page.find("summary").text();
-
+
displayPageEditor(pageName, oldRevision, defaultType, lang, isLocked, otherLangs, source, summary);
}
else {
},
error : function (req) {
Rakka.hideWaitingMessage();
-
+
if (req.status == 404) {
displayPageEditor(pageName, null, "rakka", null, false, {}, null, "");
}
var makeDirty = function () {
isDirty = true;
};
-
+
var fldPageName
= $.INPUT({type : "text", value: pageName});
$.LABEL({},
chkIsLocked,
"Disallow anonymous users to edit or delete this page")));
-
+
var btnTypeRakka
= $.INPUT({type : "radio",
name : "type",
$.OPTION({value: ""}, "(unspecified)"),
(function () {
var options = [];
-
+
$.each(Rakka.getSystemConfig().languages, function (tag, name) {
options.push(
$.OPTION({value: tag}, name));
var lang = $(selLang).val();
var pageName = $(this).val();
-
+
if (pageName == "") {
delete otherLangs[lang];
}
$(fldRedirect).change(makeDirty);
var trContent
- = $.TR({},
+ = $.TR({},
$.TH({}),
$.TD({})
);
var btnPreview
= $.INPUT({type: "button", value: "Preview page"});
-
+
$(btnPreview).click(function () {
if (btnTypeRakka.checked) {
previewRakkaPage(
var btnSubmit
= $.INPUT({type: "button", value: "Submit page"});
-
+
$(btnSubmit).click(function () {
if (btnTypeRakka.checked) {
submitTextPage(
var btnDelete
= $.INPUT({type: "button", value: "Delete this page"});
-
+
$(btnDelete).click(function () {
if (window.confirm("Do you really want to delete this page?")) {
deletePage(pageName);
var previewRakkaPage = function (pageName, source) {
Rakka.displayWaitingMessage("Loading... please wait.");
-
+
var url = Rakka.baseURI + "render/" + encodeURI(pageName);
$.ajax({
type : "POST",
var showPreview = function (doc) {
$previewArea.empty();
-
+
$previewHeader.show();
$previewArea.show();
-
+
var root = doc.documentElement;
var child = root.firstChild;
do {
Rakka.scrollToTopLeft();
};
- var submitTextPage = function (pageName, oldRevision, givenPageName, isLocked, mimeType, lang, otherLangs, summary, text) {
- var doc = document.implementation.createDocument(
- "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
-
- var page = doc.documentElement;
+ var submitTextPage
+ = function (pageName, oldRevision, givenPageName, isLocked, mimeType, lang, otherLangs, summary, text) {
+ var NS = "http://cielonegro.org/schema/Rakka/Page/1.0";
+ var doc = document.implementation.createDocument(NS, "page", null);
+ var page = doc.documentElement;
if (oldRevision != null) {
// ページ書換時
- var updateInfo = doc.createElement("updateInfo");
+ var updateInfo = doc.createElementNS(NS, "updateInfo");
updateInfo.setAttribute("oldRevision", oldRevision);
if (pageName != givenPageName) {
- var move = doc.createElement("move");
+ var move = doc.createElementNS(NS, "move");
move.setAttribute("from", pageName);
updateInfo.appendChild(move);
}
}
if (summary != null && summary != "") {
- var s = doc.createElement("summary");
+ var s = doc.createElementNS(NS, "summary");
s.appendChild(
doc.createTextNode(summary));
page.appendChild(s);
}
- var oLang = doc.createElement("otherLang");
+ var oLang = doc.createElementNS(NS, "otherLang");
for (var tag in otherLangs) {
- var link = doc.createElement("link");
+ var link = doc.createElementNS(NS, "link");
link.setAttribute("lang", tag);
link.setAttribute("page", otherLangs[tag]);
oLang.appendChild(link);
}
page.appendChild(oLang);
- var textData = doc.createElement("textData");
+ var textData = doc.createElementNS(NS, "textData");
textData.appendChild(
doc.createTextNode(text));
},
error : function (req) {
Rakka.hideWaitingMessage();
-
+
var $area = Rakka.switchScreen();
$area.text("Error: " + req.status + " " + req.statusText);
}
};
var submitBinaryPage = function (pageName, oldRevision, givenPageName, isLocked, lang, otherLangs, summary, path) {
- var doc = document.implementation.createDocument(
- "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
-
+ var NS = "http://cielonegro.org/schema/Rakka/Page/1.0";
+ var doc = document.implementation.createDocument(NS, "page", null);
var page = doc.documentElement;
if (oldRevision != null) {
// ページ書換時
- var updateInfo = doc.createElement("updateInfo");
+ var updateInfo = doc.createElementNS(NS, "updateInfo");
updateInfo.setAttribute("oldRevision", oldRevision);
if (pageName != givenPageName) {
- var move = doc.createElement("move");
+ var move = doc.createElementNS(NS, "move");
move.setAttribute("from", pageName);
updateInfo.appendChild(move);
}
}
if (summary != null) {
- var s = doc.createElement("summary");
+ var s = doc.createElementNS(NS, "summary");
s.appendChild(
doc.createTextNode(summary));
page.appendChild(s);
}
- var oLang = doc.createElement("otherLang");
+ var oLang = doc.createElementNS(NS, "otherLang");
for (var tag in otherLangs) {
- var link = doc.createElement("link");
+ var link = doc.createElementNS(NS, "link");
link.setAttribute("lang", tag);
link.setAttribute("page", otherLangs[tag]);
oLang.appendChild(link);
var bin = Rakka.loadLocalBinaryFile(path);
var b64 = Rakka.encodeBase64(bin);
- var binaryData = doc.createElement("binaryData");
+ var binaryData = doc.createElementNS(NS, "binaryData");
binaryData.appendChild(
doc.createTextNode(b64));
},
error : function (req) {
Rakka.hideWaitingMessage();
-
+
var $area = Rakka.switchScreen();
$area.text("Error: " + req.status + " " + req.statusText);
}
};
var submitRedirection = function (pageName, oldRevision, givenPageName, isLocked, destination) {
- var doc = document.implementation.createDocument(
- "http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
-
+ var NS = "http://cielonegro.org/schema/Rakka/Page/1.0";
+ var doc = document.implementation.createDocument(NS, "page", null);
var page = doc.documentElement;
if (oldRevision != null) {
// ページ書換時
- var updateInfo = doc.createElement("updateInfo");
+ var updateInfo = doc.createElementNS(NS, "updateInfo");
updateInfo.setAttribute("oldRevision", oldRevision);
if (pageName != givenPageName) {
- var move = doc.createElement("move");
+ var move = doc.createElementNS(NS, "move");
move.setAttribute("from", pageName);
updateInfo.appendChild(move);
}
},
error : function (req) {
Rakka.hideWaitingMessage();
-
+
var $area = Rakka.switchScreen();
$area.text("Error: " + req.status + " " + req.statusText);
}
},
error : function (req) {
Rakka.hideWaitingMessage();
-
+
var $area = Rakka.switchScreen();
$area.text("Error: " + req.status + " " + req.statusText);
}
(function () {
-
+
Rakka.showLoginPanel = function () {
var $area = Rakka.switchScreen();
var btnLogin
= $.INPUT({type: "button", value: "Login"});
- $(btnLogin).click(function () {
- login(fldUserID.value, fldPassword.value);
- });
+ $(btnLogin)
+ .click(function () {
+ login(fldUserID.value, fldPassword.value);
+ });
+
+ var fldHandler = function (ev) {
+ if (ev.keyCode == 27) { // ESC
+ Rakka.restoreScreen();
+ return false;
+ }
+ else if (ev.keyCode == 13) { // CR
+ login(fldUserID.value, fldPassword.value);
+ return false;
+ }
+ else {
+ return true;
+ }
+ };
+ $(fldUserID).keypress(fldHandler);
+ $(fldPassword).keypress(fldHandler);
var btnCancel
= $.INPUT({type: "button", value: "Cancel"});
);
$area.append(loginPanel);
+ $(fldUserID).focus();
};
var login = function (userID, password) {
var updateLoginState = function () {
currentUserID = null;
currentPassword = null;
-
+
var cookies = document.cookie.split(/;\s*/);
$.each(cookies, function () {
var m = this.match(/^([^=]*)=(.*)$/);
});
$("input.newButton").attr({disabled: ""});
-
+
$("input.editButton").attr({
disabled: (Rakka.isSpecialPage ? "disabled" : "")
});
+
+ $("input.configButton").attr({
+ disabled: ""
+ });
}
else {
/* ログインしてゐない */
$("input.newButton").attr({
disabled: (Rakka.isGlobalLocked ? "disabled" : "")
});
-
+
$("input.editButton").attr({
disabled: (Rakka.isLocked || Rakka.isGlobalLocked || Rakka.isSpecialPage ? "disabled" : "")
});
+
+ $("input.configButton").attr({
+ disabled: "disabled"
+ });
}
};