Skip to content

Commit

Permalink
Item1860: add domain to web hash to allow us to share foswiki's betwe…
Browse files Browse the repository at this point in the history
…en different domains, each showing a different default web.

git-svn-id: http://svn.foswiki.org/trunk@4564 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Jul 27, 2009
1 parent 75a95ce commit 62489cc
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
33 changes: 29 additions & 4 deletions HomePagePlugin/data/System/HomePagePlugin.txt
@@ -1,19 +1,43 @@
---+!! !HomePagePlugin
<!--
One line description, required for extensions repository catalog.
* Set SHORTDESCRIPTION = Allow User specified home pages - on login
* Set SHORTDESCRIPTION = Allow sitewide, user or hostname specified default pages
-->
%SHORTDESCRIPTION%

%TOC%

---++ Usage

This plugin makes the Default frontpage configurable - any time a user goes to %SCRIPTURL{view}% they will be shown the topic =configured=
This plugin makes the Default frontpage configurable -
1 any time a user goes to %SCRIPTURL{view}% they will be shown the topic =configured=
by the Foswiki administrator in ={HomePagePlugin}{SiteDefaultTopic}= in the Extensions section of =configure=.
2 if =GotoHomePageOnLogin= is set, when a user logs in, they will be shown the topic specificed in their UserForm

Additionally, there is now an __EXPERT__ setting that allows you to set different frontpages for each domain or protocol,
which means you _could_ define a hostname per web

---++ TemplateLogin configurable HomePage on login
eg
<verbatim>
'http://home.org.au' => 'HomeOrgAu',
'http://www.home.org.au' => 'HomeOrgAu',
'http://dowideit.org' => 'Blog',
'http://www.dowideit.org' => 'Blog',
'https://dowideit.org' => 'Secure',
</verbatim>

or
<verbatim>
'http://download.foswiki.org' => 'Download',
'http://tasks.foswiki.org' => 'Tasks',
'http://development.foswiki.org' => 'Development',
'http://extensions.foswiki.org' => 'Extensions',
'http://community.foswiki.org' => 'Community',
'http://support.foswiki.org' => 'Support',
'http://Sven.foswiki.org' => 'Main.SvenDowideit',
</verbatim>

---++ !TemplateLogin configurable !HomePage on login
The Admin can also =configure= ={HomePagePlugin}{GotoHomePageOnLogin}= so Foswiki Always show user's
HomePage (from the UserForm field in their User topic.) when they log in (makes sense if users have personalised home pages.)
__Note__ that this means that any URL's emailed to them will only be useful after login.
Expand All @@ -29,10 +53,11 @@ Many thanks to the following sponsors for supporting this work:
* Created for Blackfin inc.

| Author(s): | Foswiki:Main.SvenDowideit|
| Copyright: | &copy; 2009 SvenDowideit@fosiki.com|
| Copyright: | &copy; 2009 SvenDowideit@fosiki.com |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License 3)]] |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| July 2009 | add Expert hash allowing domain name based frontpage setting |
| Feb 2009 | initial version |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | http://foswiki.org/bin/view/Extensions/HomePagePlugin |
Expand Down
7 changes: 7 additions & 0 deletions HomePagePlugin/lib/Foswiki/Plugins/HomePagePlugin.pm
@@ -1,5 +1,7 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# (c) 2009: Sven Dowideit, SvenDowideit@fosiki.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
Expand Down Expand Up @@ -73,6 +75,11 @@ sub initializeUserHandler {
if (($path_info eq '' or $path_info eq '/') or
($gotoOnLogin) ) {
my $siteDefault = $Foswiki::cfg{HomePagePlugin}{SiteDefaultTopic};
#$Foswiki::cfg{HomePagePlugin}{HostnameMapping}
my $hostName = lc(Foswiki::Func::getUrlHost());
if (defined($Foswiki::cfg{HomePagePlugin}{HostnameMapping}->{$hostName})) {
$siteDefault = $Foswiki::cfg{HomePagePlugin}{HostnameMapping}->{$hostName};
}

if (Foswiki::Func::topicExists($Foswiki::cfg{UsersWebName},
Foswiki::Func::getWikiName($loginName)) ) {
Expand Down
14 changes: 13 additions & 1 deletion HomePagePlugin/lib/Foswiki/Plugins/HomePagePlugin/Config.spec
Expand Up @@ -6,8 +6,20 @@ $Foswiki::cfg{HomePagePlugin}{SiteDefaultTopic} = '';


# **BOOLEAN**
#Always show user's HomePage when they log in (makes sense if users have personalised home pages.)
#Always show user's HomePage (from the UserForm field in their User topic.)
#when they log in (makes sense if users have personalised home pages.)
#but will mean that any URL's emailed to them will only be useful after login
$Foswiki::cfg{HomePagePlugin}{GotoHomePageOnLogin} = $FALSE;

# **PERL EXPERT**
# a hash mapping hostnames to DefaultTopics
# (so http://home.org.au and http://dowideit.org can use the same foswiki, but show different webs)
# defaults to {SiteDefaultTopic} above. *make sure the domain portion is specified in lower case*
$Foswiki::cfg{HomePagePlugin}{HostnameMapping} = {
'http://home.org.au' => 'HomeOrgAu',
'http://www.home.org.au' => 'HomeOrgAu',
'http://dowideit.org' => 'Blog',
'http://www.dowideit.org' => 'Blog',
};


0 comments on commit 62489cc

Please sign in to comment.