]> git.pld-linux.org Git - packages/dokuwiki-plugin-icalevents.git/commitdiff
- allow more params via wiki syntax
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 5 Dec 2010 20:47:08 +0000 (20:47 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    allow-params.patch -> 1.1
    dokuwiki-plugin-icalevents.spec -> 1.4

allow-params.patch [new file with mode: 0644]
dokuwiki-plugin-icalevents.spec

diff --git a/allow-params.patch b/allow-params.patch
new file mode 100644 (file)
index 0000000..c150829
--- /dev/null
@@ -0,0 +1,69 @@
+--- dokuwiki-plugin-icalevents-20100501/syntax.php     2010-12-05 22:33:33.062976306 +0200
++++ iCalEvents/syntax.php      2010-12-05 22:44:54.218325084 +0200
+@@ -74,20 +74,32 @@
+         $previewSec = 60*24*3600;  # two month
+       }
+       
++      # Take dateformat from params, or
++      # If dateformat is set in plugin configuration ('dformat'), then use it.
++      # Otherwise fall back to dokuwiki's default dformat from the global /conf/dokuwiki.php.
++      if (!empty($params['dformat'])) {
++        $dateFormat = $params['dformat'];
++      } else {
++        global $conf;
++        $dateFormat = $this->getConf('dformat') ? $this->getConf('dformat') : $conf['dformat'];
++      }
++
++      $showEndDates = !empty($params['showEndDates']);
++      
+       #echo "url=$icsURL from = $from    previewSec = $previewSec<br>";
+       
+-      return array($icsURL, $from, $previewSec); 
++      return array($icsURL, $from, $previewSec, $dateFormat, $showEndDates); 
+     }
+     
+     /**
+      * loads the ics file via HTTP, parses it and renders an HTML table.
+      */
+     function render($mode, &$renderer, $data) {
+-      list($url, $from, $previewSec) = $data;
++      list($url, $from, $previewSec, $dateFormat, $showEndDates) = $data;
+       $ret = '';
+       if($mode == 'xhtml'){
+             # parse the ICS file
+-          $entries = $this->_parseIcs($url, $from, $previewSec);
++          $entries = $this->_parseIcs($url, $from, $previewSec, $dateFormat);
+           if ($this->error) {
+             $renderer->doc .= "Error in Plugin iCalEvents: ".$this->error;
+             return true;
+@@ -103,7 +115,7 @@
+           foreach ($entries as $entry) {
+             $rowCount++;
+             $ret .= '<tr>';
+-                      if ($this->getConf('showEndDates')) {
++                      if ($showEndDates || $this->getConf('showEndDates')) {
+                               $ret .= '<td>'.$entry['startdate'].' - '.$entry['enddate'].'</td>';
+                       } else {
+                               $ret .= '<td>'.$entry['startdate'];
+@@ -130,9 +142,7 @@
+      * @param previewSec preview range also in seconds 
+      * @return an array of entries sorted by their startdate
+      */
+-    function _parseIcs($url, $from, $previewSec) {
+-          global $conf;
+-
++    function _parseIcs($url, $from, $previewSec, $dateFormat) {
+         // must reset error in case we have multiple calendars on page
+         $this->error = false;
+@@ -144,10 +154,6 @@
+         $content    = $http->resp_body;
+         $entries    = array();
+         
+-              # If dateformat is set in plugin configuration ('dformat'), then use it.
+-              # Otherwise fall back to dokuwiki's default dformat from the global /conf/dokuwiki.php.
+-              $dateFormat = $this->getConf('dformat') ? $this->getConf('dformat') : $conf['dformat'];
+-                              
+         # regular expressions for items that we want to extract from the iCalendar file
+         $regex_vevent      = '/BEGIN:VEVENT(.*?)END:VEVENT/s';
+         $regex_summary     = '/SUMMARY:(.*?)\n/';
index 900e38fee355f7e64a293266e5a9ae4583768e26..65be76c76a6f24ef721204b90f22ca9fa59c7b43 100644 (file)
@@ -4,7 +4,7 @@
 Summary:       Parses an iCal calendar .ics file and renders it as an HTML table
 Name:          dokuwiki-plugin-icalevents
 Version:       20100501
-Release:       0.6
+Release:       1
 License:       GPL v2
 Group:         Applications/WWW
 Source0:       http://public.doogie.de/projects/dokuwiki/plugin_iCalEvents_2.0.zip
@@ -12,6 +12,7 @@ Source0:      http://public.doogie.de/projects/dokuwiki/plugin_iCalEvents_2.0.zip
 URL:           http://www.dokuwiki.org/plugin:icalevents
 Patch0:                dformat.patch
 Patch1:                reset-error.patch
+Patch2:                allow-params.patch
 BuildRequires: rpm-php-pearprov >= 4.4.2-11
 BuildRequires: rpmbuild(macros) >= 1.553
 Requires:      dokuwiki >= 20080505
@@ -37,6 +38,7 @@ mv iCalEvents/* .
 %undos -f php
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 version=$(awk -F"'" '/date/&&/=>/{print $4}' syntax.php)
 if [ "$(echo "$version" | tr -d -)" != %{version} ]; then
This page took 0.07214 seconds and 4 git commands to generate.