This is an automated email from the ASF dual-hosted git repository.

brushed pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git


The following commit(s) were added to refs/heads/master by this push:
     new a85828e  2.11.0-M4-git-12   [JSPWIKI-1104] Add ALERT Dialog with 
cookies
a85828e is described below

commit a85828ea60d7f1b639bfa361d2cfbcc82e7480d8
Author: brushed <[email protected]>
AuthorDate: Wed May 1 23:48:49 2019 +0200

    2.11.0-M4-git-12   [JSPWIKI-1104] Add ALERT Dialog with cookies
---
 ChangeLog                                          | 10 ++++
 .../src/main/java/org/apache/wiki/Release.java     |  2 +-
 .../java/org/apache/wiki/plugin/InsertPage.java    | 49 +++++++++++++++--
 .../resources/plugin/PluginResources.properties    |  3 ++
 .../main/resources/templates/default.properties    |  8 +++
 .../main/resources/templates/default_fr.properties |  6 +++
 .../main/resources/templates/default_nl.properties | 16 ++++--
 jspwiki-war/src/main/config/wro/wro-haddock.xml    |  1 +
 jspwiki-war/src/main/scripts/util/cookies.js       | 62 ++++++++++++++++++++++
 jspwiki-war/src/main/scripts/wiki/Prefs.js         | 14 ++++-
 jspwiki-war/src/main/scripts/wiki/Recents.js       |  2 +-
 .../src/main/scripts/wiki/Wiki.Behaviors.js        | 21 ++++----
 jspwiki-war/src/main/scripts/wiki/Wiki.js          | 46 +++++++++++++---
 .../styles/haddock/default/InsertPagePlugin.less   | 59 ++++++++++++++++++++
 .../styles/haddock/default/Template.Attach.less    |  2 +-
 .../main/styles/haddock/default/Template.View.less |  2 +-
 .../src/main/styles/haddock/default/build.less     |  1 +
 .../src/main/styles/haddock/default/modals.less    |  5 +-
 .../src/main/styles/haddock/default/tables.less    |  1 -
 .../src/main/styles/haddock/default/variables.less |  3 +-
 .../src/main/webapp/templates/default/Nav.jsp      |  2 +-
 .../webapp/templates/default/PreferencesTab.jsp    | 25 +++++++++
 22 files changed, 305 insertions(+), 35 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cc4a632..7a9f4e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-05-1  Dirk Frederickx (brushed AT apache DOT org)
+
+       * 2.11.0-M4-git-12
+
+       * [JSPWIKI-1104] InsertPagePlugin now also supports cookie based
+         inserts.
+         The UserPreferences page has been extended to allow the users to view 
and
+         delete page-based cookies.
+
+
 2019-04-28  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.11.0-M4-git-11
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/Release.java 
b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
index 627ddfe..82f36fc 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "11";
+    public static final String     BUILD         = "12";
 
     /**
      *  This is the generic version string you should use when printing out 
the version.  It is of
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/plugin/InsertPage.java 
b/jspwiki-main/src/main/java/org/apache/wiki/plugin/InsertPage.java
index 478bf35..10906ba 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/plugin/InsertPage.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/plugin/InsertPage.java
@@ -21,6 +21,7 @@ package org.apache.wiki.plugin;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.ResourceBundle;
 
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
@@ -31,6 +32,9 @@ import org.apache.wiki.api.plugin.WikiPlugin;
 import org.apache.wiki.auth.AuthorizationManager;
 import org.apache.wiki.auth.permissions.PermissionFactory;
 import org.apache.wiki.util.TextUtil;
+import org.apache.wiki.util.HttpUtil;
+import org.apache.wiki.preferences.Preferences;
+
 
 /**
  *  Inserts page contents.  Muchos thanks to Scott Hurlbert for the initial 
code.
@@ -58,6 +62,8 @@ public class InsertPage
     public static final String PARAM_MAXLENGTH = "maxlength";
     /** Parameter name for setting the class.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_CLASS     = "class";
+    /** Parameter name for setting the show option.  Value is 
<tt>{@value}</tt>. */
+    public static final String PARAM_SHOW   = "show";
     /** Parameter name for setting the section.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_SECTION   = "section";
     /** Parameter name for setting the default.  Value is <tt>{@value}</tt>. */
@@ -65,6 +71,8 @@ public class InsertPage
 
     private static final String DEFAULT_STYLE = "";
 
+    private static final String ONCE_COOKIE = "JSPWiki.Once.";
+
     /** This attribute is stashed in the WikiContext to make sure that we don't
      *  have circular references.
      */
@@ -84,10 +92,14 @@ public class InsertPage
         String clazz        = params.get( PARAM_CLASS );
         String includedPage = params.get( PARAM_PAGENAME );
         String style        = params.get( PARAM_STYLE );
+        Boolean showOnce    = "once".equals( params.get( PARAM_SHOW ) );
         String defaultstr   = params.get( PARAM_DEFAULT );
         int    section      = TextUtil.parseIntParameter(params.get( 
PARAM_SECTION ), -1 );
         int    maxlen       = TextUtil.parseIntParameter(params.get( 
PARAM_MAXLENGTH ), -1 );
 
+        ResourceBundle rb = Preferences.getBundle( context, 
WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE );
+
+
         if( style == null ) style = DEFAULT_STYLE;
 
         if( maxlen == -1 ) maxlen = Integer.MAX_VALUE;
@@ -133,9 +145,6 @@ public class InsertPage
                     previousIncludes = new ArrayList<String>();
                 }
 
-                previousIncludes.add( page.getName() );
-                context.setVariable( ATTR_RECURSE, previousIncludes );
-
                 //
                 // Check for permissions
                 //
@@ -148,6 +157,30 @@ public class InsertPage
                     return res.toString();
                 }
 
+                //
+                // Show Once
+                // Check for page-cookie, only include page if cookie is not 
yet set
+                //
+                String cookieName = "";
+
+                if( showOnce )
+                {
+                    cookieName = ONCE_COOKIE +
+                                 TextUtil.urlEncodeUTF8( page.getName() )
+                                         .replaceAll( "\\+", "%20" );
+
+                    if( HttpUtil.retrieveCookieValue( context.getHttpRequest(),
+                                                      cookieName ) != null )
+                    {
+                        return "";  //silent exit
+                    }
+
+                }
+
+                // move here, after premature exit points (permissions, 
page-cookie)
+                previousIncludes.add( page.getName() );
+                context.setVariable( ATTR_RECURSE, previousIncludes );
+
                 /**
                  *  We want inclusion to occur within the context of
                  *  its own page, because we need the links to be correct.
@@ -174,12 +207,18 @@ public class InsertPage
                 if( pageData.length() > maxlen )
                 {
                     pageData = pageData.substring( 0, maxlen )+" ...";
-                    moreLink = "<p><a 
href=\""+context.getURL(WikiContext.VIEW,includedPage)+"\">More...</a></p>";
+                    moreLink = "<p><a 
href=\""+context.getURL(WikiContext.VIEW,includedPage)+"\">"+rb.getString("insertpage.more")+"</a></p>";
                 }
 
-                res.append("<div style=\""+style+"\""+(clazz != null ? " 
class=\""+clazz+"\"" : "")+">");
+                res.append("<div class=\"inserted-page ");
+                if( clazz != null ) res.append( clazz );
+                if( style != DEFAULT_STYLE ) res.append("\" style=\""+style );
+                if( showOnce ) res.append("\" data-once=\""+cookieName );
+                res.append("\" >");
+
                 res.append( engine.textToHTML( includedContext, pageData ) );
                 res.append( moreLink );
+
                 res.append("</div>");
 
                 //
diff --git a/jspwiki-main/src/main/resources/plugin/PluginResources.properties 
b/jspwiki-main/src/main/resources/plugin/PluginResources.properties
index 4902ef5..f953262 100644
--- a/jspwiki-main/src/main/resources/plugin/PluginResources.properties
+++ b/jspwiki-main/src/main/resources/plugin/PluginResources.properties
@@ -50,6 +50,9 @@ weblogentryplugin.postedby = Posted by {0}&nbsp;&nbsp;
 weblogentryplugin.permalink = Permalink
 weblogentryplugin.addcomment = <span class="icon-plus"></span> Add new comment 
({0})
 
+# InserPagePlugin
+insertpage.more=More...
+
 
 # ReferringPagesPlugin
 
diff --git a/jspwiki-main/src/main/resources/templates/default.properties 
b/jspwiki-main/src/main/resources/templates/default.properties
index f9ae036..314c80c 100644
--- a/jspwiki-main/src/main/resources/templates/default.properties
+++ b/jspwiki-main/src/main/resources/templates/default.properties
@@ -383,6 +383,12 @@ prefs.user.timezone.server=[SERVER]
 prefs.user.language=Language
 prefs.user.language.default=[DEFAULT]
 
+prefs.user.pagecookies=Page Cookies
+prefs.user.pagecookies.type=Cookie Type
+prefs.user.pagecookies.page=Page
+prefs.user.pagecookies.actions=Actions
+prefs.user.pagecookie.delete=Delete Cookie
+
 prefs.instructions=Set your user preferences here. Your choices will be saved 
in your browser as cookies.
 prefs.assertedname=Name
 prefs.assertedname.description=Your name. If you haven&\#8217;t created a user 
profile yet, you can tell {0} who you are by &\#8216;asserting&\#8217; an 
identity. You wouldn&\#8217;t lie to us would you? <br /> Note that setting 
your user name this way isn&\#8217;t a real method of authentication, because 
it just sets a cookie in your browser without requiring a password. Depending 
on the security policy, the wiki may grant you fewer privileges as an 
&\#8220;asserted&\#8221; user. {0} if [...]
@@ -631,6 +637,8 @@ javascript.edit.areyousure=Without clicking the Save 
button, your changes will b
     Are you sure you want to exit this page?
 javascript.preview.zone = Preview Zone
 
+javascript.dialog.confirm = Confirm
+javascript.dialog.cancel = Cancel
 javascript.dialog.character.entities = Character entities
 javascript.dialog.link.attributes = Wiki Link Attributes
 javascript.dialog.plugin = Plugin
diff --git a/jspwiki-main/src/main/resources/templates/default_fr.properties 
b/jspwiki-main/src/main/resources/templates/default_fr.properties
index 180f297..25fc4bc 100644
--- a/jspwiki-main/src/main/resources/templates/default_fr.properties
+++ b/jspwiki-main/src/main/resources/templates/default_fr.properties
@@ -415,6 +415,12 @@ prefs.user.timezone=S\u00E9lectionner le fuseau horaire
 prefs.user.timezone.server=[SERVEUR]
 prefs.user.language=Langue
 prefs.user.language.default=[DEFAUT]
+prefs.user.pagecookies=Cookies de PAge
+prefs.user.pagecookies.type=Cookie Type
+prefs.user.pagecookies.page=Page
+prefs.user.pagecookies.actions=Actions
+prefs.user.pagecookie.delete=Supprimer le Cookie
+
 
 prefs.instructions=Modifiez vos pr\u00E9f\u00E9rences utilisateur ici. Vos 
choix seront enregistr\u00E9s dans les cookies de votre navigateur.
 prefs.assertedname=Nom
diff --git a/jspwiki-main/src/main/resources/templates/default_nl.properties 
b/jspwiki-main/src/main/resources/templates/default_nl.properties
index 30aaadc..38bfef5 100644
--- a/jspwiki-main/src/main/resources/templates/default_nl.properties
+++ b/jspwiki-main/src/main/resources/templates/default_nl.properties
@@ -396,7 +396,10 @@ prefs.user.skin=Layout
 prefs.user.orientation=Wijzig de Layout Orientatie
 prefs.user.orientation.left=Links
 prefs.user.orientation.right=Rechts
-#prefs.user.editorareaheight=Wijzig Editor hoogte
+prefs.user.layout = Pagina Layout
+prefs.user.layout.fixed = Vaste breedte
+prefs.user.layout.fluid = Volledig breedte
+prefs.user.orientation.hidden = Gesloten zijbalk
 prefs.user.sectionediting=Sectie Editing
 prefs.user.sectionediting.text=Activeer <a class="editsection" href="#">Sectie 
Editing</a>
 prefs.user.appearance=Weergave
@@ -407,10 +410,13 @@ prefs.user.timezone=Wijzig de Tijd-zone
 prefs.user.timezone.server=[SERVER]
 prefs.user.language=Wijzig de Taal
 prefs.user.language.default=[DEFAULT]
-prefs.user.layout = Pagina Layout
-prefs.user.layout.fixed = Vaste breedte
-prefs.user.layout.fluid = Volledig breedte
-prefs.user.orientation.hidden = Gesloten zijbalk
+
+prefs.user.pagecookies=Pagina Cookies
+prefs.user.pagecookies.type=Cookie Type
+prefs.user.pagecookies.page=Pagina
+prefs.user.pagecookies.actions=Acties
+prefs.user.pagecookie.delete=Cookie Verwijderen
+
 
 prefs.instructions=Hier kan U de Gebruikers Instellingen wijzigen. Deze worden 
bewaard in de cookies van de browser
 prefs.assertedname=Naam
diff --git a/jspwiki-war/src/main/config/wro/wro-haddock.xml 
b/jspwiki-war/src/main/config/wro/wro-haddock.xml
index 623698d..6b8bd85 100644
--- a/jspwiki-war/src/main/config/wro/wro-haddock.xml
+++ b/jspwiki-war/src/main/config/wro/wro-haddock.xml
@@ -26,6 +26,7 @@
     <js>/scripts/lib/mootools-core-1.6.0.js</js>
     <js>/scripts/lib/mootools-more-1.6.0.js</js>
     <js>/scripts/lib/prettify4mar13.js</js>
+    <js>/scripts/util/cookies.js</js>
   </group>
 
   <group name="mooextend" abstract="true">
diff --git a/jspwiki-war/src/main/scripts/util/cookies.js 
b/jspwiki-war/src/main/scripts/util/cookies.js
new file mode 100644
index 0000000..7e18532
--- /dev/null
+++ b/jspwiki-war/src/main/scripts/util/cookies.js
@@ -0,0 +1,62 @@
+/*
+    JSPWiki - a JSP-based WikiWiki clone.
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); fyou may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+/*eslint-env browser */
+/*global $ */
+
+/*
+Minimal cookie handling 
+
+Get a cookie
+>>  $.cookie("sweetCookie");
+
+Set a cookie  (returns the name of the cookie)
+>> $.cookie("sweetCookie", "some-data");
+>> $.cookie("sweetCookie", "some-data", { expiry: 5 });  //expires in 5 days
+*/
+$.cookie = function(name, value, options) {
+
+    if(value == undefined) {
+        // read cookie
+                   var value = document.cookie.match('(?:^|;)\\s*' + name + 
'=([^;]*)');
+                   return (value) ? 
decodeURIComponent(value[1]).replace(/\+/g, " ") : null;
+    }
+
+    // write or delete a cookie
+    if( /\s/.test(name) ) name = encodeURIComponent(name);
+    var brownies = name  + '=' + encodeURIComponent(value);
+
+    if (options){
+        if ('path' in options) brownies += ';path=' + options.path;
+        if ('domain' in options) brownies += ';domain=' + options.domain;
+        if ('secure' in options && options.secure) brownies += ';secure';
+        if ('expiry' in options){
+            var expiry = options.expiry;
+            if (!isNaN(expiry)  ){
+                //its a number, indicating the relative number of days ; to be 
converted to milliseconds  
+                expiry = new Date(expiry * 864e5 /*1000 * 60 * 60 * 24*/ + 
Date.now() );
+            }
+            brownies += ';expires=' + expiry.toUTCString();
+        }  
+    }
+    document.cookie = brownies;
+    //console.log(document.cookie)
+}
+$.cookie.delete = function(name){ $.cookie(name, "" ,{expiry:-1}); }
diff --git a/jspwiki-war/src/main/scripts/wiki/Prefs.js 
b/jspwiki-war/src/main/scripts/wiki/Prefs.js
index d1e91f8..a8b0a43 100644
--- a/jspwiki-war/src/main/scripts/wiki/Prefs.js
+++ b/jspwiki-war/src/main/scripts/wiki/Prefs.js
@@ -41,7 +41,7 @@ Javascript routines to support JSPWiki UserPreferences
     var datapref = "*[data-pref]"; //data preference form elements
 
     function getValue( el ){
-        return ( el.match( "[type=checkbox]" ) ? el.checked : el.value );
+        return ( el.matches( "[type=checkbox]" ) ? el.checked : el.value );
     }
 
     function windowUnload( onbeforeunload ){
@@ -99,7 +99,17 @@ Javascript routines to support JSPWiki UserPreferences
 
         };
 
-        //FFS: add click-triggers to some preferences:  prefLayout, 
prefOrientation,
+        function deleteCookie(event){
+
+            var cookie = this.getAttribute("data-delete-cookie");
+
+            $.cookie.delete(cookie);
+            this.closest("tr").remove();
+        }
+
+        form.getElements("[data-delete-cookie]").forEach( function(element){
+            element.onclick = deleteCookie;
+        })
 
     });
 
diff --git a/jspwiki-war/src/main/scripts/wiki/Recents.js 
b/jspwiki-war/src/main/scripts/wiki/Recents.js
index 593494a..378131c 100644
--- a/jspwiki-war/src/main/scripts/wiki/Recents.js
+++ b/jspwiki-war/src/main/scripts/wiki/Recents.js
@@ -83,7 +83,7 @@ Wiki.Recents = new Class({
 
         var self = this, form = self.form;
 
-        if( element.match(".clear") ){
+        if( element.matches(".clear") ){
 
             //element.getSiblings("li.recents").destroy();
             //element.destroy();
diff --git a/jspwiki-war/src/main/scripts/wiki/Wiki.Behaviors.js 
b/jspwiki-war/src/main/scripts/wiki/Wiki.Behaviors.js
index 992569e..fd4a27a 100644
--- a/jspwiki-war/src/main/scripts/wiki/Wiki.Behaviors.js
+++ b/jspwiki-war/src/main/scripts/wiki/Wiki.Behaviors.js
@@ -190,10 +190,13 @@ Behavior:Alert (based on Bootstrap)
 */
     .add(".alert", function(element){
 
-        element.addClass("alert-warning alert-dismissable").grab(
+        element.addClass("alert-dismissable").grab(
 
             "button.close[type=button][html=&times;]".slick()
-                .addEvent("click", function(){ element.dispose(); }),
+                .addEvent("click", function(){
+                    element.remove();
+
+                }),
             "top"
 
         );
@@ -236,7 +239,7 @@ Behavior: Viewer
         Viewer.preload(a.href, { width: 800, height: 600 }, function( element 
){
 
             var next = a.getNext();
-            if( next && next.match("img.outlink") ){ next.dispose(); }
+            if( next && next.matches("img.outlink") ){ next.remove(); }
 
             element.addClass("viewport").replaces(a);
 
@@ -311,9 +314,9 @@ becomes
 //helper function, to collect the links to be converted
 function filterJSPWikiLinks(element){
 
-    return element.match("a") ?
+    return element.matches("a") ?
         element :
-        element.getElements( element.match(".slimbox-attachments") ?
+        element.getElements( element.matches(".slimbox-attachments") ?
             "a[href].attachment" :
             // otherwise,  catch several different cases in one go
             //    img:not([href$=/attachment_small.png]):not(.outlink)  
::jspwiki small icons
@@ -411,7 +414,7 @@ function collapseFn(element, cookie){
 
     cookie = cookie || wiki.PageName;
 
-    cookie = new Cookie.Flags("JSPWikiCollapse" + cookie, {path: 
wiki.BasePath, duration: 20});
+    cookie = new Cookie.Flags("JSPWiki.Collapse." + cookie, {path: 
wiki.BaseUrl, duration: 20});
 
     if( clazz == list ){
 
@@ -482,7 +485,7 @@ Example:
 
         element.addClass("prettyprint");
         /*html5 expects  <pre><code>  */
-        if( element.match("pre") ){
+        if( element.matches("pre") ){
             element.innerHTML = "<code>" + element.innerHTML + "</code>";
         }
 
@@ -491,7 +494,7 @@ Example:
 
         element.addClass("prettyprint");
         /*html5 expects  <pre><code>  */
-        if( element.match("pre") ){
+        if( element.matches("pre") ){
             element.innerHTML = "<code>" + element.innerHTML + "</code>";
         }
 
@@ -835,7 +838,7 @@ div[this is the parent container]
         var bgBox = image.getParent(".bg"),
             clazz = bgBox.className; //contains possibly other styles to be 
applied to the background image
 
-        if( bgBox && bgBox.match("td") ){
+        if( bgBox && bgBox.matches("td") ){
             bgBox = bgBox.getParent("table");
         }
 
diff --git a/jspwiki-war/src/main/scripts/wiki/Wiki.js 
b/jspwiki-war/src/main/scripts/wiki/Wiki.js
index b172855..035feb5 100644
--- a/jspwiki-war/src/main/scripts/wiki/Wiki.js
+++ b/jspwiki-war/src/main/scripts/wiki/Wiki.js
@@ -103,6 +103,9 @@ var Wiki = {
                 wiki.resizer(element, $$(element.get("data-resize")) );
             })
 
+            //cookie based page insertions
+            .add(".context-view .inserted-page[data-once]", wiki.insertPage )
+
             //add header scroll-up/down effect
             .add( ".fixed-header > .header", wiki.yoyo )
 
@@ -149,7 +152,6 @@ var Wiki = {
                 wiki.search = new wiki.Search( form, {
                     xhrURL: wiki.XHRSearch,
                     onComplete: function(){
-                        //console.log(form.query.get("value"));
                         wiki.prefs.set("PrevQuery", form.query.get("value"));
                     }
                 });
@@ -208,8 +210,6 @@ var Wiki = {
         });
         //console.log(wiki.prefs.hash);
 
-        //Object.each(wiki.prefs.hash, function(item,key){ console.log("PREFS  
",key,"=>",item); });
-
         if( wiki.version != wiki.prefs.get("version") ){
             wiki.prefs.empty();
             wiki.prefs.set("version", wiki.version);
@@ -450,7 +450,7 @@ var Wiki = {
                 li.inject(parentLi, "before");
 
             }
-            ul.dispose();
+            ul.remove();
 
         });
 
@@ -469,7 +469,7 @@ var Wiki = {
             if( element.getNext("p *,hr") ){
                 "li.divider".slick().inject(parentLi, "before") ;
             }
-            element.dispose();
+            element.remove();
 
         });
 
@@ -584,7 +584,7 @@ var Wiki = {
         //Handle all configuration checkboxes
         form.getElements("[type=checkbox][data-cmd]").each( function( el ){
 
-            el.checked = !!wiki.prefs.get(el.getAttribute("data-cmd"));
+            //el.checked = !!wiki.prefs.get(el.getAttribute("data-cmd"));
             el.addEvent("click", onCheck );
             onCheck.apply(el);
 
@@ -820,6 +820,40 @@ var Wiki = {
 
         }
 
+    },
+
+    //behavior linked to ".context-view .inserted-page[data-once]"
+    insertPage: function( element ){
+
+        var onceCookie = element.getAttribute("data-once"),
+            okButton = ".btn.btn-success";
+
+        //do not handle the notification (and cookie) when this is the 
inserted-page itself
+        if( onceCookie.test( RegExp( "." + 
Wiki.PageName.replace(/\s/g,"%20")+"$" ) ) ){
+            if( !element.closest(".page") ) element.remove();
+            return;
+        }
+
+        if( !element.getElement( okButton ) ){
+            element.grab([
+                "div.modal-footer", [
+                    "button.btn.btn-success", { text: 
"dialog.confirm".localize() }                            ]
+            ].slick());
+        }
+
+        element.getElement( okButton ).addEvent("click", function(){
+            $.cookie( onceCookie, Date() );   //register the current timestamp
+            element.remove();
+        });
+
+        //if no other additional css class is set, add the default .modal class
+        if( element.className.trim() === "inserted-page" ){
+            element.addClass("modal");      //element.classList.add("modal");
+        }
+
+        if( element.matches(".modal") ){
+            element.openModal( ); // open the modal dialog
+        }
     }
 
 };
diff --git a/jspwiki-war/src/main/styles/haddock/default/InsertPagePlugin.less 
b/jspwiki-war/src/main/styles/haddock/default/InsertPagePlugin.less
new file mode 100644
index 0000000..7f1b98f
--- /dev/null
+++ b/jspwiki-war/src/main/styles/haddock/default/InsertPagePlugin.less
@@ -0,0 +1,59 @@
+/*
+    JSPWiki - a JSP-based WikiWiki clone.
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); fyou may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+/*
+DOM structure:
+       div.inserted-page.modal[data-once="JSPWiki.Once.PrivacyPolicy"]
+               button.close[type="button"] ×
+               ...
+*/
+
+
+
+.alert-dismissable, .alert-dismissible {
+       position:relative;
+       
+       & > *:nth-child(2) { margin-top:0; }   //just after the button.close    
+       & > *:last-child { margin-bottom:0; }   
+       
+       .close {
+               position:absolute;
+               top:.25em;
+               right:.5em;
+       }
+       
+}
+
+.modal, .default, .info {
+       //.modal
+       // ffs: move margin-top fix elsewhere in generic style.less
+       & > *:first-child {
+               margin-top:0;
+       }
+}
+
+
+.inserted-page {
+
+       .hashlink, 
+       .editsection { .hidden; } 
+               
+}
diff --git a/jspwiki-war/src/main/styles/haddock/default/Template.Attach.less 
b/jspwiki-war/src/main/styles/haddock/default/Template.Attach.less
index 7cb6782..9202cef 100644
--- a/jspwiki-war/src/main/styles/haddock/default/Template.Attach.less
+++ b/jspwiki-war/src/main/styles/haddock/default/Template.Attach.less
@@ -85,7 +85,7 @@ form.legacy .canDragAndDrop { .hide; }
 
 .attach-name {
     max-width: 200px;
-    white-space: nowrap;
+    //white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
 }
diff --git a/jspwiki-war/src/main/styles/haddock/default/Template.View.less 
b/jspwiki-war/src/main/styles/haddock/default/Template.View.less
index e9d14d1..f548ccb 100644
--- a/jspwiki-war/src/main/styles/haddock/default/Template.View.less
+++ b/jspwiki-war/src/main/styles/haddock/default/Template.View.less
@@ -217,7 +217,7 @@ Fixed .header with hide (on scrolldown)  and show (on 
scrollup) effects.
 
 
 .footer {
-    //background: @wiki-footer-bg; //reuse header background
+    background: @wiki-footer-bg;
     padding: @padding-base-horizontal;
        text-align: center;
 }
diff --git a/jspwiki-war/src/main/styles/haddock/default/build.less 
b/jspwiki-war/src/main/styles/haddock/default/build.less
index a59b9b7..ae99fd2 100755
--- a/jspwiki-war/src/main/styles/haddock/default/build.less
+++ b/jspwiki-war/src/main/styles/haddock/default/build.less
@@ -133,6 +133,7 @@ Stylesheet: JSPWiki
 // JSPWiki: Plugins
 @import "ImagePlugin.less";
 @import "IndexPlugin.less";
+@import "InsertPagePlugin.less";
 @import "TOCPlugin.less";
 @import "WeblogPlugin.less";
 @import "RecentChangesPlugin.less";
diff --git a/jspwiki-war/src/main/styles/haddock/default/modals.less 
b/jspwiki-war/src/main/styles/haddock/default/modals.less
index f88c4b8..062c9ac 100755
--- a/jspwiki-war/src/main/styles/haddock/default/modals.less
+++ b/jspwiki-war/src/main/styles/haddock/default/modals.less
@@ -39,10 +39,11 @@ body[.show-modal]
   position: fixed;
   //position: absolute;
   max-width: unit(@wiki-modal-max-width, vw);
-  max-height: unit(@wiki-modal-max-height,vh);
+  max-height: unit(@wiki-modal-max-height, vh);
   top: unit( (100 - @wiki-modal-max-height)/2,vh);
   left: 50%; margin-right:-50%;
   transform: translate(-50%);
+  overflow: auto;
 
   padding: @modal-inner-padding;
 
@@ -85,6 +86,8 @@ body[.show-modal]
 .modal-footer {
     margin-top: @modal-inner-padding;
     text-align: center; // right align buttons
+    position:relative;
+    bottom:0;
 
     // Properly space out buttons
     .btn + .btn {
diff --git a/jspwiki-war/src/main/styles/haddock/default/tables.less 
b/jspwiki-war/src/main/styles/haddock/default/tables.less
index 84f47a6..136ba77 100644
--- a/jspwiki-war/src/main/styles/haddock/default/tables.less
+++ b/jspwiki-war/src/main/styles/haddock/default/tables.less
@@ -36,7 +36,6 @@ table[border="1"] td { border:0; }
     // and add 2px to the bottom border for header rows
     tr:first-child {
         th, td {
-            border-top: 0;
             vertical-align: top; //fix bootstrap th setting
 
         }
diff --git a/jspwiki-war/src/main/styles/haddock/default/variables.less 
b/jspwiki-war/src/main/styles/haddock/default/variables.less
index 326edea..0a2ca10 100644
--- a/jspwiki-war/src/main/styles/haddock/default/variables.less
+++ b/jspwiki-war/src/main/styles/haddock/default/variables.less
@@ -76,6 +76,7 @@ images/feather-small.png   wxh  162x286
 // Main color scheme
 @wiki-header-bg:    hsla(214, 68%, 58%, 0.9); //@brand-primary;
 //@wiki-header-bg: -webkit-linear-gradient(108deg,rgba(112,208,238,0.8), 
rgba(74,137,220,0.9)/*rgba(42,132,210,0.8)*/ 90%);
+@wiki-footer-bg:    @wiki-header-bg;
 
 @wiki-header-color: @white;
 @wiki-page-bg:      @white;
@@ -105,7 +106,7 @@ images/feather-small.png   wxh  162x286
 
 @modal-backdrop-bg: hsl(16, 44%, 63%); //copper blush
 @wiki-modal-max-width: 100 * (1-@sidebar-ratio);
-@wiki-modal-max-height: 40;
+@wiki-modal-max-height: 100 * (1-@sidebar-ratio);
 
 //Nav bar
 @wiki-logo-font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue 
UltraLight', 'Helvetica Neue', Arial, Helvetica, sans-serif;
diff --git a/jspwiki-war/src/main/webapp/templates/default/Nav.jsp 
b/jspwiki-war/src/main/webapp/templates/default/Nav.jsp
index 99b7868..c04b7bb 100644
--- a/jspwiki-war/src/main/webapp/templates/default/Nav.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/Nav.jsp
@@ -56,7 +56,7 @@
       --%>
       <c:forEach items="${breadCrumbTrail}" varStatus="status" begin="2">
           <c:set var="crumb" 
value="${breadCrumbTrail[fn:length(breadCrumbTrail) - status.index]}" />
-          <li><wiki:Link 
page="${crumb}">${fn:escapeXml(crumb)}</wiki:Link></li>
+          <li><wiki:Translate>[${crumb}]</wiki:Translate></li>
       </c:forEach>
 
     </ul>
diff --git a/jspwiki-war/src/main/webapp/templates/default/PreferencesTab.jsp 
b/jspwiki-war/src/main/webapp/templates/default/PreferencesTab.jsp
index d77c3e2..7ab41a2 100644
--- a/jspwiki-war/src/main/webapp/templates/default/PreferencesTab.jsp
+++ b/jspwiki-war/src/main/webapp/templates/default/PreferencesTab.jsp
@@ -208,4 +208,29 @@
     </select>
   </div>
 
+  <hr />
+
+  <div class="form-group table-striped-bordered-condensed-fit-sort">
+    <label class="control-label form-col-20" 
style="vertical-align:top;"><fmt:message key="prefs.user.pagecookies"/></label>
+    <table class="wikitable" style="display:inline-block;">
+    <tr>
+      <th><fmt:message key="prefs.user.pagecookies.type"/></th>
+      <th><fmt:message key="prefs.user.pagecookies.page"/></th>
+      <th><fmt:message key="prefs.user.pagecookies.actions"/></th>
+    </tr>
+    <c:forEach var="aCookie" items="${pageContext.request.cookies}" >
+      <c:if test="${fn:startsWith(aCookie.name,'JSPWiki.') }">
+        <c:set var="cookiePieces" value="${fn:split(aCookie.name, '.')}" />
+        <c:set var="cookieType" value="${cookiePieces[1]}" />
+        <c:set var="cookiePage" value="${fn:replace(cookiePieces[2], '%20', ' 
')}" />
+        <tr>
+          <td>${cookieType}</td>
+          <td><wiki:Link cssClass="slimbox" 
page="${cookiePage}">${cookiePage}</wiki:Link></td>
+          <td><div class="btn btn-xs btn-danger" 
data-delete-cookie="${aCookie.name}"><fmt:message 
key="prefs.user.pagecookie.delete"/></div></td>
+        </tr>
+      </c:if>
+    </c:forEach>
+    </table>
+  </div>
+
 </form>

Reply via email to