Short description
In wikis with a lot of inexperienced users it would be very nice to directly have after account creation some kind of welcome screen which gives further explanation and information what to do now (recommandation to create a user homepage, read the "WikiQuicky" or other small HowTo pages, look at HelpContents, SyntaxReference...). This idea goes back to some usability observation by ChristophKoenig UsabilityObservation/ClickLoginInsteadOfCreateProfile and his solution for that at ChristophKoenig/LoginPages. Also on my wiki it would be very helpful to have that. So I have written a small implementation for Moin 1.6dev, hoping that this might be integrated there in some way.
Patch for Moin 1.6dev (moin-1-6-main-7c58e8af1a97)
1.) Introduce a new wikiconfig.py / multiconfig.py var with "show_welcome = False" as default:
1 --- multiconfig_old.py 2006-12-10 16:18:40.000000000 +0100
2 +++ multiconfig.py 2006-12-10 12:34:30.000000000 +0100
3 @@ -379,6 +379,7 @@
4 show_section_numbers = 0
5 show_timings = False
6 show_version = False
7 + show_welcome = False
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
2.) Make some minor changes to user.py:
1 --- user_old.py 2007-01-14 15:18:54.000000000 +0100
2 +++ user.py 2007-01-18 17:20:06.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_welcome = 0
8 self.theme_name = self._cfg.theme_default
9 self.editor_default = self._cfg.editor_default
10 self.editor_ui = self._cfg.editor_ui
11 @@ -386,6 +387,7 @@
12 vars(self)[key] = val
13
14 self.tz_offset = int(self.tz_offset)
15 + self.show_welcome = int(self.show_welcome)
16
17 # Remove old unsupported attributes from user data file.
18 remove_attributes = ['passwd', 'show_emoticons']
3.) To get the redirection work after log-in, you have to change request/_init_.py as follows:
1 --- __init__old.py 2007-01-14 15:34:48.000000000 +0100
2 +++ __init__.py 2007-01-18 18:03:10.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_welcome for new users is activated in wikiconfig.py
9 + # and user hasn't turned of welcome page as starting page, show WelcomeUser page
10 + elif not pagename and self.cfg.show_welcome and self.user.show_welcome:
11 + welcome = wikiutil.getSysPage(self, 'WelcomeUser').url(self, escape=0, relative=False)
12 + self.http_redirect(welcome)
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
4.) That's it. To get it work you now must just create a new underlay page "WelcomeUser":
1 ## Please edit system and help pages ONLY in the moinmaster wiki! For more
2 ## information, please see MoinMaster:MoinPagesEditorGroup.
3 ##master-page:Unknown-Page
4 ##master-date:Unknown-Date
5 #acl MoinPagesEditorGroup:read,write,delete,revert All:read
6 #format wiki
7 #language en
8
9 = Welcome =
10
11 Hello, [[CurrentUser]]! Welcome to this wiki. You can now
12 * Create your [[CreateUserHomepage(WikiHomepage)]]
13 * Edit your [[Action(userprefs, UserPreferences)]]
14 * Look at the HelpContents to learn more about wikis
15 * Go to the FrontPage and browse this wiki
16
17 == Creating a homepage ==
18 A personal home page is a nice place to publish data ''about yourself'', like:
19 * who you are, what you do, what you like or dislike
20 * your phone number, email address or other contact data
21 * a photo of yourself
22
23 You also can use it to keep things ''for yourself'' (and maybe also for others), like:
24 * your favourite links
25 * your todo list
26 * your notes
27
28 Keep in mind that the home page itself is usually ''public'', everybody can read and also write it (and this is a good thing, see it as a means of communication with you). But you can also create protected sub-pages of it, so restricting access to some of your pages is no problem.
29
30 You don't have to create a home page, but normally all users who often work with this wiki do have a homepage. If you want to create a homepage, click on '''CreateHomePageNow'''. You then will be promptet to create a new page. Now you can choose either the homepage page template or just create an empty page and style your homepage as you want.
31
32 == Editing your userpreferences ==
33 On the [[Action(userprefs, UserPreferences)]] page you can customize the wiki to your needs.
34
35 == Help contents ==
36 On the HelpContents page you find a list of the most important help pages. For a short overview of the wiki markup see SyntaxReference.
37
38 == FrontPage ==
39 The FrontPage of this wiki is a good starting point to systematically explore this wiki.
40
41 == Show this page again? ==
42 If you don't want this page to be shown again on your next visit, check the check box and click on ''Save''.
43
44 [[ToggleWelcome]]
45
To get this page correctly displayed you also need these new marcos and actions:
CurrentUser.py: Displays the name of the current user so as to welcome him by name.
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - CurrentUser macro
4
5 Syntax:
6 [[CurrentUser]]
7
8 @copyright: 2006 by Oliver Siemoneit
9 @license: GNU GPL, see COPYING for details.
10 """
11
12 from MoinMoin import user
13
14 def execute(macro, args):
15 request = macro.request
16 _ = request.getText
17
18 if request.user.isCurrentUser():
19 name = request.user.name
20 aliasname = request.user.aliasname
21 if not aliasname:
22 aliasname = name
23 if aliasname == "":
24 return _('<unknown>')
25 return aliasname
26
27 return _('<unknown>')
CreateUserHomepage.py: Creates a link to the new user homepage and takes also care of the user_homewiki var.
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - CreateUserHomepage
4
5 Syntax:
6 [[CreateUserHomepage]]
7 Default text of the generated link for homepage ceration is "username"
8
9 [[CreateUserHomepage(Link Text)]]
10 Text of the generated link for homepage ceration is "Link Text"
11
12 ToDo:
13 Append "?action=edit&template=HomepageTemplate" as wikitail to force
14 template usage for homepage creation. At least: create an option for that.
15
16 CreateUserHomepage partly based on
17 MoinMoin - Theme Package
18 @copyright: 2003-2006 by MoinMoin:ThomasWaldmann
19
20 MoinMoin - CreateUserHomepage
21 @copyright: 2006 by Oliver Siemoneit
22 @license: GNU GPL, see COPYING for details.
23 """
24
25 from MoinMoin import user, wikiutil
26
27 def execute(macro, args):
28 request = macro.request
29 _ = request.getText
30
31 if request.user.valid and request.user.name:
32 interwiki = wikiutil.getInterwikiHomePage(request)
33 name = request.user.name
34 aliasname = request.user.aliasname
35 if not aliasname:
36 aliasname = name
37 title = "%s @ %s" % (aliasname, interwiki[0])
38 # link to (interwiki) user homepage
39 if args is None:
40 homelink = "%s%s%s" % (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki),
41 request.formatter.text(name),
42 request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
43 return homelink
44 else:
45 homelink = "%s%s%s" % (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki),
46 request.formatter.text(args),
47 request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
48 return homelink
49 else:
50 if args is None:
51 return _('<unknown>')
52 else:
53 return args # or: "%s. %s" % (args, _('Please log in first'))
ToggleWelcome.py: Displays a form in the page which allows to turn the welcome screen of (checkbox with text "Don't show page again on next visit").
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - ToggleWelcome form
4
5 Syntax:
6 [[ToggleWelcome]]
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_welcome:
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="togglewelcome">
42 <input type="hidden" name="ticket" value="%(ticket)s">
43 <table border="0">
44 <tr>
45 <td><input type="checkbox" name="toggle_welcome" id="chktoggle_welcome" value="%(value)s" %(checked)s></td>
46 <td><label for="chktoggle_welcome">%(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, }
togglewelcome.py: The corresponding action for the ToggleWelcome macro, which does the event handling of the form.
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - togglewelcome action
4
5 This is the backend of the ToggleWelcome 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_welcome'):
27 request.user.show_welcome = 0
28 request.user.save()
29 return page.send_page(request, msg = _("User preferences saved!"))
30 else:
31 request.user.show_welcome = 1
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.'))
5.) You can also change the MissingHomePage page and add CreateUserHomepage there so as not to run into troubles if user_homewiki var is set.
1 ## Please edit system and help pages ONLY in the moinmaster wiki! For more
2 ## information, please see MoinMaster:MoinPagesEditorGroup.
3 ##master-page:Unknown-Page
4 ##master-date:Unknown-Date
5 #acl MoinPagesEditorGroup:read,write,delete,revert All:read
6 #format wiki
7 #language en
8 It looks like you have not created your personal home page yet.
9
10 A personal home page is a nice place to publish data ''about yourself'', like:
11 * who you are, what you do, what you like or dislike
12 * your phone number, email address or other contact data
13 * a photo of yourself
14
15 You also can use it to keep things ''for yourself'' (and maybe also for others), like:
16 * your favourite links
17 * your todo list
18 * your notes
19
20 Keep in mind that the home page itself is usually ''public'', everybody can read and also write it (and this is a good thing, see it as a means of communication with you). But you can also create protected sub-pages of it, so restricting access to some of your pages is no problem.
21
22 [[CreateUserHomepage(Create my home page now!)]]
23
24 If you don't want a home page, just click somewhere else.
6.) In wikiconfig.py you can now activate the "WelcomeUser" feature by:
show_welcome = True
You can also change the WelcomeUser page now as you want and adapt it to your needs. That's it. The new "WelcomeYouLoser" screen (no, just kidding ) should work now.
-- OliverSiemoneit 2006-12-10 16:11:53
Discussion
There may be much more user relevant macros possible. We should start with these two refactored into one User macro with parameters or/and keywords. CurrentUser could be default of User and [[User(CreateHomePage)]] then the other one. -- ReimarBauer 2007-01-07 10:26:08
Ok. Here is a proposal for a richer User.py macro. I have also moved calling the userpreferences in the macro now. Maybe we can change the old code since we don't need a UserPreferences macro anymore, since it's part of User now. Calling userprefs macro with [[UserPreferences(createonly)]] is no longer needed, since I have written a separate CreateAccount macro for that, see FeatureRequests/SeparateCreateAccountPage and an enhanced create-account-and-mail which is the new MakeInvitations macro, see FeatureRequests/MakeInvitations! To get the welcome screen correctly work with mail invitation, the http-redirect as suggested above should not take place in action/_init_.py but in the place where authentication and login is done (I don't understand the code there..). If login is successfull, Moin can check the new bool value in User class "show_welcome=True" and redirect than (like the existing redirect to last visited page). Another idea is to place on the new underlay page "Welcome new user" as small checkmark box "Don't display welcome screen again". So user can toggle this.. We could also enhance this idea of redirection after login to have a new setting in userprefs "Redirect to my Homepage" (not only last visited page) or admins could set a certain page in wikiconfig.py to display after login, e.g. to give some security advice or update information for the existing users ("Our wiki is now updated on Moin 1.6 with fulltext attachment search. To learn more about the new search functionaliy, go to...." see FeatureRequests/AdminSplashScreen) -- OliverSiemoneit 2007-01-07 19:19:28
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - User macro
4
5 Syntax:
6 [[User]]
7 Displays the name of the current user
8
9 [[User(homepage)]]
10 Displays a link to the user's homepage
11
12 [[User(homepage=Your link text)]]
13 Displays a renamed link to the user's homepage
14
15 [[User(preferences)]]
16 Display the user's preferences
17
18 @copyright: 2007 by Oliver Siemoneit
19 @license: GNU GPL, see COPYING for details.
20 """
21
22 from MoinMoin import user, wikiutil
23
24 def _getArgs(given_arguments, allowed_arguments):
25 if not given_arguments:
26 return {}
27
28 args = {}
29 for s in given_arguments.split(','):
30 if s and s.find('=') > 0:
31 key, value = s.split('=', 1)
32 key = key.strip()
33 if key and value:
34 if key in allowed_arguments:
35 args[key] = wikiutil.escape(value.strip())
36 else:
37 if key in allowed_arguments:
38 args[key] = None
39 else:
40 key = s.strip()
41 if key in allowed_arguments:
42 args[key] = None
43
44 return args
45
46 def _displayUserName(request):
47 _ = request.getText
48
49 if request.user.isCurrentUser():
50 name = request.user.name
51 aliasname = request.user.aliasname
52 if not aliasname:
53 aliasname = name
54 if aliasname == "":
55 return _('<unknown>')
56 return aliasname
57
58 return _('<unknown>')
59
60 def _displayHomepageLink(request, linktext):
61 _ = request.getText
62
63 if request.user.valid and request.user.name:
64 interwiki = wikiutil.getInterwikiHomePage(request)
65 name = request.user.name
66 aliasname = request.user.aliasname
67 if not aliasname:
68 aliasname = name
69 title = "%s @ %s" % (aliasname, interwiki[0])
70 # link to (interwiki) user homepage
71 if linktext is None:
72 homelink = "%s%s%s" % (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki),
73 request.formatter.text(name),
74 request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
75 return homelink
76 else:
77 homelink = "%s%s%s" % (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki),
78 request.formatter.text(linktext),
79 request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
80 return homelink
81 else:
82 if linktext is None:
83 return _('<unknown>')
84 else:
85 return linktext
86
87 def _displayUserPreferences(request):
88 from MoinMoin import userform
89
90 return request.formatter.rawHTML(userform.getUserForm(request, create_only=False))
91
92
93 def execute(macro, given_args):
94 request = macro.request
95
96 allowed_args = ['homepage', 'preferences']
97 args = _getArgs(given_args, allowed_args)
98
99 if not args:
100 return _displayUserName(request)
101
102 elif args.has_key('homepage'):
103 return _displayHomepageLink(request, args['homepage'])
104
105 elif args.has_key('preferences'):
106 return _displayUserPreferences(request)
107
108 return
Annotation: ToggleWelcome.py could also be integrated in the user macro, but I haven't done this yet.. Also ToggleSplash from FeatureRequests/AdminSplashScreen