js/jquery-dom.js
js/localFile.js
js/login.js
+ js/parseuri.js
js/screen.js
js/search.js
js/uri.js
localFile.js \
login.js \
redirection.js \
+ parseuri.js \
screen.js \
search.js \
systemConfig.js \
Rakka.baseURI = null;
Rakka.isLocked = false;
Rakka.isGlobalLocked = false;
-Rakka.isSpecialPage = false;
\ No newline at end of file
+Rakka.isSpecialPage = false;
+
+Rakka.rePageName = /^[^ a-z.|#\[\]][^ .|#\[\]]*$/;
var $previewHeader = null;
var $previewArea = null;
- var isDirty = null;
-
- var rePageName = /^[^ a-z.|#\[\]][^ .|#\[\]]*$/;
-
Rakka.editPage = function (pageName) {
var $area = Rakka.switchScreen();
$area.append($.H1({}, pageName == "" ? "Create page" : "Edit page"));
+ var isDirty = null;
var makeDirty = function () {
isDirty = true;
};
var validate = function () {
var isValid = (function () {
- if (fldPageName.value.match(rePageName) == null) {
+ if (fldPageName.value.match(Rakka.rePageName) == null) {
return false;
}
if (btnTypeRedirect.checked) {
- if (fldRedirect.value.match(rePageName) == null) {
+ if (fldRedirect.value.match(Rakka.rePageName) == null) {
return false;
}
}
else {
for (var tag in otherLangs) {
- if (otherLangs[tag].match(rePageName) == null) {
+ if (otherLangs[tag].match(Rakka.rePageName) == null) {
return false;
}
}
if (!Rakka.isLoggedIn() || Rakka.isGlobalLocked) {
$(trIsLocked).hide();
}
-
- isDirty = false;
};
var previewRakkaPage = function (pageName, source) {
--- /dev/null
+/*
+ parseUri 1.2.1
+ (c) 2007 Steven Levithan <stevenlevithan.com>
+ MIT License
+*/
+
+function parseUri (str) {
+ var o = parseUri.options,
+ m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
+ uri = {},
+ i = 14;
+
+ while (i--) uri[o.key[i]] = m[i] || "";
+
+ uri[o.q.name] = {};
+ uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
+ if ($1) uri[o.q.name][$1] = $2;
+ });
+
+ return uri;
+};
+
+parseUri.options = {
+ strictMode: false,
+ key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+ q: {
+ name: "queryKey",
+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+ },
+ parser: {
+ strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
+ loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
+ }
+};
var cachedConf = null;
+ var isValidBaseURI = function (str) {
+ parseUri.options.strictMode = true;
+ var uri = parseUri(str);
+
+ return (uri.protocol != "" &&
+ uri.authority != "" &&
+ uri.path != "" &&
+ uri.path.match(/\/$/) &&
+ uri.query == "" &&
+ uri.anchor == "");
+ };
+
Rakka.getSystemConfig = function () {
if (cachedConf != null) {
return cachedConf;
)
);
+ var validate = function () {
+ var isValid = (function () {
+ if (!isValidBaseURI(fldBaseURI.value)) {
+ return false;
+ }
+
+ return true;
+ })();
+
+ $(btnSave).attr({disabled: (isValid ? "" : "disabled")});
+ };
+
+ var isDirty = null;
+ var makeDirty = function () {
+ isDirty = true;
+ };
+
+ $(fldSiteName)
+ .add(fldBaseURI)
+ .add(fldDefaultPage)
+ .add(fldStyleSheet)
+ .add(fldLanguages)
+ .change(validate)
+ .keyup(validate)
+ .change(makeDirty);
+
$area.append(configPanel);
};