Changeset 1238


Ignore:
Timestamp:
12/09/08 22:54:45 (4 years ago)
Author:
EugenMayer
Message:

Item373: Renaming plugin, generelizing use to export any cookie by name

Location:
trunk/ExportCookiePlugin
Files:
3 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/ExportCookiePlugin/data/System/ExportCookiePlugin.txt

    r1210 r1238  
    11---+!! <nop>%TOPIC% 
    22 
    3 _This Drupal-Connector exports the SID of drupal and makes it available in Foswiki_ 
     3Exports the value of a Cookie into the Foswiki variable <verbatim>%EXPORTCOOKIE%</verbatim> 
    44 
    55%TOC% 
    66 
    77---++ USAGE 
    8 Use the macro <verbatim>%DRUPALSID%</verbatim> to display the sid. You can use this in links or further pugins. 
     8Use the macro <verbatim>%EXPORTCOOKIE%</verbatim> to display the value. You can use this in links or further pugins. 
    99 
    1010---++ Plugin Settings 
    11  
    12 Plugin settings are stored as preferences variables. To reference a plugin setting write ==%<nop>&lt;plugin&gt;_&lt;setting&gt;%==, i.e. ==%<nop>NEWPLUGIN_SHORTDESCRIPTION%== 
    13  
    14    * You need to set the Drupal->SessionHash string in the configure script of Foswiki. You find this hash in your Drupal installation. Please consider the Drupal documentation 
    15       * Hint: You can find the hash by easy checking your cookies when logged in in drupal. 
     11   * you need to set the CookieName in the Foswiki configure-system 
    1612 
    1713---++ Plugin Installation Instructions 
    18  
    19 __Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.  
    20  
    21    * Download the ZIP file from the Plugin Home (see below) 
    22    * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content: 
    23      | *File:* | *Description:* | 
    24      | ==data/System/%TOPIC%.txt== | Plugin topic | 
    25      | ==data/System/%TOPIC%.txt,v== | Plugin topic repository | 
    26      | ==lib/Foswiki/Plugins/%TOPIC%.pm== | Plugin Perl module | 
    27  
     14   * just use the installer attached to the topic or even easier, use the configure-system/Extension to easy install it trough an user-interface 
    2815---++ Plugin Info 
    2916 
    30 |  Plugin Author: | Foswiki:Main.EugenMayer| 
    31 |  Copyright: | &copy; 2007, Impressive.media | 
     17|  Plugin Author: | Foswiki:Main.MayerEugen | 
     18|  Copyright: | &copy; 2006, Impressive.media | 
    3219|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    33 |  Plugin Version: | 01 Dez 2008 (V0.1) | 
     20|  Plugin Version: | 09 Dez 2008 (V0.2) | 
    3421|  Change History: | <!-- versions below in reverse order -->&nbsp; | 
    35 |  01 dEZ 2008: | Initial version | 
    36 |  TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 | 
     22|  09 Dez 2008: | Renamed plugin to ExportCookiePlugin to generelize the use  | 
     23|  01 Dez 2008: | Initial version | 
     24|  Foswiki Dependency: |  | 
    3725|  CPAN Dependencies: | HTTP::Cookies::Find | 
    38 |  Other Dependencies: | none | 
     26|  Other Dependencies: | | 
    3927|  Perl Version: | 5.005 | 
    40 |  [[Foswiki:Extensions/Benchmark][Benchmarks]]: |  | 
    41 |  Plugin Home: | http://foswiki.org/Extensions/%TOPIC% | 
     28|  Add-on Home: | http://foswiki.org/Extensions/%TOPIC% | 
    4229|  Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev | 
    4330|  Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal | 
    4431 
    45 __Related Topics:__ [[%SYSTEMWEB%.Plugins][Plugins]], %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences 
     32__Related Topics:__  
  • trunk/ExportCookiePlugin/lib/Foswiki/Plugins/ExportCookiePlugin/Config.spec

    r1117 r1238  
    1 # ---+ Drupal 
     1# ---+ ExportCookie 
    22# <h2>General Settings</h2> 
    33 
    44# **STRING** 
    5 # Path to the themes folder 
    6  
    7 $Foswiki::cfg{Plugins}{Drupal}{SessionHash}=""; 
     5# Name of the cookie to export 
     6$Foswiki::cfg{Plugins}{ExportCookie}{CookieName}=""; 
  • trunk/ExportCookiePlugin/lib/Foswiki/Plugins/ExportCookiePlugin/MANIFEST

    r1117 r1238  
    1 data/System/DrupalConSidExportPlugin.txt Plugin topic 
    2 lib/Foswiki/Plugins/DrupalConSidExportPlugin.pm Plugin Perl module 
     1data/System/ExportCookiePlugin.txt Plugin topic 
     2lib/Foswiki/Plugins/ExportCookiePlugin.pm Plugin Perl module 
     3lib/Foswiki/Plugins/ExportCookiePlugin/Config.spec 0644 
    34 
  • trunk/ExportCookiePlugin/lib/Foswiki/Plugins/ExportCookiePlugin/build.pl

    r1117 r1238  
    99use Foswiki::Contrib::Build; 
    1010 
    11 $build = new Foswiki::Contrib::Build( "DrupalConSidExportPlugin" ); 
     11$build = new Foswiki::Contrib::Build( "ExportCookiePlugin" ); 
    1212$build->build($build->{target}); 
    1313 
  • trunk/ExportCookiePlugin/lib/Foswiki/Plugins/ExportCookiePluginPlugin.pm

    r1210 r1238  
    1414# http://www.gnu.org/copyleft/gpl.html 
    1515 
    16 package Foswiki::Plugins::DrupalConSidExportPlugin; 
     16package Foswiki::Plugins::ExportCookiePlugin; 
    1717 
    1818use strict; 
     
    2626$RELEASE = 'Dakar'; 
    2727 
    28 $SHORTDESCRIPTION = 'Saves the current PHPsid generated by drupal and makes it available'; 
     28$SHORTDESCRIPTION = 'Exports the value of a cookie into the Foswiki variable %EXPORTCOOKIE%'; 
    2929$NO_PREFS_IN_TOPIC = 1; 
    3030 
    31 $pluginName = 'DrupalConSidExportPlugin'; 
     31$pluginName = 'ExportCookiePlugin'; 
    3232 
    3333sub initPlugin { 
     
    4242    $debug = $Foswiki::cfg{Plugins}{PHPsidPlugin}{Debug} || 0; 
    4343 
    44     Foswiki::Func::registerTagHandler( 'DRUPALSID', \&_DRUPALSID ); 
     44    Foswiki::Func::registerTagHandler( 'EXPORTCOOKIE', \&_GETCOOKIE ); 
    4545    return 1; 
    4646} 
    4747 
    48 sub _DRUPALSID { 
     48sub _GETCOOKIEVALUE { 
    4949    my($this, $params, $theTopic, $theWeb) = @_; 
    50         my $twiki = $this->{twiki}; 
    5150        my $query = Foswiki::Func::getCgiQuery();        
    52         my $sid = ""; 
    53         my $drupalSessionHash = $Foswiki::cfg{Plugins}{Drupal}{SessionHash}; 
     51        my $value = ""; 
     52        my $CookieName = $Foswiki::cfg{Plugins}{ExportCookie}{CookieName}; 
    5453 
    5554        foreach my $name ($query->cookie()) { 
    56                 if($name eq $drupalSessionHash) 
     55                if($name eq $CookieName) 
    5756                { 
    58                         $sid = $query->cookie('-name'=>$name); 
     57                        $value = $query->cookie('-name'=>$name); 
    5958                } 
    6059        } 
    6160         
    62         return $sid; 
     61        return $value; 
    6362} 
    64631; 
Note: See TracChangeset for help on using the changeset viewer.