diff options
author | Mario <mario@mariovavti.com> | 2022-05-25 07:02:15 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-05-25 07:02:15 +0000 |
commit | 0a30b12f7d06a334234a96ce46860bfca4dc0f7f (patch) | |
tree | 0c58c814c32b4672f2ddc5e2bd2122ee9d21e5e2 /view | |
parent | 3058cbfbb242dbe12a131cc212cc15a46f1f29dc (diff) | |
download | volse-hubzilla-0a30b12f7d06a334234a96ce46860bfca4dc0f7f.tar.gz volse-hubzilla-0a30b12f7d06a334234a96ce46860bfca4dc0f7f.tar.bz2 volse-hubzilla-0a30b12f7d06a334234a96ce46860bfca4dc0f7f.zip |
move wiki related templates to addon
Diffstat (limited to 'view')
-rw-r--r-- | view/tpl/wiki.tpl | 475 | ||||
-rw-r--r-- | view/tpl/wiki_page_history.tpl | 59 | ||||
-rw-r--r-- | view/tpl/wiki_page_list.tpl | 90 | ||||
-rw-r--r-- | view/tpl/wiki_page_not_found.tpl | 34 | ||||
-rw-r--r-- | view/tpl/wikilist.tpl | 101 | ||||
-rw-r--r-- | view/tpl/wikilist_widget.tpl | 8 |
6 files changed, 0 insertions, 767 deletions
diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl deleted file mode 100644 index 640678ae8..000000000 --- a/view/tpl/wiki.tpl +++ /dev/null @@ -1,475 +0,0 @@ -<div class="generic-content-wrapper"> - <div class="section-title-wrapper"> - <div class="float-end"> - <span class="text-muted wiki-typename">[{{$typename}}] </span> - {{if $showPageControls}} - <div id="page-tools" class="btn-group" style="display: none;"> - <button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown"> - <i class="fa fa-cog"></i> {{$tools_label}} - </button> - <div class="dropdown-menu dropdown-menu-end"> - {{if $renamePage}} - <a class="dropdown-item rename-page" href="#"><i class="fa fa-fw fa-edit"></i> {{$renamePage}}</a> - {{/if}} - <a id="embed-image" class="dropdown-item" href="#"><i class="fa fa-fw fa-picture-o"></i> Embed Image</a> - </div> - </div> - {{/if}} - <button type="button" class="btn btn-outline-secondary btn-sm" title="{{$sharePage}}" onclick="window.location.href='rpost?f=&body={{$shareLink}}';"><i class="fa fa-fw fa-share"></i></button> - <button id="fullscreen-btn" type="button" class="btn btn-outline-secondary btn-sm" onclick="makeFullScreen(); adjustFullscreenEditorHeight();"><i class="fa fa-expand"></i></button> - <button id="inline-btn" type="button" class="btn btn-outline-secondary btn-sm" onclick="makeFullScreen(false); adjustInlineEditorHeight()"><i class="fa fa-compress"></i></button> - </div> - <h2> - <span id="wiki-header-name">{{$wikiheaderName}}</span>: - <span id="wiki-header-page">{{$wikiheaderPage}}</span> - </h2> - <div class="clear"></div> - </div> - <div id="rename-page-form-wrapper" class="section-content-tools-wrapper" style="display:none;"> - <form id="rename-page-form" action="wiki/rename/page" method="post" > - {{include file="field_input.tpl" field=$pageRename}} - <div class="mb-3"> - <div class="float-end"> - <button id="rename-page-submit" class="btn btn-primary" type="submit" name="submit">Submit</button> - </div> - <div> - <button class="btn btn-outline-secondary rename-page" type="button">Cancel</button> - </div> - <div class="clear"></div> - </div> - </form> - </div> - <div id="wiki-content-container" class="section-content-wrapper"> - <ul class="nav nav-tabs" id="wiki-nav-tabs"> - <li class="nav-item" id="edit-pane-tab"><a class="nav-link" data-bs-toggle="tab" href="#edit-pane">{{$editOrSourceLabel}}</a></li> - <li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" href="#preview-pane" id="wiki-get-preview">{{$view_lbl}}</a></li> - <li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#page-history-pane" id="wiki-get-history">{{$history_lbl}}</a></li> - </ul> - <div class="tab-content" id="wiki-page-tabs"> - <div id="edit-pane" class="tab-pane"> - {{if !$mimeType || $mimeType == 'text/markdown'}} - <div id="ace-editor"></div> - {{else}} - <div id="editor-wrapper"> - <textarea id="editor">{{$content}}</textarea> - </div> - {{/if}} - </div> - <div id="preview-pane" class="tab-pane active"> - <div id="wiki-preview"> - {{$renderedContent}} - </div> - </div> - <div id="page-history-pane" class="tab-pane"> - <div id="page-history-list"></div> - </div> - {{if $showPageControls}} - <div id="id_{{$commitMsg.0}}_wrapper" class="field input" style="display: none"> - <div class="input-group"> - <input class="form-control" name="{{$commitMsg.0}}" id="id_{{$commitMsg.0}}" type="text" value="{{$commitMsg.2}}"{{if $commitMsg.5}} {{$commitMsg.5}}{{/if}}> - <button id="save-page" type="button" class="btn btn-primary disabled">Save</button> - </div> - </div> - {{/if}} - </div> - </div> -</div> - -{{$wikiModal}} - -<div class="modal" id="embedPhotoModal" tabindex="-1" role="dialog" aria-labelledby="embedPhotoLabel" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h4> - <button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true"></button> - </div> - <div class="modal-body" id="embedPhotoModalBody" > - <div id="embedPhotoModalBodyAlbumListDialog" class="d-none"> - <div id="embedPhotoModalBodyAlbumList"></div> - </div> - <div id="embedPhotoModalBodyAlbumDialog" class="d-none"></div> - </div> - </div><!-- /.modal-content --> - </div><!-- /.modal-dialog --> -</div><!-- /.modal --> - -<script> - window.wiki_resource_id = '{{$resource_id}}'; - window.wiki_page_name = '{{$page|escape:'javascript'}}'; - window.wiki_page_content = '{{$content|escape:'javascript'}}'; - window.wiki_page_commit = '{{$commit}}'; - window.saved = true; - - $("#generic-modal-ok-{{$wikiModalID}}").removeClass('btn-primary'); - $("#generic-modal-ok-{{$wikiModalID}}").addClass('btn-danger'); - - $('.rename-page').click(function (ev) { - $('#rename-page-form-wrapper').toggle(); - ev.preventDefault(); - }); - - $( "#rename-page-form" ).submit(function( event ) { - $.post("wiki/{{$channel_address}}/rename/page", - { - oldName: window.wiki_page_name, - newName: $('#id_pageRename').val(), - resource_id: window.wiki_resource_id - }, - function (data) { - if (data.success) { - $('#rename-page-form-wrapper').hide(); - window.console.log('data: ' + JSON.stringify(data)); - window.wiki_page_name = data.name.htmlName; - $('#wiki-header-page').html(data.name.htmlName); - wiki_refresh_page_list(); - } else { - window.console.log('Error renaming page.'); - } - }, 'json'); - event.preventDefault(); - }); - - {{if !$mimeType || $mimeType == 'text/markdown'}} - var editor = ace.edit("ace-editor"); - editor.setOptions({ - theme: "ace/theme/github", - mode: "ace/mode/markdown", - - maxLines: Infinity, - minLines: 30, - - wrap: true, - - printMargin: false - }); - - editor.getSession().setValue(window.wiki_page_content); - window.editor = editor; // Store the editor in the window object so the anonymous function can use it. - {{else}} - window.editor = editor = $('#editor'); - {{/if}} - - {{if !$showPageControls}} - {{if !$mimeType || $mimeType == 'text/markdown'}} - editor.setReadOnly(true); // Disable editing if the viewer lacks edit permission - {{else}} - editor.prop('readonly', true); - {{/if}} - {{/if}} - - $('#edit-pane-tab').click(function (ev) { - setTimeout(function() { - window.editor.focus(); - if($('main').hasClass('fullscreen')) { - adjustFullscreenEditorHeight(); - } - else { - adjustInlineEditorHeight(); - } - }, 500); // Return the focus to the editor allowing immediate text entry - $('#page-tools, #id_{{$commitMsg.0}}_wrapper').show(); - }); - - $('#wiki-get-preview').click(function (ev) { - if(window.saved) { - $('#page-tools, #id_{{$commitMsg.0}}_wrapper').hide(); - } - else { - $('#page-tools').hide(); - } - $.post("wiki/{{$channel_address}}/preview", { - {{if !$mimeType || $mimeType == 'text/markdown'}} - content: editor.getValue(), - {{else}} - content: editor.val(), - {{/if}} - resource_id: window.wiki_resource_id, - mimetype: '{{$mimeType}}' - }, - function (data) { - if (data.success) { - $('#wiki-preview').html(data.html); - {{if !$mimeType || $mimeType == 'text/markdown'}} - $("#wiki-toc").toc({content: "#wiki-preview", headings: "h1,h2,h3,h4"}); - {{/if}} - } else { - window.console.log('Error previewing page.'); - } - }, 'json'); - ev.preventDefault(); - }); - - $('#wiki-get-history').click(function (ev) { - if(window.saved) { - $('#page-tools, #id_{{$commitMsg.0}}_wrapper').hide(); - } - else { - $('#page-tools').hide(); - } - $.post("wiki/{{$channel_address}}/history/page", {name: window.wiki_page_name, resource_id: window.wiki_resource_id}, function (data) { - if (data.success) { - $('#page-history-list').html(data.historyHTML); - } else { - window.console.log('Error getting page history.'); - } - }, 'json'); - ev.preventDefault(); - }); - - function wiki_refresh_page_list() { - if (window.wiki_resource_id === '') { - return false; - } - $.post("wiki/{{$channel_address}}/get/page/list/", {channel_id: '{{$channel_id}}', resource_id: window.wiki_resource_id}, function (data) { - if (data.success) { - $('#wiki_page_list').html(data.pages); - } else { - alert('Error fetching page list!'); - window.console.log('Error fetching page list!'); - } - }, 'json'); - return false; - } - - $('#save-page').click(function (ev) { - if (window.wiki_resource_id === '' || window.wiki_page_name === '') { - window.console.log('You must have a wiki page open in order to edit pages.'); - ev.preventDefault(); - return false; - } - {{if !$mimeType || $mimeType == 'text/markdown'}} - var currentContent = editor.getValue(); - {{else}} - var currentContent = editor.val(); - {{/if}} - - if (window.wiki_page_content === currentContent) { - $('#save-page').addClass('disabled'); // Disable the save button - window.console.log('No edits to save.'); - ev.preventDefault(); - return false; - } - $.post("wiki/{{$channel_address}}/save/page", { - content: currentContent, - commitMsg: $('#id_commitMsg').val(), - name: window.wiki_page_name, - resource_id: window.wiki_resource_id - }, - function (data) { - if (data.success) { - window.saved = true; - window.console.log('Page saved successfully.'); - //window.wiki_page_content = currentContent; - window.wiki_page_content = data.content; - $('#id_commitMsg').val(''); // Clear the commit message box - $('#save-page').addClass('disabled'); // Disable the save button - {{if !$mimeType || $mimeType == 'text/markdown'}} - window.editor.getSession().getUndoManager().markClean(); // Reset the undo history for the editor - {{/if}} - - window.editor.focus(); // Return focus to the editor for continued editing - // $('#wiki-get-history').click(); - } else { - alert('Error saving page.'); // TODO: Replace alerts with auto-timeout popups - window.console.log('Error saving page.'); - } - }, 'json'); - ev.preventDefault(); - }); - - function wiki_revert_page(commitHash) { - if (window.wiki_resource_id === '' || window.wiki_page_name === '') { - window.console.log('You must have a wiki page open in order to revert pages.'); - return false; - } - $.post("wiki/{{$channel_address}}/revert/page", {commitHash: commitHash, name: window.wiki_page_name, resource_id: window.wiki_resource_id}, - function (data) { - if (data.success) { - $('button[id^=revert-]').removeClass('btn-success'); - $('button[id^=revert-]').addClass('btn-danger'); - $('button[id^=revert-]').html('Revert'); - $('#revert-'+commitHash).removeClass('btn-danger'); - $('#revert-'+commitHash).addClass('btn-success'); - $('#revert-'+commitHash).html('Page reverted<br>but not saved'); - window.wiki_page_commit = commitHash; - // put contents in editor - editor.getSession().setValue(data.content); - } else { - window.console.log('Error reverting page.'); - } - }, 'json'); - } - - function wiki_compare_page(compareCommit) { - if (window.wiki_resource_id === '' || window.wiki_page_name === '' || window.wiki_page_commit === '') { - window.console.log('You must have a wiki page open in order to revert pages.'); - return false; - } - $.post("wiki/{{$channel_address}}/compare/page", { - compareCommit: compareCommit, - currentCommit: window.wiki_page_commit, - name: window.wiki_page_name, - resource_id: window.wiki_resource_id - }, - function (data) { - console.log(data); - if (data.success) { - var modalBody = $('#generic-modal-body-{{$wikiModalID}}'); - modalBody.html('<div class="descriptive-text">'+data.diff+'</div>'); - $('.modal-dialog').addClass('modal-lg'); - $("#generic-modal-ok-{{$wikiModalID}}").off('click'); - $("#generic-modal-ok-{{$wikiModalID}}").click(function () { - wiki_revert_page(compareCommit); - $('#generic-modal-{{$wikiModalID}}').modal('hide'); - }); - $('#generic-modal-{{$wikiModalID}}').modal('show'); - } else { - window.console.log('Error comparing page.'); - } - }, 'json'); - } - - function adjustFullscreenEditorHeight() { - $('#editor, #ace-editor').height($(window).height() - $('#id_commitMsg_wrapper').outerHeight(true) - $('.section-title-wrapper').outerHeight(true) - $('#wiki-nav-tabs').outerHeight(true) - 17); - {{if !$mimeType || $mimeType == 'text/markdown'}} - editor.setOptions({ - maxLines: null, - minLines: null - }); - editor.resize(); - {{/if}} - } - - function adjustInlineEditorHeight() { - {{if !$mimeType || $mimeType == 'text/markdown'}} - editor.setOptions({ - maxLines: Infinity, - minLines: 30 - }); - editor.resize(); - {{else}} - editor.height(editor[0].scrollHeight); - {{/if}} - } - - $('#embed-image').click(function (ev) { - initializeEmbedPhotoDialog(); - ev.preventDefault(); - }); - - var initializeEmbedPhotoDialog = function () { - $('.embed-photo-selected-photo').each(function (index) { - $(this).removeClass('embed-photo-selected-photo'); - }); - getPhotoAlbumList(); - $('#embedPhotoModalBodyAlbumDialog').off('click'); - $('#embedPhotoModal').modal('show'); - }; - - var choosePhotoFromAlbum = function (album) { - $.post("embedphotos/album", {name: album}, - function(data) { - if (data['status']) { - $('#embedPhotoModalLabel').html("{{$modalchooseimages}}"); - $('#embedPhotoModalBodyAlbumDialog').html('\ - <div><ul class="nav nav-pills flex-column">\n\ - <li class="nav-item"><a class="nav-link" href="#" onclick="initializeEmbedPhotoDialog();return false;">\n\ - <i class="fa fa-chevron-left"></i> \n\ - {{$modaldiffalbum}}\n\ - </a>\n\ - </li>\n\ - </ul><br></div>') - $('#embedPhotoModalBodyAlbumDialog').append(data['content']); - $('#embedPhotoModalBodyAlbumDialog').click(function (evt) { - evt.preventDefault(); - var image = document.getElementById(evt.target.id); - if (typeof($(image).parent()[0]) !== 'undefined') { - var imageparent = document.getElementById($(image).parent()[0].id); - $(imageparent).toggleClass('embed-photo-selected-photo'); - var href = $(imageparent).attr('href'); - $.post("embedphotos/photolink", {href: href}, - function(ddata) { - if (ddata['status']) { - {{if !$mimeType || $mimeType == 'text/markdown'}} - var imgURL = ddata['photolink'].replace( /\[.*\]\[.*\](.*)\[.*\]\[.*\]/, '\n![image]($1)' ) - editor.getSession().insert(editor.getCursorPosition(), imgURL) - {{else}} - var currentContent = $('#editor').val(); - $('#editor').val(currentContent + ddata['photolink']); - {{/if}} - } else { - window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']); - } - return false; - }, - 'json'); - $('#embedPhotoModalBodyAlbumDialog').html(''); - $('#embedPhotoModalBodyAlbumDialog').off('click'); - $('#embedPhotoModal').modal('hide'); - } - }); - - $('#embedPhotoModalBodyAlbumListDialog').addClass('d-none'); - $('#embedPhotoModalBodyAlbumDialog').removeClass('d-none'); - } else { - window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']); - } - return false; - }, - 'json'); - }; - - var getPhotoAlbumList = function () { - $.post("embedphotos/albumlist", {}, - function(data) { - if (data['status']) { - var albums = data['albumlist']; //JSON.parse(data['albumlist']); - $('#embedPhotoModalLabel').html("{{$modalchoosealbum}}"); - $('#embedPhotoModalBodyAlbumList').html('<ul class="nav nav-pills flex-column"></ul>'); - for(var i = 0; i < albums.length; i++) { - var albumName = albums[i].text; - var jsAlbumName = albums[i].jstext; - var albumLink = '<li class="nav-item">'; - albumLink += '<a class="nav-link" href="#" onclick="choosePhotoFromAlbum(\'' + jsAlbumName + '\'); return false;">' + albumName + '</a>'; - albumLink += '</li>'; - $('#embedPhotoModalBodyAlbumList').find('ul').append(albumLink); - } - $('#embedPhotoModalBodyAlbumDialog').addClass('d-none'); - $('#embedPhotoModalBodyAlbumListDialog').removeClass('d-none'); - } else { - window.console.log("{{$modalerrorlist}}" + ':' + data['errormsg']); - } - return false; - }, - 'json'); - }; - - $(document).ready(function () { - {{if !$mimeType || $mimeType == 'text/markdown'}} - $("#wiki-toc").toc({content: "#wiki-preview", headings: "h1,h2,h3,h4"}); - window.editor.on("input", function() { - window.saved = false; - if(window.editor.getSession().getUndoManager().isClean()) { - $('#save-page').addClass('disabled'); - } else { - $('#save-page').removeClass('disabled'); - } - }); - {{else}} - window.editor.on("input", function() { - window.saved = false; - $('#save-page').removeClass('disabled'); - }); - {{if $mimeType == 'text/bbcode'}} - window.editor.bbco_autocomplete('bbcode'); - {{/if}} - {{/if}} - }); - - $(window).resize(function () { - if($('main').hasClass('fullscreen')) { - adjustFullscreenEditorHeight(); - } - }); -</script> diff --git a/view/tpl/wiki_page_history.tpl b/view/tpl/wiki_page_history.tpl deleted file mode 100644 index 9e5ba0f9c..000000000 --- a/view/tpl/wiki_page_history.tpl +++ /dev/null @@ -1,59 +0,0 @@ -<style> - .diff { - width:100%; - word-break: break-all; - } - - .diff td{ - padding:0 0.667em; - vertical-align:top; - white-space:pre; - white-space:pre-wrap; - font-family:Consolas,'Courier New',Courier,monospace; - font-size:1.0em; - line-height:1.333; - } - - .diff span{ - display:block; - min-height:1.333em; - margin-top:-1px; - padding:0 3px; - } - - * html .diff span{ - height:1.333em; - } - - .diff span:first-child{ - margin-top:0; - } - - .diffDeleted span{ - border:1px solid rgb(255,192,192); - background:rgb(255,224,224); - } - - .diffInserted span{ - border:1px solid rgb(192,255,192); - background:rgb(224,255,224); - } -</style> -<table class="table-striped table-responsive table-hover" style="width: 100%;"> - {{foreach $pageHistory as $commit}} - <tr><td> - <table id="rev-{{$commit.hash}}" onclick="$('#details-{{$commit.hash}}').show()" width="100%"> - <tr><td width="10%">Date</td><td width="70%">{{$commit.date}}</td> - <td rowspan="3" width="20%" align="right"> - {{if $permsWrite}} - <button id="revert-{{$commit.hash}}" class="btn btn-danger btn-sm" onclick="wiki_revert_page('{{$commit.hash}}')">Revert</button> - <br><br> - {{/if}} - <button id="compare-{{$commit.hash}}" class="btn btn-warning btn-sm" onclick="wiki_compare_page('{{$commit.hash}}')">Compare</button> - </td></tr> - <tr><td>Name</td><td>{{$commit.name}} <{{$commit.email}}></td></tr> - <tr><td>Message</td><td>{{$commit.title}}</td></tr> - </table> - </td></tr> - {{/foreach}} -</table> diff --git a/view/tpl/wiki_page_list.tpl b/view/tpl/wiki_page_list.tpl deleted file mode 100644 index 4f99587c2..000000000 --- a/view/tpl/wiki_page_list.tpl +++ /dev/null @@ -1,90 +0,0 @@ -{{if ! $refresh}} -<div id="wiki_page_list" class="widget" > -{{/if}} - <h3>{{$header}}</h3> - <ul class="nav nav-pills flex-column"> - {{if $pages}} - {{foreach $pages as $page}} - <li class="nav-item nav-item-hack" id="{{$page.link_id}}"> - {{if $page.resource_id && $candel}} - <i class="nav-link widget-nav-pills-icons fa fa-trash-o drop-icons" onclick="wiki_delete_page('{{$page.title|escape:'javascript'}}', '{{$page.title|escape:'javascript'}}', '{{$page.resource_id}}', '{{$page.link_id}}')"></i> - {{/if}} - <a class="nav-link" href="/wiki/{{$channel_address}}/{{$wikiname}}/{{$page.url}}">{{$page.title}}</a> - </li> - {{/foreach}} - {{/if}} - {{if $canadd}} - <li class="nav-item"><a class="nav-link" href="#" onclick="wiki_show_new_page_form(); return false;"><i class="fa fa-plus-circle"></i> {{$addnew}}</a></li> - {{/if}} - {{if $canadd}} - <div id="new-page-form-wrapper" class="clearfix sub-menu" style="display:none;"> - <form id="new-page-form" action="wiki/{{$channel_address}}/create/page" method="post" > - <input type="hidden" name="resource_id" value="{{$resource_id}}"> - {{include file="field_input.tpl" field=$pageName}} - {{if $typelock}} - <input id="id_mimetype" type="hidden" name="mimetype" value="{{$lockedtype}}"> - {{else}} - <div id="wiki_page_options" style="display: none"> - {{$mimetype}} - </div> - <div class="float-end fakelink" onClick="openClose('wiki_page_options')"> - {{$options}} - </div> - {{/if}} - <button id="new-page-submit" class="btn btn-primary" type="submit" name="submit" >{{$submit}}</button> - </form> - </div> - {{/if}} - </ul> -{{if ! $refresh}} -</div> -{{/if}} - -{{if $canadd}} -<script> - $('#new-page-submit').click(function (ev) { - $.post("wiki/{{$channel_address}}/create/page", {pageName: $('#id_pageName').val(), resource_id: window.wiki_resource_id, mimetype: $('#id_mimetype').val() }, - function(data) { - if(data.success) { - window.location = data.url; - } else { - window.console.log('Error creating page.'); - } - }, 'json'); - ev.preventDefault(); - }); - - function wiki_delete_page(wiki_page_name, wiki_page_url, wiki_resource_id, wiki_link_id) { - if(!confirm('Are you sure you want to delete the page: ' + wiki_page_name)) { - return; - } - $.post("wiki/{{$channel_address}}/delete/page", {name: wiki_page_url, resource_id: wiki_resource_id}, - function (data) { - if (data.success) { - window.console.log('Page deleted successfully.'); - if(wiki_page_url == window.wiki_page_name) { - var url = window.location.href; - if(url.substr(-1) == '/') - url = url.substr(0, url.length - 2); - url = url.split('/'); - url.pop(); - window.location = url.join('/'); - } - else { - $('#' + wiki_link_id).remove(); - } - } else { - alert('Error deleting page.'); // TODO: Replace alerts with auto-timeout popups - window.console.log('Error deleting page.'); - } - }, 'json'); - return false; - } - - function wiki_show_new_page_form() { - $('#new-page-form-wrapper').toggle(); - $('#id_pageName').focus(); - return false; - } -</script> -{{/if}} diff --git a/view/tpl/wiki_page_not_found.tpl b/view/tpl/wiki_page_not_found.tpl deleted file mode 100644 index 8fdee4596..000000000 --- a/view/tpl/wiki_page_not_found.tpl +++ /dev/null @@ -1,34 +0,0 @@ - <h3>Page does not exist</h3> - <br /><br /><br /> - {{if $canadd}} - <form id="new-page-form" action="/wiki/{{$channel_address}}/create/page" method="post" > - <input type="hidden" name="resource_id" value="{{$resource_id}}"> - {{include file="field_input.tpl" field=$pageName}} - {{if $typelock}} - <input id="id_mimetype" type="hidden" name="mimetype" value="{{$lockedtype}}"> - {{else}} - <div id="wiki_missing_page_options" style="display: none"> - {{$mimetype}} - </div> - <div class="float-end fakelink" onClick="openClose('wiki_missing_page_options')"> - {{$options}} - </div> - {{/if}} - <button id="create-missing-page-submit" class="btn btn-primary" type="submit" name="submit" >{{$submit}}</button> - </form> - -<script> - $('#create-missing-page-submit').click(function (ev) { - $.post("wiki/{{$channel_address}}/create/page", {pageName: $('#id_missingPageName').val(), resource_id: window.wiki_resource_id, mimetype: $('#id_mimetype').val() }, - function(data) { - if(data.success) { - window.location = data.url; - } else { - window.console.log('Error creating page. ('+data.message+')'); - } - }, 'json'); - ev.preventDefault(); - }); - -</script> -{{/if}} diff --git a/view/tpl/wikilist.tpl b/view/tpl/wikilist.tpl deleted file mode 100644 index bc8461dac..000000000 --- a/view/tpl/wikilist.tpl +++ /dev/null @@ -1,101 +0,0 @@ -<div class="generic-content-wrapper"> - <div class="section-title-wrapper clearfix"> - {{if $owner}} - <button type="button" class="btn btn-success btn-sm float-end acl-form-trigger" onclick="openClose('new-wiki-form-wrapper');" data-form_id="new-wiki-form"><i class="fa fa-plus-circle"></i> {{$create}}</button> - {{/if}} - <h2>{{$header}}</h2> - </div> - {{if $owner}} - <div id="new-wiki-form-wrapper" class="section-content-tools-wrapper"> - <form id="new-wiki-form" action="wiki/{{$channel}}/create/wiki" method="post" class="acl-form" data-form_id="new-wiki-form" data-allow_cid='{{$allow_cid}}' data-allow_gid='{{$allow_gid}}' data-deny_cid='{{$deny_cid}}' data-deny_gid='{{$deny_gid}}'> - {{include file="field_input.tpl" field=$wikiName}} - {{include file="field_select.tpl" field=$mimeType}} - {{include file="field_checkbox.tpl" field=$typelock}} - {{include file="field_checkbox.tpl" field=$notify}} - <div> - <div class="btn-group float-end"> - <button id="dbtn-acl" class="btn btn-outline-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#aclModal" title="Permission settings" onclick="return false;"> - <i id="jot-perms-icon" class="fa fa-{{$lockstate}} jot-icons"></i> - </button> - <button id="new-wiki-submit" class="btn btn-primary btn-sm" type="submit" name="submit" >{{$submit}}</button> - </div> - </div> - </form> - <div class="clear"></div> - </div> - {{/if}} - <div class="section-content-wrapper-np"> - <table id="wikis-index"> - <tr> - <th width="96%">{{$name}}</th> - <th width="1%">{{$type}}</th> - <th width="1%"></th> - {{if $owner}} - <th width="1%"></th> - {{/if}} - <th width="1%"></th> - {{if $owner}} - <th width="1%"></th> - {{/if}} - </tr> - {{foreach $wikis as $wiki}} - <tr class="wikis-index-row"> - <td><a href="/wiki/{{$channel}}/{{$wiki.urlName}}/Home" title="{{$view}}"{{if $wiki.active}} class="active"{{/if}}>{{$wiki.title}}</a></td> - <td>{{if $wiki.typelock}}{{$wiki.mimeType}}{{else}}{{$unlocked}}{{/if}}</td> - {{if $owner}} - <td><i class="fa fa-pencil" onclick="openCloseTR('wikis-index-edit-{{$wiki.id}}')"></i></td> - {{/if}} - <td class="dropdown"> - {{if $wiki.lockstate == 'lock'}} - <i class="fa fa-lock lockview" data-bs-toggle="dropdown" onclick="lockview('item',{{$wiki.id}});"></i> - <ul id="panel-{{$wiki.id}}" class="lockview-panel dropdown-menu dropdown-menu-end"></ul> - {{/if}} - </td> - <td><i class="fa fa-download" onclick="wiki_download_wiki('{{$wiki.resource_id}}'); return false;"></i></td> - {{if $owner}} - <td><i class="fa fa-trash-o drop-icons" onclick="wiki_delete_wiki('{{$wiki.title|escape:'javascript'}}', '{{$wiki.resource_id}}'); return false;"></i></td> - {{/if}} - </tr> - {{if $owner}} - <tr id="wikis-index-edit-{{$wiki.id}}" style="display:none"> - <td colspan="6"> - <form id="edit-wiki-form-{{$wiki.id}}" method="post" action="wiki/{{$channel}}/update/wiki" class="acl-form" data-form_id="edit-wiki-form-{{$wiki.id}}" data-allow_cid='{{$wiki.json_allow_cid}}' data-allow_gid='{{$wiki.json_allow_gid}}' data-deny_cid='{{$wiki.json_deny_cid}}' data-deny_gid='{{$wiki.json_deny_gid}}'> - <input type="hidden" name="origRawName" value="{{$wiki.title}}"> - {{include file="field_input.tpl" field=['updateRawName', $edit_wiki_name, $wiki.title]}} - <div class="btn-group float-end"> - <button class="btn btn-outline-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#aclModal" type="button"> - <i class="jot-perms-icon fa fa-{{$wiki.lockstate}}"></i> - </button> - <button class="btn btn-primary btn-sm" type="submit" value="edit">Submit</button> - </div> - </form> - </td> - </tr> - {{/if}} - {{/foreach}} - </table> - </div> -</div> -{{$acl}} -<script> - {{if $owner}} - function wiki_delete_wiki(wikiHtmlName, resource_id) { - if(!confirm('Are you sure you want to delete the entire wiki: ' + JSON.stringify(wikiHtmlName))) { - return; - } - $.post("wiki/{{$channel}}/delete/wiki", {resource_id: resource_id}, function (data) { - if (data.success) { - window.console.log('Wiki deleted'); - // Refresh list and redirect page as necessary - window.location = 'wiki/{{$channel}}'; - } else { - alert('Error deleting wiki!'); - window.console.log('Error deleting wiki.'); - } - }, 'json'); - } - {{/if}} - function wiki_download_wiki(resource_id) { - window.location = "wiki/{{$channel}}/download/wiki/" + resource_id; - } -</script> diff --git a/view/tpl/wikilist_widget.tpl b/view/tpl/wikilist_widget.tpl deleted file mode 100644 index 9853f9850..000000000 --- a/view/tpl/wikilist_widget.tpl +++ /dev/null @@ -1,8 +0,0 @@ -<div id="wiki_list" class="widget"> - <h3>{{$header}}</h3> - <ul class="nav nav-pills flex-column"> - {{foreach $wikis as $wiki}} - <li class="nav-item"><a class="nav-link" href="/wiki/{{$channel}}/{{$wiki.urlName}}/Home" title="{{$view}}">{{$wiki.title}}</a></li> - {{/foreach}} - </ul> -</div> |