2024-01-17 22:41:41 +00:00
|
|
|
title: MultiWikiServer Administration
|
|
|
|
|
2024-01-26 14:03:32 +00:00
|
|
|
\procedure createBag(name,description,errorTiddler)
|
2024-01-24 22:24:24 +00:00
|
|
|
\procedure completion-createBag()
|
|
|
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
2024-01-26 14:03:32 +00:00
|
|
|
<$action-log
|
|
|
|
status=<<status>>
|
|
|
|
statusText=<<statusText>>
|
|
|
|
error=<<error>>
|
|
|
|
data=<<data>>
|
|
|
|
headers=<<headers>>
|
|
|
|
/>
|
|
|
|
<%if [<error>match[]] %>
|
|
|
|
<$action-setfield $tiddler=<<errorTiddler>> text=""/>
|
2024-01-26 14:42:17 +00:00
|
|
|
<$action-sendmessage $message="tm-server-refresh"/>
|
2024-01-26 14:03:32 +00:00
|
|
|
<%else%>
|
|
|
|
<$action-setfield $tiddler=<<errorTiddler>> text=<<data>>/>
|
|
|
|
<%endif%>
|
2024-01-24 22:24:24 +00:00
|
|
|
\end completion-createBag
|
|
|
|
<$action-sendmessage
|
|
|
|
$message="tm-http-request"
|
|
|
|
url=`/wiki/$(name)$/bags/$(name)$`
|
|
|
|
method="PUT"
|
|
|
|
body=`{"description":"${ [<description>encodeuricomponent[]] }$"}`
|
|
|
|
oncompletion=<<completion-createBag>>
|
2024-01-26 14:03:32 +00:00
|
|
|
var-errorTiddler=<<errorTiddler>>
|
2024-01-24 22:24:24 +00:00
|
|
|
/>
|
2024-01-19 11:03:58 +00:00
|
|
|
\end createBag
|
|
|
|
|
|
|
|
\procedure createBagButton(name)
|
2024-01-24 22:24:24 +00:00
|
|
|
\whitespace trim
|
|
|
|
<form class="mws-form">
|
|
|
|
<div class="mws-form-heading">
|
|
|
|
<$text text="Create a new bag"/>
|
|
|
|
</div>
|
|
|
|
<div class="mws-form-fields">
|
|
|
|
<div class="mws-form-field">
|
|
|
|
<label class="mws-form-field-description">
|
|
|
|
Bag name
|
|
|
|
</label>
|
|
|
|
<$edit-text tiddler="$:/state/NewBagName" tag="input" placeholder="(bag name)" class="mws-form-field-input"/>
|
|
|
|
</div>
|
|
|
|
<div class="mws-form-field">
|
|
|
|
<label class="mws-form-field-description">
|
|
|
|
Bag description
|
|
|
|
</label>
|
|
|
|
<$edit-text tiddler="$:/state/NewBagDescription" tag="input" placeholder="(description)" class="mws-form-field-input"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-26 14:03:32 +00:00
|
|
|
<div class="mws-form-status">
|
|
|
|
<%if [[$:/state/NewBagError]get[text]else[]!match[]] %>
|
|
|
|
<div class="mws-form-error">
|
|
|
|
<$text text={{$:/state/NewBagError}}/>
|
|
|
|
</div>
|
|
|
|
<%endif%>
|
|
|
|
</div>
|
2024-01-24 22:24:24 +00:00
|
|
|
<div class="mws-form-buttons">
|
|
|
|
<$button class="mws-form-button">
|
|
|
|
<$transclude
|
|
|
|
$variable="createBag"
|
|
|
|
name={{$:/state/NewBagName}}
|
|
|
|
description={{$:/state/NewBagDescription}}
|
2024-01-26 14:03:32 +00:00
|
|
|
errorTiddler="$:/state/NewBagError"
|
2024-01-24 22:24:24 +00:00
|
|
|
/>
|
|
|
|
Create Bag
|
|
|
|
</$button>
|
|
|
|
</div>
|
|
|
|
</form>
|
2024-01-19 11:03:58 +00:00
|
|
|
\end createBagButton
|
|
|
|
|
2024-01-26 14:03:32 +00:00
|
|
|
\procedure createRecipe(name,bag_names,description,errorTiddler)
|
2024-01-24 22:24:24 +00:00
|
|
|
\procedure completion-createRecipe()
|
|
|
|
\import [subfilter{$:/core/config/GlobalImportFilter}]
|
2024-01-26 14:03:32 +00:00
|
|
|
<%if [<error>match[]] %>
|
|
|
|
<$action-setfield $tiddler=<<errorTiddler>> text=""/>
|
2024-01-26 14:42:17 +00:00
|
|
|
<$action-sendmessage $message="tm-server-refresh"/>
|
2024-01-26 14:03:32 +00:00
|
|
|
<%else%>
|
|
|
|
<$action-setfield $tiddler=<<errorTiddler>> text=<<data>>/>
|
|
|
|
<%endif%>
|
2024-01-24 22:24:24 +00:00
|
|
|
\end completion-createRecipe
|
|
|
|
\procedure emptyArray() []
|
|
|
|
\function createRecipeJson()
|
|
|
|
[<bag_names>enlist-input[]] :reduce[<accumulator>!match[]else<emptyArray>jsonset<index>,<currentTiddler>]
|
|
|
|
\end createRecipeJson
|
|
|
|
<$action-sendmessage
|
|
|
|
$message="tm-http-request"
|
|
|
|
url=`/wiki/$(name)$/recipes/$(name)$`
|
|
|
|
method="PUT"
|
|
|
|
body=`{"bag_names":${ [<createRecipeJson>] }$,"description":"${ [<description>encodeuricomponent[]] }$"}`
|
|
|
|
oncompletion=<<completion-createRecipe>>
|
2024-01-26 14:03:32 +00:00
|
|
|
var-errorTiddler=<<errorTiddler>>
|
2024-01-24 22:24:24 +00:00
|
|
|
/>
|
2024-01-19 11:03:58 +00:00
|
|
|
\end createRecipe
|
|
|
|
|
2024-01-24 22:24:24 +00:00
|
|
|
\procedure createRecipeButton()
|
|
|
|
\whitespace trim
|
|
|
|
<form class="mws-form">
|
|
|
|
<div class="mws-form-heading">
|
|
|
|
<$text text="Create a new recipe"/>
|
|
|
|
</div>
|
|
|
|
<div class="mws-form-fields">
|
|
|
|
<div class="mws-form-field">
|
|
|
|
<label class="mws-form-field-description">
|
|
|
|
Recipe name
|
|
|
|
</label>
|
|
|
|
<$edit-text tiddler="$:/state/NewRecipeName" tag="input" placeholder="(recipe name)" class="mws-form-field-input"/>
|
|
|
|
</div>
|
|
|
|
<div class="mws-form-field">
|
|
|
|
<label class="mws-form-field-description">
|
|
|
|
Bag names
|
|
|
|
</label>
|
|
|
|
<$edit-text tiddler="$:/state/NewRecipeBagNames" tag="input" placeholder="(space separated list of bags)"/>
|
|
|
|
</div>
|
|
|
|
<div class="mws-form-field">
|
|
|
|
<label class="mws-form-field-description">
|
|
|
|
Recipe description
|
|
|
|
</label>
|
|
|
|
<$edit-text tiddler="$:/state/NewRecipeDescription" tag="input" placeholder="(description)" class="mws-form-field-input"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-26 14:03:32 +00:00
|
|
|
<div class="mws-form-status">
|
|
|
|
<%if [[$:/state/NewRecipeError]get[text]else[]!match[]] %>
|
|
|
|
<div class="mws-form-error">
|
|
|
|
<$text text={{$:/state/NewRecipeError}}/>
|
|
|
|
</div>
|
|
|
|
<%endif%>
|
|
|
|
</div>
|
2024-01-24 22:24:24 +00:00
|
|
|
<div class="mws-form-buttons">
|
|
|
|
<$button class="mws-form-button">
|
|
|
|
<$transclude
|
|
|
|
$variable="createRecipe"
|
|
|
|
name={{$:/state/NewRecipeName}}
|
|
|
|
bag_names={{$:/state/NewRecipeBagNames}}
|
|
|
|
description={{$:/state/NewRecipeDescription}}
|
2024-01-26 14:03:32 +00:00
|
|
|
errorTiddler="$:/state/NewRecipeError"
|
2024-01-24 22:24:24 +00:00
|
|
|
/>
|
|
|
|
Create Recipe
|
|
|
|
</$button>
|
|
|
|
</div>
|
|
|
|
</form>
|
2024-01-19 11:03:58 +00:00
|
|
|
\end createRecipeButton
|
|
|
|
|
2024-01-23 12:52:40 +00:00
|
|
|
<!-- Expects currentTiddler to be the title of a bag entity state tiddler -->
|
|
|
|
\procedure bagPill(element-tag:"span",is-topmost:"no")
|
2024-01-24 22:24:24 +00:00
|
|
|
\whitespace trim
|
|
|
|
<$genesis $type=<<element-tag>> class={{{ mws-bag-pill [<is-topmost>match[yes]then[mws-bag-pill-topmost]] +[join[ ]] }}}>
|
|
|
|
<a class="mws-bag-pill-link" href=`/wiki/${ [{!!bag-name}encodeuricomponent[]] }$/bags/${ [{!!bag-name}encodeuricomponent[]] }$` rel="noopener noreferrer" target="_blank">
|
2024-01-23 22:05:22 +00:00
|
|
|
<$image
|
2024-01-24 22:24:24 +00:00
|
|
|
source=`/wiki/${ [{!!bag-name}encodeuricomponent[]] }$/bags/${ [{!!bag-name}encodeuricomponent[]] }$/tiddlers/%24%3A%2Ffavicon.ico`
|
2024-01-23 22:05:22 +00:00
|
|
|
class="mws-favicon-small"
|
2024-01-24 22:24:24 +00:00
|
|
|
>
|
|
|
|
<$image
|
|
|
|
source="$:/plugins/multiwikiserver/images/missing-favicon.png"
|
|
|
|
class="mws-favicon-small"
|
|
|
|
/>
|
|
|
|
</$image>
|
|
|
|
<span class="mws-bag-pill-label">
|
|
|
|
<$text text={{!!bag-name}}/>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</$genesis>
|
2024-01-23 12:52:40 +00:00
|
|
|
\end
|
|
|
|
|
|
|
|
<!-- Expects currentTiddler to be the title of a recipe entity state tiddler -->
|
|
|
|
\procedure wikiCard()
|
2024-01-24 22:24:24 +00:00
|
|
|
\whitespace trim
|
|
|
|
<a class="mws-wiki-card" href=`/wiki/${ [{!!recipe-name}encodeuricomponent[]] }$` rel="noopener noreferrer" target="_blank">
|
|
|
|
<div class="mws-wiki-card-image">
|
2024-01-23 22:05:22 +00:00
|
|
|
<$image
|
2024-01-24 22:24:24 +00:00
|
|
|
source=`/wiki/${ [{!!recipe-name}encodeuricomponent[]] }$/recipes/${ [{!!recipe-name}encodeuricomponent[]] }$/tiddlers/%24%3A%2Ffavicon.ico`
|
2024-01-23 22:05:22 +00:00
|
|
|
class="mws-favicon"
|
2024-01-24 22:24:24 +00:00
|
|
|
>
|
|
|
|
<$image
|
|
|
|
source="$:/plugins/multiwikiserver/images/missing-favicon.png"
|
|
|
|
class="mws-favicon"
|
|
|
|
/>
|
|
|
|
</$image>
|
2024-01-23 12:52:40 +00:00
|
|
|
</div>
|
2024-01-24 22:24:24 +00:00
|
|
|
<div class="mws-wiki-card-content">
|
|
|
|
<div class="mws-wiki-card-header">
|
|
|
|
<$text text={{!!recipe-name}}/>
|
|
|
|
</div>
|
|
|
|
<div class="mws-wiki-card-meta">
|
|
|
|
<%if [list<currentTiddler>] %>
|
|
|
|
<ol class="mws-horizontal-list">
|
|
|
|
<$list filter="[list<currentTiddler>]" counter="counter">
|
|
|
|
<$transclude $variable="bagPill" is-topmost={{{ [<counter-last>match[yes]] }}} element-tag="li"/>
|
|
|
|
</$list>
|
|
|
|
</ol>
|
|
|
|
<%else%>
|
|
|
|
(no bags defined)
|
|
|
|
<%endif%>
|
|
|
|
</div>
|
|
|
|
<div class="mws-wiki-card-description">
|
|
|
|
<$text text={{!!text}}/>
|
|
|
|
</div>
|
2024-01-23 12:52:40 +00:00
|
|
|
</div>
|
2024-01-24 22:24:24 +00:00
|
|
|
</a>
|
2024-01-23 12:52:40 +00:00
|
|
|
\end
|
|
|
|
|
2024-01-17 22:41:41 +00:00
|
|
|
<div class="mws-admin-container">
|
2024-01-23 12:52:40 +00:00
|
|
|
<h1>Wikis</h1>
|
|
|
|
<p>
|
|
|
|
These are the wikis available on this server. Click on a wiki to visit it in a new browser tab.
|
|
|
|
</p>
|
|
|
|
<ul class="mws-vertical-list">
|
2024-01-24 10:56:23 +00:00
|
|
|
<$list filter="[prefix[$:/state/MultiWikiServer/recipes/]]">
|
2024-01-20 21:50:12 +00:00
|
|
|
<li>
|
2024-01-23 12:52:40 +00:00
|
|
|
<<wikiCard>>
|
2024-01-20 21:50:12 +00:00
|
|
|
</li>
|
|
|
|
</$list>
|
|
|
|
</ul>
|
|
|
|
<div>
|
|
|
|
<<createRecipeButton>>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
Higher numbered bags take priority if a tiddler with the same title is in more than one bag
|
|
|
|
</div>
|
|
|
|
<h1>Bags</h1>
|
2024-01-23 12:52:40 +00:00
|
|
|
<ul class="mws-vertical-list">
|
2024-01-24 10:56:23 +00:00
|
|
|
<$list filter="[prefix[$:/state/MultiWikiServer/bags/]]">
|
2024-01-20 21:50:12 +00:00
|
|
|
<li>
|
2024-01-23 12:52:40 +00:00
|
|
|
<<bagPill>>
|
2024-01-24 22:24:24 +00:00
|
|
|
<$text text={{!!text}}/>
|
2024-01-20 21:50:12 +00:00
|
|
|
</li>
|
|
|
|
</$list>
|
|
|
|
</ul>
|
|
|
|
<div>
|
|
|
|
<<createBagButton>>
|
|
|
|
</div>
|
2024-01-19 11:03:58 +00:00
|
|
|
</div>
|