Attachment 'AdminSplash.diff'

Download

   1 diff -urN MoinMoin_orig/action/togglesplash.py MoinMoin_patched/action/togglesplash.py
   2 --- MoinMoin_orig/action/togglesplash.py	1970-01-01 01:00:00.000000000 +0100
   3 +++ MoinMoin_patched/action/togglesplash.py	2007-01-20 23:08:24.000000000 +0100
   4 @@ -0,0 +1,35 @@
   5 +# -*- coding: iso-8859-1 -*-
   6 +"""
   7 +    MoinMoin - togglesplash action
   8 +
   9 +    This is the backend of the ToggleSplash macro
  10 +    
  11 +    @copyright: 2007 by Oliver Siemoneit
  12 +    @license: GNU GPL, see COPYING for details.
  13 +"""
  14 +
  15 +from MoinMoin.Page import Page
  16 +from MoinMoin import wikiutil
  17 +
  18 +def execute(pagename, request):
  19 +    _ = request.getText
  20 +    page = Page(request, pagename)
  21 +     
  22 +    if not request.user.valid:
  23 +        return page.send_page(request,
  24 +            msg = _('Please log in first.'))
  25 +
  26 +    if request.form.has_key('action') and request.form.has_key('ticket'):
  27 +        if not wikiutil.checkTicket(request, request.form['ticket'][0]):
  28 +            return page.send_page(request,
  29 +                msg = _('Please use the interactive user interface.'))
  30 +        if request.form.has_key('toggle_splash'):
  31 +            request.user.show_splash = request.cfg.show_splash
  32 +            request.user.save()
  33 +            return page.send_page(request, msg = _("User preferences saved!"))
  34 +        else:
  35 +            request.user.show_splash = ''
  36 +            request.user.save()
  37 +            return page.send_page(request, msg = _("User preferences saved!"))
  38 +
  39 +    return page.send_page(request, msg = _('Please use the interactive user interface.'))
  40 diff -urN MoinMoin_orig/config/multiconfig.py MoinMoin_patched/config/multiconfig.py
  41 --- MoinMoin_orig/config/multiconfig.py	2006-12-10 16:18:40.000000000 +0100
  42 +++ MoinMoin_patched/config/multiconfig.py	2007-01-19 16:16:48.000000000 +0100
  43 @@ -379,6 +379,7 @@
  44      show_section_numbers = 0
  45      show_timings = False
  46      show_version = False
  47 +    show_splash = ''
  48      siteid = 'default'
  49      stylesheets = [] # list of tuples (media, csshref) to insert after theme css, before user css
  50      subscribed_pages_default = [] # preload user subscribed pages with this page list
  51 diff -urN MoinMoin_orig/macro/ToggleSplash.py MoinMoin_patched/macro/ToggleSplash.py
  52 --- MoinMoin_orig/macro/ToggleSplash.py	1970-01-01 01:00:00.000000000 +0100
  53 +++ MoinMoin_patched/macro/ToggleSplash.py	2007-01-19 16:24:30.000000000 +0100
  54 @@ -0,0 +1,57 @@
  55 +# -*- coding: iso-8859-1 -*-
  56 +"""
  57 +    MoinMoin - ToggleSplash form
  58 +    
  59 +    Syntax:
  60 +       [[ToggleSplash]]
  61 +
  62 +    @copyright: 2007 by Oliver Siemoneit
  63 +    @license: GNU GPL, see COPYING for details.
  64 +"""
  65 +
  66 +from MoinMoin import wikiutil
  67 +
  68 +def execute(macro, args):
  69 +    request = macro.request
  70 +    _ = request.getText
  71 +
  72 +    if not request.user.valid:
  73 +        return
  74 +        
  75 +    ticket = wikiutil.createTicket(request)
  76 +    
  77 +    sn = request.getScriptname()
  78 +    pi = request.getPathinfo()
  79 +    action = u"%s%s" % (sn, pi)
  80 + 
  81 +    lang_attr = request.theme.ui_lang_attr()
  82 +    buttontext = _('Save')
  83 +    label = _("Don't show this page again")
  84 +
  85 +    if request.user.show_splash != request.cfg.show_splash:
  86 +        checked = ''
  87 +        value = '0'
  88 +    else:
  89 +        checked = 'checked'
  90 +        value = '1'
  91 +        
  92 +    return '''
  93 +<form action="%(action)s" method="POST">
  94 +<div class="userpref" %(lang_attr)s>
  95 +<input type="hidden" name="action" value="togglesplash">
  96 +<input type="hidden" name="ticket" value="%(ticket)s">
  97 +<table border="0">
  98 +<tr>
  99 +<td><input type="checkbox" name="toggle_splash" id="chktoggle_splash" value="%(value)s" %(checked)s></td>
 100 +<td><label for="chktoggle_splash">%(label)s</label></td>
 101 +<td><input type="submit" name="save_toggle" value="%(buttontext)s"></td>
 102 +</tr>
 103 +</table>
 104 +</form>''' % { 'action': action,
 105 +               'lang_attr': lang_attr,
 106 +               'ticket': ticket,
 107 +               'value': value,
 108 +               'checked': checked,            
 109 +               'label': label,
 110 +               'buttontext': buttontext, }
 111 +
 112 diff -urN MoinMoin_orig/request/__init__.py MoinMoin_patched/request/__init__.py
 113 --- MoinMoin_orig/request/__init__.py	2007-01-14 15:34:48.000000000 +0100
 114 +++ MoinMoin_patched/request/__init__.py	2007-01-19 16:17:32.000000000 +0100
 115 @@ -1088,7 +1088,14 @@
 116                  page = wikiutil.getSysPage(self, 'UserPreferences')
 117                  page.send_page(self, msg=msg)
 118  
 119 -            # 2. Or jump to page where user left off
 120 +            # 2. If show_splash is activated in wikiconfig.py and user hasn't turned
 121 +            # of splash screen, show it
 122 +            elif not pagename and self.cfg.show_splash != '' and (self.user.show_splash != self.cfg.show_splash):
 123 +                splash = Page(self, self.cfg.show_splash).url(self, escape=0, relative=False)
 124 +                self.http_redirect(splash)
 125 +                return self.finish()
 126 +                
 127 +            # 3. Or jump to page where user left off
 128              elif not pagename and self.user.remember_last_visit:
 129                  pagetrail = self.user.getTrail()
 130                  if pagetrail:
 131 @@ -1104,7 +1111,7 @@
 132                  self.http_redirect(url)
 133                  return self.finish()
 134  
 135 -            # 3. Or handle action
 136 +            # 4. Or handle action
 137              else:
 138                  # pagename could be empty after normalization e.g. '///' -> ''
 139                  # Use localized FrontPage if pagename is empty

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-01-20 22:13:02, 5.4 KB) [[attachment:AdminSplash.diff]]
  • [get | view] (2007-01-19 16:26:31, 1.5 KB) [[attachment:ToggleSplash.py]]
  • [get | view] (2007-01-19 16:21:49, 0.4 KB) [[attachment:multiconfig.diff]]
  • [get | view] (2007-01-19 16:25:35, 1.3 KB) [[attachment:request__init__.diff]]
  • [get | view] (2007-01-20 22:13:30, 1.2 KB) [[attachment:togglesplash.py]]
  • [get | view] (2007-01-19 16:24:18, 0.5 KB) [[attachment:user.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.