SF.net SVN: phpwiki:[10702] trunk

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10702
          http://sourceforge.net/p/phpwiki/code/10702
Author:   vargenau
Date:     2021-11-30 09:00:23 +0000 (Tue, 30 Nov 2021)
Log Message:
-----------
Arguments pagename, allow_detail, dispose_admin are used in themes/default/templates/online.tmpl

Modified Paths:
--------------
    trunk/lib/plugin/WhoIsOnline.php
    trunk/locale/de/pgsrc/WerIstOnline
    trunk/locale/fr/pgsrc/QuiEstEnLigne
    trunk/pgsrc/Help%2FWhoIsOnlinePlugin
    trunk/pgsrc/WhoIsOnline

Modified: trunk/lib/plugin/WhoIsOnline.php
===================================================================
--- trunk/lib/plugin/WhoIsOnline.php	2021-11-29 13:15:14 UTC (rev 10701)
+++ trunk/lib/plugin/WhoIsOnline.php	2021-11-30 09:00:23 UTC (rev 10702)
@@ -46,6 +46,9 @@
         // two modes: summary and detail, page links to the page with the other mode
         return array(
             'mode' => 'summary', // or "detail"
+            'pagename' => '[pagename]', // refer to the page with the other mode
+            'allow_detail' => false, // if false, page is ignored
+            'dispose_admin' => false,
         );
     }
 
@@ -54,19 +57,44 @@
      * @param string $argstr
      * @param WikiRequest $request
      * @param string $basepage
-     * @return mixed
+     * @return Template
      */
     function run($dbi, $argstr, &$request, $basepage)
     {
         global $WikiTheme;
+
         $request->setArg('nocache', 1);
         $args = $this->getArgs($argstr, $request);
+        extract($args);
+
+        if (!is_bool($allow_detail)) {
+            if (($allow_detail == '0') || ($allow_detail == 'false')) {
+                $allow_detail = false;
+            } elseif (($allow_detail == '1') || ($allow_detail == 'true')) {
+                $allow_detail = true;
+            } else {
+                return $this->error(sprintf(_("Argument '%s' must be a boolean"), "allow_detail"));
+            }
+        }
+
+        if (!is_bool($dispose_admin)) {
+            if (($dispose_admin == '0') || ($dispose_admin == 'false')) {
+                $dispose_admin = false;
+            } elseif (($dispose_admin == '1') || ($dispose_admin == 'true')) {
+                $dispose_admin = true;
+            } else {
+                return $this->error(sprintf(_("Argument '%s' must be a boolean"), "dispose_admin"));
+            }
+        }
+
         // use the "online.tmpl" template
         // todo: check which arguments are really needed in the template.
         $stats = $this->getStats($dbi, $request, $args['mode']);
-        if ($src = $WikiTheme->getImageURL("whosonline"))
+        if ($src = $WikiTheme->getImageURL("whosonline")) {
             $img = HTML::img(array('src' => $src, 'alt' => $this->getName()));
-        else $img = '';
+        } else {
+            $img = '';
+        }
         $other = array();
         $other['ONLINE_ICON'] = $img;
         return new Template('online', $request, array_merge($args, $stats, $other));
@@ -79,7 +107,7 @@
      * @param string $args
      * @param WikiRequest $request
      * @param string $basepage
-     * @return $this|HtmlElement
+     * @return HTML
      */
     function box($args = '', $request = null, $basepage = '')
     {
@@ -92,13 +120,8 @@
                             $stats['NUM_USERS']))))));
     }
 
-    function getSessions($dbi, &$request)
-    {
-        // check the current user sessions and what they are doing
-    }
-
     // check the current sessions
-    function getStats($dbi, &$request, $mode = 'summary')
+    function getStats($dbi, $request, $mode = 'summary')
     {
         $num_pages = 0;
         $num_users = 0;
@@ -188,6 +211,8 @@
         }
         $num_users = $num_guests + $num_registered;
 
+        //TODO: get and sets max stats in global_data
+        //$page = $dbi->getPage($request->getArg('pagename'));
         $stats = array();
         $stats['max_online_num'] = 0;
         if ($stats = $dbi->get('stats')) {

Modified: trunk/locale/de/pgsrc/WerIstOnline
===================================================================
--- trunk/locale/de/pgsrc/WerIstOnline	2021-11-29 13:15:14 UTC (rev 10701)
+++ trunk/locale/de/pgsrc/WerIstOnline	2021-11-30 09:00:23 UTC (rev 10702)
@@ -1,4 +1,4 @@
-Date: Mon, 29 Nov 2021 14:11:05 +0000
+Date: Wed, 10 Apr 2019 16:39:09 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=WerIstOnline;
@@ -6,7 +6,7 @@
   charset=UTF-8
 Content-Transfer-Encoding: binary
 
-<<WhoIsOnline>>
+<<WhoIsOnline allow_detail=1>>
 
 ----
 [[KategorieAktionSeite]]

Modified: trunk/locale/fr/pgsrc/QuiEstEnLigne
===================================================================
--- trunk/locale/fr/pgsrc/QuiEstEnLigne	2021-11-29 13:15:14 UTC (rev 10701)
+++ trunk/locale/fr/pgsrc/QuiEstEnLigne	2021-11-30 09:00:23 UTC (rev 10702)
@@ -1,4 +1,4 @@
-Date: Mon, 29 Nov 2021 14:11:05 +0000
+Date: Thu, 13 Oct 2016 15:09:17 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=QuiEstEnLigne;
@@ -6,7 +6,7 @@
   charset=UTF-8
 Content-Transfer-Encoding: binary
 
-<<WhoIsOnline>>
+<<WhoIsOnline allow_detail=1>>
 
 ----
 [[CatégoriePageDAction]]

Modified: trunk/pgsrc/Help%2FWhoIsOnlinePlugin
===================================================================
--- trunk/pgsrc/Help%2FWhoIsOnlinePlugin	2021-11-29 13:15:14 UTC (rev 10701)
+++ trunk/pgsrc/Help%2FWhoIsOnlinePlugin	2021-11-30 09:00:23 UTC (rev 10702)
@@ -1,4 +1,4 @@
-Date: Mon, 29 Nov 2021 14:11:05 +0000
+Date: Mon, 29 Nov 2021 19:45:46 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=Help%2FWhoIsOnlinePlugin;
@@ -24,8 +24,26 @@
 | **mode**
 | summary or detail
 | summary
+|-
+| **pagename**
+| Refer to the page with the other mode.
+| ~[pagename]
+|-
+| **allow_detail**
+| Boolean. If true, in summary mode, add a link to the detail mode.
+| false
+|-
+| **dispose_admin**
+| Boolean. If true, also display the fact that admin is online.
+| false
 |}
 
+**Note:** if you use ##allow_detail## with mode ##detail##, use the
+following syntax to be able to switch between modes:
+{{{
+<<WhoIsOnline mode||=detail allow_detail=true>>
+}}}
+
 == Example ==
 
 {{{

Modified: trunk/pgsrc/WhoIsOnline
===================================================================
--- trunk/pgsrc/WhoIsOnline	2021-11-29 13:15:14 UTC (rev 10701)
+++ trunk/pgsrc/WhoIsOnline	2021-11-30 09:00:23 UTC (rev 10702)
@@ -1,4 +1,4 @@
-Date: Mon, 29 Nov 2021 14:11:05 +0000
+Date: Thu, 13 Oct 2016 15:09:28 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=WhoIsOnline;
@@ -6,7 +6,7 @@
   charset=UTF-8
 Content-Transfer-Encoding: binary
 
-<<WhoIsOnline>>
+<<WhoIsOnline allow_detail=1>>
 
 ----
 [[CategoryActionPage]]

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
phpwiki-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.