= Redirection {
redirName :: !PageName
, redirDest :: !PageName
+ , redirIsLocked :: !Bool
, redirRevision :: RevNum
, redirLastMod :: UTCTime
, redirUpdateInfo :: Maybe UpdateInfo
isRedirect :: Page -> Bool
-isRedirect (Redirection _ _ _ _ _) = True
-isRedirect _ = False
+isRedirect (Redirection _ _ _ _ _ _) = True
+isRedirect _ = False
isEntity :: Page -> Bool
= proc (name, tree)
-> do updateInfo <- maybeA parseUpdateInfo -< tree
redirect <- maybeA (getXPathTreesInDoc "/page/@redirect/text()" >>> getText) -< tree
+ isLocked <- (withDefault (getXPathTreesInDoc "/page/@isLocked/text()" >>> getText) "no"
+ >>> parseYesOrNo) -< tree
case redirect of
Nothing -> parseEntity -< (name, tree)
Just dest -> returnA -< (Redirection {
redirName = name
, redirDest = dest
+ , redirIsLocked = isLocked
, redirRevision = undefined
, redirLastMod = undefined
, redirUpdateInfo = updateInfo
lastMod <- getRevisionProp "svn:date"
>>= return . fromJust . parseW3CDateTime . chomp . fromJust
+ isLocked <- getRevisionProp "rakka:isLocked"
+ >>= return . isJust
+
return Redirection {
redirName = name
, redirDest = dest
+ , redirIsLocked = isLocked
, redirRevision = pageRev
, redirLastMod = zonedTimeToUTC lastMod
, redirUpdateInfo = undefined
setNodeProp path "rakka:lang" Nothing
setNodeProp path "rakka:isTheme" Nothing
setNodeProp path "rakka:isFeed" Nothing
- setNodeProp path "rakka:isLocked" Nothing
+ setNodeProp path "rakka:isLocked" (encodeFlag $ redirIsLocked page)
setNodeProp path "rakka:isBinary" Nothing
setNodeProp path "rakka:summary" Nothing
setNodeProp path "rakka:otherLang" Nothing
: $page.attr("redirect") != null ? "redirect"
: "unknown"
;
+ var isLocked = $page.attr("isLocked") == "yes";
var source
= $page.attr("redirect") != null ? $page.attr("redirect")
: $page.find("textData").text()
;
var summary = $page.find("summary").text();
- displayPageEditor(pageName, oldRevision, defaultType, source, summary);
+ displayPageEditor(pageName, oldRevision, defaultType, isLocked, source, summary);
},
error : function (req) {
Rakka.hideWaitingMessage();
if (req.status == 404) {
- displayPageEditor(pageName, null, "rakka", null, "");
+ displayPageEditor(pageName, null, "rakka", false, null, "");
}
else {
$area.text("Error: " + req.status + " " + req.statusText);
};
Rakka.newPage = function () {
- displayPageEditor("", null, "rakka", null, "");
+ displayPageEditor("", null, "rakka", false, null, "");
};
- var displayPageEditor = function (pageName, oldRevision, defaultType, source, summary) {
+ var displayPageEditor = function (pageName, oldRevision, defaultType, isLocked, source, summary) {
var $area = Rakka.switchScreen();
$previewHeader = $( $.H1({}, "Preview") );
$(fldPageName).change(makeDirty);
+ var chkIsLocked
+ = $.INPUT({type : "checkbox",
+ checked: (isLocked ? "checked" : "")});
+
+ $(chkIsLocked).change(makeDirty);
+
+ var trIsLocked
+ = $.TR({},
+ $.TH({}, "Page lock"),
+ $.TD({},
+ $.LABEL({},
+ chkIsLocked,
+ "Disallow anonymous users to edit or delete this page")));
+
var btnTypeRakka
= $.INPUT({type : "radio",
name : "type",
pageName,
oldRevision,
fldPageName.value,
+ chkIsLocked.checked,
"text/x-rakka",
fldSummary.value,
fldRakkaSource.value);
pageName,
oldRevision,
fldPageName.value,
+ chkIsLocked.checked,
"text/css",
fldSummary.value,
fldCSSSource.value);
pageName,
oldRevision,
fldPageName.value,
+ chkIsLocked.checked,
fldSummary.value,
fldUploadFile.value);
}
pageName,
oldRevision,
fldPageName.value,
+ chkIsLocked.checked,
fldRedirect.value);
}
});
$.TH({}, "Page name"),
$.TD({}, fldPageName)
),
+ trIsLocked,
$.TR({},
$.TH({}, "Page type"),
$.TD({},
Rakka.scrollToTopLeft();
};
- var submitTextPage = function (pageName, oldRevision, givenPageName, mimeType, summary, text) {
+ var submitTextPage = function (pageName, oldRevision, givenPageName, isLocked, mimeType, summary, text) {
var doc = document.implementation.createDocument(
"http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
page.appendChild(updateInfo);
}
+ page.setAttribute("isLocked", isLocked ? "yes" : "no");
page.setAttribute("type", mimeType);
if (summary != null) {
});
};
- var submitBinaryPage = function (pageName, oldRevision, givenPageName, summary, path) {
+ var submitBinaryPage = function (pageName, oldRevision, givenPageName, isLocked, summary, path) {
var doc = document.implementation.createDocument(
"http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
page.appendChild(updateInfo);
}
+ page.setAttribute("isLocked", isLocked ? "yes" : "no");
page.setAttribute("type", "");
if (summary != null) {
});
};
- var submitRedirection = function (pageName, oldRevision, givenPageName, destination) {
+ var submitRedirection = function (pageName, oldRevision, givenPageName, isLocked, destination) {
var doc = document.implementation.createDocument(
"http://cielonegro.org/schema/Rakka/Page/1.0", "page", null);
page.appendChild(updateInfo);
}
+ page.setAttribute("isLocked", isLocked ? "yes" : "no");
page.setAttribute("redirect", destination);
Rakka.displayWaitingMessage("Submitting... please wait.");