|
|
|
firncore > Tabs > intranet tab
intranet tabVon $1Inhaltsverzeichniskeine Gliederung/***
USAGE:
Guide(description)
Show a content guide that organizes the tree rooted at the guide pages into types of pages (topics, tutorials, troubleshooting and reference).
PARAMETERS:
description : str
Description of what this guide covers.
***/
// Redirect to custom page, if any
var template_custom = wiki.inclusions(true)[-1].path .. 'Custom';
if (wiki.pageexists(template_custom)) {
return template(template_custom, $);
}
var description = $0 ?? $description;
// build list of all child pages in order of appearance
var common_parents = page.parents;
var tree = wiki.tree();
var pageids = [ xml.num(id) foreach var id in tree["//@pageid"] ];
var pages = {
(p.id): p .. {
parents: list.splice(p.parents, 0, #common_parents),
topic: #[ t foreach var t in tags where string.startswith(t.value, 'article:topic') ] > 0,
tutorial: #[ t foreach var t in tags where string.startswith(t.value, 'article:task-tutorial') ] > 0,
troubleshooting: #[ t foreach var t in tags where string.startswith(t.value, 'article:task-troubleshooting') ] > 0,
reference: #[ t foreach var t in tags where string.startswith(t.value, 'article:reference') ] > 0,
beginner: #[ t foreach var t in tags where string.endswith(t.value, 'beginner') ] > 0,
intermediate: #[ t foreach var t in tags where string.endswith(t.value, 'intermediate') ] > 0,
advanced: #[ t foreach var t in tags where string.endswith(t.value, 'advanced') ] > 0,
feature: #[ t foreach var t in tags where string.endswith(t.value, 'feature') ] > 0,
sample: #[ t foreach var t in tags where string.endswith(t.value, 'sample') ] > 0
} foreach
var id in pageids,
var p = wiki.getpage(id),
var tags = p.tags
};
var topics = [ p foreach var id in pageids, var p = pages[id], if p.topic ];
var tutorials = [ p foreach var id in pageids, var p = pages[id], if p.tutorial ];
var troubleshootings = [ p foreach var id in pageids, var p = pages[id], if p.troubleshooting ];
var references = [ p foreach var id in pageids, var p = pages[id], if p.reference ];
<div class="mindtouch-content mindtouch-collection">
var guide = __request.args.guide ?? 'guide';
// can preload when not on history tab
var class_preload = (guide != 'history') ? 'mt-guide-preload' : '';
/*
* Master Tabs
*/
<div class="mt-control-nav">
<ul>
<li class=(guide == "guide" ? "active" : "")>
<a rel="custom" href=(page.uri & { guide: nil }) id="guide-guide" class=(class_preload)>
wiki.localize("firncore.tab.intranet.tab1");
" ";
</a>
</li>
<li class=(guide == "history" ? "active" : "")>
<a rel="custom" href=(page.uri & { guide: "history" }) id="guide-history">
wiki.localize("firncore.tab.intranet.tab2");
</a>
</li>
</ul>
</div>
// all tabs except history are preloaded; render them in full, but hide with CSS
if (guide == 'history') {
<div class="page-history">Template("firnCORE/Tabs/intranet_tab/last_changes_intern", {
limit: 100,
depth: 'infinity'
});
</div>
}
else {
/*
* Reference Tab
*/
var style_reference = (guide == 'reference') ? '' : 'display: none;';
<div style=(style_reference) id="guide-reference-content" class="guide-content">
if(#references == 0) {
<div class="mt-control-nocontent">
<p class="nocontent-title">wiki.localize("MindTouch.IDF.reference.empty");</p>
<p>wiki.localize("MindTouch.IDF.reference.text");</p>
</div>
} else {
<div class="mt-control-pagelist">
<div class="mt-control-subnav">
<p>wiki.localize("MindTouch.IDF.reference.view");</p>
<ul>
<li><a href="#reference-feature">
wiki.localize("MindTouch.IDF.reference.feature.short");</a>
</li>
<li><a href="#reference-sample">
wiki.localize("MindTouch.IDF.reference.sample.short");</a>
</li>
</ul>
</div>
var p = [ p foreach var p in references where p.feature ];
if(#p > 0) {
<div class="subtitle" id="reference-feature">
wiki.localize("MindTouch.IDF.reference.feature");
</div>
template("MindTouch/Controls/PageListWithBreadcrumbs", {
pages: p,
heading: "h4"
});
}
var p = [ p foreach var p in references where p.sample ];
if(#p > 0) {
<div class="subtitle" id="reference-sample">
wiki.localize("MindTouch.IDF.reference.sample");
</div>
template("Mindtoch/IDF/Controls/PageListWithBreadcrumbs", {
pages: p,
heading: "h4"
});
}
</div>
}
</div>
/*
* Main guide page
*/
var style_guide = (guide == 'guide') ? '' : 'display: none;';
<div style=(style_guide) class="guide-content" id="guide-guide-content">
wiki.template("firnCORE/Tabs/intranet_tab/user_projects", {description: description, pages: pages });
</div>
} // end ajax tabs
</div>
Tags: (Schlagworte bearbeiten)
|