let cssHref = [uriToString id (mkObjectURI baseURI styleSheet) ""]
scriptSrc = [uriToString id (baseURI { uriPath = uriPath baseURI </> "js" }) ""]
- feeds <- arrIO0 (findFeeds (envStorage env)) -< ()
+ feeds <- arrIO0 (findFeeds (envStorage env)) -< ()
+ javaScripts <- arrIO0 (findJavaScripts (envStorage env)) -< ()
pageTitle <- listA (readSubPage env) -< (name, Just page, "PageTitle")
leftSideBar <- listA (readSubPage env) -< (name, Just page, "SideBar/Left")
+= txt ("Rakka.isLocked=" ++ trueOrFalse isLocked ++ ";")
+= txt ("Rakka.isGlobalLocked=" ++ trueOrFalse isGLocked ++ ";")
)
+ += ( constL javaScripts
+ >>>
+ eelem "script"
+ += sattr "type" "text/javascript"
+ += attr "src" (arr (mkObjectURIStr baseURI) >>> mkText)
+ )
)
+= ( eelem "body"
+= ( eelem "div"
let cssHref = [uriToString id (mkObjectURI baseURI styleSheet) ""]
scriptSrc = [uriToString id (baseURI { uriPath = uriPath baseURI </> "js" }) ""]
+ feeds <- arrIO0 (findFeeds (envStorage env)) -< ()
+ javaScripts <- arrIO0 (findJavaScripts (envStorage env)) -< ()
+
pageTitle <- listA (readSubPage env) -< (name, Nothing, "PageTitle")
leftSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Left")
rightSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Right")
+= sattr "type" "text/css"
+= attr "href" (arr id >>> mkText)
)
+ += ( constL feeds
+ >>>
+ eelem "link"
+ += sattr "rel" "alternate"
+ += sattr "type" "application/rss+xml"
+ += attr "title" (txt siteName <+> txt " - " <+> mkText)
+ += attr "href" (arr (mkFeedURIStr baseURI) >>> mkText)
+ )
+= ( constL scriptSrc
>>>
eelem "script"
+= txt ("Rakka.baseURI = \"" ++ uriToString id baseURI "" ++ "\";")
+= txt ("Rakka.isGlobalLocked=" ++ trueOrFalse isGLocked ++ ";")
)
+ += ( constL javaScripts
+ >>>
+ eelem "script"
+ += sattr "type" "text/javascript"
+ += attr "src" (arr (mkObjectURIStr baseURI) >>> mkText)
+ )
)
+= ( eelem "body"
+= ( eelem "div"
let cssHref = [uriToString id (mkObjectURI baseURI styleSheet) ""]
scriptSrc = [uriToString id (baseURI { uriPath = uriPath baseURI </> "js" }) ""]
+ feeds <- arrIO0 (findFeeds (envStorage env)) -< ()
+ javaScripts <- arrIO0 (findJavaScripts (envStorage env)) -< ()
+
pageTitle <- listA (readSubPage env) -< (name, Nothing, "PageTitle")
leftSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Left")
rightSideBar <- listA (readSubPage env) -< (name, Nothing, "SideBar/Right")
+= sattr "type" "text/css"
+= attr "href" (arr id >>> mkText)
)
+ += ( constL feeds
+ >>>
+ eelem "link"
+ += sattr "rel" "alternate"
+ += sattr "type" "application/rss+xml"
+ += attr "title" (txt siteName <+> txt " - " <+> mkText)
+ += attr "href" (arr (mkFeedURIStr baseURI) >>> mkText)
+ )
+= ( constL scriptSrc
>>>
eelem "script"
+= txt ("Rakka.baseURI = \"" ++ uriToString id baseURI "" ++ "\";")
+= txt ("Rakka.isGlobalLocked=" ++ trueOrFalse isGLocked ++ ";")
)
+ += ( constL javaScripts
+ >>>
+ eelem "script"
+ += sattr "type" "text/javascript"
+ += attr "src" (arr (mkObjectURIStr baseURI) >>> mkText)
+ )
)
+= ( eelem "body"
+= ( eelem "div"
return (map hpPageName $ srPages result)
+findJavaScripts :: Storage -> IO [PageName]
+findJavaScripts sto
+ = do cond <- newCondition
+ setPhrase cond "[UVSET]"
+ addAttrCond cond "@title STRBW Global/"
+ addAttrCond cond "@type STRBW text/javascript"
+ setOrder cond "@uri STRA"
+ result <- searchPages sto cond
+ return (map hpPageName $ srPages result)
+
+
mkFeedURIStr :: URI -> PageName -> String
mkFeedURIStr baseURI name
= uriToString id (mkFeedURI baseURI name) ""
+
+
+mkObjectURIStr :: URI -> PageName -> String
+mkObjectURIStr baseURI name
+ = uriToString id (mkObjectURI baseURI name) ""
var $page = $(pageXml).find("page");
var oldRevision = $page.attr("revision");
var defaultType
- = $page.attr("isBinary") == "yes" ? "binary"
- : $page.attr("type") == "text/x-rakka" ? "rakka"
- : $page.attr("type") == "text/css" ? "css"
- : $page.attr("redirect") != null ? "redirect"
- : "unknown"
+ = $page.attr("isBinary") == "yes" ? "binary"
+ : $page.attr("type") == "text/x-rakka" ? "rakka"
+ : $page.attr("type") == "text/css" ? "css"
+ : $page.attr("type") == "text/javascript" ? "js"
+ : $page.attr("redirect") != null ? "redirect"
+ : "unknown"
;
var lang = $page.attr("lang");
var isLocked = $page.attr("isLocked") == "yes";
$(btnTypeCSS).change(makeDirty);
+ var btnTypeJS
+ = $.INPUT({type : "radio",
+ name : "type",
+ checked: (defaultType == "js" ? "checked" : "")});
+ $(btnTypeJS).change(makeDirty);
+
var btnTypeBinary
= $.INPUT({type : "radio",
name : "type",
$(fldCSSSource).change(makeDirty);
+ var fldJSSource
+ = $.TEXTAREA({className: "source"},
+ (defaultType == "js" && source != null ? source : ""));
+
+ $(fldJSSource).change(makeDirty);
+
var fldUploadFile
= $.INPUT({type: "file"});
fldSummary.value,
fldCSSSource.value);
}
+ else if (btnTypeJS.checked) {
+ submitTextPage(
+ pageName,
+ oldRevision,
+ fldPageName.value,
+ chkIsLocked.checked,
+ "text/javascript",
+ $(selPageLang).val(),
+ otherLangs,
+ fldSummary.value,
+ fldJSSource.value);
+ }
else if (btnTypeBinary.checked) {
if (fldUploadFile.value != "") {
submitBinaryPage(
$(trContent).find("td").empty().append(fldCSSSource);
$(btnPreview).hide();
}
+ else if (btnTypeJS.checked) {
+ $(trPageLang).show();
+ $(trOtherLangs).show();
+ $(trSummary).show();
+ $(trContent).find("th").text("JavaScript source");
+ $(trContent).find("td").empty().append(fldJSSource);
+ $(btnPreview).hide();
+ }
else if (btnTypeBinary.checked) {
$(trPageLang).show();
$(trOtherLangs).show();
};
$(btnTypeRakka ).change(updateTRContent);
$(btnTypeCSS ).change(updateTRContent);
+ $(btnTypeJS ).change(updateTRContent);
$(btnTypeBinary ).change(updateTRContent);
$(btnTypeRedirect).change(updateTRContent);
updateTRContent();
"Style sheet"
)
),
+ $.LI({},
+ $.LABEL({},
+ btnTypeJS,
+ "JavaScript"
+ )
+ ),
$.LI({},
$.LABEL({},
btnTypeBinary,
$(fldPageName)
.add(btnTypeRakka)
.add(btnTypeCSS)
+ .add(btnTypeJS)
.add(btnTypeBinary)
.add(btnTypeRedirect)
.add($(trOtherLangs).find("input"))