1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-01 15:46:18 +00:00
TiddlyWiki5/core/ui/ControlPanel/Modals/AddPlugins.tid
2024-09-30 14:24:10 +01:00

231 lines
10 KiB
Plaintext

title: $:/core/ui/ControlPanel/Modals/AddPlugins
subtitle: {{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/Add/Caption}}
\define install-plugin-actions()
\whitespace trim
<$action-sendmessage $message="tm-load-plugin-from-library" url={{!!url}} title={{$(assetInfo)$!!original-title}}/>
<$set name="url" value={{!!url}}>
<$set name="currentTiddler" value=<<assetInfo>>>
<$list filter="[enlist{!!dependents}] [{!!parent-plugin}] +[sort[name]]" variable="dependency">
<$action-sendmessage $message="tm-load-plugin-from-library" url=<<url>> title=<<dependency>>/>
</$list>
</$set>
</$set>
\end
\define install-plugin-button()
\whitespace trim
<div>
<$set name="libraryVersion" value={{{ [<assetInfo>get[version]] }}}>
<$set name="installedVersion" value={{{ [<assetInfo>get[original-title]get[version]] }}}>
<$set name="reinstall-type" value={{{ [<libraryVersion>compare:version:eq<installedVersion>then[tc-reinstall]] [<libraryVersion>compare:version:gt<installedVersion>then[tc-reinstall-upgrade]] [<libraryVersion>compare:version:lt<installedVersion>then[tc-reinstall-downgrade]] }}}>
<$button actions=<<install-plugin-actions>> class={{{ [<assetInfo>get[original-title]has[version]then<reinstall-type>] tc-btn-invisible tc-install-plugin +[join[ ]] }}}>
{{$:/core/images/download-button}}
&#32;
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="ignore" emptyMessage="{{$:/language/ControlPanel/Plugins/Install/Caption}}">
<$list filter="[<libraryVersion>compare:version:gt<installedVersion>]" variable="ignore" emptyMessage="
\whitespace trim
<$list filter='[<libraryVersion>compare:version:lt<installedVersion>]' variable='ignore' emptyMessage='{{$:/language/ControlPanel/Plugins/Reinstall/Caption}}'>
{{$:/language/ControlPanel/Plugins/Downgrade/Caption}}
</$list>
">
{{$:/language/ControlPanel/Plugins/Update/Caption}}
</$list>
</$list>
</$button>
<div>
</div>
<$reveal stateTitle=<<assetInfo>> stateField="requires-reload" type="match" text="yes">{{$:/language/ControlPanel/Plugins/PluginWillRequireReload}}</$reveal>
</$set>
</$set>
</$set>
</div>
\end
\define popup-state-macro()
$:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
\end
\define display-plugin-info(type)
\whitespace trim
<$set name="popup-state" value=<<popup-state-macro>>>
<div class="tc-plugin-info">
<div class="tc-plugin-info-chunk tc-plugin-info-toggle">
<$reveal type="nomatch" state=<<popup-state>> text="yes">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="yes">
{{$:/core/images/chevron-right}}
</$button>
</$reveal>
<$reveal type="match" state=<<popup-state>> text="yes">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="no">
{{$:/core/images/chevron-down}}
</$button>
</$reveal>
</div>
<div class="tc-plugin-info-chunk tc-plugin-info-icon">
<$list filter="[<assetInfo>has[icon]]" emptyMessage="""<$transclude tiddler="$:/core/images/plugin-generic-$type$"/>""">
<img src={{$(assetInfo)$!!icon}}/>
</$list>
</div>
<div class="tc-plugin-info-chunk tc-plugin-info-description">
<h1><strong><$text text={{{ [<assetInfo>get[name]] ~[<assetInfo>get[original-title]split[/]last[1]] }}}/></strong>:
&#32;
<$view tiddler=<<assetInfo>> field="description"/>
</h1>
<h2><$view tiddler=<<assetInfo>> field="original-title"/></h2>
<div>
<%if [<assetInfo>get[stability]match[STABILITY_0_DEPRECATED]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-deprecated">{{$:/language/ControlPanel/Plugins/Stability/Deprecated}}</span>
<%elseif [<assetInfo>get[stability]match[STABILITY_1_EXPERIMENTAL]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-experimental">{{$:/language/ControlPanel/Plugins/Stability/Experimental}}</span>
<%elseif [<assetInfo>get[stability]match[STABILITY_2_STABLE]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-stable">{{$:/language/ControlPanel/Plugins/Stability/Stable}}</span>
<%elseif [<assetInfo>get[stability]match[STABILITY_3_LEGACY]] %>
<span class="tc-plugin-info-stability tc-plugin-info-stability-legacy">{{$:/language/ControlPanel/Plugins/Stability/Legacy}}</span>
<%endif%>
<em><$view tiddler=<<assetInfo>> field="version"/></em></div>
<$list filter="[<assetInfo>get[original-title]get[version]]" variable="installedVersion"><div><em>{{$:/language/ControlPanel/Plugins/AlreadyInstalled/Hint}}</em></div></$list>
</div>
<div class="tc-plugin-info-chunk tc-plugin-info-buttons">
<<install-plugin-button>>
</div>
</div>
<$set name="original-title" value={{{ [<assetInfo>get[original-title]] }}}>
<$reveal type="match" text="yes" state=<<popup-state>>>
<div class="tc-plugin-info-dropdown">
<$list filter="[enlist{!!dependents}] [<currentTiddler>get[parent-plugin]] +[limit[1]] ~[<assetInfo>get[original-title]!is[tiddler]]" variable="ignore">
<div class="tc-plugin-info-dropdown-message">
<$list filter="[<assetInfo>get[original-title]!is[tiddler]]">
{{$:/language/ControlPanel/Plugins/NotInstalled/Hint}}
</$list>
<$set name="currentTiddler" value=<<assetInfo>>>
<$list filter="[enlist{!!dependents}] [<currentTiddler>get[parent-plugin]] +[limit[1]]" variable="ignore">
<div>
{{$:/language/ControlPanel/Plugins/AlsoRequires}}&#32;
<$list filter="[enlist{!!dependents}] [{!!parent-plugin}] +[sort[name]]" variable="dependency">
<$text text=<<dependency>>/>&#32;
</$list>
</div>
</$list>
</$set>
</div>
</$list>
<div class="tc-plugin-info-dropdown-body">
<$transclude tiddler=<<assetInfo>> field="readme" mode="block"/>
</div>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>limit[1]]" variable="ignore">
<div class="tc-plugin-info-sub-plugins">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>sort[name]]" variable="assetInfo">
<<display-plugin-info "$type$">>
</$list>
</div>
</$list>
</div>
</$reveal>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>limit[1]]" variable="ignore">
<$reveal type="nomatch" text="yes" state=<<popup-state>> tag="div" class="tc-plugin-info-sub-plugin-indicator">
<$wikify name="count" text="""<$count filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]has[parent-plugin]parent-plugin<original-title>]"/>""">
<$button class="tc-btn-invisible" set=<<popup-state>> setTo="yes">
{{$:/language/ControlPanel/Plugins/SubPluginPrompt}}
</$button>
</$wikify>
</$reveal>
</$list>
</$set>
</$set>
\end
\define load-plugin-library-button()
\whitespace trim
<$list filter="[<currentTiddler>get[enabled]else[yes]match[yes]]" variable="ignore">
<$button class="tc-btn-big-green">
<$action-sendmessage $message="tm-load-plugin-library" url={{!!url}} infoTitlePrefix="$:/temp/RemoteAssetInfo/"/>
{{$:/core/images/chevron-right}}&#32;{{$:/language/ControlPanel/Plugins/OpenPluginLibrary}}
</$button>
</$list>
\end
\define display-server-assets(type)
\whitespace trim
{{$:/language/Search/Search}}:
&#32;
<$edit-text tiddler="""$:/temp/RemoteAssetSearch/$(currentTiddler)$""" default="" type="search" tag="input"/>
&#32;
<$reveal state="""$:/temp/RemoteAssetSearch/$(currentTiddler)$""" type="nomatch" text="">
<$button class="tc-btn-invisible">
<$action-setfield $tiddler="""$:/temp/RemoteAssetSearch/$(currentTiddler)$""" $field="text" $value=""/>
{{$:/core/images/close-button}}
</$button>
</$reveal>
<div class="tc-plugin-library-listing">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}original-plugin-type[$type$]search:author,description,original-title,readme,title{$:/temp/RemoteAssetSearch/$(currentTiddler)$}sort[name]]" variable="assetInfo">
<$list filter="[[$:/temp/RemoteAssetSearch/$(currentTiddler)$]has[text]] ~[<assetInfo>!has[parent-plugin]]" variable="ignore"><!-- Hide sub-plugins if we're not searching -->
<<display-plugin-info "$type$">>
</$list>
</$list>
</div>
\end
\define display-server-connection()
\whitespace trim
<$list filter="[all[tiddlers+shadows]tag[$:/tags/ServerConnection]suffix{!!url}]" variable="connectionTiddler" emptyMessage=<<load-plugin-library-button>>>
<$set name="transclusion" value=<<connectionTiddler>>>
<<tabs "[[$:/core/ui/ControlPanel/Plugins/Add/Updates]] [[$:/core/ui/ControlPanel/Plugins/Add/Plugins]] [[$:/core/ui/ControlPanel/Plugins/Add/Themes]] [[$:/core/ui/ControlPanel/Plugins/Add/Languages]]" "$:/core/ui/ControlPanel/Plugins/Add/Plugins">>
</$set>
</$list>
\end
\define close-library-button()
\whitespace trim
<$reveal type='nomatch' state='$:/temp/ServerConnection/$(PluginLibraryURL)$' text=''>
<$button class='tc-btn-big-green'>
<$action-sendmessage $message="tm-unload-plugin-library" url={{!!url}}/>
{{$:/core/images/chevron-left}}&#32;{{$:/language/ControlPanel/Plugins/ClosePluginLibrary}}
<$action-deletetiddler $filter="[prefix[$:/temp/ServerConnection/$(PluginLibraryURL)$]][prefix[$:/temp/RemoteAssetInfo/$(PluginLibraryURL)$]]"/>
</$button>
</$reveal>
\end
\define plugin-library-listing()
\whitespace trim
<div class="tc-tab-set">
<$set name="defaultTab" value={{{ [all[tiddlers+shadows]tag[$:/tags/PluginLibrary]] }}}>
<div class="tc-tab-buttons">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]">
<$button set=<<qualify "$:/state/addplugins/tab">> setTo=<<currentTiddler>> default=<<defaultTab>> selectedClass="tc-tab-selected">
<$set name="tv-wikilinks" value="no">
<$transclude field="caption"/>
</$set>
</$button>
</$list>
</div>
<div class="tc-tab-divider"/>
<div class="tc-tab-content">
<$list filter="[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]">
<$reveal type="match" state=<<qualify "$:/state/addplugins/tab">> text=<<currentTiddler>> default=<<defaultTab>>>
<h2><$link><$transclude field="caption"><$view field="title"/></$transclude></$link></h2>
//<$view field="url"/>//
<$transclude mode="block"/>
<$set name=PluginLibraryURL value={{!!url}}>
<<close-library-button>>
</$set>
&#32;
<<display-server-connection>>
</$reveal>
</$list>
</div>
</$set>
</div>
\end
\import [subfilter{$:/core/config/GlobalImportFilter}]
\whitespace trim
<div>
<<plugin-library-listing>>
</div>