Skip to content

Commit

Permalink
Item1156: Create Release01x00 branch
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x00@2738 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Feb 26, 2009
1 parent 340cd2f commit 0369762
Show file tree
Hide file tree
Showing 35 changed files with 1,656 additions and 0 deletions.
49 changes: 49 additions & 0 deletions TWikiCompatibilityPlugin/data/System/TWikiCompatibilityPlugin.txt
@@ -0,0 +1,49 @@
---+!! !TWikiCompatibilityPlugin
<!--
One line description, required for extensions repository catalog.
* Set SHORTDESCRIPTION = add TWiki personality to Foswiki
-->
%SHORTDESCRIPTION%

%TOC%

---++ Usage
Automatically maps requests for legacy TWiki web topics to Foswiki free topics as per
[[http://foswiki.org/Development/TopicNameMappingTable][TopicNameMappingTable]].

Map TWIKIWEB to SYSTEMWEB and MAINWEB to USERSWEB - no Preference settings required.

to add similar auto-compatibility for attachments, add (or uncomment) the following ErrorDocument handeling to
your Apache configuration _in the =pub= section_

<verbatim>
#for TWikiCompatibility
ErrorDocument 404 /foswiki/bin/viewfile
</verbatim>

---+++ TODO:
1 pub file redirection - will probably have to be a final regex in postRendering

---++ Installation Instructions

%$INSTALL_INSTRUCTIONS%

---++ Plugin Info

Many thanks to the following sponsors for supporting this work:
* Acknowledge any sponsors here

| Plugin Author(s): | Sven Dowideit, Michael Daum, Crawford Currie |
| Copyright: | &copy; SvenDowideit@fosiki.com |
| License: | [[http://www.gnu.org/licenses/gpl.html][GPL3 (Gnu General Public License)]] |
| Plugin Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| Dependencies: | %$DEPENDENCIES% |
| Plugin Home: | http://nextwiki.org/bin/view/Extensions/TWikiCompatibilityPlugin |
| Feedback: | http://nextwiki.org/bin/view/Extensions/TWikiCompatibilityPluginDev |
| Appraisal: | http://nextwiki.org/bin/view/Extensions/TWikiCompatibilityPluginAppraisal |

---
*Related Topics:* [[%SYSTEMWEB%.Plugins][Plugins]], %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences

<!-- Do _not_ attempt to edit this topic; it is auto-generated. Please add comments/questions/remarks to the feedback topic on twiki.org instead. -->
6 changes: 6 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebAtom.txt
@@ -0,0 +1,6 @@
%META:TOPICINFO{author="ProjectContributor" date="1138082878" format="1.0" version="$Rev: 8264 $"}%
<title>%WIKITOOLNAME%'s <nop>%WEB% web</title>
<subtitle>%MAKETEXT{"The [_1] web of Foswiki, the Free and Open Source Wiki." args="<nop>%WEB%"}%</subtitle>
%INCLUDE{"%SYSTEMWEB%.WebAtomBase"}% <!--
* Set SKIN = rssatom
-->
2 changes: 2 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebChanges.txt
@@ -0,0 +1,2 @@
%META:TOPICINFO{author="ProjectContributor" date="1163619832" format="1.0" version="$Rev: 13096 $"}%
%INCLUDE{"%SYSTEMWEB%.%TOPIC%"}%
4 changes: 4 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebCreateNewTopic.txt
@@ -0,0 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1131431859" format="1.1" version="$Rev$"}%
<!--
* Set VIEW_TEMPLATE = WebCreateNewTopic
-->
8 changes: 8 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebHome.txt
@@ -0,0 +1,8 @@
%META:TOPICINFO{author="ProjectContributor" date="1231008977" format="1.1" version="1"}%
---++ TWiki Web Home

The TWiki web is required only for the %SYSTEMWEB%.TWikiCompatibilityPlugin, and any installed legacy TWiki plugins to work. Please do not add any content to this web,

Former TWiki web content is now located in [[%SYSTEMWEB%.WebHome][the System web]]

If you do not need TWiki compatibility you can disable =TWikiCompatibilityPlugin= in the [[%SCRIPTURL{configure}%][configure]] Plugins section. This will also hide the TWiki web so it does not appear in any user interfaces. Not even administrators will see it.
2 changes: 2 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebIndex.txt
@@ -0,0 +1,2 @@
%META:TOPICINFO{author="ProjectContributor" date="1163619832" format="1.0" version="$Rev: 13096 $"}%
%INCLUDE{"%SYSTEMWEB%.%TOPIC%"}%
14 changes: 14 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebLeftBarExample.txt
@@ -0,0 +1,14 @@
%META:TOPICINFO{author="ProjectContributor" date="1178746198" format="1.1" version="$Rev: 14836 $"}%
%INCLUDE{"%IF{"context can_login" then="%SYSTEMWEB%.WebLeftBarLogin" else="<nop>"}%" warn="off"}%
* *%MAKETEXT{"Toolbox"}%*
* [[%SCRIPTURLPATH{"view"}%/%BASEWEB%/WebCreateNewTopic?topicparent=%BASETOPIC%][ %ICON{"newtopic"}% %MAKETEXT{"Create New Topic"}%]]
* [[%BASEWEB%.WebTopicList][ %ICON{"index"}% %MAKETEXT{"Index"}%]]
* [[%BASEWEB%.WebSearch][ %ICON{"searchtopic"}% %MAKETEXT{"Search"}%]]
* [[%BASEWEB%.WebChanges][ %ICON{"changes"}% %MAKETEXT{"Changes"}%]]
* [[%BASEWEB%.WebNotify][ %ICON{"notify"}% %MAKETEXT{"Notifications"}%]]
* [[%BASEWEB%.WebRss][ %ICON{"feed"}% %MAKETEXT{"RSS Feed"}%]]
* [[%BASEWEB%.WebStatistics][ %ICON{"statistics"}% %MAKETEXT{"Statistics"}%]]
* [[%BASEWEB%.WebPreferences][ %ICON{"wrench"}% %MAKETEXT{"Preferences"}%]]

---
%INCLUDE{ "%SYSTEMWEB%.WebLeftBarWebsList" }%
8 changes: 8 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebNotify.txt
@@ -0,0 +1,8 @@
%META:TOPICINFO{author="ProjectContributor" date="1112002813" format="1.0" version="$Rev: 15171 $"}%
%MAKETEXT{"This is a subscription service to be automatically notified by e-mail when topics change in this [_1] web. This is a convenient service, so you do not have to come back and check all the time if something has changed. To subscribe, please add a bullet with your [_2] in alphabetical order to this list:" args="*<nop>%WEB%*,[[%SYSTEMWEB%.WikiName][WikiName]]"}%

* %USERSWEB%.WikiGuest
* %USERSWEB%.WikiGuest - example@your.company


%INCLUDE{"%SYSTEMWEB%.WebChangesAlert"}%
8 changes: 8 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebPreferences.txt
@@ -0,0 +1,8 @@
%META:TOPICINFO{author="ProjectContributor" date="1227589168" format="1.1" reprev="1.1" version="1.1"}%
Preferences
* Set WEBBGCOLOR = #FFD8AA
* Set SITEMAPWHAT =
* Set SITEMAPUSETO =
---+++ Don't advertise the TWiki Compatibility web
* Set SITEMAPLIST =
* Set NOSEARCHALL = on
8 changes: 8 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebRss.txt
@@ -0,0 +1,8 @@
%META:TOPICINFO{author="ProjectContributor" date="1112002813" format="1.0" version="$Rev: 13096 $"}%
<channel rdf:about="%SCRIPTURL{"view"}%/%WEB%">
%IF{ "$'URLPARAM{search}'!=''" then="<title><nop>%WIKITOOLNAME% search results for <nop>%URLPARAM{search}%</title>" else="<title><nop>%WIKITOOLNAME%'s <nop>%WEB% web</title>"}%
<link>%SCRIPTURL{"view"}%/%WEB%</link>
<description>%MAKETEXT{"The [_1] web of Foswiki, the Free and Open Source Wiki." args="<nop>%WEB%"}%</description>
%INCLUDE{"%SYSTEMWEB%.WebRssBase"}%<!--
* Set SKIN = rss
-->
2 changes: 2 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebSearch.txt
@@ -0,0 +1,2 @@
%META:TOPICINFO{author="ProjectContributor" date="1163619832" format="1.0" version="$Rev: 13096 $"}%
%INCLUDE{"%SYSTEMWEB%.%TOPIC%"}%
3 changes: 3 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebSearchAdvanced.txt
@@ -0,0 +1,3 @@
%META:TOPICINFO{author="ProjectContributor" date="1163619832" format="1.0" version="$Rev: 13096 $"}%
%META:TOPICPARENT{name="WebSearch"}%
%INCLUDE{"%SYSTEMWEB%.%TOPIC%"}%
12 changes: 12 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebStatistics.txt
@@ -0,0 +1,12 @@
%META:TOPICINFO{author="ProjectContributor" date="1112697648" format="1.0" version="$Rev: 15288 $"}%
%META:TOPICPARENT{name="WebHome"}%
---++ Statistics for <nop>%WEB% Web

| *Month:* | *Topic <br /> views:* | *Topic <br /> saves:* | *File <br /> uploads:* | *Most popular <br /> topic views:* | *Top contributors for <br /> topic save and uploads:* |
| <!--statDate--> | <!--statViews--> | <!--statSaves--> | <!--statUploads--> | <!--statTopViews--> | <!--statTopContributors--> |

*Notes:*
* Do not edit this topic, it is updated automatically. (You can also [[%SCRIPTURL{"statistics"}%/%WEB%][force]] an update)
* [[%SYSTEMWEB%.SiteTools#WebStatistics_site_statistics][Site tools]] tells you how to enable the automatic updates of the statistics.
* Suggestion: You could archive this topic once a year and delete the previous year's statistics from the table.

2 changes: 2 additions & 0 deletions TWikiCompatibilityPlugin/data/TWiki/WebTopicList.txt
@@ -0,0 +1,2 @@
%META:TOPICINFO{author="ProjectContributor" date="1163619832" format="1.0" version="$Rev: 13096 $"}%
%INCLUDE{"%SYSTEMWEB%.%TOPIC%"}%
@@ -0,0 +1,162 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details, published at
# http://www.gnu.org/copyleft/gpl.html

=begin TML
---+ package Foswiki::Plugins::TWikiCompatibilityPlugin
=cut


package Foswiki::Plugins::TWikiCompatibilityPlugin;

# Always use strict to enforce variable scoping
use strict;

require Foswiki::Func; # The plugins API
require Foswiki::Plugins; # For the API version
use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION $debug $pluginName $NO_PREFS_IN_TOPIC );
$VERSION = '$Rev$';
$RELEASE = 'Foswiki-1.0';
$TWiki::RELEASE = 'TWiki 4.2.3';
$SHORTDESCRIPTION = 'add TWiki personality to Foswiki';
$NO_PREFS_IN_TOPIC = 1;
$pluginName = 'TWikiCompatibilityPlugin';

=begin TML
---++ initPlugin($topic, $web, $user, $installWeb) -> $boolean
* =$topic= - the name of the topic in the current CGI query
* =$web= - the name of the web in the current CGI query
* =$user= - the login name of the user
* =$installWeb= - the name of the web the plugin is installed in
=cut

sub initPlugin {
my( $topic, $web, $user, $installWeb ) = @_;

#initialise the augmented template path
augmentedTemplatePath();

return 1;
}

=begin TML
---++ earlyInitPlugin()
If the TWiki web does not exist, change the request to the %SYSTEMWEB%
This may not be enough for Plugins that do have in topic preferences.
=cut

sub earlyInitPlugin {

my $session = $Foswiki::Plugins::SESSION;
if (($session->{webName} eq 'TWiki') &&
(!Foswiki::Func::topicExists($session->{webName}, $session->{topicName}))) {
my $TWikiWebTopicNameConversion = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TWikiWebTopicNameConversion};
$session->{webName} = $Foswiki::cfg{SystemWebName};
if (defined($TWikiWebTopicNameConversion->{$session->{topicName}})) {
$session->{topicName} =
$TWikiWebTopicNameConversion->{$session->{topicName}};
#print STDERR "converted to $session->{topicName}";
}
}
my $MainWebTopicNameConversion = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{MainWebTopicNameConversion};
if (($session->{webName} eq 'Main') &&
(defined($MainWebTopicNameConversion->{$session->{topicName}}))) {
$session->{topicName} =
$MainWebTopicNameConversion->{$session->{topicName}};
#print STDERR "converted to $session->{topicName}";
}

#Map TWIKIWEB to SYSTEMWEB and MAINWEB to USERSWEB
#TODO: should we test for existance and other things?
Foswiki::Func::setPreferencesValue('TWIKIWEB', 'TWiki');
Foswiki::Func::setPreferencesValue('MAINWEB', '%USERSWEB%');

# Load TWiki::Func and TWiki::Plugins, for badly written plugins
# which rely on them being there without using them first
use TWiki;
use TWiki::Func;
use TWiki::Plugins;

return;
}

sub augmentedTemplatePath {
#TWikiCompatibility, need to test to see if there is a twiki.skin tmpl
#allow the user to set the compatibility tempalte path too
unless (defined($Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TemplatePath})) {
my @cfgTemplatePath = split( /\s*,\s*/, $Foswiki::cfg{TemplatePath} );
my @templatePath = ();
foreach my $path (@cfgTemplatePath) {
push(@templatePath, $path);
if ($path =~ /^(.*)\$name(.*)$/) {
#SMELL: hardcoded foswiki and twiki
push(@templatePath, "$1twiki$2");
}
}
$Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TemplatePath} = \@templatePath;
}

return @{$Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TemplatePath}};
}

=pod
---++ postRenderingHandler( $text )
* =$text= - the text that has just been rendered. May be modified in place.
using the same simplistic mechanism as DistributedServersPlugin, we find all
the System and TWiki web pub URL's and make sure they actually exist. If not,
we look in the 'other' place, and modify them if that file does exist.
* TODO: should really protect non-HTML src type url's from re-writing
=cut

sub NOT_postRenderingHandler {
# do not uncomment, use $_[0], $_[1]... instead
#my $text = shift;

# remove duplicated hostPath's
#my $hostUrl = TWiki::Func::getUrlHost( );
#$_[0] =~ s|($hostUrl)($hostUrl)|$1|g;

# $_[0] =~ s/(.*)($Foswiki::cfg{PubUrlPath}\/)(TWiki|$Foswiki::cfg{SystemWebName})([^"']*)/$1.validatePubURL($2, $3, $4)/ge;
$_[0] =~ s/(.*)($Foswiki::cfg{PubUrlPath}\/)([^"'\/]*)([^"'<]*)/$1.validatePubURL($2, $3, $4, $1)/gem;
}

sub validatePubURL {
my ($pubUrl, $web, $file) = @_;
print STDERR "validatePubURL($pubUrl, $web, $file)\n";
my %map = ('TWiki' => $Foswiki::cfg{SystemWebName},
$Foswiki::cfg{SystemWebName} => 'TWiki');

#TODO: make into a hash - and see if we can persist it for fastcgi etc..
my $filePath = $Foswiki::cfg{PubDir}.'/'.$web.$file;
unless (-e $filePath) {
$web = $map{$web};
$filePath = $Foswiki::cfg{PubDir}.'/'.$web.$file;
unless (-e $filePath) {
print STDERR " validatePubURL($pubUrl, $web, $file) ($filePath) - can't find file ine either $map{$web} or $web\n";
}
}
return $pubUrl.$web.$file;
}

1;
@@ -0,0 +1,82 @@
# ---+ Extensions
# ---++ TWikiCompatibilityPlugin
# **PERL**
# a hash mapping TWiki's TWiki web topics to Foswiki's topics
$Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TWikiWebTopicNameConversion} = {
'ATasteOfTWiki' => 'BeginnersStartHere',
'TWikiAccessControl' => 'AccessControl',
'TWikiAddOns' => 'ContributedAddOns',
'TWikiContribs' => 'Contribs',
'TWikiContributor' => 'ProjectContributor',
'TWikiCss' => 'CascadingStyleSheets',
'TWikiDocGraphics' => 'DocumentGraphics',
'TWikiDocumentation' => 'CompleteDocumentation',
'TWikiDownload' => 'DownloadSources',
'TWikiEditingShorthand' => 'EditingShorthand',
'TWikiEnhancementRequests' => 'EnhancementRequests',
'TWikiFaqTemplate' => 'FaqTemplate',
'TWikiFAQ' => 'FrequentlyAskedQuestions',
'TWikiForms' => 'DataForms',
'TWikiGlossary' => 'GlossaryOfTerms',
'TWikiHistory' => 'ReleaseHistory',
'TWikiInstallationGuide' => 'InstallationGuide',
'TWikiJavascripts' => 'JavascriptFiles',
'TWikiLogos' => 'ProjectLogos',
'TWikiMetaData' => 'MetaData',
'TWikiPlannedFeatures' => '_remove_',
'TWikiPlugins' => 'Plugins',
'TWikiPreferences' => 'DefaultPreferences',
'TWikiReferenceManual' => 'ReferenceManual',
'TWikiRegistration' => 'UserRegistration',
'TWikiReleaseNotes04x00' => '_remove_',
'TWikiReleaseNotes04x01' => '_remove_',
'TWikiReleaseNotes04x02' => 'ReleaseNotes01x00',
'TWikiRenderingShortcut' => 'RenderingShortcut',
'TWikiScripts' => 'CommandAndCGIScripts',
'TWikiShorthand' => 'ShortHand',
'TWikiSiteTools' => 'SiteTools',
'TWikiSite' => '_remove_',
'TWikiSkinBrowser' => 'SkinBrowser',
'TWikiSkins' => 'Skins',
'TWikiSystemRequirements' => 'SystemRequirements',
'TWikiTemplates' => 'SkinTemplates',
'TWikiTemplates' => 'TemplateTopics',
'TWikiTopics' => 'TopicsAndWebs',
'TWikiTutorial' => 'TwentyMinuteTutorial',
'TWikiUpgradeGuide' => 'UpgradeGuide',
'TWikiUserAuthentication' => 'UserAuthentication',
'TWikiUsersGuide' => 'UsersGuide',
'TWikiVariablesQuickStart' => 'MacrosQuickStart',
'TWikiVariables' => 'Macros',
'TWikiWebsTable' => 'WebsTable',
'WhatDoesTWikiStandFor' => '_remove_',
'TWikiRegistrationAgent' => 'RegistrationAgent',
#TopicUserMapping topics
'TWikiUserMappingContrib' => 'TopicUserMappingContrib',
'TWikiUserSetting' => 'UserSetting',
'TWikiUsersTemplate' => 'UsersTemplate',
};
# **PERL**
# a hash mapping TWiki's Main web topics to Foswiki's topics
$Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{MainWebTopicNameConversion} = {
'TWikiAdminGroup' => 'AdminGroup',
'TWikiGroupTemplate' => 'GroupTemplate',
'TWikiPreferences' => 'SitePreferences',
'TWikiGroups' => 'WikiGroups',
'TWikiContributor' => 'ProjectContributor',
'TWikiUsers' => 'WikiUsers',
'TWikiGuest' => 'WikiGuest',
'TWikiRegistrationAgent' => 'RegistrationAgent',
'TWikiAdminUser' => 'AdminUser',
};


# **PERL**
# Used by TWikiCompatibilityPlugin view and viewfile auto-compatibility.
# if a topic or attachment is not found in one web, it will try the other.
$Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{WebSearchPath} = {
"$Foswiki::cfg{SystemWebName}" => 'TWiki',
'TWiki' => "$Foswiki::cfg{SystemWebName}"
};

1;
@@ -0,0 +1,5 @@
# Dependencies for TWikiCompatibilityPlugin
# Example:
# Time::ParseDate,>=2003.0211,cpan,Required.
# Foswiki::Plugins,>=1.15,perl,Foswiki 1 release.

0 comments on commit 0369762

Please sign in to comment.