Short description

Here's again a feature request that makes some people roll their eyes ('Oh gosh. Go away with that!') and the other shout out 'Yipee!'. So keep calm, take a seat and here it comes, the request is shown as follows:

It would be nice if the wikiadmin could also force by some setting in wikiconfig.py a certain start page / splash screen. This could be very useful if you want to assure that people on login do really read these important information. If you don't have a splash screen you will probably loose all those users who have activated "Remember_Last_Visit" / "Jump to page last visited". Maybe they don't care looking at the front page. With this feature at hand you can assure, that every wikiuser must read the information before browsing the wiki. And that could be quite usefull depending of the wiki and its users. But this request mainly aims at wikis with a lot of inexperienced users or for larger companies and intranet usage.

Here are some scenerios for a splash screen:

-- OliverSiemoneit 2007-01-19 16:20:08

Great. I like that request. Looking forward to see that -- DollyBuster 2007-01-07 20:19:28

+1 -- HeinzKohut 2007-01-07 20:19:28

Thanks :-) -- OliverSiemoneit 2007-01-19 16:20:08

Here is a patch for Moin 1.6 (moin-1-6-main-7c58e8af1a97)

1.) Add a new var in multiconfig.py

   1 --- multiconfig_old.py	2006-12-10 16:18:40.000000000 +0100
   2 +++ multiconfig.py	2007-01-19 16:16:48.000000000 +0100
   3 @@ -379,6 +379,7 @@
   4      show_section_numbers = 0
   5      show_timings = False
   6      show_version = False
   7 +    show_splash = ''
   8      siteid = 'default'
   9      stylesheets = [] # list of tuples (media, csshref) to insert after theme css, before user css
  10      subscribed_pages_default = [] # preload user subscribed pages with this page list

multiconfig.diff

2.) Make some changes to user.py

   1 --- user_old.py	2007-01-14 15:18:54.000000000 +0100
   2 +++ user.py	2007-01-19 16:16:28.000000000 +0100
   3 @@ -248,6 +248,7 @@
   4          self.datetime_fmt = ""
   5          self.quicklinks = self._cfg.quicklinks_default
   6          self.subscribed_pages = self._cfg.subscribed_pages_default
   7 +        self.show_splash = ""
   8          self.theme_name = self._cfg.theme_default
   9          self.editor_default = self._cfg.editor_default
  10          self.editor_ui = self._cfg.editor_ui

user.diff

3.) To get the redirect work, you have to change request/_init_.py

   1 --- __init__old.py	2007-01-14 15:34:48.000000000 +0100
   2 +++ __init__.py	2007-01-19 16:17:32.000000000 +0100
   3 @@ -1088,7 +1088,14 @@
   4                  page = wikiutil.getSysPage(self, 'UserPreferences')
   5                  page.send_page(self, msg=msg)
   6  
   7 -            # 2. Or jump to page where user left off
   8 +            # 2. If show_splash is activated in wikiconfig.py and user hasn't turned
   9 +            # of splash screen, show it
  10 +            elif not pagename and self.cfg.show_splash != '' and (self.user.show_splash != self.cfg.show_splash):
  11 +                splash = Page(self, self.cfg.show_splash).url(self, escape=0, relative=False)
  12 +                self.http_redirect(splash)
  13 +                return self.finish()
  14 +                
  15 +            # 3. Or jump to page where user left off
  16              elif not pagename and self.user.remember_last_visit:
  17                  pagetrail = self.user.getTrail()
  18                  if pagetrail:
  19 @@ -1104,7 +1111,7 @@
  20                  self.http_redirect(url)
  21                  return self.finish()
  22  
  23 -            # 3. Or handle action
  24 +            # 4. Or handle action
  25              else:
  26                  # pagename could be empty after normalization e.g. '///' -> ''
  27                  # Use localized FrontPage if pagename is empty

request__init__.diff

4.) In wikiconig.py you can now set a splash screen by:

show_splash="SplashPageName"

5.) To allow the user to toggle the splash screen, please add to the splash page the macro call [[ToggleSplash]]. ToggleSplash displays a small checkbox with the labeltext "Don't show page again" and a save setting button.

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - ToggleSplash form
   4     
   5     Syntax:
   6        [[ToggleSplash]]
   7 
   8     @copyright: 2007 by Oliver Siemoneit
   9     @license: GNU GPL, see COPYING for details.
  10 """
  11 
  12 from MoinMoin import wikiutil
  13 
  14 def execute(macro, args):
  15     request = macro.request
  16     _ = request.getText
  17 
  18     if not request.user.valid:
  19         return
  20         
  21     ticket = wikiutil.createTicket(request)
  22     
  23     sn = request.getScriptname()
  24     pi = request.getPathinfo()
  25     action = u"%s%s" % (sn, pi)
  26  
  27     lang_attr = request.theme.ui_lang_attr()
  28     buttontext = _('Save')
  29     label = _("Don't show this page again")
  30 
  31     if request.user.show_splash != request.cfg.show_splash:
  32         checked = ''
  33         value = '0'
  34     else:
  35         checked = 'checked'
  36         value = '1'
  37         
  38     return '''
  39 <form action="%(action)s" method="POST">
  40 <div class="userpref" %(lang_attr)s>
  41 <input type="hidden" name="action" value="togglesplash">
  42 <input type="hidden" name="ticket" value="%(ticket)s">
  43 <table border="0">
  44 <tr>
  45 <td><input type="checkbox" name="toggle_splash" id="chktoggle_splash" value="%(value)s" %(checked)s></td>
  46 <td><label for="chktoggle_splash">%(label)s</label></td>
  47 <td><input type="submit" name="save_toggle" value="%(buttontext)s"></td>
  48 </tr>
  49 </table>
  50 </form>''' % { 'action': action,
  51                'lang_attr': lang_attr,
  52                'ticket': ticket,
  53                'value': value,
  54                'checked': checked,            
  55                'label': label,
  56                'buttontext': buttontext, }

ToggleSplash.py

6.) To get the form work you need also this action, which does the event handling.

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - togglesplash action
   4 
   5     This is the backend of the ToggleSplash macro
   6     
   7     @copyright: 2007 by Oliver Siemoneit
   8     @license: GNU GPL, see COPYING for details.
   9 """
  10 
  11 from MoinMoin.Page import Page
  12 from MoinMoin import wikiutil
  13 
  14 def execute(pagename, request):
  15     _ = request.getText
  16     page = Page(request, pagename)
  17      
  18     if not request.user.valid:
  19         return page.send_page(request,
  20             msg = _('Please log in first.'))
  21 
  22     if request.form.has_key('action') and request.form.has_key('ticket'):
  23         if not wikiutil.checkTicket(request, request.form['ticket'][0]):
  24             return page.send_page(request,
  25                 msg = _('Please use the interactive user interface.'))
  26         if request.form.has_key('toggle_splash'):
  27             request.user.show_splash = request.cfg.show_splash
  28             request.user.save()
  29             return page.send_page(request, msg = _("User preferences saved!"))
  30         else:
  31             request.user.show_splash = ''
  32             request.user.save()
  33             return page.send_page(request, msg = _("User preferences saved!"))
  34 
  35     return page.send_page(request, msg = _('Please use the interactive user interface.'))

togglesplash.py

/!\ Please make sure each time you put a new splash screen for startup, name it differently than the old one otherwise the page won't be shown to the user!! I recommand to name the splash screen "splash" followed by the date as not to run into trouble, e.g. "splash-dd-mm-yy".

That's it! -- OliverSiemoneit 2007-01-19 16:20:08

(!) And now do that again and use diff -urN oldtree newtree to generate a single diff. :)

:-) Cool. Didn't know that. Here's a unified diff AdminSplash.diff . However it's not that talkative. Explaining a patch what you have done and why you have done it isn't that bad either..


Can someone update this feature for moin_18x. I tried but no success. I think problem is with changes of multiconfig file. Thanks

It is good functionality to administrate the wiki users. I send always emails to my users, when i want to say anything about wiki and offcourse it is not comfortable. Can you please activate/update this functionality for moin-193?

Moin already has a configurable html header. You can use this to give hints to users (see header of http://master18.moinmo.in/ ). -- ThomasWaldmann 2010-10-29 15:54:38


CategoryFeaturePatched

MoinMoin: FeatureRequests/AdminSplashScreen (last edited 2010-10-29 15:54:39 by ThomasWaldmann)