Wijzigen voor document AdminWikiDescriptorSheet

Laatst gewijzigd door admin op 08-02-2022

Van versie < 4.1
gewijzigd door admin
op 08-02-2022
Naar versie 1.1 >
gewijzigd door admin
op 25-03-2019
Opmerking bij wijziging: Install extension [org.xwiki.platform:xwiki-platform-wiki-ui-common/11.1]

Samenvatting

Details

Paginaeigenschappen
Inhoud
... ... @@ -46,9 +46,6 @@
46 46   ## Display the UI.
47 47   ##
48 48   #set ($discard = $xwiki.jsfx.use('js/xwiki/actionbuttons/actionButtons.js', true))
49 - ## In case of conflict issue we want to display the diff properly
50 - #set ($discard = $xwiki.ssfx.use('uicomponents/viewers/diff.css', true))
51 - #set ($discard = $xwiki.jsfx.use('uicomponents/viewers/diff.js'))
52 52   #if ($doc.documentReference.name != $sheetDocName)
53 53   #set ($discard = $xwiki.jsx.use($sheetDocFullName))
54 54   #set ($discard = $xwiki.ssx.use($sheetDocFullName))
... ... @@ -86,12 +86,7 @@
86 86   #else
87 87   #set ($homepage = '')
88 88   #end
89 - #set ($pagePickerParams = {
90 - 'id': 'homepage',
91 - 'name': 'homepage',
92 - 'value': $homepage
93 - })
94 - #pagePicker($pagePickerParams)
86 + <input id='homepage' name='homepage' type='text' size='30' class='suggestDocuments' value="$!{escapetool.xml($homepage)}" />
95 95   </dd>
96 96  
97 97   ## Only show the owner change form element if the current user is the current owner or a global admin (has edit on the wiki's descriptor document).
XWiki.ConfigurableClass[0]
configureGlobally
... ... @@ -1,0 +1,1 @@
1 +1
Scope
... ... @@ -1,1 +1,0 @@
1 -WIKI
XWiki.JavaScriptExtension[0]
Code
... ... @@ -1,32 +1,37 @@
1 -require(['jquery', 'xwiki-events-bridge'], function($) {
2 - 'use strict';
1 +(function() {
2 +var init = function() {
3 + // We only need this behavior in the admin (administration) and view modes.
4 + if (XWiki.contextaction != 'admin' && XWiki.contextaction != 'view') {
5 + return;
6 + }
3 3  
4 - var init = function() {
5 - $('input[name="action_saveandcontinue"]').on('xwiki:actions:beforeSave', function(event) {
6 - // Rename the save button so that XWiki's action filter does not get in our way and send our request somewhere
7 - // else rather than the form's action.
8 - $(this).attr('name', 'xaction_saveandcontinue');
8 + // Listen for the save & continue event (that we reuse with our button).
9 + document.observe("xwiki:actions:save", function(event) {
10 + // Rename the save button so that XWiki's action filter does not get in our way and send our request somewhere else
11 + // rather than the form's action.
12 + if ($$("input[name='action_saveandcontinue']")[0]) {
13 + $$("input[name='action_saveandcontinue']")[0].name = 'xaction_saveandcontinue';
14 + }
9 9  
10 - // Ask for confirmation when the new owner does not exist and is entered by hand.
11 - var ownerSelectize = $('#owner')[0]?.selectize;
12 - var ownerDoesNotExist = ownerSelectize && ownerSelectize.items.some(function(ownerId) {
13 - var owner = ownerSelectize.options[ownerId];
14 - return !owner.icon && owner.label === owner.value;
15 - });
16 - if (ownerDoesNotExist) {
17 - // We do it like this because we want to wait for the reply while blocking (window.confirm) the save event
18 - // handler so that we can eventually stop the event itself instead of having to re-submit the form in an asynch
19 - // callback (Confirm Widget).
20 - if (!window.confirm($jsontool.serialize($services.localization.render(
21 - 'platform.wiki.admin.wiki.ownerProblemConfirmation')))) {
22 - event.preventDefault();
16 + // Ask for confirmation when the new owner does not exist and is entered by hand.
17 + if ($$("input[name='owner']")[0] && !$$("input[name='owner'][type='hidden']")[0]) {
18 + // We do it like this because we want to wait for the reply while blocking (window.confirm) the save event
19 + // handler so that we can eventually stop the event itself instead of having to re-submit the form in an asynch
20 + // callback (Confirm Widget).
21 + var confirmed = window.confirm("$services.localization.render('platform.wiki.admin.wiki.ownerProblemConfirmation')");
22 + if (!confirmed) {
23 + event.stop();
24 + if (event.memo) {
25 + event.memo.originalEvent.stop();
23 23   }
24 24   }
25 - });
26 - };
28 + }
29 + });
30 +};
27 27  
28 - // We only need this behavior in the administration and view modes.
29 - if (XWiki.contextaction === 'admin' || XWiki.contextaction === 'view') {
30 - $(init);
31 - }
32 -});
32 +// Register on xwiki:dom:loading because we want to register a handler for xwiki:actions:save before the default
33 +// handler gets registered, otherwise our handler will be called after the default, thus after the AJAX request
34 +// is sent, and we don`t want that.
35 +(XWiki && XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loading', init);
36 +
37 +})();

Inhoudsopgave

Copyright © 2016-2025 ASolutions
Rivium Quadrant 181 - 2909 LC - Capelle aan den IJsselpubliek v14.10.5