[Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

Dr. Sassafras
ya, I had to run earlier so was not able to write this email right away, but here it is:

PrefDoc Plugin

Documents current tiki plugins, by outputting a table very similar to what we currently use.

* This will automatically record and keep past preference versions. So each version of tiki will be recorded.
* It allows for preference images to be inserted like we currently do.
* It automatically re-caches the current tiki preferences every time the version number increases (like from 17.0 to 17.1)
* You may force a re-cache by emptying all caches (will only re-load current version)
* If description, hint or help (link) are added to a new version of tiki, it automatically populates past versions that are missing that information
* Images specified for a version of tiki (say version 12) will stretch forward up to 4 versions if no other images exist.
*Preference data is stored as it is in tiki, so there is information cached that is not being used, it allows for maximum expansion in the future with backwards compatibility (like if color coding for basic-advanced-experimental was to be implemented etc.)
* This also means that updates to PrefDoc Plugin visual appearance is independent from storage, allowing for dramatic style changes.

Syntax:
{PREFDOC(tab="community-socialinteraction" img="17:1|10:2") /}

If no tab or a invalid tab is specified, it will generate a list of available preference tabs. Images are: TikiVersionNum:FileGalleryId|TikiVersionNum:FileGalleryId|etc. etc.

So. Plans for moving forward. We have a lot of old info on pages that may or may not be current. We cant mix and match this with the old info. Its all got to be deleted or migrated over. There is a lot of info on those pages though that is NOT in tiki. Im willing to migrate that data over, but have zero interest in discussing if the data is correct or grammatically correct. So if I do it, we got to find others willing to correct it, or we just have to agree that some information (mostly descriptions) is a step up from a blank space.

To migrate this onto the doc website, I will need to back-port it to 16.x (case that is the version of server running there now)

Im not interested in back porting the migrated info from the doc sites, so that info wont be available on the doc website until the server is upgraded to 17.x, where it will become available, unless someone wants to pack port it.

I can also do a local backport of the plugin to generate a preference history back as far as 9.x (dont see much use in going further, but likely wouldn't be much effort to do so if someone wanted the older data.

I also have a question. The Plugin currently supports help links that point to doc.tiki.org. 99% of them do but i think I saw 2 (maybe 3) that point other places. Im kinda in favor of moving those links into the description and having the help links point always to a doc.tiki.org page. If we want external links there, its no big deal incorporating that into the plugin, but just thought I would ask you guys what you thought? When looking at the documentation online, I just thought it was really slick to be able to rely on those links keeping you on the current website.

Limitations:
* Ideally the output wound be re-done to be HTML instead of wiki syntax, for performance and versatility.
* It currently relies on consecutive version numbers, skipping is not supported (although it could be modified to do this)

Thoughts?

---------- Forwarded message ----------
From: Jonny Bradley <[hidden email]>
Date: Tue, Feb 7, 2017 at 7:09 PM
Subject: Re: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
To: Tiki developers <[hidden email]>


Hi Brendan

This looks good, looking forward to trying it out!

Thanks :)

jonny



> On 7 Feb 2017, at 09:27, [hidden email] wrote:
>
> Revision: 61234
>          http://sourceforge.net/p/tikiwiki/code/61234
> Author:   drsassafras
> Date:     2017-02-07 08:27:25 +0000 (Tue, 07 Feb 2017)
> Log Message:
> -----------
> [NEW] PrefDoc Plugin - Automatically document tiki prefs
>
> Modified Paths:
> --------------
>    trunk/tiki-admin_system.php
>
> Added Paths:
> -----------
>    trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
>
> Removed Paths:
> -------------
>    trunk/doc/devtools/experimental/prefsdoc.php
>
> Deleted: trunk/doc/devtools/experimental/prefsdoc.php
> ===================================================================
> --- trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 08:27:25 UTC (rev 61234)
> @@ -1,228 +0,0 @@
> -#!/usr/bin/php
> -<?php
> -// (c) Copyright 2002-2017 by authors of the Tiki Wiki CMS Groupware Project
> -//
> -// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> -// $Id:
> -
> -
> -// can only be run from the command line
> -if (php_sapi_name() !== 'cli'){
> -     echo 'can only be run from the command line';
> -     die;
> -}
> -
> -$baseDir = realpath(__DIR__ .'/../../../').'/';
> -
> -require_once ($baseDir.'tiki-setup.php');
> -
> -/**
> - *
> - * Used for automatically generating preference documentation
> - * for use on doc.tiki.org. It takes the currently installed preferences
> - * and generates files in wiki-syntax to be pasted into doc.tiki.org
> - *
> - * Running this will overwrite any previously generated pref doc files
> - *
> - * TODO: Handle help links that dont point at doc.tiki.org
> - *
> - * TODO: There is 4 prefs that are not captured with tabs. (maybe outside a tab?)
> - *
> - * Class PrefsDoc
> - *
> - */
> -
> -class PrefsDoc extends TWVersion{
> -
> -     public $baseDir;
> -     private $PrefVars;
> -     public $fileCount;
> -     public $prefCount;
> -     public $prefDefault;
> -     public $prefDescription;
> -     public $prefName;
> -     public $docTable;
> -
> -     public function getPrefs(){
> -
> -             $prefs = array();
> -             $docFiles = scandir($this->baseDir.'lib/prefs'); // grab all the files that house prefs
> -             foreach ($docFiles as $fileName) {
> -                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> -                             require ($this->baseDir.'lib/prefs/'.$fileName);
> -                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> -                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> -
> -                     }
> -             }
> -             $this->PrefVars = $prefs;
> -     }
> -
> -
> -
> -     /**
> -      *
> -      * This generates a list of prefs in the order that they appear on the admin panel.
> -      *
> -      * @param string $fileName Name of file to scan
> -      *
> -      * @return array  array of pref names
> -      *
> -      */
> -     public function getAdminUIPrefs($fileName){
> -             $file = file_get_contents($this->baseDir . 'templates/admin/' . $fileName);
> -             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> -             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> -             if ($count) {
> -                     while ($count >= 1) {
> -                             $count--;
> -                             $prefs = array();
> -                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> -                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> -                             if ($prefs[1])
> -                                     $tabPrefs[$fileName.'-'.$tabs[1][$count]] = $prefs[1];                                                                                  // Add named tabbed array
> -                     }
> -             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){;
> -                     $tabPrefs[$fileName] = $prefs[1];
> -             }
> -
> -             return $tabPrefs;
> -     }
> -
> -
> -     /**
> -      *
> -      * This sets an vars of an indivigual prefrence
> -      *
> -      * @param $param
> -      */
> -     public function setParams($param)
> -     {
> -
> -             // set default
> -             if ($this->PrefVars[$param]['default'] == 'n') {
> -                     $this->prefDefault = 'Disabled';
> -             } else if ($this->PrefVars[$param]['default'] == 'y') {
> -                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> -             } else if (is_array($this->PrefVars[$param]['default'])) {
> -                     $this->prefDefault = implode(', ', $this->PrefVars[$param]['default']);
> -             } else {
> -                     $this->prefDefault = $this->PrefVars[$param]['default'];
> -             }
> -             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> -             $this->prefDefault = trim($this->prefDefault);
> -             if (!$this->prefDefault) {
> -                     $this->prefDefault = '~~gray:None~~';
> -             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> -                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> -             } else{
> -                     if (strlen($this->prefDefault) > 30) {
> -                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> -                     }
> -                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> -             }
> -
> -             // set name
> -             if ($this->PrefVars[$param]['help']) {
> -                     $this->prefName = '((' . $this->PrefVars[$param]['help'] . '|' . $this->PrefVars[$param]['name'] . '))';
> -             }else {
> -                     $this->prefName = $this->PrefVars[$param]['name'];
> -             }
> -             $this->prefName = $this->wikiConvert($this->prefName);
> -
> -             // set description
> -             $this->prefDescription = $this->PrefVars[$param]['description'];
> -             if ($this->PrefVars[$param]['hint'])
> -                     $this->prefDescription .= " ''Hint: ".$this->PrefVars[$param]['hint']."''";
> -             foreach ($this->PrefVars[$param]['tags'] as $tag)
> -                     if ($tag === 'experimental')
> -                             $this->prefDescription .= ' (experimental)';
> -             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> -     }
> -
> -
> -     /**
> -      * Preps a string from tiki prefs for insertion into tiki-syntax land
> -      *
> -      * @param $string string to be parsed
> -      *
> -      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> -      *
> -      *
> -      * @return string parsed string sutable for wiki insertion
> -      *
> -      */
> -     private function wikiConvert($string, $escape = false){
> -             $escapedString = '';
> -             if ($string) {
> -                     if ($escape) {
> -                             $escapedString = ' ~np~';
> -                     }
> -                     $escapedString .= str_replace("\n", ' ', $string);
> -                     $escapedString = trim($escapedString);
> -                     if ($escape) {
> -                             $escapedString .= '~/np~';
> -                     }
> -             }
> -
> -             return $escapedString;
> -
> -     }
> -
> -     /**
> -      *
> -      * Writes a generated pref wiki formatted file to disk
> -      *
> -      * @param string $fileName  The file name to write to disk.
> -      *
> -      */
> -     public function writeFile($fileName){
> -
> -             $begining = '~hc~ -- Table generated with prefsdoc.php for tiki '.$this->getVersion()." -- ~/hc~\n";
> -             $begining .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}'."\n";
> -
> -             $end = "{FANCYTABLE}\n/////\n";
> -
> -             $fileName .=".txt";                             // Name of file to be written
> -
> -             if (!is_dir($this->baseDir.'storage/prefsdoc')) {
> -                     if (!mkdir($this->baseDir . 'storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> -                             die("Cant create storage/prefsdoc directory\n");
> -                     }
> -             }if (is_file($this->baseDir . 'storage/prefsdoc/' . $fileName)) {
> -                     if (!unlink($this->baseDir . 'storage/prefsdoc/' . $fileName)){
> -                             die("Cant overwrite existing $fileName\n");
> -                             }
> -                     }
> -
> -             if (!file_put_contents($this->baseDir . 'storage/prefsdoc/' . $fileName, $begining.$this->docTable.$end))               // write one file for each pref page on control panel
> -                     die("Unable to write $fileName\n");
> -             $this->docTable = '';
> -     }
> -}
> -
> -$Doc = new PrefsDoc();
> -$Doc->baseDir = $baseDir;
> -$Doc->fileCount = 0;
> -$Doc->prefCount = 0;
> -$Doc->getPrefs();
> -
> -$docFiles = scandir($baseDir.'templates/admin'); // grab all the files that house prefs
> -foreach ($docFiles as $fileName) {
> -     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> -             $FilePrefs = $Doc->getAdminUIPrefs($fileName);
> -             $Doc->docTable = '';
> -             foreach ($FilePrefs as $tabName => $tab) {
> -                     foreach ($tab as $param) {
> -                             $Doc->setParams($param);
> -                             $Doc->prefCount++;
> -                             $Doc->docTable .= $Doc->prefName . '~|~' . $Doc->prefDescription . '~|~' . $Doc->prefDefault . "\n";
> -                     }
> -                     $Doc->writeFile($tabName);
> -                     $Doc->fileCount++;
> -             }
> -     }
> -}
> -
> -echo "\033[33m".$Doc->fileCount. ' pref files written to storage/prefsdoc/ with a total of '.$Doc->prefCount." prefs.\033[0m\n";
>
> Added: trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
> ===================================================================
> --- trunk/lib/wiki-plugins/wikiplugin_prefdoc.php                             (rev 0)
> +++ trunk/lib/wiki-plugins/wikiplugin_prefdoc.php     2017-02-07 08:27:25 UTC (rev 61234)
> @@ -0,0 +1,437 @@
> +<?php
> +// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
> +//
> +// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> +// $Id:
> +
> +function wikiplugin_prefdoc_info()
> +{
> +     return array(
> +             'name' => tra('Document Preferences'),
> +             //'documentation' => tra('coming+soon'), TODO Fill in doc page
> +             'description' => tra('Generates documentation for Tiki preferences tabs.'),
> +             'prefs' => array( 'wikiplugin_prefdoc' ),
> +             'validate' => 'all',
> +             'introduced' => 17,
> +             'iconname' => 'th-list',
> +             'tags' => array( 'advanced' ),
> +             'params' => array(
> +                     'tab' => array(
> +                             'required' => false,
> +                             'name' => tra('Preference-Tab'),
> +                             'description' => tra('The name of the preference tab to display. In the format of "preference page name"-"Tab Name witout spaces" eg. To link to General Layout on the Look and Feel page you would use "look-generallayout". Note that the "look" can be found in the url tiki-admin.php?page=<strong>look</strong>.'),
> +                             'filter' => 'text',
> +                             'since' => '17',
> +                     ),
> +                     'img' => array(
> +                             'required' => false,
> +                             'name' => tra('Images'),
> +                             'description' => tra('Show images at the top of each version of tiki. Format: TikiVersion:FileGalleryID'),
> +                             'since' => '17',
> +                             'filter' => 'text',
> +                     ),
> +             ),
> +     );
> +}
> +
> +/**
> + *
> + * Generate, Display & Archive Tiki Pref Documentation
> + *
> + * @param $data     this is ignored
> + * @param $params   paramiters to process
> + *
> + * @return string   returnes error or pref table
> + */
> +
> +function wikiplugin_prefdoc( $data, $params )
> +{
> +
> +     $Doc = new PrefsDoc();
> +
> +     if (!$Doc->genPrefsState())
> +             return $Doc->error;
> +
> +     if (!isset($params['tab']))         // if no tab specified, return a list of available tabs
> +             return $Doc->genPrefCodes();
> +
> +     if (!$Doc->genPrefHistory($params['tab'],$params['img']))
> +             return $Doc->error;
> +     return $Doc->error.$Doc->docTable;
> +}
> +
> +
> +
> +/**
> + *
> + *
> + * Used for automatically generating preference documentation
> + * for use on doc.tiki.org. It takes the currently installed preferences
> + * and generates files in wiki-syntax
> + *
> + * Running this will overwrite any previously generated pref doc files
> + *
> + * TODO: Handle help links that dont point at doc.tiki.org
> + *
> + *
> + * Class PrefsDoc
> + *
> + * @var $docTable string The output to be sent to displayed, in wiki format
> + *
> + */
> +
> +
> +class PrefsDoc extends TWVersion{
> +
> +     private $PrefVars;
> +     private $prevFilePrefs;
> +     private $fileCount;
> +     private $prefCount;
> +     private $prefDefault;
> +     private $prefDescription;
> +     private $prefName;
> +     public $docTable;
> +     public $error;
> +
> +
> +     /**
> +      *
> +      * Populates $docTable with a string to display.
> +      * The main function to generate version tabs etc.
> +      *
> +      * @param $tabName string   The pref-tab name to create an output for
> +      * @param $images string    Images & Versions to display with a Version tab.
> +      *
> +      * @return bool             true on success false on failure
> +      */
> +     public function genPrefHistory($tabName,$images){
> +
> +             $version = (int)$this->getBaseVersion();
> +             if (!is_file("storage/prefsdoc/$version-$tabName.json")) {
> +                     $this->error .= "Error: <strong>Cant find $tabName</strong> you may choose from one of the following: \n".$this->genPrefCodes();
> +                     return false;
> +             }
> +             $file = json_decode(file_get_contents("storage/prefsdoc/$version-$tabName.json"));
> +
> +             while ($version >= $file->oldest){
> +                     $versions[] = $version;
> +                     $version --;
> +             }
> +
> +             $this->docTable = '{TABS(name="'.$tabName.'" tabs="Tiki Version '.implode('|',$versions)."\" toggle=\"n\")}";
> +             $imageArray = array();
> +             $images = explode('|',$images);
> +             foreach ($images as $key => $image) {
> +                     $image = explode(':', $image);
> +                     $imageArray[$image[0]][0] = $image[1];
> +                     $imageArray[$image[0]][1] = $image[0];
> +             }
> +             unset($images);
> +
> +             // carry over images from past versions of Tiki, if available.
> +             foreach ($versions as $version) {
> +                     $count =$version;
> +                     while ($version - $count < 4) {         // If the image is older than 4 tiki versions, dont display it.
> +                             if ($imageArray[$count][0]) {
> +                                     $this->docTable .= '{img fileId="'.$imageArray[$count][0].'" thumb="y" rel="box[g]" width="300" desc="Tiki '.  $imageArray[$count][1].' Preferences Image" alt="' . $tabName . '" align="center"}';
> +                                     break;
> +                             }
> +                             $count--;
> +                     }
> +                     $this->genPrefVersion("storage/prefsdoc/$version-$tabName.json");
> +                     if ($file->oldest !== $version)
> +                             $this->docTable .= "/////\n";
> +             }
> +
> +
> +             $this->docTable .= '{TABS}';
> +             return true;
> +
> +     }
> +
> +     /**
> +      *
> +      * @return string file-tab codes available for use.
> +      */
> +     public function genPrefCodes(){
> +
> +             $version = (int)$this->getBaseVersion();
> +             $files = glob('storage/prefsdoc/'.$version.'-*.json');
> +             if (!$files)
> +                     return 'There was no files found, please Clear All Caches to reindex files.';
> +             foreach ($files as $key => $file){
> +                     $file = substr($file,20);
> +                     $files[$key] = substr($file,0,-5);
> +             }
> +             $files = implode('<br>',$files);
> +             return $files;
> +     }
> +
> +     /**
> +      *
> +      * Check if the prefs documentation is up to date.
> +      * If its not up to date, then update it.
> +      *
> +      * Documentation is updated for every minor version change.
> +      * A seprate set of documentatin is creaed for every major version.
> +      * Only consecutive versions are supported (you cant skip a version)
> +      *
> +      * @return bool false on error, true on success.
> +      */
> +
> +
> +     public function genPrefsState(){
> +
> +             if (!is_dir('storage/prefsdoc')) {
> +                     if (!mkdir('storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> +                             $this->error .= "Cant create storage/prefsdoc directory. ";
> +                             return false;
> +                     }
> +             }
> +
> +             // check if the current prefs doc is up to date, if its not, continue
> +             if (is_file('storage/prefsdoc/state.json')){
> +                     $state = json_decode(file_get_contents('storage/prefsdoc/state.json'));
> +                     if ($state->version === $this->getBaseVersion())
> +                             return true;
> +             }
> +
> +             // prepate to generate prefs doc
> +             $this->fileCount = 0;
> +             $this->prefCount = 0;
> +             $this->getPrefs();
> +
> +             $docFiles = scandir('templates/admin'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> +                             $FilePrefs = $this->getAdminUIPrefs($fileName);
> +                             foreach ($FilePrefs as $tabName => $tab) {
> +                                     if (!$this->writeFile($tabName,$tab))
> +                                             return false;
> +                                     $this->prefCount ++;
> +                             }
> +                     }
> +             }
> +             // record the state so its easy to figure out whats what next time.
> +             $state = json_encode(array(
> +                     'version' => $this->getBaseVersion(),
> +                     'created' => time()));
> +             file_put_contents('storage/prefsdoc/state.json',$state);
> +
> +             $logslib = TikiLib::lib('logs');
> +             $logslib->add_log('prefDoc',$this->fileCount. ' pref doc files generated/updated covering ' . $this->prefCount.' prefs');
> +
> +             return true;
> +     }
> +
> +     /**
> +      * compiles a all prefs for the current tiki install and sets PrefVars with it
> +      */
> +     private function getPrefs(){
> +
> +             $prefs = array();
> +             $docFiles = scandir('lib/prefs'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> +                             require_once ('lib/prefs/'.$fileName);
> +                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> +                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> +
> +                     }
> +             }
> +             $this->PrefVars = $prefs;
> +     }
> +
> +
> +
> +     /**
> +      *
> +      * This generates a list of prefs in the order that they appear on the admin panel.
> +      *
> +      * @param string $fileName Name of file to scan
> +      *
> +      * @return array  array of pref names, or false on failure
> +      *
> +      */
> +     private function getAdminUIPrefs($fileName){
> +             $file = file_get_contents('templates/admin/' . $fileName);
> +             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> +             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> +             if ($count) {
> +                     while ($count >= 1) {
> +                             $count--;
> +                             $prefs = array();
> +                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> +                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> +                             foreach ($prefs[1] as $pref) {
> +                                     $tabPrefs[$fileName . '-' . $tabs[1][$count]][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                             }
> +                     }
> +             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){
> +                     foreach ($prefs[1] as $pref) {
> +                             $tabPrefs[$fileName][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                     }
> +             }
> +
> +             return $tabPrefs;
> +     }
> +
> +
> +     /**
> +      *
> +      * This sets an vars of an individual preference
> +      *
> +      * @param $param object the prefs to be processed into pretty & standardized output
> +      */
> +     private function setParams($param)
> +     {
> +             // set default
> +             if ($param->default == 'n') {
> +                     $this->prefDefault = 'Disabled';
> +             } else if ($param->default == 'y') {
> +                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> +             } else if (is_array($param->default)) {
> +                     $this->prefDefault = implode(', ', $param->default);
> +             } else {
> +                     $this->prefDefault = $param->default;
> +             }
> +             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> +             $this->prefDefault = trim($this->prefDefault);
> +             if (!$this->prefDefault) {
> +                     $this->prefDefault = '~~gray:None~~';
> +             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> +                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> +             } else{
> +                     if (strlen($this->prefDefault) > 30) {
> +                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> +                     }
> +                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> +             }
> +
> +             // set name
> +             if ($param->help) {
> +                     $this->prefName = '((' . $param->help . '|' . $param->name . '))';
> +             }else {
> +                     $this->prefName = $param->name;
> +             }
> +             $this->prefName = $this->wikiConvert($this->prefName);
> +
> +             // set description
> +             $this->prefDescription = $param->description;
> +             if ($param->hint)
> +                     $this->prefDescription .= " ''Hint: ".$param->hint."''";
> +             foreach ($param->tags as $tag)
> +                     if ($tag === 'experimental')
> +                             $this->prefDescription .= ' (experimental)';
> +             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> +     }
> +
> +
> +     /**
> +      * Preps a string from tiki prefs for insertion into tiki-syntax land
> +      *
> +      * @param $string string to be parsed
> +      *
> +      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> +      *
> +      *
> +      * @return string parsed string sutable for wiki insertion
> +      *
> +      */
> +     private function wikiConvert($string, $escape = false){
> +             $escapedString = '';
> +             if ($string) {
> +                     if ($escape) {
> +                             $escapedString = ' ~np~';
> +                     }
> +                     $escapedString .= str_replace("\n", ' ', $string);
> +                     $escapedString = trim($escapedString);
> +                     if ($escape) {
> +                             $escapedString .= '~/np~';
> +                     }
> +             }
> +
> +             return $escapedString;
> +
> +     }
> +
> +     /**
> +      *
> +      * Generates a wiki syntax table for a specific version of tiki
> +      *
> +      * @param string $fileName  The file name to write to disk.
> +      *
> +      * @return bool false on error, true otherwise
> +      */
> +     private function genPrefVersion($fileName)
> +     {
> +             if (!is_file($fileName)){
> +                     $this->error .= "Cant read $fileName. ";
> +                     return false;
> +             }
> +             $this->docTable .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}';
> +             $FilePrefs = json_decode(file_get_contents($fileName));
> +             foreach ($FilePrefs->prefs as $prefName => &$pref) {
> +                     $this->prevFilePrefs;
> +
> +                     // carry over missing information filled out in a newer version
> +                     if (!$pref->description)
> +                             $pref->description = $this->prevFilePrefs->$prefName->description;
> +                     if (!$pref->help)
> +                             $pref->help = $this->prevFilePrefs->$prefName->help;
> +                     if (!$pref->hint)
> +                             $pref->hint = $this->prevFilePrefs->$prefName->hint;
> +                     $this->setParams($pref);
> +                     $this->docTable .= $this->prefName . '~|~' . $this->prefDescription . '~|~' . $this->prefDefault . "\n";
> +             }
> +             $this->prevFilePrefs = $FilePrefs->prefs;
> +             $this->docTable .= "{FANCYTABLE}";
> +             return true;
> +     }
> +
> +     /**
> +      *
> +      * Writes a pref file to disk
> +      *
> +      * @param $tabName string name of tab or pref file to write
> +      * @param $prefs array the prefs to write to file
> +      *
> +      * @return bool|string returns error message on failure, or false on success
> +      */
> +
> +
> +     private function writeFile($tabName,$prefs)
> +     {
> +             $version = (int)$this->getBaseVersion();
> +             $oldest = $version;
> +             $tabName = '-' . $tabName . '.json';                // Name of file to be written, minus prefex
> +
> +             while (is_file('storage/prefsdoc/' . ($oldest - 1) . $tabName)) {
> +                     $oldest--;
> +             }
> +
> +             $prefs = json_encode(array(
> +                     'oldest' => $oldest,
> +                     'prefs'  => $prefs,
> +             ));
> +
> +             if (is_file('storage/prefsdoc/' . $version . $tabName)) {
> +                     if (!unlink('storage/prefsdoc/' . $version . $tabName)) {
> +                             $this->error .= ("Cant overwrite existing $version-$tabName.json ");
> +
> +                             return false;
> +
> +                     }
> +             }
> +
> +             if (!file_put_contents('storage/prefsdoc/' . $version . $tabName, $prefs)) {
> +                     // write one file for each pref page on control panel
> +                     $this->error .= ("Unable to write $version.$tabName");
> +                     return false;
> +             }
> +             $this->fileCount++;
> +             return true;
> +     }
> +}
> +
>
> Modified: trunk/tiki-admin_system.php
> ===================================================================
> --- trunk/tiki-admin_system.php       2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/tiki-admin_system.php       2017-02-07 08:27:25 UTC (rev 61234)
> @@ -22,6 +22,10 @@
>               // Also rebuild admin index
>               TikiLib::lib('prefs')->rebuildIndex();
>
> +             // also rebuild plugin prefdoc current version
> +             if (file_exists('storage/prefsdoc/state.json'))
> +                     unlink('storage/prefsdoc/state.json');
> +
>               // seems combination of clearing prefs and public now messes up the page, so reload
>               include_once('lib/setup/prefs.php');
>               initialize_prefs();
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Tikiwiki-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tikiwiki-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

Cloutier, Philippe (RESSOURCE EXTERNE)

Thank you Brendan.

I am sure this is great for doc.tiki.org, but this is an extremely advanced plugin. I am not too concerned by performance and do not mind it being packaged, but we can only categorize as basic or advanced, so the impact on the interface should be well considered. Currently the description of wikiplugin_prefdoc is “'Generates documentation for Tiki preferences tabs.” I think a user who does not know about the PrefDoc plugin will wonder what “Tiki preferences tabs” are. It may not be clear for them that they do not want to enable that plugin.

 

Would “'Generates documentation for Tiki plugins ([mostly] used on Tiki’s documentation website).” not be a clearer description? Actually, does this only document plugins?

 

De : Brendan Ferguson [mailto:[hidden email]]
Envoyé : 7 février 2017 10:39
À : Tiki developers <[hidden email]>
Objet : [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

 

ya, I had to run earlier so was not able to write this email right away, but here it is:

PrefDoc Plugin

Documents current tiki plugins, by outputting a table very similar to what we currently use.

* This will automatically record and keep past preference versions. So each version of tiki will be recorded.

* It allows for preference images to be inserted like we currently do.

* It automatically re-caches the current tiki preferences every time the version number increases (like from 17.0 to 17.1)

* You may force a re-cache by emptying all caches (will only re-load current version)

* If description, hint or help (link) are added to a new version of tiki, it automatically populates past versions that are missing that information

* Images specified for a version of tiki (say version 12) will stretch forward up to 4 versions if no other images exist.

*Preference data is stored as it is in tiki, so there is information cached that is not being used, it allows for maximum expansion in the future with backwards compatibility (like if color coding for basic-advanced-experimental was to be implemented etc.)

* This also means that updates to PrefDoc Plugin visual appearance is independent from storage, allowing for dramatic style changes.

Syntax:
{PREFDOC(tab="community-socialinteraction" img="17:1|10:2") /}

If no tab or a invalid tab is specified, it will generate a list of available preference tabs. Images are: TikiVersionNum:FileGalleryId|TikiVersionNum:FileGalleryId|etc. etc.

 

So. Plans for moving forward. We have a lot of old info on pages that may or may not be current. We cant mix and match this with the old info. Its all got to be deleted or migrated over. There is a lot of info on those pages though that is NOT in tiki. Im willing to migrate that data over, but have zero interest in discussing if the data is correct or grammatically correct. So if I do it, we got to find others willing to correct it, or we just have to agree that some information (mostly descriptions) is a step up from a blank space.

To migrate this onto the doc website, I will need to back-port it to 16.x (case that is the version of server running there now)

Im not interested in back porting the migrated info from the doc sites, so that info wont be available on the doc website until the server is upgraded to 17.x, where it will become available, unless someone wants to pack port it.

 

I can also do a local backport of the plugin to generate a preference history back as far as 9.x (dont see much use in going further, but likely wouldn't be much effort to do so if someone wanted the older data.

I also have a question. The Plugin currently supports help links that point to doc.tiki.org. 99% of them do but i think I saw 2 (maybe 3) that point other places. Im kinda in favor of moving those links into the description and having the help links point always to a doc.tiki.org page. If we want external links there, its no big deal incorporating that into the plugin, but just thought I would ask you guys what you thought? When looking at the documentation online, I just thought it was really slick to be able to rely on those links keeping you on the current website.

 

Limitations:

* Ideally the output wound be re-done to be HTML instead of wiki syntax, for performance and versatility.

* It currently relies on consecutive version numbers, skipping is not supported (although it could be modified to do this)

 

Thoughts?

 

---------- Forwarded message ----------
From: Jonny Bradley <[hidden email]>
Date: Tue, Feb 7, 2017 at 7:09 PM
Subject: Re: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
To: Tiki developers <[hidden email]>


Hi Brendan

This looks good, looking forward to trying it out!

Thanks :)

jonny



> On 7 Feb 2017, at 09:27, [hidden email] wrote:
>
> Revision: 61234
>          http://sourceforge.net/p/tikiwiki/code/61234
> Author:   drsassafras
> Date:     2017-02-07 08:27:25 +0000 (Tue, 07 Feb 2017)
> Log Message:
> -----------
> [NEW] PrefDoc Plugin - Automatically document tiki prefs
>
> Modified Paths:
> --------------
>    trunk/tiki-admin_system.php
>
> Added Paths:
> -----------
>    trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
>
> Removed Paths:
> -------------
>    trunk/doc/devtools/experimental/prefsdoc.php
>
> Deleted: trunk/doc/devtools/experimental/prefsdoc.php
> ===================================================================
> --- trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 08:27:25 UTC (rev 61234)
> @@ -1,228 +0,0 @@
> -#!/usr/bin/php
> -<?php
> -// (c) Copyright 2002-2017 by authors of the Tiki Wiki CMS Groupware Project
> -//
> -// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> -// $Id:
> -
> -
> -// can only be run from the command line
> -if (php_sapi_name() !== 'cli'){
> -     echo 'can only be run from the command line';
> -     die;
> -}
> -
> -$baseDir = realpath(__DIR__ .'/../../../').'/';
> -
> -require_once ($baseDir.'tiki-setup.php');
> -
> -/**
> - *
> - * Used for automatically generating preference documentation
> - * for use on doc.tiki.org. It takes the currently installed preferences
> - * and generates files in wiki-syntax to be pasted into doc.tiki.org
> - *
> - * Running this will overwrite any previously generated pref doc files
> - *
> - * TODO: Handle help links that dont point at doc.tiki.org
> - *
> - * TODO: There is 4 prefs that are not captured with tabs. (maybe outside a tab?)
> - *
> - * Class PrefsDoc
> - *
> - */
> -
> -class PrefsDoc extends TWVersion{
> -
> -     public $baseDir;
> -     private $PrefVars;
> -     public $fileCount;
> -     public $prefCount;
> -     public $prefDefault;
> -     public $prefDescription;
> -     public $prefName;
> -     public $docTable;
> -
> -     public function getPrefs(){
> -
> -             $prefs = array();
> -             $docFiles = scandir($this->baseDir.'lib/prefs'); // grab all the files that house prefs
> -             foreach ($docFiles as $fileName) {
> -                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> -                             require ($this->baseDir.'lib/prefs/'.$fileName);
> -                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> -                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> -
> -                     }
> -             }
> -             $this->PrefVars = $prefs;
> -     }
> -
> -
> -
> -     /**
> -      *
> -      * This generates a list of prefs in the order that they appear on the admin panel.
> -      *
> -      * @param string $fileName Name of file to scan
> -      *
> -      * @return array  array of pref names
> -      *
> -      */
> -     public function getAdminUIPrefs($fileName){
> -             $file = file_get_contents($this->baseDir . 'templates/admin/' . $fileName);
> -             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> -             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> -             if ($count) {
> -                     while ($count >= 1) {
> -                             $count--;
> -                             $prefs = array();
> -                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> -                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> -                             if ($prefs[1])
> -                                     $tabPrefs[$fileName.'-'.$tabs[1][$count]] = $prefs[1];                                                                                  // Add named tabbed array
> -                     }
> -             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){;
> -                     $tabPrefs[$fileName] = $prefs[1];
> -             }
> -
> -             return $tabPrefs;
> -     }
> -
> -
> -     /**
> -      *
> -      * This sets an vars of an indivigual prefrence
> -      *
> -      * @param $param
> -      */
> -     public function setParams($param)
> -     {
> -
> -             // set default
> -             if ($this->PrefVars[$param]['default'] == 'n') {
> -                     $this->prefDefault = 'Disabled';
> -             } else if ($this->PrefVars[$param]['default'] == 'y') {
> -                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> -             } else if (is_array($this->PrefVars[$param]['default'])) {
> -                     $this->prefDefault = implode(', ', $this->PrefVars[$param]['default']);
> -             } else {
> -                     $this->prefDefault = $this->PrefVars[$param]['default'];
> -             }
> -             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> -             $this->prefDefault = trim($this->prefDefault);
> -             if (!$this->prefDefault) {
> -                     $this->prefDefault = '~~gray:None~~';
> -             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> -                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> -             } else{
> -                     if (strlen($this->prefDefault) > 30) {
> -                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> -                     }
> -                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> -             }
> -
> -             // set name
> -             if ($this->PrefVars[$param]['help']) {
> -                     $this->prefName = '((' . $this->PrefVars[$param]['help'] . '|' . $this->PrefVars[$param]['name'] . '))';
> -             }else {
> -                     $this->prefName = $this->PrefVars[$param]['name'];
> -             }
> -             $this->prefName = $this->wikiConvert($this->prefName);
> -
> -             // set description
> -             $this->prefDescription = $this->PrefVars[$param]['description'];
> -             if ($this->PrefVars[$param]['hint'])
> -                     $this->prefDescription .= " ''Hint: ".$this->PrefVars[$param]['hint']."''";
> -             foreach ($this->PrefVars[$param]['tags'] as $tag)
> -                     if ($tag === 'experimental')
> -                             $this->prefDescription .= ' (experimental)';
> -             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> -     }
> -
> -
> -     /**
> -      * Preps a string from tiki prefs for insertion into tiki-syntax land
> -      *
> -      * @param $string string to be parsed
> -      *
> -      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> -      *
> -      *
> -      * @return string parsed string sutable for wiki insertion
> -      *
> -      */
> -     private function wikiConvert($string, $escape = false){
> -             $escapedString = '';
> -             if ($string) {
> -                     if ($escape) {
> -                             $escapedString = ' ~np~';
> -                     }
> -                     $escapedString .= str_replace("\n", ' ', $string);
> -                     $escapedString = trim($escapedString);
> -                     if ($escape) {
> -                             $escapedString .= '~/np~';
> -                     }
> -             }
> -
> -             return $escapedString;
> -
> -     }
> -
> -     /**
> -      *
> -      * Writes a generated pref wiki formatted file to disk
> -      *
> -      * @param string $fileName  The file name to write to disk.
> -      *
> -      */
> -     public function writeFile($fileName){
> -
> -             $begining = '~hc~ -- Table generated with prefsdoc.php for tiki '.$this->getVersion()." -- ~/hc~\n";
> -             $begining .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}'."\n";
> -
> -             $end = "{FANCYTABLE}\n/////\n";
> -
> -             $fileName .=".txt";                             // Name of file to be written
> -
> -             if (!is_dir($this->baseDir.'storage/prefsdoc')) {
> -                     if (!mkdir($this->baseDir . 'storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> -                             die("Cant create storage/prefsdoc directory\n");
> -                     }
> -             }if (is_file($this->baseDir . 'storage/prefsdoc/' . $fileName)) {
> -                     if (!unlink($this->baseDir . 'storage/prefsdoc/' . $fileName)){
> -                             die("Cant overwrite existing $fileName\n");
> -                             }
> -                     }
> -
> -             if (!file_put_contents($this->baseDir . 'storage/prefsdoc/' . $fileName, $begining.$this->docTable.$end))               // write one file for each pref page on control panel
> -                     die("Unable to write $fileName\n");
> -             $this->docTable = '';
> -     }
> -}
> -
> -$Doc = new PrefsDoc();
> -$Doc->baseDir = $baseDir;
> -$Doc->fileCount = 0;
> -$Doc->prefCount = 0;
> -$Doc->getPrefs();
> -
> -$docFiles = scandir($baseDir.'templates/admin'); // grab all the files that house prefs
> -foreach ($docFiles as $fileName) {
> -     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> -             $FilePrefs = $Doc->getAdminUIPrefs($fileName);
> -             $Doc->docTable = '';
> -             foreach ($FilePrefs as $tabName => $tab) {
> -                     foreach ($tab as $param) {
> -                             $Doc->setParams($param);
> -                             $Doc->prefCount++;
> -                             $Doc->docTable .= $Doc->prefName . '~|~' . $Doc->prefDescription . '~|~' . $Doc->prefDefault . "\n";
> -                     }
> -                     $Doc->writeFile($tabName);
> -                     $Doc->fileCount++;
> -             }
> -     }
> -}
> -
> -echo "\033[33m".$Doc->fileCount. ' pref files written to storage/prefsdoc/ with a total of '.$Doc->prefCount." prefs.\033[0m\n";
>
> Added: trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
> ===================================================================
> --- trunk/lib/wiki-plugins/wikiplugin_prefdoc.php                             (rev 0)
> +++ trunk/lib/wiki-plugins/wikiplugin_prefdoc.php     2017-02-07 08:27:25 UTC (rev 61234)
> @@ -0,0 +1,437 @@
> +<?php
> +// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
> +//
> +// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> +// $Id:
> +
> +function wikiplugin_prefdoc_info()
> +{
> +     return array(
> +             'name' => tra('Document Preferences'),
> +             //'documentation' => tra('coming+soon'), TODO Fill in doc page
> +             'description' => tra('Generates documentation for Tiki preferences tabs.'),
> +             'prefs' => array( 'wikiplugin_prefdoc' ),
> +             'validate' => 'all',
> +             'introduced' => 17,
> +             'iconname' => 'th-list',
> +             'tags' => array( 'advanced' ),
> +             'params' => array(
> +                     'tab' => array(
> +                             'required' => false,
> +                             'name' => tra('Preference-Tab'),
> +                             'description' => tra('The name of the preference tab to display. In the format of "preference page name"-"Tab Name witout spaces" eg. To link to General Layout on the Look and Feel page you would use "look-generallayout". Note that the "look" can be found in the url tiki-admin.php?page=<strong>look</strong>.'),
> +                             'filter' => 'text',
> +                             'since' => '17',
> +                     ),
> +                     'img' => array(
> +                             'required' => false,
> +                             'name' => tra('Images'),
> +                             'description' => tra('Show images at the top of each version of tiki. Format: TikiVersion:FileGalleryID'),
> +                             'since' => '17',
> +                             'filter' => 'text',
> +                     ),
> +             ),
> +     );
> +}
> +
> +/**
> + *
> + * Generate, Display & Archive Tiki Pref Documentation
> + *
> + * @param $data     this is ignored
> + * @param $params   paramiters to process
> + *
> + * @return string   returnes error or pref table
> + */
> +
> +function wikiplugin_prefdoc( $data, $params )
> +{
> +
> +     $Doc = new PrefsDoc();
> +
> +     if (!$Doc->genPrefsState())
> +             return $Doc->error;
> +
> +     if (!isset($params['tab']))         // if no tab specified, return a list of available tabs
> +             return $Doc->genPrefCodes();
> +
> +     if (!$Doc->genPrefHistory($params['tab'],$params['img']))
> +             return $Doc->error;
> +     return $Doc->error.$Doc->docTable;
> +}
> +
> +
> +
> +/**
> + *
> + *
> + * Used for automatically generating preference documentation
> + * for use on doc.tiki.org. It takes the currently installed preferences
> + * and generates files in wiki-syntax
> + *
> + * Running this will overwrite any previously generated pref doc files
> + *
> + * TODO: Handle help links that dont point at doc.tiki.org
> + *
> + *
> + * Class PrefsDoc
> + *
> + * @var $docTable string The output to be sent to displayed, in wiki format
> + *
> + */
> +
> +
> +class PrefsDoc extends TWVersion{
> +
> +     private $PrefVars;
> +     private $prevFilePrefs;
> +     private $fileCount;
> +     private $prefCount;
> +     private $prefDefault;
> +     private $prefDescription;
> +     private $prefName;
> +     public $docTable;
> +     public $error;
> +
> +
> +     /**
> +      *
> +      * Populates $docTable with a string to display.
> +      * The main function to generate version tabs etc.
> +      *
> +      * @param $tabName string   The pref-tab name to create an output for
> +      * @param $images string    Images & Versions to display with a Version tab.
> +      *
> +      * @return bool             true on success false on failure
> +      */
> +     public function genPrefHistory($tabName,$images){
> +
> +             $version = (int)$this->getBaseVersion();
> +             if (!is_file("storage/prefsdoc/$version-$tabName.json")) {
> +                     $this->error .= "Error: <strong>Cant find $tabName</strong> you may choose from one of the following: \n".$this->genPrefCodes();
> +                     return false;
> +             }
> +             $file = json_decode(file_get_contents("storage/prefsdoc/$version-$tabName.json"));
> +
> +             while ($version >= $file->oldest){
> +                     $versions[] = $version;
> +                     $version --;
> +             }
> +
> +             $this->docTable = '{TABS(name="'.$tabName.'" tabs="Tiki Version '.implode('|',$versions)."\" toggle=\"n\")}";
> +             $imageArray = array();
> +             $images = explode('|',$images);
> +             foreach ($images as $key => $image) {
> +                     $image = explode(':', $image);
> +                     $imageArray[$image[0]][0] = $image[1];
> +                     $imageArray[$image[0]][1] = $image[0];
> +             }
> +             unset($images);
> +
> +             // carry over images from past versions of Tiki, if available.
> +             foreach ($versions as $version) {
> +                     $count =$version;
> +                     while ($version - $count < 4) {         // If the image is older than 4 tiki versions, dont display it.
> +                             if ($imageArray[$count][0]) {
> +                                     $this->docTable .= '{img fileId="'.$imageArray[$count][0].'" thumb="y" rel="box[g]" width="300" desc="Tiki '.  $imageArray[$count][1].' Preferences Image" alt="' . $tabName . '" align="center"}';
> +                                     break;
> +                             }
> +                             $count--;
> +                     }
> +                     $this->genPrefVersion("storage/prefsdoc/$version-$tabName.json");
> +                     if ($file->oldest !== $version)
> +                             $this->docTable .= "/////\n";
> +             }
> +
> +
> +             $this->docTable .= '{TABS}';
> +             return true;
> +
> +     }
> +
> +     /**
> +      *
> +      * @return string file-tab codes available for use.
> +      */
> +     public function genPrefCodes(){
> +
> +             $version = (int)$this->getBaseVersion();
> +             $files = glob('storage/prefsdoc/'.$version.'-*.json');
> +             if (!$files)
> +                     return 'There was no files found, please Clear All Caches to reindex files.';
> +             foreach ($files as $key => $file){
> +                     $file = substr($file,20);
> +                     $files[$key] = substr($file,0,-5);
> +             }
> +             $files = implode('<br>',$files);
> +             return $files;
> +     }
> +
> +     /**
> +      *
> +      * Check if the prefs documentation is up to date.
> +      * If its not up to date, then update it.
> +      *
> +      * Documentation is updated for every minor version change.
> +      * A seprate set of documentatin is creaed for every major version.
> +      * Only consecutive versions are supported (you cant skip a version)
> +      *
> +      * @return bool false on error, true on success.
> +      */
> +
> +
> +     public function genPrefsState(){
> +
> +             if (!is_dir('storage/prefsdoc')) {
> +                     if (!mkdir('storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> +                             $this->error .= "Cant create storage/prefsdoc directory. ";
> +                             return false;
> +                     }
> +             }
> +
> +             // check if the current prefs doc is up to date, if its not, continue
> +             if (is_file('storage/prefsdoc/state.json')){
> +                     $state = json_decode(file_get_contents('storage/prefsdoc/state.json'));
> +                     if ($state->version === $this->getBaseVersion())
> +                             return true;
> +             }
> +
> +             // prepate to generate prefs doc
> +             $this->fileCount = 0;
> +             $this->prefCount = 0;
> +             $this->getPrefs();
> +
> +             $docFiles = scandir('templates/admin'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> +                             $FilePrefs = $this->getAdminUIPrefs($fileName);
> +                             foreach ($FilePrefs as $tabName => $tab) {
> +                                     if (!$this->writeFile($tabName,$tab))
> +                                             return false;
> +                                     $this->prefCount ++;
> +                             }
> +                     }
> +             }
> +             // record the state so its easy to figure out whats what next time.
> +             $state = json_encode(array(
> +                     'version' => $this->getBaseVersion(),
> +                     'created' => time()));
> +             file_put_contents('storage/prefsdoc/state.json',$state);
> +
> +             $logslib = TikiLib::lib('logs');
> +             $logslib->add_log('prefDoc',$this->fileCount. ' pref doc files generated/updated covering ' . $this->prefCount.' prefs');
> +
> +             return true;
> +     }
> +
> +     /**
> +      * compiles a all prefs for the current tiki install and sets PrefVars with it
> +      */
> +     private function getPrefs(){
> +
> +             $prefs = array();
> +             $docFiles = scandir('lib/prefs'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> +                             require_once ('lib/prefs/'.$fileName);
> +                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> +                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> +
> +                     }
> +             }
> +             $this->PrefVars = $prefs;
> +     }
> +
> +
> +
> +     /**
> +      *
> +      * This generates a list of prefs in the order that they appear on the admin panel.
> +      *
> +      * @param string $fileName Name of file to scan
> +      *
> +      * @return array  array of pref names, or false on failure
> +      *
> +      */
> +     private function getAdminUIPrefs($fileName){
> +             $file = file_get_contents('templates/admin/' . $fileName);
> +             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> +             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> +             if ($count) {
> +                     while ($count >= 1) {
> +                             $count--;
> +                             $prefs = array();
> +                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> +                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> +                             foreach ($prefs[1] as $pref) {
> +                                     $tabPrefs[$fileName . '-' . $tabs[1][$count]][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                             }
> +                     }
> +             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){
> +                     foreach ($prefs[1] as $pref) {
> +                             $tabPrefs[$fileName][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                     }
> +             }
> +
> +             return $tabPrefs;
> +     }
> +
> +
> +     /**
> +      *
> +      * This sets an vars of an individual preference
> +      *
> +      * @param $param object the prefs to be processed into pretty & standardized output
> +      */
> +     private function setParams($param)
> +     {
> +             // set default
> +             if ($param->default == 'n') {
> +                     $this->prefDefault = 'Disabled';
> +             } else if ($param->default == 'y') {
> +                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> +             } else if (is_array($param->default)) {
> +                     $this->prefDefault = implode(', ', $param->default);
> +             } else {
> +                     $this->prefDefault = $param->default;
> +             }
> +             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> +             $this->prefDefault = trim($this->prefDefault);
> +             if (!$this->prefDefault) {
> +                     $this->prefDefault = '~~gray:None~~';
> +             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> +                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> +             } else{
> +                     if (strlen($this->prefDefault) > 30) {
> +                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> +                     }
> +                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> +             }
> +
> +             // set name
> +             if ($param->help) {
> +                     $this->prefName = '((' . $param->help . '|' . $param->name . '))';
> +             }else {
> +                     $this->prefName = $param->name;
> +             }
> +             $this->prefName = $this->wikiConvert($this->prefName);
> +
> +             // set description
> +             $this->prefDescription = $param->description;
> +             if ($param->hint)
> +                     $this->prefDescription .= " ''Hint: ".$param->hint."''";
> +             foreach ($param->tags as $tag)
> +                     if ($tag === 'experimental')
> +                             $this->prefDescription .= ' (experimental)';
> +             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> +     }
> +
> +
> +     /**
> +      * Preps a string from tiki prefs for insertion into tiki-syntax land
> +      *
> +      * @param $string string to be parsed
> +      *
> +      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> +      *
> +      *
> +      * @return string parsed string sutable for wiki insertion
> +      *
> +      */
> +     private function wikiConvert($string, $escape = false){
> +             $escapedString = '';
> +             if ($string) {
> +                     if ($escape) {
> +                             $escapedString = ' ~np~';
> +                     }
> +                     $escapedString .= str_replace("\n", ' ', $string);
> +                     $escapedString = trim($escapedString);
> +                     if ($escape) {
> +                             $escapedString .= '~/np~';
> +                     }
> +             }
> +
> +             return $escapedString;
> +
> +     }
> +
> +     /**
> +      *
> +      * Generates a wiki syntax table for a specific version of tiki
> +      *
> +      * @param string $fileName  The file name to write to disk.
> +      *
> +      * @return bool false on error, true otherwise
> +      */
> +     private function genPrefVersion($fileName)
> +     {
> +             if (!is_file($fileName)){
> +                     $this->error .= "Cant read $fileName. ";
> +                     return false;
> +             }
> +             $this->docTable .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}';
> +             $FilePrefs = json_decode(file_get_contents($fileName));
> +             foreach ($FilePrefs->prefs as $prefName => &$pref) {
> +                     $this->prevFilePrefs;
> +
> +                     // carry over missing information filled out in a newer version
> +                     if (!$pref->description)
> +                             $pref->description = $this->prevFilePrefs->$prefName->description;
> +                     if (!$pref->help)
> +                             $pref->help = $this->prevFilePrefs->$prefName->help;
> +                     if (!$pref->hint)
> +                             $pref->hint = $this->prevFilePrefs->$prefName->hint;
> +                     $this->setParams($pref);
> +                     $this->docTable .= $this->prefName . '~|~' . $this->prefDescription . '~|~' . $this->prefDefault . "\n";
> +             }
> +             $this->prevFilePrefs = $FilePrefs->prefs;
> +             $this->docTable .= "{FANCYTABLE}";
> +             return true;
> +     }
> +
> +     /**
> +      *
> +      * Writes a pref file to disk
> +      *
> +      * @param $tabName string name of tab or pref file to write
> +      * @param $prefs array the prefs to write to file
> +      *
> +      * @return bool|string returns error message on failure, or false on success
> +      */
> +
> +
> +     private function writeFile($tabName,$prefs)
> +     {
> +             $version = (int)$this->getBaseVersion();
> +             $oldest = $version;
> +             $tabName = '-' . $tabName . '.json';                // Name of file to be written, minus prefex
> +
> +             while (is_file('storage/prefsdoc/' . ($oldest - 1) . $tabName)) {
> +                     $oldest--;
> +             }
> +
> +             $prefs = json_encode(array(
> +                     'oldest' => $oldest,
> +                     'prefs'  => $prefs,
> +             ));
> +
> +             if (is_file('storage/prefsdoc/' . $version . $tabName)) {
> +                     if (!unlink('storage/prefsdoc/' . $version . $tabName)) {
> +                             $this->error .= ("Cant overwrite existing $version-$tabName.json ");
> +
> +                             return false;
> +
> +                     }
> +             }
> +
> +             if (!file_put_contents('storage/prefsdoc/' . $version . $tabName, $prefs)) {
> +                     // write one file for each pref page on control panel
> +                     $this->error .= ("Unable to write $version.$tabName");
> +                     return false;
> +             }
> +             $this->fileCount++;
> +             return true;
> +     }
> +}
> +
>
> Modified: trunk/tiki-admin_system.php
> ===================================================================
> --- trunk/tiki-admin_system.php       2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/tiki-admin_system.php       2017-02-07 08:27:25 UTC (rev 61234)
> @@ -22,6 +22,10 @@
>               // Also rebuild admin index
>               TikiLib::lib('prefs')->rebuildIndex();
>
> +             // also rebuild plugin prefdoc current version
> +             if (file_exists('storage/prefsdoc/state.json'))
> +                     unlink('storage/prefsdoc/state.json');
> +
>               // seems combination of clearing prefs and public now messes up the page, so reload
>               include_once('lib/setup/prefs.php');
>               initialize_prefs();
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Tikiwiki-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tikiwiki-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

Dr. Sassafras

Would “'Generates documentation for Tiki plugins ([mostly] used on Tiki’s documentation website).” not be a clearer description? Actually, does this only document plugins?


It does not document plugins at all, it creates documentation for tiki preferences. Perhaps "Generates documentation for Tiki preferences (mostly used on Tiki’s documentation website)." Would be good?

Brendan

Perhaps 

De : Brendan Ferguson [[hidden email]]
Envoyé : 7 février 2017 10:39
À : Tiki developers <[hidden email]>
Objet : [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

 

ya, I had to run earlier so was not able to write this email right away, but here it is:

PrefDoc Plugin

Documents current tiki plugins, by outputting a table very similar to what we currently use.

* This will automatically record and keep past preference versions. So each version of tiki will be recorded.

* It allows for preference images to be inserted like we currently do.

* It automatically re-caches the current tiki preferences every time the version number increases (like from 17.0 to 17.1)

* You may force a re-cache by emptying all caches (will only re-load current version)

* If description, hint or help (link) are added to a new version of tiki, it automatically populates past versions that are missing that information

* Images specified for a version of tiki (say version 12) will stretch forward up to 4 versions if no other images exist.

*Preference data is stored as it is in tiki, so there is information cached that is not being used, it allows for maximum expansion in the future with backwards compatibility (like if color coding for basic-advanced-experimental was to be implemented etc.)

* This also means that updates to PrefDoc Plugin visual appearance is independent from storage, allowing for dramatic style changes.

Syntax:
{PREFDOC(tab="community-socialinteraction" img="17:1|10:2") /}

If no tab or a invalid tab is specified, it will generate a list of available preference tabs. Images are: TikiVersionNum:FileGalleryId|TikiVersionNum:FileGalleryId|etc. etc.

 

So. Plans for moving forward. We have a lot of old info on pages that may or may not be current. We cant mix and match this with the old info. Its all got to be deleted or migrated over. There is a lot of info on those pages though that is NOT in tiki. Im willing to migrate that data over, but have zero interest in discussing if the data is correct or grammatically correct. So if I do it, we got to find others willing to correct it, or we just have to agree that some information (mostly descriptions) is a step up from a blank space.

To migrate this onto the doc website, I will need to back-port it to 16.x (case that is the version of server running there now)

Im not interested in back porting the migrated info from the doc sites, so that info wont be available on the doc website until the server is upgraded to 17.x, where it will become available, unless someone wants to pack port it.

 

I can also do a local backport of the plugin to generate a preference history back as far as 9.x (dont see much use in going further, but likely wouldn't be much effort to do so if someone wanted the older data.

I also have a question. The Plugin currently supports help links that point to doc.tiki.org. 99% of them do but i think I saw 2 (maybe 3) that point other places. Im kinda in favor of moving those links into the description and having the help links point always to a doc.tiki.org page. If we want external links there, its no big deal incorporating that into the plugin, but just thought I would ask you guys what you thought? When looking at the documentation online, I just thought it was really slick to be able to rely on those links keeping you on the current website.

 

Limitations:

* Ideally the output wound be re-done to be HTML instead of wiki syntax, for performance and versatility.

* It currently relies on consecutive version numbers, skipping is not supported (although it could be modified to do this)

 

Thoughts?

 

---------- Forwarded message ----------
From: Jonny Bradley <[hidden email]>
Date: Tue, Feb 7, 2017 at 7:09 PM
Subject: Re: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
To: Tiki developers <[hidden email]>


Hi Brendan

This looks good, looking forward to trying it out!

Thanks :)

jonny



> On 7 Feb 2017, at 09:27, [hidden email] wrote:
>
> Revision: 61234
>          http://sourceforge.net/p/tikiwiki/code/61234
> Author:   drsassafras
> Date:     2017-02-07 08:27:25 +0000 (Tue, 07 Feb 2017)
> Log Message:
> -----------
> [NEW] PrefDoc Plugin - Automatically document tiki prefs
>
> Modified Paths:
> --------------
>    trunk/tiki-admin_system.php
>
> Added Paths:
> -----------
>    trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
>
> Removed Paths:
> -------------
>    trunk/doc/devtools/experimental/prefsdoc.php
>
> Deleted: trunk/doc/devtools/experimental/prefsdoc.php
> ===================================================================
> --- trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 08:27:25 UTC (rev 61234)
> @@ -1,228 +0,0 @@
> -#!/usr/bin/php
> -<?php
> -// (c) Copyright 2002-2017 by authors of the Tiki Wiki CMS Groupware Project
> -//
> -// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> -// $Id:
> -
> -
> -// can only be run from the command line
> -if (php_sapi_name() !== 'cli'){
> -     echo 'can only be run from the command line';
> -     die;
> -}
> -
> -$baseDir = realpath(__DIR__ .'/../../../').'/';
> -
> -require_once ($baseDir.'tiki-setup.php');
> -
> -/**
> - *
> - * Used for automatically generating preference documentation
> - * for use on doc.tiki.org. It takes the currently installed preferences
> - * and generates files in wiki-syntax to be pasted into doc.tiki.org
> - *
> - * Running this will overwrite any previously generated pref doc files
> - *
> - * TODO: Handle help links that dont point at doc.tiki.org
> - *
> - * TODO: There is 4 prefs that are not captured with tabs. (maybe outside a tab?)
> - *
> - * Class PrefsDoc
> - *
> - */
> -
> -class PrefsDoc extends TWVersion{
> -
> -     public $baseDir;
> -     private $PrefVars;
> -     public $fileCount;
> -     public $prefCount;
> -     public $prefDefault;
> -     public $prefDescription;
> -     public $prefName;
> -     public $docTable;
> -
> -     public function getPrefs(){
> -
> -             $prefs = array();
> -             $docFiles = scandir($this->baseDir.'lib/prefs'); // grab all the files that house prefs
> -             foreach ($docFiles as $fileName) {
> -                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> -                             require ($this->baseDir.'lib/prefs/'.$fileName);
> -                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> -                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> -
> -                     }
> -             }
> -             $this->PrefVars = $prefs;
> -     }
> -
> -
> -
> -     /**
> -      *
> -      * This generates a list of prefs in the order that they appear on the admin panel.
> -      *
> -      * @param string $fileName Name of file to scan
> -      *
> -      * @return array  array of pref names
> -      *
> -      */
> -     public function getAdminUIPrefs($fileName){
> -             $file = file_get_contents($this->baseDir . 'templates/admin/' . $fileName);
> -             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> -             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> -             if ($count) {
> -                     while ($count >= 1) {
> -                             $count--;
> -                             $prefs = array();
> -                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> -                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> -                             if ($prefs[1])
> -                                     $tabPrefs[$fileName.'-'.$tabs[1][$count]] = $prefs[1];                                                                                  // Add named tabbed array
> -                     }
> -             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){;
> -                     $tabPrefs[$fileName] = $prefs[1];
> -             }
> -
> -             return $tabPrefs;
> -     }
> -
> -
> -     /**
> -      *
> -      * This sets an vars of an indivigual prefrence
> -      *
> -      * @param $param
> -      */
> -     public function setParams($param)
> -     {
> -
> -             // set default
> -             if ($this->PrefVars[$param]['default'] == 'n') {
> -                     $this->prefDefault = 'Disabled';
> -             } else if ($this->PrefVars[$param]['default'] == 'y') {
> -                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> -             } else if (is_array($this->PrefVars[$param]['default'])) {
> -                     $this->prefDefault = implode(', ', $this->PrefVars[$param]['default']);
> -             } else {
> -                     $this->prefDefault = $this->PrefVars[$param]['default'];
> -             }
> -             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> -             $this->prefDefault = trim($this->prefDefault);
> -             if (!$this->prefDefault) {
> -                     $this->prefDefault = '~~gray:None~~';
> -             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> -                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> -             } else{
> -                     if (strlen($this->prefDefault) > 30) {
> -                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> -                     }
> -                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> -             }
> -
> -             // set name
> -             if ($this->PrefVars[$param]['help']) {
> -                     $this->prefName = '((' . $this->PrefVars[$param]['help'] . '|' . $this->PrefVars[$param]['name'] . '))';
> -             }else {
> -                     $this->prefName = $this->PrefVars[$param]['name'];
> -             }
> -             $this->prefName = $this->wikiConvert($this->prefName);
> -
> -             // set description
> -             $this->prefDescription = $this->PrefVars[$param]['description'];
> -             if ($this->PrefVars[$param]['hint'])
> -                     $this->prefDescription .= " ''Hint: ".$this->PrefVars[$param]['hint']."''";
> -             foreach ($this->PrefVars[$param]['tags'] as $tag)
> -                     if ($tag === 'experimental')
> -                             $this->prefDescription .= ' (experimental)';
> -             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> -     }
> -
> -
> -     /**
> -      * Preps a string from tiki prefs for insertion into tiki-syntax land
> -      *
> -      * @param $string string to be parsed
> -      *
> -      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> -      *
> -      *
> -      * @return string parsed string sutable for wiki insertion
> -      *
> -      */
> -     private function wikiConvert($string, $escape = false){
> -             $escapedString = '';
> -             if ($string) {
> -                     if ($escape) {
> -                             $escapedString = ' ~np~';
> -                     }
> -                     $escapedString .= str_replace("\n", ' ', $string);
> -                     $escapedString = trim($escapedString);
> -                     if ($escape) {
> -                             $escapedString .= '~/np~';
> -                     }
> -             }
> -
> -             return $escapedString;
> -
> -     }
> -
> -     /**
> -      *
> -      * Writes a generated pref wiki formatted file to disk
> -      *
> -      * @param string $fileName  The file name to write to disk.
> -      *
> -      */
> -     public function writeFile($fileName){
> -
> -             $begining = '~hc~ -- Table generated with prefsdoc.php for tiki '.$this->getVersion()." -- ~/hc~\n";
> -             $begining .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}'."\n";
> -
> -             $end = "{FANCYTABLE}\n/////\n";
> -
> -             $fileName .=".txt";                             // Name of file to be written
> -
> -             if (!is_dir($this->baseDir.'storage/prefsdoc')) {
> -                     if (!mkdir($this->baseDir . 'storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> -                             die("Cant create storage/prefsdoc directory\n");
> -                     }
> -             }if (is_file($this->baseDir . 'storage/prefsdoc/' . $fileName)) {
> -                     if (!unlink($this->baseDir . 'storage/prefsdoc/' . $fileName)){
> -                             die("Cant overwrite existing $fileName\n");
> -                             }
> -                     }
> -
> -             if (!file_put_contents($this->baseDir . 'storage/prefsdoc/' . $fileName, $begining.$this->docTable.$end))               // write one file for each pref page on control panel
> -                     die("Unable to write $fileName\n");
> -             $this->docTable = '';
> -     }
> -}
> -
> -$Doc = new PrefsDoc();
> -$Doc->baseDir = $baseDir;
> -$Doc->fileCount = 0;
> -$Doc->prefCount = 0;
> -$Doc->getPrefs();
> -
> -$docFiles = scandir($baseDir.'templates/admin'); // grab all the files that house prefs
> -foreach ($docFiles as $fileName) {
> -     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> -             $FilePrefs = $Doc->getAdminUIPrefs($fileName);
> -             $Doc->docTable = '';
> -             foreach ($FilePrefs as $tabName => $tab) {
> -                     foreach ($tab as $param) {
> -                             $Doc->setParams($param);
> -                             $Doc->prefCount++;
> -                             $Doc->docTable .= $Doc->prefName . '~|~' . $Doc->prefDescription . '~|~' . $Doc->prefDefault . "\n";
> -                     }
> -                     $Doc->writeFile($tabName);
> -                     $Doc->fileCount++;
> -             }
> -     }
> -}
> -
> -echo "\033[33m".$Doc->fileCount. ' pref files written to storage/prefsdoc/ with a total of '.$Doc->prefCount." prefs.\033[0m\n";
>
> Added: trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
> ===================================================================
> --- trunk/lib/wiki-plugins/wikiplugin_prefdoc.php                             (rev 0)
> +++ trunk/lib/wiki-plugins/wikiplugin_prefdoc.php     2017-02-07 08:27:25 UTC (rev 61234)
> @@ -0,0 +1,437 @@
> +<?php
> +// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
> +//
> +// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> +// $Id:
> +
> +function wikiplugin_prefdoc_info()
> +{
> +     return array(
> +             'name' => tra('Document Preferences'),
> +             //'documentation' => tra('coming+soon'), TODO Fill in doc page
> +             'description' => tra('Generates documentation for Tiki preferences tabs.'),
> +             'prefs' => array( 'wikiplugin_prefdoc' ),
> +             'validate' => 'all',
> +             'introduced' => 17,
> +             'iconname' => 'th-list',
> +             'tags' => array( 'advanced' ),
> +             'params' => array(
> +                     'tab' => array(
> +                             'required' => false,
> +                             'name' => tra('Preference-Tab'),
> +                             'description' => tra('The name of the preference tab to display. In the format of "preference page name"-"Tab Name witout spaces" eg. To link to General Layout on the Look and Feel page you would use "look-generallayout". Note that the "look" can be found in the url tiki-admin.php?page=<strong>look</strong>.'),
> +                             'filter' => 'text',
> +                             'since' => '17',
> +                     ),
> +                     'img' => array(
> +                             'required' => false,
> +                             'name' => tra('Images'),
> +                             'description' => tra('Show images at the top of each version of tiki. Format: TikiVersion:FileGalleryID'),
> +                             'since' => '17',
> +                             'filter' => 'text',
> +                     ),
> +             ),
> +     );
> +}
> +
> +/**
> + *
> + * Generate, Display & Archive Tiki Pref Documentation
> + *
> + * @param $data     this is ignored
> + * @param $params   paramiters to process
> + *
> + * @return string   returnes error or pref table
> + */
> +
> +function wikiplugin_prefdoc( $data, $params )
> +{
> +
> +     $Doc = new PrefsDoc();
> +
> +     if (!$Doc->genPrefsState())
> +             return $Doc->error;
> +
> +     if (!isset($params['tab']))         // if no tab specified, return a list of available tabs
> +             return $Doc->genPrefCodes();
> +
> +     if (!$Doc->genPrefHistory($params['tab'],$params['img']))
> +             return $Doc->error;
> +     return $Doc->error.$Doc->docTable;
> +}
> +
> +
> +
> +/**
> + *
> + *
> + * Used for automatically generating preference documentation
> + * for use on doc.tiki.org. It takes the currently installed preferences
> + * and generates files in wiki-syntax
> + *
> + * Running this will overwrite any previously generated pref doc files
> + *
> + * TODO: Handle help links that dont point at doc.tiki.org
> + *
> + *
> + * Class PrefsDoc
> + *
> + * @var $docTable string The output to be sent to displayed, in wiki format
> + *
> + */
> +
> +
> +class PrefsDoc extends TWVersion{
> +
> +     private $PrefVars;
> +     private $prevFilePrefs;
> +     private $fileCount;
> +     private $prefCount;
> +     private $prefDefault;
> +     private $prefDescription;
> +     private $prefName;
> +     public $docTable;
> +     public $error;
> +
> +
> +     /**
> +      *
> +      * Populates $docTable with a string to display.
> +      * The main function to generate version tabs etc.
> +      *
> +      * @param $tabName string   The pref-tab name to create an output for
> +      * @param $images string    Images & Versions to display with a Version tab.
> +      *
> +      * @return bool             true on success false on failure
> +      */
> +     public function genPrefHistory($tabName,$images){
> +
> +             $version = (int)$this->getBaseVersion();
> +             if (!is_file("storage/prefsdoc/$version-$tabName.json")) {
> +                     $this->error .= "Error: <strong>Cant find $tabName</strong> you may choose from one of the following: \n".$this->genPrefCodes();
> +                     return false;
> +             }
> +             $file = json_decode(file_get_contents("storage/prefsdoc/$version-$tabName.json"));
> +
> +             while ($version >= $file->oldest){
> +                     $versions[] = $version;
> +                     $version --;
> +             }
> +
> +             $this->docTable = '{TABS(name="'.$tabName.'" tabs="Tiki Version '.implode('|',$versions)."\" toggle=\"n\")}";
> +             $imageArray = array();
> +             $images = explode('|',$images);
> +             foreach ($images as $key => $image) {
> +                     $image = explode(':', $image);
> +                     $imageArray[$image[0]][0] = $image[1];
> +                     $imageArray[$image[0]][1] = $image[0];
> +             }
> +             unset($images);
> +
> +             // carry over images from past versions of Tiki, if available.
> +             foreach ($versions as $version) {
> +                     $count =$version;
> +                     while ($version - $count < 4) {         // If the image is older than 4 tiki versions, dont display it.
> +                             if ($imageArray[$count][0]) {
> +                                     $this->docTable .= '{img fileId="'.$imageArray[$count][0].'" thumb="y" rel="box[g]" width="300" desc="Tiki '.  $imageArray[$count][1].' Preferences Image" alt="' . $tabName . '" align="center"}';
> +                                     break;
> +                             }
> +                             $count--;
> +                     }
> +                     $this->genPrefVersion("storage/prefsdoc/$version-$tabName.json");
> +                     if ($file->oldest !== $version)
> +                             $this->docTable .= "/////\n";
> +             }
> +
> +
> +             $this->docTable .= '{TABS}';
> +             return true;
> +
> +     }
> +
> +     /**
> +      *
> +      * @return string file-tab codes available for use.
> +      */
> +     public function genPrefCodes(){
> +
> +             $version = (int)$this->getBaseVersion();
> +             $files = glob('storage/prefsdoc/'.$version.'-*.json');
> +             if (!$files)
> +                     return 'There was no files found, please Clear All Caches to reindex files.';
> +             foreach ($files as $key => $file){
> +                     $file = substr($file,20);
> +                     $files[$key] = substr($file,0,-5);
> +             }
> +             $files = implode('<br>',$files);
> +             return $files;
> +     }
> +
> +     /**
> +      *
> +      * Check if the prefs documentation is up to date.
> +      * If its not up to date, then update it.
> +      *
> +      * Documentation is updated for every minor version change.
> +      * A seprate set of documentatin is creaed for every major version.
> +      * Only consecutive versions are supported (you cant skip a version)
> +      *
> +      * @return bool false on error, true on success.
> +      */
> +
> +
> +     public function genPrefsState(){
> +
> +             if (!is_dir('storage/prefsdoc')) {
> +                     if (!mkdir('storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> +                             $this->error .= "Cant create storage/prefsdoc directory. ";
> +                             return false;
> +                     }
> +             }
> +
> +             // check if the current prefs doc is up to date, if its not, continue
> +             if (is_file('storage/prefsdoc/state.json')){
> +                     $state = json_decode(file_get_contents('storage/prefsdoc/state.json'));
> +                     if ($state->version === $this->getBaseVersion())
> +                             return true;
> +             }
> +
> +             // prepate to generate prefs doc
> +             $this->fileCount = 0;
> +             $this->prefCount = 0;
> +             $this->getPrefs();
> +
> +             $docFiles = scandir('templates/admin'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> +                             $FilePrefs = $this->getAdminUIPrefs($fileName);
> +                             foreach ($FilePrefs as $tabName => $tab) {
> +                                     if (!$this->writeFile($tabName,$tab))
> +                                             return false;
> +                                     $this->prefCount ++;
> +                             }
> +                     }
> +             }
> +             // record the state so its easy to figure out whats what next time.
> +             $state = json_encode(array(
> +                     'version' => $this->getBaseVersion(),
> +                     'created' => time()));
> +             file_put_contents('storage/prefsdoc/state.json',$state);
> +
> +             $logslib = TikiLib::lib('logs');
> +             $logslib->add_log('prefDoc',$this->fileCount. ' pref doc files generated/updated covering ' . $this->prefCount.' prefs');
> +
> +             return true;
> +     }
> +
> +     /**
> +      * compiles a all prefs for the current tiki install and sets PrefVars with it
> +      */
> +     private function getPrefs(){
> +
> +             $prefs = array();
> +             $docFiles = scandir('lib/prefs'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> +                             require_once ('lib/prefs/'.$fileName);
> +                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> +                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> +
> +                     }
> +             }
> +             $this->PrefVars = $prefs;
> +     }
> +
> +
> +
> +     /**
> +      *
> +      * This generates a list of prefs in the order that they appear on the admin panel.
> +      *
> +      * @param string $fileName Name of file to scan
> +      *
> +      * @return array  array of pref names, or false on failure
> +      *
> +      */
> +     private function getAdminUIPrefs($fileName){
> +             $file = file_get_contents('templates/admin/' . $fileName);
> +             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> +             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> +             if ($count) {
> +                     while ($count >= 1) {
> +                             $count--;
> +                             $prefs = array();
> +                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> +                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> +                             foreach ($prefs[1] as $pref) {
> +                                     $tabPrefs[$fileName . '-' . $tabs[1][$count]][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                             }
> +                     }
> +             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){
> +                     foreach ($prefs[1] as $pref) {
> +                             $tabPrefs[$fileName][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                     }
> +             }
> +
> +             return $tabPrefs;
> +     }
> +
> +
> +     /**
> +      *
> +      * This sets an vars of an individual preference
> +      *
> +      * @param $param object the prefs to be processed into pretty & standardized output
> +      */
> +     private function setParams($param)
> +     {
> +             // set default
> +             if ($param->default == 'n') {
> +                     $this->prefDefault = 'Disabled';
> +             } else if ($param->default == 'y') {
> +                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> +             } else if (is_array($param->default)) {
> +                     $this->prefDefault = implode(', ', $param->default);
> +             } else {
> +                     $this->prefDefault = $param->default;
> +             }
> +             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> +             $this->prefDefault = trim($this->prefDefault);
> +             if (!$this->prefDefault) {
> +                     $this->prefDefault = '~~gray:None~~';
> +             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> +                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> +             } else{
> +                     if (strlen($this->prefDefault) > 30) {
> +                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> +                     }
> +                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> +             }
> +
> +             // set name
> +             if ($param->help) {
> +                     $this->prefName = '((' . $param->help . '|' . $param->name . '))';
> +             }else {
> +                     $this->prefName = $param->name;
> +             }
> +             $this->prefName = $this->wikiConvert($this->prefName);
> +
> +             // set description
> +             $this->prefDescription = $param->description;
> +             if ($param->hint)
> +                     $this->prefDescription .= " ''Hint: ".$param->hint."''";
> +             foreach ($param->tags as $tag)
> +                     if ($tag === 'experimental')
> +                             $this->prefDescription .= ' (experimental)';
> +             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> +     }
> +
> +
> +     /**
> +      * Preps a string from tiki prefs for insertion into tiki-syntax land
> +      *
> +      * @param $string string to be parsed
> +      *
> +      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> +      *
> +      *
> +      * @return string parsed string sutable for wiki insertion
> +      *
> +      */
> +     private function wikiConvert($string, $escape = false){
> +             $escapedString = '';
> +             if ($string) {
> +                     if ($escape) {
> +                             $escapedString = ' ~np~';
> +                     }
> +                     $escapedString .= str_replace("\n", ' ', $string);
> +                     $escapedString = trim($escapedString);
> +                     if ($escape) {
> +                             $escapedString .= '~/np~';
> +                     }
> +             }
> +
> +             return $escapedString;
> +
> +     }
> +
> +     /**
> +      *
> +      * Generates a wiki syntax table for a specific version of tiki
> +      *
> +      * @param string $fileName  The file name to write to disk.
> +      *
> +      * @return bool false on error, true otherwise
> +      */
> +     private function genPrefVersion($fileName)
> +     {
> +             if (!is_file($fileName)){
> +                     $this->error .= "Cant read $fileName. ";
> +                     return false;
> +             }
> +             $this->docTable .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}';
> +             $FilePrefs = json_decode(file_get_contents($fileName));
> +             foreach ($FilePrefs->prefs as $prefName => &$pref) {
> +                     $this->prevFilePrefs;
> +
> +                     // carry over missing information filled out in a newer version
> +                     if (!$pref->description)
> +                             $pref->description = $this->prevFilePrefs->$prefName->description;
> +                     if (!$pref->help)
> +                             $pref->help = $this->prevFilePrefs->$prefName->help;
> +                     if (!$pref->hint)
> +                             $pref->hint = $this->prevFilePrefs->$prefName->hint;
> +                     $this->setParams($pref);
> +                     $this->docTable .= $this->prefName . '~|~' . $this->prefDescription . '~|~' . $this->prefDefault . "\n";
> +             }
> +             $this->prevFilePrefs = $FilePrefs->prefs;
> +             $this->docTable .= "{FANCYTABLE}";
> +             return true;
> +     }
> +
> +     /**
> +      *
> +      * Writes a pref file to disk
> +      *
> +      * @param $tabName string name of tab or pref file to write
> +      * @param $prefs array the prefs to write to file
> +      *
> +      * @return bool|string returns error message on failure, or false on success
> +      */
> +
> +
> +     private function writeFile($tabName,$prefs)
> +     {
> +             $version = (int)$this->getBaseVersion();
> +             $oldest = $version;
> +             $tabName = '-' . $tabName . '.json';                // Name of file to be written, minus prefex
> +
> +             while (is_file('storage/prefsdoc/' . ($oldest - 1) . $tabName)) {
> +                     $oldest--;
> +             }
> +
> +             $prefs = json_encode(array(
> +                     'oldest' => $oldest,
> +                     'prefs'  => $prefs,
> +             ));
> +
> +             if (is_file('storage/prefsdoc/' . $version . $tabName)) {
> +                     if (!unlink('storage/prefsdoc/' . $version . $tabName)) {
> +                             $this->error .= ("Cant overwrite existing $version-$tabName.json ");
> +
> +                             return false;
> +
> +                     }
> +             }
> +
> +             if (!file_put_contents('storage/prefsdoc/' . $version . $tabName, $prefs)) {
> +                     // write one file for each pref page on control panel
> +                     $this->error .= ("Unable to write $version.$tabName");
> +                     return false;
> +             }
> +             $this->fileCount++;
> +             return true;
> +     }
> +}
> +
>
> Modified: trunk/tiki-admin_system.php
> ===================================================================
> --- trunk/tiki-admin_system.php       2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/tiki-admin_system.php       2017-02-07 08:27:25 UTC (rev 61234)
> @@ -22,6 +22,10 @@
>               // Also rebuild admin index
>               TikiLib::lib('prefs')->rebuildIndex();
>
> +             // also rebuild plugin prefdoc current version
> +             if (file_exists('storage/prefsdoc/state.json'))
> +                     unlink('storage/prefsdoc/state.json');
> +
>               // seems combination of clearing prefs and public now messes up the page, so reload
>               include_once('lib/setup/prefs.php');
>               initialize_prefs();
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Tikiwiki-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tikiwiki-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

Cloutier, Philippe (RESSOURCE EXTERNE)

Thanks. In that case, your suggestion seems perfect.

 

Philippe Cloutier
Registre foncier

Systèmes d’information

Ministère de l'Énergie et des Ressources naturelles

Québec (Québec)  G1H 6R1

Téléphone : 418 627-6282, poste 2209

philippe.cloutier.externe@...
mern.gouv.qc.ca

 

De : Dr. Sassafras [mailto:[hidden email]]
Envoyé : 9 février 2017 13:46
À : Cloutier, Philippe (RESSOURCE EXTERNE) <[hidden email]>
Cc : Tiki developers <[hidden email]>
Objet : Re: [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

 



Would “'Generates documentation for Tiki plugins ([mostly] used on Tiki’s documentation website).” not be a clearer description? Actually, does this only document plugins?

 

It does not document plugins at all, it creates documentation for tiki preferences. Perhaps "Generates documentation for Tiki preferences (mostly used on Tiki’s documentation website)." Would be good?

 

Brendan

 

Perhaps 

De : Brendan Ferguson [[hidden email]]
Envoyé : 7 février 2017 10:39
À : Tiki developers <[hidden email]>
Objet : [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

 

ya, I had to run earlier so was not able to write this email right away, but here it is:

PrefDoc Plugin

Documents current tiki plugins, by outputting a table very similar to what we currently use.

* This will automatically record and keep past preference versions. So each version of tiki will be recorded.

* It allows for preference images to be inserted like we currently do.

* It automatically re-caches the current tiki preferences every time the version number increases (like from 17.0 to 17.1)

* You may force a re-cache by emptying all caches (will only re-load current version)

* If description, hint or help (link) are added to a new version of tiki, it automatically populates past versions that are missing that information

* Images specified for a version of tiki (say version 12) will stretch forward up to 4 versions if no other images exist.

*Preference data is stored as it is in tiki, so there is information cached that is not being used, it allows for maximum expansion in the future with backwards compatibility (like if color coding for basic-advanced-experimental was to be implemented etc.)

* This also means that updates to PrefDoc Plugin visual appearance is independent from storage, allowing for dramatic style changes.

Syntax:
{PREFDOC(tab="community-socialinteraction" img="17:1|10:2") /}

If no tab or a invalid tab is specified, it will generate a list of available preference tabs. Images are: TikiVersionNum:FileGalleryId|TikiVersionNum:FileGalleryId|etc. etc.

 

So. Plans for moving forward. We have a lot of old info on pages that may or may not be current. We cant mix and match this with the old info. Its all got to be deleted or migrated over. There is a lot of info on those pages though that is NOT in tiki. Im willing to migrate that data over, but have zero interest in discussing if the data is correct or grammatically correct. So if I do it, we got to find others willing to correct it, or we just have to agree that some information (mostly descriptions) is a step up from a blank space.

To migrate this onto the doc website, I will need to back-port it to 16.x (case that is the version of server running there now)

Im not interested in back porting the migrated info from the doc sites, so that info wont be available on the doc website until the server is upgraded to 17.x, where it will become available, unless someone wants to pack port it.

 

I can also do a local backport of the plugin to generate a preference history back as far as 9.x (dont see much use in going further, but likely wouldn't be much effort to do so if someone wanted the older data.

I also have a question. The Plugin currently supports help links that point to doc.tiki.org. 99% of them do but i think I saw 2 (maybe 3) that point other places. Im kinda in favor of moving those links into the description and having the help links point always to a doc.tiki.org page. If we want external links there, its no big deal incorporating that into the plugin, but just thought I would ask you guys what you thought? When looking at the documentation online, I just thought it was really slick to be able to rely on those links keeping you on the current website.

 

Limitations:

* Ideally the output wound be re-done to be HTML instead of wiki syntax, for performance and versatility.

* It currently relies on consecutive version numbers, skipping is not supported (although it could be modified to do this)

 

Thoughts?

 

---------- Forwarded message ----------
From: Jonny Bradley <[hidden email]>
Date: Tue, Feb 7, 2017 at 7:09 PM
Subject: Re: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
To: Tiki developers <[hidden email]>


Hi Brendan

This looks good, looking forward to trying it out!

Thanks :)

jonny



> On 7 Feb 2017, at 09:27, [hidden email] wrote:
>
> Revision: 61234
>          http://sourceforge.net/p/tikiwiki/code/61234
> Author:   drsassafras
> Date:     2017-02-07 08:27:25 +0000 (Tue, 07 Feb 2017)
> Log Message:
> -----------
> [NEW] PrefDoc Plugin - Automatically document tiki prefs
>
> Modified Paths:
> --------------
>    trunk/tiki-admin_system.php
>
> Added Paths:
> -----------
>    trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
>
> Removed Paths:
> -------------
>    trunk/doc/devtools/experimental/prefsdoc.php
>
> Deleted: trunk/doc/devtools/experimental/prefsdoc.php
> ===================================================================
> --- trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 08:27:25 UTC (rev 61234)
> @@ -1,228 +0,0 @@
> -#!/usr/bin/php
> -<?php
> -// (c) Copyright 2002-2017 by authors of the Tiki Wiki CMS Groupware Project
> -//
> -// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> -// $Id:
> -
> -
> -// can only be run from the command line
> -if (php_sapi_name() !== 'cli'){
> -     echo 'can only be run from the command line';
> -     die;
> -}
> -
> -$baseDir = realpath(__DIR__ .'/../../../').'/';
> -
> -require_once ($baseDir.'tiki-setup.php');
> -
> -/**
> - *
> - * Used for automatically generating preference documentation
> - * for use on doc.tiki.org. It takes the currently installed preferences
> - * and generates files in wiki-syntax to be pasted into doc.tiki.org
> - *
> - * Running this will overwrite any previously generated pref doc files
> - *
> - * TODO: Handle help links that dont point at doc.tiki.org
> - *
> - * TODO: There is 4 prefs that are not captured with tabs. (maybe outside a tab?)
> - *
> - * Class PrefsDoc
> - *
> - */
> -
> -class PrefsDoc extends TWVersion{
> -
> -     public $baseDir;
> -     private $PrefVars;
> -     public $fileCount;
> -     public $prefCount;
> -     public $prefDefault;
> -     public $prefDescription;
> -     public $prefName;
> -     public $docTable;
> -
> -     public function getPrefs(){
> -
> -             $prefs = array();
> -             $docFiles = scandir($this->baseDir.'lib/prefs'); // grab all the files that house prefs
> -             foreach ($docFiles as $fileName) {
> -                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> -                             require ($this->baseDir.'lib/prefs/'.$fileName);
> -                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> -                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> -
> -                     }
> -             }
> -             $this->PrefVars = $prefs;
> -     }
> -
> -
> -
> -     /**
> -      *
> -      * This generates a list of prefs in the order that they appear on the admin panel.
> -      *
> -      * @param string $fileName Name of file to scan
> -      *
> -      * @return array  array of pref names
> -      *
> -      */
> -     public function getAdminUIPrefs($fileName){
> -             $file = file_get_contents($this->baseDir . 'templates/admin/' . $fileName);
> -             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> -             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> -             if ($count) {
> -                     while ($count >= 1) {
> -                             $count--;
> -                             $prefs = array();
> -                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> -                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> -                             if ($prefs[1])
> -                                     $tabPrefs[$fileName.'-'.$tabs[1][$count]] = $prefs[1];                                                                                  // Add named tabbed array
> -                     }
> -             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){;
> -                     $tabPrefs[$fileName] = $prefs[1];
> -             }
> -
> -             return $tabPrefs;
> -     }
> -
> -
> -     /**
> -      *
> -      * This sets an vars of an indivigual prefrence
> -      *
> -      * @param $param
> -      */
> -     public function setParams($param)
> -     {
> -
> -             // set default
> -             if ($this->PrefVars[$param]['default'] == 'n') {
> -                     $this->prefDefault = 'Disabled';
> -             } else if ($this->PrefVars[$param]['default'] == 'y') {
> -                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> -             } else if (is_array($this->PrefVars[$param]['default'])) {
> -                     $this->prefDefault = implode(', ', $this->PrefVars[$param]['default']);
> -             } else {
> -                     $this->prefDefault = $this->PrefVars[$param]['default'];
> -             }
> -             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> -             $this->prefDefault = trim($this->prefDefault);
> -             if (!$this->prefDefault) {
> -                     $this->prefDefault = '~~gray:None~~';
> -             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> -                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> -             } else{
> -                     if (strlen($this->prefDefault) > 30) {
> -                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> -                     }
> -                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> -             }
> -
> -             // set name
> -             if ($this->PrefVars[$param]['help']) {
> -                     $this->prefName = '((' . $this->PrefVars[$param]['help'] . '|' . $this->PrefVars[$param]['name'] . '))';
> -             }else {
> -                     $this->prefName = $this->PrefVars[$param]['name'];
> -             }
> -             $this->prefName = $this->wikiConvert($this->prefName);
> -
> -             // set description
> -             $this->prefDescription = $this->PrefVars[$param]['description'];
> -             if ($this->PrefVars[$param]['hint'])
> -                     $this->prefDescription .= " ''Hint: ".$this->PrefVars[$param]['hint']."''";
> -             foreach ($this->PrefVars[$param]['tags'] as $tag)
> -                     if ($tag === 'experimental')
> -                             $this->prefDescription .= ' (experimental)';
> -             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> -     }
> -
> -
> -     /**
> -      * Preps a string from tiki prefs for insertion into tiki-syntax land
> -      *
> -      * @param $string string to be parsed
> -      *
> -      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> -      *
> -      *
> -      * @return string parsed string sutable for wiki insertion
> -      *
> -      */
> -     private function wikiConvert($string, $escape = false){
> -             $escapedString = '';
> -             if ($string) {
> -                     if ($escape) {
> -                             $escapedString = ' ~np~';
> -                     }
> -                     $escapedString .= str_replace("\n", ' ', $string);
> -                     $escapedString = trim($escapedString);
> -                     if ($escape) {
> -                             $escapedString .= '~/np~';
> -                     }
> -             }
> -
> -             return $escapedString;
> -
> -     }
> -
> -     /**
> -      *
> -      * Writes a generated pref wiki formatted file to disk
> -      *
> -      * @param string $fileName  The file name to write to disk.
> -      *
> -      */
> -     public function writeFile($fileName){
> -
> -             $begining = '~hc~ -- Table generated with prefsdoc.php for tiki '.$this->getVersion()." -- ~/hc~\n";
> -             $begining .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}'."\n";
> -
> -             $end = "{FANCYTABLE}\n/////\n";
> -
> -             $fileName .=".txt";                             // Name of file to be written
> -
> -             if (!is_dir($this->baseDir.'storage/prefsdoc')) {
> -                     if (!mkdir($this->baseDir . 'storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> -                             die("Cant create storage/prefsdoc directory\n");
> -                     }
> -             }if (is_file($this->baseDir . 'storage/prefsdoc/' . $fileName)) {
> -                     if (!unlink($this->baseDir . 'storage/prefsdoc/' . $fileName)){
> -                             die("Cant overwrite existing $fileName\n");
> -                             }
> -                     }
> -
> -             if (!file_put_contents($this->baseDir . 'storage/prefsdoc/' . $fileName, $begining.$this->docTable.$end))               // write one file for each pref page on control panel
> -                     die("Unable to write $fileName\n");
> -             $this->docTable = '';
> -     }
> -}
> -
> -$Doc = new PrefsDoc();
> -$Doc->baseDir = $baseDir;
> -$Doc->fileCount = 0;
> -$Doc->prefCount = 0;
> -$Doc->getPrefs();
> -
> -$docFiles = scandir($baseDir.'templates/admin'); // grab all the files that house prefs
> -foreach ($docFiles as $fileName) {
> -     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> -             $FilePrefs = $Doc->getAdminUIPrefs($fileName);
> -             $Doc->docTable = '';
> -             foreach ($FilePrefs as $tabName => $tab) {
> -                     foreach ($tab as $param) {
> -                             $Doc->setParams($param);
> -                             $Doc->prefCount++;
> -                             $Doc->docTable .= $Doc->prefName . '~|~' . $Doc->prefDescription . '~|~' . $Doc->prefDefault . "\n";
> -                     }
> -                     $Doc->writeFile($tabName);
> -                     $Doc->fileCount++;
> -             }
> -     }
> -}
> -
> -echo "\033[33m".$Doc->fileCount. ' pref files written to storage/prefsdoc/ with a total of '.$Doc->prefCount." prefs.\033[0m\n";
>
> Added: trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
> ===================================================================
> --- trunk/lib/wiki-plugins/wikiplugin_prefdoc.php                             (rev 0)
> +++ trunk/lib/wiki-plugins/wikiplugin_prefdoc.php     2017-02-07 08:27:25 UTC (rev 61234)
> @@ -0,0 +1,437 @@
> +<?php
> +// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
> +//
> +// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> +// $Id:
> +
> +function wikiplugin_prefdoc_info()
> +{
> +     return array(
> +             'name' => tra('Document Preferences'),
> +             //'documentation' => tra('coming+soon'), TODO Fill in doc page
> +             'description' => tra('Generates documentation for Tiki preferences tabs.'),
> +             'prefs' => array( 'wikiplugin_prefdoc' ),
> +             'validate' => 'all',
> +             'introduced' => 17,
> +             'iconname' => 'th-list',
> +             'tags' => array( 'advanced' ),
> +             'params' => array(
> +                     'tab' => array(
> +                             'required' => false,
> +                             'name' => tra('Preference-Tab'),
> +                             'description' => tra('The name of the preference tab to display. In the format of "preference page name"-"Tab Name witout spaces" eg. To link to General Layout on the Look and Feel page you would use "look-generallayout". Note that the "look" can be found in the url tiki-admin.php?page=<strong>look</strong>.'),
> +                             'filter' => 'text',
> +                             'since' => '17',
> +                     ),
> +                     'img' => array(
> +                             'required' => false,
> +                             'name' => tra('Images'),
> +                             'description' => tra('Show images at the top of each version of tiki. Format: TikiVersion:FileGalleryID'),
> +                             'since' => '17',
> +                             'filter' => 'text',
> +                     ),
> +             ),
> +     );
> +}
> +
> +/**
> + *
> + * Generate, Display & Archive Tiki Pref Documentation
> + *
> + * @param $data     this is ignored
> + * @param $params   paramiters to process
> + *
> + * @return string   returnes error or pref table
> + */
> +
> +function wikiplugin_prefdoc( $data, $params )
> +{
> +
> +     $Doc = new PrefsDoc();
> +
> +     if (!$Doc->genPrefsState())
> +             return $Doc->error;
> +
> +     if (!isset($params['tab']))         // if no tab specified, return a list of available tabs
> +             return $Doc->genPrefCodes();
> +
> +     if (!$Doc->genPrefHistory($params['tab'],$params['img']))
> +             return $Doc->error;
> +     return $Doc->error.$Doc->docTable;
> +}
> +
> +
> +
> +/**
> + *
> + *
> + * Used for automatically generating preference documentation
> + * for use on doc.tiki.org. It takes the currently installed preferences
> + * and generates files in wiki-syntax
> + *
> + * Running this will overwrite any previously generated pref doc files
> + *
> + * TODO: Handle help links that dont point at doc.tiki.org
> + *
> + *
> + * Class PrefsDoc
> + *
> + * @var $docTable string The output to be sent to displayed, in wiki format
> + *
> + */
> +
> +
> +class PrefsDoc extends TWVersion{
> +
> +     private $PrefVars;
> +     private $prevFilePrefs;
> +     private $fileCount;
> +     private $prefCount;
> +     private $prefDefault;
> +     private $prefDescription;
> +     private $prefName;
> +     public $docTable;
> +     public $error;
> +
> +
> +     /**
> +      *
> +      * Populates $docTable with a string to display.
> +      * The main function to generate version tabs etc.
> +      *
> +      * @param $tabName string   The pref-tab name to create an output for
> +      * @param $images string    Images & Versions to display with a Version tab.
> +      *
> +      * @return bool             true on success false on failure
> +      */
> +     public function genPrefHistory($tabName,$images){
> +
> +             $version = (int)$this->getBaseVersion();
> +             if (!is_file("storage/prefsdoc/$version-$tabName.json")) {
> +                     $this->error .= "Error: <strong>Cant find $tabName</strong> you may choose from one of the following: \n".$this->genPrefCodes();
> +                     return false;
> +             }
> +             $file = json_decode(file_get_contents("storage/prefsdoc/$version-$tabName.json"));
> +
> +             while ($version >= $file->oldest){
> +                     $versions[] = $version;
> +                     $version --;
> +             }
> +
> +             $this->docTable = '{TABS(name="'.$tabName.'" tabs="Tiki Version '.implode('|',$versions)."\" toggle=\"n\")}";
> +             $imageArray = array();
> +             $images = explode('|',$images);
> +             foreach ($images as $key => $image) {
> +                     $image = explode(':', $image);
> +                     $imageArray[$image[0]][0] = $image[1];
> +                     $imageArray[$image[0]][1] = $image[0];
> +             }
> +             unset($images);
> +
> +             // carry over images from past versions of Tiki, if available.
> +             foreach ($versions as $version) {
> +                     $count =$version;
> +                     while ($version - $count < 4) {         // If the image is older than 4 tiki versions, dont display it.
> +                             if ($imageArray[$count][0]) {
> +                                     $this->docTable .= '{img fileId="'.$imageArray[$count][0].'" thumb="y" rel="box[g]" width="300" desc="Tiki '.  $imageArray[$count][1].' Preferences Image" alt="' . $tabName . '" align="center"}';
> +                                     break;
> +                             }
> +                             $count--;
> +                     }
> +                     $this->genPrefVersion("storage/prefsdoc/$version-$tabName.json");
> +                     if ($file->oldest !== $version)
> +                             $this->docTable .= "/////\n";
> +             }
> +
> +
> +             $this->docTable .= '{TABS}';
> +             return true;
> +
> +     }
> +
> +     /**
> +      *
> +      * @return string file-tab codes available for use.
> +      */
> +     public function genPrefCodes(){
> +
> +             $version = (int)$this->getBaseVersion();
> +             $files = glob('storage/prefsdoc/'.$version.'-*.json');
> +             if (!$files)
> +                     return 'There was no files found, please Clear All Caches to reindex files.';
> +             foreach ($files as $key => $file){
> +                     $file = substr($file,20);
> +                     $files[$key] = substr($file,0,-5);
> +             }
> +             $files = implode('<br>',$files);
> +             return $files;
> +     }
> +
> +     /**
> +      *
> +      * Check if the prefs documentation is up to date.
> +      * If its not up to date, then update it.
> +      *
> +      * Documentation is updated for every minor version change.
> +      * A seprate set of documentatin is creaed for every major version.
> +      * Only consecutive versions are supported (you cant skip a version)
> +      *
> +      * @return bool false on error, true on success.
> +      */
> +
> +
> +     public function genPrefsState(){
> +
> +             if (!is_dir('storage/prefsdoc')) {
> +                     if (!mkdir('storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> +                             $this->error .= "Cant create storage/prefsdoc directory. ";
> +                             return false;
> +                     }
> +             }
> +
> +             // check if the current prefs doc is up to date, if its not, continue
> +             if (is_file('storage/prefsdoc/state.json')){
> +                     $state = json_decode(file_get_contents('storage/prefsdoc/state.json'));
> +                     if ($state->version === $this->getBaseVersion())
> +                             return true;
> +             }
> +
> +             // prepate to generate prefs doc
> +             $this->fileCount = 0;
> +             $this->prefCount = 0;
> +             $this->getPrefs();
> +
> +             $docFiles = scandir('templates/admin'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> +                             $FilePrefs = $this->getAdminUIPrefs($fileName);
> +                             foreach ($FilePrefs as $tabName => $tab) {
> +                                     if (!$this->writeFile($tabName,$tab))
> +                                             return false;
> +                                     $this->prefCount ++;
> +                             }
> +                     }
> +             }
> +             // record the state so its easy to figure out whats what next time.
> +             $state = json_encode(array(
> +                     'version' => $this->getBaseVersion(),
> +                     'created' => time()));
> +             file_put_contents('storage/prefsdoc/state.json',$state);
> +
> +             $logslib = TikiLib::lib('logs');
> +             $logslib->add_log('prefDoc',$this->fileCount. ' pref doc files generated/updated covering ' . $this->prefCount.' prefs');
> +
> +             return true;
> +     }
> +
> +     /**
> +      * compiles a all prefs for the current tiki install and sets PrefVars with it
> +      */
> +     private function getPrefs(){
> +
> +             $prefs = array();
> +             $docFiles = scandir('lib/prefs'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> +                             require_once ('lib/prefs/'.$fileName);
> +                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> +                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> +
> +                     }
> +             }
> +             $this->PrefVars = $prefs;
> +     }
> +
> +
> +
> +     /**
> +      *
> +      * This generates a list of prefs in the order that they appear on the admin panel.
> +      *
> +      * @param string $fileName Name of file to scan
> +      *
> +      * @return array  array of pref names, or false on failure
> +      *
> +      */
> +     private function getAdminUIPrefs($fileName){
> +             $file = file_get_contents('templates/admin/' . $fileName);
> +             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> +             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> +             if ($count) {
> +                     while ($count >= 1) {
> +                             $count--;
> +                             $prefs = array();
> +                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> +                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> +                             foreach ($prefs[1] as $pref) {
> +                                     $tabPrefs[$fileName . '-' . $tabs[1][$count]][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                             }
> +                     }
> +             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){
> +                     foreach ($prefs[1] as $pref) {
> +                             $tabPrefs[$fileName][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                     }
> +             }
> +
> +             return $tabPrefs;
> +     }
> +
> +
> +     /**
> +      *
> +      * This sets an vars of an individual preference
> +      *
> +      * @param $param object the prefs to be processed into pretty & standardized output
> +      */
> +     private function setParams($param)
> +     {
> +             // set default
> +             if ($param->default == 'n') {
> +                     $this->prefDefault = 'Disabled';
> +             } else if ($param->default == 'y') {
> +                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> +             } else if (is_array($param->default)) {
> +                     $this->prefDefault = implode(', ', $param->default);
> +             } else {
> +                     $this->prefDefault = $param->default;
> +             }
> +             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> +             $this->prefDefault = trim($this->prefDefault);
> +             if (!$this->prefDefault) {
> +                     $this->prefDefault = '~~gray:None~~';
> +             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> +                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> +             } else{
> +                     if (strlen($this->prefDefault) > 30) {
> +                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> +                     }
> +                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> +             }
> +
> +             // set name
> +             if ($param->help) {
> +                     $this->prefName = '((' . $param->help . '|' . $param->name . '))';
> +             }else {
> +                     $this->prefName = $param->name;
> +             }
> +             $this->prefName = $this->wikiConvert($this->prefName);
> +
> +             // set description
> +             $this->prefDescription = $param->description;
> +             if ($param->hint)
> +                     $this->prefDescription .= " ''Hint: ".$param->hint."''";
> +             foreach ($param->tags as $tag)
> +                     if ($tag === 'experimental')
> +                             $this->prefDescription .= ' (experimental)';
> +             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> +     }
> +
> +
> +     /**
> +      * Preps a string from tiki prefs for insertion into tiki-syntax land
> +      *
> +      * @param $string string to be parsed
> +      *
> +      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> +      *
> +      *
> +      * @return string parsed string sutable for wiki insertion
> +      *
> +      */
> +     private function wikiConvert($string, $escape = false){
> +             $escapedString = '';
> +             if ($string) {
> +                     if ($escape) {
> +                             $escapedString = ' ~np~';
> +                     }
> +                     $escapedString .= str_replace("\n", ' ', $string);
> +                     $escapedString = trim($escapedString);
> +                     if ($escape) {
> +                             $escapedString .= '~/np~';
> +                     }
> +             }
> +
> +             return $escapedString;
> +
> +     }
> +
> +     /**
> +      *
> +      * Generates a wiki syntax table for a specific version of tiki
> +      *
> +      * @param string $fileName  The file name to write to disk.
> +      *
> +      * @return bool false on error, true otherwise
> +      */
> +     private function genPrefVersion($fileName)
> +     {
> +             if (!is_file($fileName)){
> +                     $this->error .= "Cant read $fileName. ";
> +                     return false;
> +             }
> +             $this->docTable .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}';
> +             $FilePrefs = json_decode(file_get_contents($fileName));
> +             foreach ($FilePrefs->prefs as $prefName => &$pref) {
> +                     $this->prevFilePrefs;
> +
> +                     // carry over missing information filled out in a newer version
> +                     if (!$pref->description)
> +                             $pref->description = $this->prevFilePrefs->$prefName->description;
> +                     if (!$pref->help)
> +                             $pref->help = $this->prevFilePrefs->$prefName->help;
> +                     if (!$pref->hint)
> +                             $pref->hint = $this->prevFilePrefs->$prefName->hint;
> +                     $this->setParams($pref);
> +                     $this->docTable .= $this->prefName . '~|~' . $this->prefDescription . '~|~' . $this->prefDefault . "\n";
> +             }
> +             $this->prevFilePrefs = $FilePrefs->prefs;
> +             $this->docTable .= "{FANCYTABLE}";
> +             return true;
> +     }
> +
> +     /**
> +      *
> +      * Writes a pref file to disk
> +      *
> +      * @param $tabName string name of tab or pref file to write
> +      * @param $prefs array the prefs to write to file
> +      *
> +      * @return bool|string returns error message on failure, or false on success
> +      */
> +
> +
> +     private function writeFile($tabName,$prefs)
> +     {
> +             $version = (int)$this->getBaseVersion();
> +             $oldest = $version;
> +             $tabName = '-' . $tabName . '.json';                // Name of file to be written, minus prefex
> +
> +             while (is_file('storage/prefsdoc/' . ($oldest - 1) . $tabName)) {
> +                     $oldest--;
> +             }
> +
> +             $prefs = json_encode(array(
> +                     'oldest' => $oldest,
> +                     'prefs'  => $prefs,
> +             ));
> +
> +             if (is_file('storage/prefsdoc/' . $version . $tabName)) {
> +                     if (!unlink('storage/prefsdoc/' . $version . $tabName)) {
> +                             $this->error .= ("Cant overwrite existing $version-$tabName.json ");
> +
> +                             return false;
> +
> +                     }
> +             }
> +
> +             if (!file_put_contents('storage/prefsdoc/' . $version . $tabName, $prefs)) {
> +                     // write one file for each pref page on control panel
> +                     $this->error .= ("Unable to write $version.$tabName");
> +                     return false;
> +             }
> +             $this->fileCount++;
> +             return true;
> +     }
> +}
> +
>
> Modified: trunk/tiki-admin_system.php
> ===================================================================
> --- trunk/tiki-admin_system.php       2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/tiki-admin_system.php       2017-02-07 08:27:25 UTC (rev 61234)
> @@ -22,6 +22,10 @@
>               // Also rebuild admin index
>               TikiLib::lib('prefs')->rebuildIndex();
>
> +             // also rebuild plugin prefdoc current version
> +             if (file_exists('storage/prefsdoc/state.json'))
> +                     unlink('storage/prefsdoc/state.json');
> +
>               // seems combination of clearing prefs and public now messes up the page, so reload
>               include_once('lib/setup/prefs.php');
>               initialize_prefs();
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Tikiwiki-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tikiwiki-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

Jonny Bradley-4
Hi Brendan,

Thanks for this, i haven't had time to look at the code in detail so i set up a little test on next to see what it does here:


This has {prefdoc tab="look-theme"} in it and seems to work nicely - not sure how the images param needs to be set up but i think it'll be a good addition to doc form 17.x onwards.

Thanks again! :)

jonny




On 9 Feb 2017, at 18:50, Cloutier, Philippe (RESSOURCE EXTERNE) <[hidden email]> wrote:

Thanks. In that case, your suggestion seems perfect.
 
Philippe Cloutier
Registre foncier
Systèmes d’information
Ministère de l'Énergie et des Ressources naturelles
Québec (Québec)  G1H 6R1
Téléphone : 418 627-6282, poste 2209
<a href="x-msg://102/philippe.cloutier.externe@mern.gouv.qc.ca" style="color: purple; text-decoration: underline;" class="">philippe.cloutier.externe@...
mern.gouv.qc.ca
 
De : Dr. Sassafras [[hidden email]] 
Envoyé : 9 février 2017 13:46
À : Cloutier, Philippe (RESSOURCE EXTERNE) <[hidden email]>
Cc : Tiki developers <[hidden email]>
Objet : Re: [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
 


Would “'Generates documentation for Tiki plugins ([mostly] used on Tiki’s documentation website).” not be a clearer description? Actually, does this only document plugins?
 
It does not document plugins at all, it creates documentation for tiki preferences. Perhaps "Generates documentation for Tiki preferences (mostly used on Tiki’s documentation website)." Would be good?
 
Brendan
 
Perhaps 

De : Brendan Ferguson [[hidden email]] 
Envoyé : 7 février 2017 10:39
À : Tiki developers <[hidden email]>
Objet : [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
 

ya, I had to run earlier so was not able to write this email right away, but here it is:

PrefDoc Plugin

Documents current tiki plugins, by outputting a table very similar to what we currently use.

* This will automatically record and keep past preference versions. So each version of tiki will be recorded.
* It allows for preference images to be inserted like we currently do.
* It automatically re-caches the current tiki preferences every time the version number increases (like from 17.0 to 17.1)
* You may force a re-cache by emptying all caches (will only re-load current version)
* If description, hint or help (link) are added to a new version of tiki, it automatically populates past versions that are missing that information
* Images specified for a version of tiki (say version 12) will stretch forward up to 4 versions if no other images exist.
*Preference data is stored as it is in tiki, so there is information cached that is not being used, it allows for maximum expansion in the future with backwards compatibility (like if color coding for basic-advanced-experimental was to be implemented etc.)

* This also means that updates to PrefDoc Plugin visual appearance is independent from storage, allowing for dramatic style changes.

Syntax:
{PREFDOC(tab="community-socialinteraction" img="17:1|10:2") /}

If no tab or a invalid tab is specified, it will generate a list of available preference tabs. Images are: TikiVersionNum:FileGalleryId|TikiVersionNum:FileGalleryId|etc. etc.
 

So. Plans for moving forward. We have a lot of old info on pages that may or may not be current. We cant mix and match this with the old info. Its all got to be deleted or migrated over. There is a lot of info on those pages though that is NOT in tiki. Im willing to migrate that data over, but have zero interest in discussing if the data is correct or grammatically correct. So if I do it, we got to find others willing to correct it, or we just have to agree that some information (mostly descriptions) is a step up from a blank space.

To migrate this onto the doc website, I will need to back-port it to 16.x (case that is the version of server running there now)

Im not interested in back porting the migrated info from the doc sites, so that info wont be available on the doc website until the server is upgraded to 17.x, where it will become available, unless someone wants to pack port it. 
 

I can also do a local backport of the plugin to generate a preference history back as far as 9.x (dont see much use in going further, but likely wouldn't be much effort to do so if someone wanted the older data.

I also have a question. The Plugin currently supports help links that point to doc.tiki.org. 99% of them do but i think I saw 2 (maybe 3) that point other places. Im kinda in favor of moving those links into the description and having the help links point always to a doc.tiki.org page. If we want external links there, its no big deal incorporating that into the plugin, but just thought I would ask you guys what you thought? When looking at the documentation online, I just thought it was really slick to be able to rely on those links keeping you on the current website.
 
Limitations:
* Ideally the output wound be re-done to be HTML instead of wiki syntax, for performance and versatility.
* It currently relies on consecutive version numbers, skipping is not supported (although it could be modified to do this)
 
Thoughts?
 
---------- Forwarded message ----------
From: Jonny Bradley <[hidden email]>
Date: Tue, Feb 7, 2017 at 7:09 PM
Subject: Re: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
To: Tiki developers <[hidden email]>


Hi Brendan

This looks good, looking forward to trying it out!

Thanks :)

jonny



> On 7 Feb 2017, at 09:27, [hidden email] wrote:
>
> Revision: 61234
>          http://sourceforge.net/p/tikiwiki/code/61234
> Author:   drsassafras
> Date:     2017-02-07 08:27:25 +0000 (Tue, 07 Feb 2017)
> Log Message:
> -----------
> [NEW] PrefDoc Plugin - Automatically document tiki prefs
>
> Modified Paths:
> --------------
>    trunk/tiki-admin_system.php
>
> Added Paths:
> -----------
>    trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
>
> Removed Paths:
> -------------
>    trunk/doc/devtools/experimental/prefsdoc.php
>
> Deleted: trunk/doc/devtools/experimental/prefsdoc.php
> ===================================================================
> --- trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 08:27:25 UTC (rev 61234)
> @@ -1,228 +0,0 @@
> -#!/usr/bin/php
> -<?php
> -// (c) Copyright 2002-2017 by authors of the Tiki Wiki CMS Groupware Project
> -//
> -// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> -// $Id:
> -
> -
> -// can only be run from the command line
> -if (php_sapi_name() !== 'cli'){
> -     echo 'can only be run from the command line';
> -     die;
> -}
> -
> -$baseDir = realpath(__DIR__ .'/../../../').'/';
> -
> -require_once ($baseDir.'tiki-setup.php');
> -
> -/**
> - *
> - * Used for automatically generating preference documentation
> - * for use on doc.tiki.org. It takes the currently installed preferences
> - * and generates files in wiki-syntax to be pasted into doc.tiki.org
> - *
> - * Running this will overwrite any previously generated pref doc files
> - *
> - * TODO: Handle help links that dont point at doc.tiki.org
> - *
> - * TODO: There is 4 prefs that are not captured with tabs. (maybe outside a tab?)
> - *
> - * Class PrefsDoc
> - *
> - */
> -
> -class PrefsDoc extends TWVersion{
> -
> -     public $baseDir;
> -     private $PrefVars;
> -     public $fileCount;
> -     public $prefCount;
> -     public $prefDefault;
> -     public $prefDescription;
> -     public $prefName;
> -     public $docTable;
> -
> -     public function getPrefs(){
> -
> -             $prefs = array();
> -             $docFiles = scandir($this->baseDir.'lib/prefs'); // grab all the files that house prefs
> -             foreach ($docFiles as $fileName) {
> -                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> -                             require ($this->baseDir.'lib/prefs/'.$fileName);
> -                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> -                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> -
> -                     }
> -             }
> -             $this->PrefVars = $prefs;
> -     }
> -
> -
> -
> -     /**
> -      *
> -      * This generates a list of prefs in the order that they appear on the admin panel.
> -      *
> -      * @param string $fileName Name of file to scan
> -      *
> -      * @return array  array of pref names
> -      *
> -      */
> -     public function getAdminUIPrefs($fileName){
> -             $file = file_get_contents($this->baseDir . 'templates/admin/' . $fileName);
> -             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> -             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> -             if ($count) {
> -                     while ($count >= 1) {
> -                             $count--;
> -                             $prefs = array();
> -                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> -                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> -                             if ($prefs[1])
> -                                     $tabPrefs[$fileName.'-'.$tabs[1][$count]] = $prefs[1];                                                                                  // Add named tabbed array
> -                     }
> -             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){;
> -                     $tabPrefs[$fileName] = $prefs[1];
> -             }
> -
> -             return $tabPrefs;
> -     }
> -
> -
> -     /**
> -      *
> -      * This sets an vars of an indivigual prefrence
> -      *
> -      * @param $param
> -      */
> -     public function setParams($param)
> -     {
> -
> -             // set default
> -             if ($this->PrefVars[$param]['default'] == 'n') {
> -                     $this->prefDefault = 'Disabled';
> -             } else if ($this->PrefVars[$param]['default'] == 'y') {
> -                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> -             } else if (is_array($this->PrefVars[$param]['default'])) {
> -                     $this->prefDefault = implode(', ', $this->PrefVars[$param]['default']);
> -             } else {
> -                     $this->prefDefault = $this->PrefVars[$param]['default'];
> -             }
> -             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> -             $this->prefDefault = trim($this->prefDefault);
> -             if (!$this->prefDefault) {
> -                     $this->prefDefault = '~~gray:None~~';
> -             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> -                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> -             } else{
> -                     if (strlen($this->prefDefault) > 30) {
> -                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> -                     }
> -                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> -             }
> -
> -             // set name
> -             if ($this->PrefVars[$param]['help']) {
> -                     $this->prefName = '((' . $this->PrefVars[$param]['help'] . '|' . $this->PrefVars[$param]['name'] . '))';
> -             }else {
> -                     $this->prefName = $this->PrefVars[$param]['name'];
> -             }
> -             $this->prefName = $this->wikiConvert($this->prefName);
> -
> -             // set description
> -             $this->prefDescription = $this->PrefVars[$param]['description'];
> -             if ($this->PrefVars[$param]['hint'])
> -                     $this->prefDescription .= " ''Hint: ".$this->PrefVars[$param]['hint']."''";
> -             foreach ($this->PrefVars[$param]['tags'] as $tag)
> -                     if ($tag === 'experimental')
> -                             $this->prefDescription .= ' (experimental)';
> -             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> -     }
> -
> -
> -     /**
> -      * Preps a string from tiki prefs for insertion into tiki-syntax land
> -      *
> -      * @param $string string to be parsed
> -      *
> -      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> -      *
> -      *
> -      * @return string parsed string sutable for wiki insertion
> -      *
> -      */
> -     private function wikiConvert($string, $escape = false){
> -             $escapedString = '';
> -             if ($string) {
> -                     if ($escape) {
> -                             $escapedString = ' ~np~';
> -                     }
> -                     $escapedString .= str_replace("\n", ' ', $string);
> -                     $escapedString = trim($escapedString);
> -                     if ($escape) {
> -                             $escapedString .= '~/np~';
> -                     }
> -             }
> -
> -             return $escapedString;
> -
> -     }
> -
> -     /**
> -      *
> -      * Writes a generated pref wiki formatted file to disk
> -      *
> -      * @param string $fileName  The file name to write to disk.
> -      *
> -      */
> -     public function writeFile($fileName){
> -
> -             $begining = '~hc~ -- Table generated with prefsdoc.php for tiki '.$this->getVersion()." -- ~/hc~\n";
> -             $begining .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}'."\n";
> -
> -             $end = "{FANCYTABLE}\n/////\n";
> -
> -             $fileName .=".txt";                             // Name of file to be written
> -
> -             if (!is_dir($this->baseDir.'storage/prefsdoc')) {
> -                     if (!mkdir($this->baseDir . 'storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> -                             die("Cant create storage/prefsdoc directory\n");
> -                     }
> -             }if (is_file($this->baseDir . 'storage/prefsdoc/' . $fileName)) {
> -                     if (!unlink($this->baseDir . 'storage/prefsdoc/' . $fileName)){
> -                             die("Cant overwrite existing $fileName\n");
> -                             }
> -                     }
> -
> -             if (!file_put_contents($this->baseDir . 'storage/prefsdoc/' . $fileName, $begining.$this->docTable.$end))               // write one file for each pref page on control panel
> -                     die("Unable to write $fileName\n");
> -             $this->docTable = '';
> -     }
> -}
> -
> -$Doc = new PrefsDoc();
> -$Doc->baseDir = $baseDir;
> -$Doc->fileCount = 0;
> -$Doc->prefCount = 0;
> -$Doc->getPrefs();
> -
> -$docFiles = scandir($baseDir.'templates/admin'); // grab all the files that house prefs
> -foreach ($docFiles as $fileName) {
> -     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> -             $FilePrefs = $Doc->getAdminUIPrefs($fileName);
> -             $Doc->docTable = '';
> -             foreach ($FilePrefs as $tabName => $tab) {
> -                     foreach ($tab as $param) {
> -                             $Doc->setParams($param);
> -                             $Doc->prefCount++;
> -                             $Doc->docTable .= $Doc->prefName . '~|~' . $Doc->prefDescription . '~|~' . $Doc->prefDefault . "\n";
> -                     }
> -                     $Doc->writeFile($tabName);
> -                     $Doc->fileCount++;
> -             }
> -     }
> -}
> -
> -echo "\033[33m".$Doc->fileCount. ' pref files written to storage/prefsdoc/ with a total of '.$Doc->prefCount." prefs.\033[0m\n";
>
> Added: trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
> ===================================================================
> --- trunk/lib/wiki-plugins/wikiplugin_prefdoc.php                             (rev 0)
> +++ trunk/lib/wiki-plugins/wikiplugin_prefdoc.php     2017-02-07 08:27:25 UTC (rev 61234)
> @@ -0,0 +1,437 @@
> +<?php
> +// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
> +//
> +// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> +// $Id:
> +
> +function wikiplugin_prefdoc_info()
> +{
> +     return array(
> +             'name' => tra('Document Preferences'),
> +             //'documentation' => tra('coming+soon'), TODO Fill in doc page
> +             'description' => tra('Generates documentation for Tiki preferences tabs.'),
> +             'prefs' => array( 'wikiplugin_prefdoc' ),
> +             'validate' => 'all',
> +             'introduced' => 17,
> +             'iconname' => 'th-list',
> +             'tags' => array( 'advanced' ),
> +             'params' => array(
> +                     'tab' => array(
> +                             'required' => false,
> +                             'name' => tra('Preference-Tab'),
> +                             'description' => tra('The name of the preference tab to display. In the format of "preference page name"-"Tab Name witout spaces" eg. To link to General Layout on the Look and Feel page you would use "look-generallayout". Note that the "look" can be found in the url tiki-admin.php?page=<strong>look</strong>.'),
> +                             'filter' => 'text',
> +                             'since' => '17',
> +                     ),
> +                     'img' => array(
> +                             'required' => false,
> +                             'name' => tra('Images'),
> +                             'description' => tra('Show images at the top of each version of tiki. Format: TikiVersion:FileGalleryID'),
> +                             'since' => '17',
> +                             'filter' => 'text',
> +                     ),
> +             ),
> +     );
> +}
> +
> +/**
> + *
> + * Generate, Display & Archive Tiki Pref Documentation
> + *
> + * @param $data     this is ignored
> + * @param $params   paramiters to process
> + *
> + * @return string   returnes error or pref table
> + */
> +
> +function wikiplugin_prefdoc( $data, $params )
> +{
> +
> +     $Doc = new PrefsDoc();
> +
> +     if (!$Doc->genPrefsState())
> +             return $Doc->error;
> +
> +     if (!isset($params['tab']))         // if no tab specified, return a list of available tabs
> +             return $Doc->genPrefCodes();
> +
> +     if (!$Doc->genPrefHistory($params['tab'],$params['img']))
> +             return $Doc->error;
> +     return $Doc->error.$Doc->docTable;
> +}
> +
> +
> +
> +/**
> + *
> + *
> + * Used for automatically generating preference documentation
> + * for use on doc.tiki.org. It takes the currently installed preferences
> + * and generates files in wiki-syntax
> + *
> + * Running this will overwrite any previously generated pref doc files
> + *
> + * TODO: Handle help links that dont point at doc.tiki.org
> + *
> + *
> + * Class PrefsDoc
> + *
> + * @var $docTable string The output to be sent to displayed, in wiki format
> + *
> + */
> +
> +
> +class PrefsDoc extends TWVersion{
> +
> +     private $PrefVars;
> +     private $prevFilePrefs;
> +     private $fileCount;
> +     private $prefCount;
> +     private $prefDefault;
> +     private $prefDescription;
> +     private $prefName;
> +     public $docTable;
> +     public $error;
> +
> +
> +     /**
> +      *
> +      * Populates $docTable with a string to display.
> +      * The main function to generate version tabs etc.
> +      *
> +      * @param $tabName string   The pref-tab name to create an output for
> +      * @param $images string    Images & Versions to display with a Version tab.
> +      *
> +      * @return bool             true on success false on failure
> +      */
> +     public function genPrefHistory($tabName,$images){
> +
> +             $version = (int)$this->getBaseVersion();
> +             if (!is_file("storage/prefsdoc/$version-$tabName.json")) {
> +                     $this->error .= "Error: <strong>Cant find $tabName</strong> you may choose from one of the following: \n".$this->genPrefCodes();
> +                     return false;
> +             }
> +             $file = json_decode(file_get_contents("storage/prefsdoc/$version-$tabName.json"));
> +
> +             while ($version >= $file->oldest){
> +                     $versions[] = $version;
> +                     $version --;
> +             }
> +
> +             $this->docTable = '{TABS(name="'.$tabName.'" tabs="Tiki Version '.implode('|',$versions)."\" toggle=\"n\")}";
> +             $imageArray = array();
> +             $images = explode('|',$images);
> +             foreach ($images as $key => $image) {
> +                     $image = explode(':', $image);
> +                     $imageArray[$image[0]][0] = $image[1];
> +                     $imageArray[$image[0]][1] = $image[0];
> +             }
> +             unset($images);
> +
> +             // carry over images from past versions of Tiki, if available.
> +             foreach ($versions as $version) {
> +                     $count =$version;
> +                     while ($version - $count < 4) {         // If the image is older than 4 tiki versions, dont display it.
> +                             if ($imageArray[$count][0]) {
> +                                     $this->docTable .= '{img fileId="'.$imageArray[$count][0].'" thumb="y" rel="box[g]" width="300" desc="Tiki '.  $imageArray[$count][1].' Preferences Image" alt="' . $tabName . '" align="center"}';
> +                                     break;
> +                             }
> +                             $count--;
> +                     }
> +                     $this->genPrefVersion("storage/prefsdoc/$version-$tabName.json");
> +                     if ($file->oldest !== $version)
> +                             $this->docTable .= "/////\n";
> +             }
> +
> +
> +             $this->docTable .= '{TABS}';
> +             return true;
> +
> +     }
> +
> +     /**
> +      *
> +      * @return string file-tab codes available for use.
> +      */
> +     public function genPrefCodes(){
> +
> +             $version = (int)$this->getBaseVersion();
> +             $files = glob('storage/prefsdoc/'.$version.'-*.json');
> +             if (!$files)
> +                     return 'There was no files found, please Clear All Caches to reindex files.';
> +             foreach ($files as $key => $file){
> +                     $file = substr($file,20);
> +                     $files[$key] = substr($file,0,-5);
> +             }
> +             $files = implode('<br>',$files);
> +             return $files;
> +     }
> +
> +     /**
> +      *
> +      * Check if the prefs documentation is up to date.
> +      * If its not up to date, then update it.
> +      *
> +      * Documentation is updated for every minor version change.
> +      * A seprate set of documentatin is creaed for every major version.
> +      * Only consecutive versions are supported (you cant skip a version)
> +      *
> +      * @return bool false on error, true on success.
> +      */
> +
> +
> +     public function genPrefsState(){
> +
> +             if (!is_dir('storage/prefsdoc')) {
> +                     if (!mkdir('storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> +                             $this->error .= "Cant create storage/prefsdoc directory. ";
> +                             return false;
> +                     }
> +             }
> +
> +             // check if the current prefs doc is up to date, if its not, continue
> +             if (is_file('storage/prefsdoc/state.json')){
> +                     $state = json_decode(file_get_contents('storage/prefsdoc/state.json'));
> +                     if ($state->version === $this->getBaseVersion())
> +                             return true;
> +             }
> +
> +             // prepate to generate prefs doc
> +             $this->fileCount = 0;
> +             $this->prefCount = 0;
> +             $this->getPrefs();
> +
> +             $docFiles = scandir('templates/admin'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> +                             $FilePrefs = $this->getAdminUIPrefs($fileName);
> +                             foreach ($FilePrefs as $tabName => $tab) {
> +                                     if (!$this->writeFile($tabName,$tab))
> +                                             return false;
> +                                     $this->prefCount ++;
> +                             }
> +                     }
> +             }
> +             // record the state so its easy to figure out whats what next time.
> +             $state = json_encode(array(
> +                     'version' => $this->getBaseVersion(),
> +                     'created' => time()));
> +             file_put_contents('storage/prefsdoc/state.json',$state);
> +
> +             $logslib = TikiLib::lib('logs');
> +             $logslib->add_log('prefDoc',$this->fileCount. ' pref doc files generated/updated covering ' . $this->prefCount.' prefs');
> +
> +             return true;
> +     }
> +
> +     /**
> +      * compiles a all prefs for the current tiki install and sets PrefVars with it
> +      */
> +     private function getPrefs(){
> +
> +             $prefs = array();
> +             $docFiles = scandir('lib/prefs'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> +                             require_once ('lib/prefs/'.$fileName);
> +                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> +                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> +
> +                     }
> +             }
> +             $this->PrefVars = $prefs;
> +     }
> +
> +
> +
> +     /**
> +      *
> +      * This generates a list of prefs in the order that they appear on the admin panel.
> +      *
> +      * @param string $fileName Name of file to scan
> +      *
> +      * @return array  array of pref names, or false on failure
> +      *
> +      */
> +     private function getAdminUIPrefs($fileName){
> +             $file = file_get_contents('templates/admin/' . $fileName);
> +             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> +             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> +             if ($count) {
> +                     while ($count >= 1) {
> +                             $count--;
> +                             $prefs = array();
> +                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> +                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> +                             foreach ($prefs[1] as $pref) {
> +                                     $tabPrefs[$fileName . '-' . $tabs[1][$count]][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                             }
> +                     }
> +             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){
> +                     foreach ($prefs[1] as $pref) {
> +                             $tabPrefs[$fileName][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                     }
> +             }
> +
> +             return $tabPrefs;
> +     }
> +
> +
> +     /**
> +      *
> +      * This sets an vars of an individual preference
> +      *
> +      * @param $param object the prefs to be processed into pretty & standardized output
> +      */
> +     private function setParams($param)
> +     {
> +             // set default
> +             if ($param->default == 'n') {
> +                     $this->prefDefault = 'Disabled';
> +             } else if ($param->default == 'y') {
> +                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> +             } else if (is_array($param->default)) {
> +                     $this->prefDefault = implode(', ', $param->default);
> +             } else {
> +                     $this->prefDefault = $param->default;
> +             }
> +             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> +             $this->prefDefault = trim($this->prefDefault);
> +             if (!$this->prefDefault) {
> +                     $this->prefDefault = '~~gray:None~~';
> +             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> +                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> +             } else{
> +                     if (strlen($this->prefDefault) > 30) {
> +                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> +                     }
> +                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> +             }
> +
> +             // set name
> +             if ($param->help) {
> +                     $this->prefName = '((' . $param->help . '|' . $param->name . '))';
> +             }else {
> +                     $this->prefName = $param->name;
> +             }
> +             $this->prefName = $this->wikiConvert($this->prefName);
> +
> +             // set description
> +             $this->prefDescription = $param->description;
> +             if ($param->hint)
> +                     $this->prefDescription .= " ''Hint: ".$param->hint."''";
> +             foreach ($param->tags as $tag)
> +                     if ($tag === 'experimental')
> +                             $this->prefDescription .= ' (experimental)';
> +             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> +     }
> +
> +
> +     /**
> +      * Preps a string from tiki prefs for insertion into tiki-syntax land
> +      *
> +      * @param $string string to be parsed
> +      *
> +      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> +      *
> +      *
> +      * @return string parsed string sutable for wiki insertion
> +      *
> +      */
> +     private function wikiConvert($string, $escape = false){
> +             $escapedString = '';
> +             if ($string) {
> +                     if ($escape) {
> +                             $escapedString = ' ~np~';
> +                     }
> +                     $escapedString .= str_replace("\n", ' ', $string);
> +                     $escapedString = trim($escapedString);
> +                     if ($escape) {
> +                             $escapedString .= '~/np~';
> +                     }
> +             }
> +
> +             return $escapedString;
> +
> +     }
> +
> +     /**
> +      *
> +      * Generates a wiki syntax table for a specific version of tiki
> +      *
> +      * @param string $fileName  The file name to write to disk.
> +      *
> +      * @return bool false on error, true otherwise
> +      */
> +     private function genPrefVersion($fileName)
> +     {
> +             if (!is_file($fileName)){
> +                     $this->error .= "Cant read $fileName. ";
> +                     return false;
> +             }
> +             $this->docTable .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}';
> +             $FilePrefs = json_decode(file_get_contents($fileName));
> +             foreach ($FilePrefs->prefs as $prefName => &$pref) {
> +                     $this->prevFilePrefs;
> +
> +                     // carry over missing information filled out in a newer version
> +                     if (!$pref->description)
> +                             $pref->description = $this->prevFilePrefs->$prefName->description;
> +                     if (!$pref->help)
> +                             $pref->help = $this->prevFilePrefs->$prefName->help;
> +                     if (!$pref->hint)
> +                             $pref->hint = $this->prevFilePrefs->$prefName->hint;
> +                     $this->setParams($pref);
> +                     $this->docTable .= $this->prefName . '~|~' . $this->prefDescription . '~|~' . $this->prefDefault . "\n";
> +             }
> +             $this->prevFilePrefs = $FilePrefs->prefs;
> +             $this->docTable .= "{FANCYTABLE}";
> +             return true;
> +     }
> +
> +     /**
> +      *
> +      * Writes a pref file to disk
> +      *
> +      * @param $tabName string name of tab or pref file to write
> +      * @param $prefs array the prefs to write to file
> +      *
> +      * @return bool|string returns error message on failure, or false on success
> +      */
> +
> +
> +     private function writeFile($tabName,$prefs)
> +     {
> +             $version = (int)$this->getBaseVersion();
> +             $oldest = $version;
> +             $tabName = '-' . $tabName . '.json';                // Name of file to be written, minus prefex
> +
> +             while (is_file('storage/prefsdoc/' . ($oldest - 1) . $tabName)) {
> +                     $oldest--;
> +             }
> +
> +             $prefs = json_encode(array(
> +                     'oldest' => $oldest,
> +                     'prefs'  => $prefs,
> +             ));
> +
> +             if (is_file('storage/prefsdoc/' . $version . $tabName)) {
> +                     if (!unlink('storage/prefsdoc/' . $version . $tabName)) {
> +                             $this->error .= ("Cant overwrite existing $version-$tabName.json ");
> +
> +                             return false;
> +
> +                     }
> +             }
> +
> +             if (!file_put_contents('storage/prefsdoc/' . $version . $tabName, $prefs)) {
> +                     // write one file for each pref page on control panel
> +                     $this->error .= ("Unable to write $version.$tabName");
> +                     return false;
> +             }
> +             $this->fileCount++;
> +             return true;
> +     }
> +}
> +
>
> Modified: trunk/tiki-admin_system.php
> ===================================================================
> --- trunk/tiki-admin_system.php       2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/tiki-admin_system.php       2017-02-07 08:27:25 UTC (rev 61234)
> @@ -22,6 +22,10 @@
>               // Also rebuild admin index
>               TikiLib::lib('prefs')->rebuildIndex();
>
> +             // also rebuild plugin prefdoc current version
> +             if (file_exists('storage/prefsdoc/state.json'))
> +                     unlink('storage/prefsdoc/state.json');
> +
>               // seems combination of clearing prefs and public now messes up the page, so reload
>               include_once('lib/setup/prefs.php');
>               initialize_prefs();
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Tikiwiki-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tikiwiki-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk

Dr. Sassafras
Great. While I generated history files for 12.x onwards, so if an admin uploads them we will be fully documented from 12x onwards. I guess we can start using it as soon as doc.tiki.org sports the code.

Brendan

On Feb 12, 2017, at 12:27 AM, Jonny Bradley <[hidden email]> wrote:

Hi Brendan,

Thanks for this, i haven't had time to look at the code in detail so i set up a little test on next to see what it does here:


This has {prefdoc tab="look-theme"} in it and seems to work nicely - not sure how the images param needs to be set up but i think it'll be a good addition to doc form 17.x onwards.

Thanks again! :)

jonny




On 9 Feb 2017, at 18:50, Cloutier, Philippe (RESSOURCE EXTERNE) <[hidden email]> wrote:

Thanks. In that case, your suggestion seems perfect.
 
Philippe Cloutier
Registre foncier
Systèmes d’information
Ministère de l'Énergie et des Ressources naturelles
Québec (Québec)  G1H 6R1
Téléphone : 418 627-6282, poste 2209
<a href="x-msg://102/philippe.cloutier.externe@mern.gouv.qc.ca" style="color: purple; text-decoration: underline;" class="">philippe.cloutier.externe@...
mern.gouv.qc.ca
 
De : Dr. Sassafras [[hidden email]] 
Envoyé : 9 février 2017 13:46
À : Cloutier, Philippe (RESSOURCE EXTERNE) <[hidden email]>
Cc : Tiki developers <[hidden email]>
Objet : Re: [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
 


Would “'Generates documentation for Tiki plugins ([mostly] used on Tiki’s documentation website).” not be a clearer description? Actually, does this only document plugins?
 
It does not document plugins at all, it creates documentation for tiki preferences. Perhaps "Generates documentation for Tiki preferences (mostly used on Tiki’s documentation website)." Would be good?
 
Brendan
 
Perhaps 

De : Brendan Ferguson [[hidden email]] 
Envoyé : 7 février 2017 10:39
À : Tiki developers <[hidden email]>
Objet : [Tiki-devel] Fwd: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
 

ya, I had to run earlier so was not able to write this email right away, but here it is:

PrefDoc Plugin

Documents current tiki plugins, by outputting a table very similar to what we currently use.

* This will automatically record and keep past preference versions. So each version of tiki will be recorded.
* It allows for preference images to be inserted like we currently do.
* It automatically re-caches the current tiki preferences every time the version number increases (like from 17.0 to 17.1)
* You may force a re-cache by emptying all caches (will only re-load current version)
* If description, hint or help (link) are added to a new version of tiki, it automatically populates past versions that are missing that information
* Images specified for a version of tiki (say version 12) will stretch forward up to 4 versions if no other images exist.
*Preference data is stored as it is in tiki, so there is information cached that is not being used, it allows for maximum expansion in the future with backwards compatibility (like if color coding for basic-advanced-experimental was to be implemented etc.)

* This also means that updates to PrefDoc Plugin visual appearance is independent from storage, allowing for dramatic style changes.

Syntax:
{PREFDOC(tab="community-socialinteraction" img="17:1|10:2") /}

If no tab or a invalid tab is specified, it will generate a list of available preference tabs. Images are: TikiVersionNum:FileGalleryId|TikiVersionNum:FileGalleryId|etc. etc.
 

So. Plans for moving forward. We have a lot of old info on pages that may or may not be current. We cant mix and match this with the old info. Its all got to be deleted or migrated over. There is a lot of info on those pages though that is NOT in tiki. Im willing to migrate that data over, but have zero interest in discussing if the data is correct or grammatically correct. So if I do it, we got to find others willing to correct it, or we just have to agree that some information (mostly descriptions) is a step up from a blank space.

To migrate this onto the doc website, I will need to back-port it to 16.x (case that is the version of server running there now)

Im not interested in back porting the migrated info from the doc sites, so that info wont be available on the doc website until the server is upgraded to 17.x, where it will become available, unless someone wants to pack port it. 
 

I can also do a local backport of the plugin to generate a preference history back as far as 9.x (dont see much use in going further, but likely wouldn't be much effort to do so if someone wanted the older data.

I also have a question. The Plugin currently supports help links that point to doc.tiki.org. 99% of them do but i think I saw 2 (maybe 3) that point other places. Im kinda in favor of moving those links into the description and having the help links point always to a doc.tiki.org page. If we want external links there, its no big deal incorporating that into the plugin, but just thought I would ask you guys what you thought? When looking at the documentation online, I just thought it was really slick to be able to rely on those links keeping you on the current website.
 
Limitations:
* Ideally the output wound be re-done to be HTML instead of wiki syntax, for performance and versatility.
* It currently relies on consecutive version numbers, skipping is not supported (although it could be modified to do this)
 
Thoughts?
 
---------- Forwarded message ----------
From: Jonny Bradley <[hidden email]>
Date: Tue, Feb 7, 2017 at 7:09 PM
Subject: Re: [Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[61234] trunk
To: Tiki developers <[hidden email]>


Hi Brendan

This looks good, looking forward to trying it out!

Thanks :)

jonny



> On 7 Feb 2017, at 09:27, [hidden email] wrote:
>
> Revision: 61234
>          http://sourceforge.net/p/tikiwiki/code/61234
> Author:   drsassafras
> Date:     2017-02-07 08:27:25 +0000 (Tue, 07 Feb 2017)
> Log Message:
> -----------
> [NEW] PrefDoc Plugin - Automatically document tiki prefs
>
> Modified Paths:
> --------------
>    trunk/tiki-admin_system.php
>
> Added Paths:
> -----------
>    trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
>
> Removed Paths:
> -------------
>    trunk/doc/devtools/experimental/prefsdoc.php
>
> Deleted: trunk/doc/devtools/experimental/prefsdoc.php
> ===================================================================
> --- trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/doc/devtools/experimental/prefsdoc.php      2017-02-07 08:27:25 UTC (rev 61234)
> @@ -1,228 +0,0 @@
> -#!/usr/bin/php
> -<?php
> -// (c) Copyright 2002-2017 by authors of the Tiki Wiki CMS Groupware Project
> -//
> -// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> -// $Id:
> -
> -
> -// can only be run from the command line
> -if (php_sapi_name() !== 'cli'){
> -     echo 'can only be run from the command line';
> -     die;
> -}
> -
> -$baseDir = realpath(__DIR__ .'/../../../').'/';
> -
> -require_once ($baseDir.'tiki-setup.php');
> -
> -/**
> - *
> - * Used for automatically generating preference documentation
> - * for use on doc.tiki.org. It takes the currently installed preferences
> - * and generates files in wiki-syntax to be pasted into doc.tiki.org
> - *
> - * Running this will overwrite any previously generated pref doc files
> - *
> - * TODO: Handle help links that dont point at doc.tiki.org
> - *
> - * TODO: There is 4 prefs that are not captured with tabs. (maybe outside a tab?)
> - *
> - * Class PrefsDoc
> - *
> - */
> -
> -class PrefsDoc extends TWVersion{
> -
> -     public $baseDir;
> -     private $PrefVars;
> -     public $fileCount;
> -     public $prefCount;
> -     public $prefDefault;
> -     public $prefDescription;
> -     public $prefName;
> -     public $docTable;
> -
> -     public function getPrefs(){
> -
> -             $prefs = array();
> -             $docFiles = scandir($this->baseDir.'lib/prefs'); // grab all the files that house prefs
> -             foreach ($docFiles as $fileName) {
> -                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> -                             require ($this->baseDir.'lib/prefs/'.$fileName);
> -                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> -                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> -
> -                     }
> -             }
> -             $this->PrefVars = $prefs;
> -     }
> -
> -
> -
> -     /**
> -      *
> -      * This generates a list of prefs in the order that they appear on the admin panel.
> -      *
> -      * @param string $fileName Name of file to scan
> -      *
> -      * @return array  array of pref names
> -      *
> -      */
> -     public function getAdminUIPrefs($fileName){
> -             $file = file_get_contents($this->baseDir . 'templates/admin/' . $fileName);
> -             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> -             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> -             if ($count) {
> -                     while ($count >= 1) {
> -                             $count--;
> -                             $prefs = array();
> -                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> -                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> -                             if ($prefs[1])
> -                                     $tabPrefs[$fileName.'-'.$tabs[1][$count]] = $prefs[1];                                                                                  // Add named tabbed array
> -                     }
> -             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){;
> -                     $tabPrefs[$fileName] = $prefs[1];
> -             }
> -
> -             return $tabPrefs;
> -     }
> -
> -
> -     /**
> -      *
> -      * This sets an vars of an indivigual prefrence
> -      *
> -      * @param $param
> -      */
> -     public function setParams($param)
> -     {
> -
> -             // set default
> -             if ($this->PrefVars[$param]['default'] == 'n') {
> -                     $this->prefDefault = 'Disabled';
> -             } else if ($this->PrefVars[$param]['default'] == 'y') {
> -                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> -             } else if (is_array($this->PrefVars[$param]['default'])) {
> -                     $this->prefDefault = implode(', ', $this->PrefVars[$param]['default']);
> -             } else {
> -                     $this->prefDefault = $this->PrefVars[$param]['default'];
> -             }
> -             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> -             $this->prefDefault = trim($this->prefDefault);
> -             if (!$this->prefDefault) {
> -                     $this->prefDefault = '~~gray:None~~';
> -             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> -                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> -             } else{
> -                     if (strlen($this->prefDefault) > 30) {
> -                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> -                     }
> -                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> -             }
> -
> -             // set name
> -             if ($this->PrefVars[$param]['help']) {
> -                     $this->prefName = '((' . $this->PrefVars[$param]['help'] . '|' . $this->PrefVars[$param]['name'] . '))';
> -             }else {
> -                     $this->prefName = $this->PrefVars[$param]['name'];
> -             }
> -             $this->prefName = $this->wikiConvert($this->prefName);
> -
> -             // set description
> -             $this->prefDescription = $this->PrefVars[$param]['description'];
> -             if ($this->PrefVars[$param]['hint'])
> -                     $this->prefDescription .= " ''Hint: ".$this->PrefVars[$param]['hint']."''";
> -             foreach ($this->PrefVars[$param]['tags'] as $tag)
> -                     if ($tag === 'experimental')
> -                             $this->prefDescription .= ' (experimental)';
> -             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> -     }
> -
> -
> -     /**
> -      * Preps a string from tiki prefs for insertion into tiki-syntax land
> -      *
> -      * @param $string string to be parsed
> -      *
> -      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> -      *
> -      *
> -      * @return string parsed string sutable for wiki insertion
> -      *
> -      */
> -     private function wikiConvert($string, $escape = false){
> -             $escapedString = '';
> -             if ($string) {
> -                     if ($escape) {
> -                             $escapedString = ' ~np~';
> -                     }
> -                     $escapedString .= str_replace("\n", ' ', $string);
> -                     $escapedString = trim($escapedString);
> -                     if ($escape) {
> -                             $escapedString .= '~/np~';
> -                     }
> -             }
> -
> -             return $escapedString;
> -
> -     }
> -
> -     /**
> -      *
> -      * Writes a generated pref wiki formatted file to disk
> -      *
> -      * @param string $fileName  The file name to write to disk.
> -      *
> -      */
> -     public function writeFile($fileName){
> -
> -             $begining = '~hc~ -- Table generated with prefsdoc.php for tiki '.$this->getVersion()." -- ~/hc~\n";
> -             $begining .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}'."\n";
> -
> -             $end = "{FANCYTABLE}\n/////\n";
> -
> -             $fileName .=".txt";                             // Name of file to be written
> -
> -             if (!is_dir($this->baseDir.'storage/prefsdoc')) {
> -                     if (!mkdir($this->baseDir . 'storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> -                             die("Cant create storage/prefsdoc directory\n");
> -                     }
> -             }if (is_file($this->baseDir . 'storage/prefsdoc/' . $fileName)) {
> -                     if (!unlink($this->baseDir . 'storage/prefsdoc/' . $fileName)){
> -                             die("Cant overwrite existing $fileName\n");
> -                             }
> -                     }
> -
> -             if (!file_put_contents($this->baseDir . 'storage/prefsdoc/' . $fileName, $begining.$this->docTable.$end))               // write one file for each pref page on control panel
> -                     die("Unable to write $fileName\n");
> -             $this->docTable = '';
> -     }
> -}
> -
> -$Doc = new PrefsDoc();
> -$Doc->baseDir = $baseDir;
> -$Doc->fileCount = 0;
> -$Doc->prefCount = 0;
> -$Doc->getPrefs();
> -
> -$docFiles = scandir($baseDir.'templates/admin'); // grab all the files that house prefs
> -foreach ($docFiles as $fileName) {
> -     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> -             $FilePrefs = $Doc->getAdminUIPrefs($fileName);
> -             $Doc->docTable = '';
> -             foreach ($FilePrefs as $tabName => $tab) {
> -                     foreach ($tab as $param) {
> -                             $Doc->setParams($param);
> -                             $Doc->prefCount++;
> -                             $Doc->docTable .= $Doc->prefName . '~|~' . $Doc->prefDescription . '~|~' . $Doc->prefDefault . "\n";
> -                     }
> -                     $Doc->writeFile($tabName);
> -                     $Doc->fileCount++;
> -             }
> -     }
> -}
> -
> -echo "\033[33m".$Doc->fileCount. ' pref files written to storage/prefsdoc/ with a total of '.$Doc->prefCount." prefs.\033[0m\n";
>
> Added: trunk/lib/wiki-plugins/wikiplugin_prefdoc.php
> ===================================================================
> --- trunk/lib/wiki-plugins/wikiplugin_prefdoc.php                             (rev 0)
> +++ trunk/lib/wiki-plugins/wikiplugin_prefdoc.php     2017-02-07 08:27:25 UTC (rev 61234)
> @@ -0,0 +1,437 @@
> +<?php
> +// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
> +//
> +// All Rights Reserved. See copyright.txt for details and a complete list of authors.
> +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
> +// $Id:
> +
> +function wikiplugin_prefdoc_info()
> +{
> +     return array(
> +             'name' => tra('Document Preferences'),
> +             //'documentation' => tra('coming+soon'), TODO Fill in doc page
> +             'description' => tra('Generates documentation for Tiki preferences tabs.'),
> +             'prefs' => array( 'wikiplugin_prefdoc' ),
> +             'validate' => 'all',
> +             'introduced' => 17,
> +             'iconname' => 'th-list',
> +             'tags' => array( 'advanced' ),
> +             'params' => array(
> +                     'tab' => array(
> +                             'required' => false,
> +                             'name' => tra('Preference-Tab'),
> +                             'description' => tra('The name of the preference tab to display. In the format of "preference page name"-"Tab Name witout spaces" eg. To link to General Layout on the Look and Feel page you would use "look-generallayout". Note that the "look" can be found in the url tiki-admin.php?page=<strong>look</strong>.'),
> +                             'filter' => 'text',
> +                             'since' => '17',
> +                     ),
> +                     'img' => array(
> +                             'required' => false,
> +                             'name' => tra('Images'),
> +                             'description' => tra('Show images at the top of each version of tiki. Format: TikiVersion:FileGalleryID'),
> +                             'since' => '17',
> +                             'filter' => 'text',
> +                     ),
> +             ),
> +     );
> +}
> +
> +/**
> + *
> + * Generate, Display & Archive Tiki Pref Documentation
> + *
> + * @param $data     this is ignored
> + * @param $params   paramiters to process
> + *
> + * @return string   returnes error or pref table
> + */
> +
> +function wikiplugin_prefdoc( $data, $params )
> +{
> +
> +     $Doc = new PrefsDoc();
> +
> +     if (!$Doc->genPrefsState())
> +             return $Doc->error;
> +
> +     if (!isset($params['tab']))         // if no tab specified, return a list of available tabs
> +             return $Doc->genPrefCodes();
> +
> +     if (!$Doc->genPrefHistory($params['tab'],$params['img']))
> +             return $Doc->error;
> +     return $Doc->error.$Doc->docTable;
> +}
> +
> +
> +
> +/**
> + *
> + *
> + * Used for automatically generating preference documentation
> + * for use on doc.tiki.org. It takes the currently installed preferences
> + * and generates files in wiki-syntax
> + *
> + * Running this will overwrite any previously generated pref doc files
> + *
> + * TODO: Handle help links that dont point at doc.tiki.org
> + *
> + *
> + * Class PrefsDoc
> + *
> + * @var $docTable string The output to be sent to displayed, in wiki format
> + *
> + */
> +
> +
> +class PrefsDoc extends TWVersion{
> +
> +     private $PrefVars;
> +     private $prevFilePrefs;
> +     private $fileCount;
> +     private $prefCount;
> +     private $prefDefault;
> +     private $prefDescription;
> +     private $prefName;
> +     public $docTable;
> +     public $error;
> +
> +
> +     /**
> +      *
> +      * Populates $docTable with a string to display.
> +      * The main function to generate version tabs etc.
> +      *
> +      * @param $tabName string   The pref-tab name to create an output for
> +      * @param $images string    Images & Versions to display with a Version tab.
> +      *
> +      * @return bool             true on success false on failure
> +      */
> +     public function genPrefHistory($tabName,$images){
> +
> +             $version = (int)$this->getBaseVersion();
> +             if (!is_file("storage/prefsdoc/$version-$tabName.json")) {
> +                     $this->error .= "Error: <strong>Cant find $tabName</strong> you may choose from one of the following: \n".$this->genPrefCodes();
> +                     return false;
> +             }
> +             $file = json_decode(file_get_contents("storage/prefsdoc/$version-$tabName.json"));
> +
> +             while ($version >= $file->oldest){
> +                     $versions[] = $version;
> +                     $version --;
> +             }
> +
> +             $this->docTable = '{TABS(name="'.$tabName.'" tabs="Tiki Version '.implode('|',$versions)."\" toggle=\"n\")}";
> +             $imageArray = array();
> +             $images = explode('|',$images);
> +             foreach ($images as $key => $image) {
> +                     $image = explode(':', $image);
> +                     $imageArray[$image[0]][0] = $image[1];
> +                     $imageArray[$image[0]][1] = $image[0];
> +             }
> +             unset($images);
> +
> +             // carry over images from past versions of Tiki, if available.
> +             foreach ($versions as $version) {
> +                     $count =$version;
> +                     while ($version - $count < 4) {         // If the image is older than 4 tiki versions, dont display it.
> +                             if ($imageArray[$count][0]) {
> +                                     $this->docTable .= '{img fileId="'.$imageArray[$count][0].'" thumb="y" rel="box[g]" width="300" desc="Tiki '.  $imageArray[$count][1].' Preferences Image" alt="' . $tabName . '" align="center"}';
> +                                     break;
> +                             }
> +                             $count--;
> +                     }
> +                     $this->genPrefVersion("storage/prefsdoc/$version-$tabName.json");
> +                     if ($file->oldest !== $version)
> +                             $this->docTable .= "/////\n";
> +             }
> +
> +
> +             $this->docTable .= '{TABS}';
> +             return true;
> +
> +     }
> +
> +     /**
> +      *
> +      * @return string file-tab codes available for use.
> +      */
> +     public function genPrefCodes(){
> +
> +             $version = (int)$this->getBaseVersion();
> +             $files = glob('storage/prefsdoc/'.$version.'-*.json');
> +             if (!$files)
> +                     return 'There was no files found, please Clear All Caches to reindex files.';
> +             foreach ($files as $key => $file){
> +                     $file = substr($file,20);
> +                     $files[$key] = substr($file,0,-5);
> +             }
> +             $files = implode('<br>',$files);
> +             return $files;
> +     }
> +
> +     /**
> +      *
> +      * Check if the prefs documentation is up to date.
> +      * If its not up to date, then update it.
> +      *
> +      * Documentation is updated for every minor version change.
> +      * A seprate set of documentatin is creaed for every major version.
> +      * Only consecutive versions are supported (you cant skip a version)
> +      *
> +      * @return bool false on error, true on success.
> +      */
> +
> +
> +     public function genPrefsState(){
> +
> +             if (!is_dir('storage/prefsdoc')) {
> +                     if (!mkdir('storage/prefsdoc')) {            // create subdir for housing generated files, if it does not exist
> +                             $this->error .= "Cant create storage/prefsdoc directory. ";
> +                             return false;
> +                     }
> +             }
> +
> +             // check if the current prefs doc is up to date, if its not, continue
> +             if (is_file('storage/prefsdoc/state.json')){
> +                     $state = json_decode(file_get_contents('storage/prefsdoc/state.json'));
> +                     if ($state->version === $this->getBaseVersion())
> +                             return true;
> +             }
> +
> +             // prepate to generate prefs doc
> +             $this->fileCount = 0;
> +             $this->prefCount = 0;
> +             $this->getPrefs();
> +
> +             $docFiles = scandir('templates/admin'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if (substr($fileName, 0, 8) === 'include_') {  // filter out any file thats not a pref file
> +                             $FilePrefs = $this->getAdminUIPrefs($fileName);
> +                             foreach ($FilePrefs as $tabName => $tab) {
> +                                     if (!$this->writeFile($tabName,$tab))
> +                                             return false;
> +                                     $this->prefCount ++;
> +                             }
> +                     }
> +             }
> +             // record the state so its easy to figure out whats what next time.
> +             $state = json_encode(array(
> +                     'version' => $this->getBaseVersion(),
> +                     'created' => time()));
> +             file_put_contents('storage/prefsdoc/state.json',$state);
> +
> +             $logslib = TikiLib::lib('logs');
> +             $logslib->add_log('prefDoc',$this->fileCount. ' pref doc files generated/updated covering ' . $this->prefCount.' prefs');
> +
> +             return true;
> +     }
> +
> +     /**
> +      * compiles a all prefs for the current tiki install and sets PrefVars with it
> +      */
> +     private function getPrefs(){
> +
> +             $prefs = array();
> +             $docFiles = scandir('lib/prefs'); // grab all the files that house prefs
> +             foreach ($docFiles as $fileName) {
> +                     if ($fileName !== 'index.php' && substr($fileName, -4) === '.php') {  // filter out any file thats not a pref file
> +                             require_once ('lib/prefs/'.$fileName);
> +                             $callVar = 'prefs_'.substr($fileName,0,-4).'_list';
> +                             $prefs = array_merge($prefs,$callVar());                        // create one big var with all the pref info
> +
> +                     }
> +             }
> +             $this->PrefVars = $prefs;
> +     }
> +
> +
> +
> +     /**
> +      *
> +      * This generates a list of prefs in the order that they appear on the admin panel.
> +      *
> +      * @param string $fileName Name of file to scan
> +      *
> +      * @return array  array of pref names, or false on failure
> +      *
> +      */
> +     private function getAdminUIPrefs($fileName){
> +             $file = file_get_contents('templates/admin/' . $fileName);
> +             $fileName = substr(substr($fileName, 8), 0, -4);                                                // prepare the file name for further use
> +             $count = preg_match_all('/{tab name="?\'?(?:{tr})?([\w\s]*)(?:{\/tr})?"?\'?}([\w\W]*?){\/tab}/i', $file, $tabs);
> +             if ($count) {
> +                     while ($count >= 1) {
> +                             $count--;
> +                             $prefs = array();
> +                             preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $tabs[2][$count], $prefs);    // Generate aray of all the prefs
> +                             $tabs[1][$count] = mb_ereg_replace('\W','',strtolower($tabs[1][$count]));                               // sanitize the tab name for disk
> +                             foreach ($prefs[1] as $pref) {
> +                                     $tabPrefs[$fileName . '-' . $tabs[1][$count]][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                             }
> +                     }
> +             }else if (preg_match_all('/{preference.*name="?\'?(\w*)"?\'?.*}/i', $file, $prefs)){
> +                     foreach ($prefs[1] as $pref) {
> +                             $tabPrefs[$fileName][$pref] = $this->PrefVars[$pref];      // Add full pref info in right order
> +                     }
> +             }
> +
> +             return $tabPrefs;
> +     }
> +
> +
> +     /**
> +      *
> +      * This sets an vars of an individual preference
> +      *
> +      * @param $param object the prefs to be processed into pretty & standardized output
> +      */
> +     private function setParams($param)
> +     {
> +             // set default
> +             if ($param->default == 'n') {
> +                     $this->prefDefault = 'Disabled';
> +             } else if ($param->default == 'y') {
> +                     $this->prefDefault = 'Enabled';            // Change default codes to human readable format
> +             } else if (is_array($param->default)) {
> +                     $this->prefDefault = implode(', ', $param->default);
> +             } else {
> +                     $this->prefDefault = $param->default;
> +             }
> +             // end first processing the below should be applied to the above.... not a continuation (eg. empty array)
> +             $this->prefDefault = trim($this->prefDefault);
> +             if (!$this->prefDefault) {
> +                     $this->prefDefault = '~~gray:None~~';
> +             } else if (!preg_match('\W', $this->prefDefault)) {                // if Pref is a singe word
> +                     $this->prefDefault = ucfirst($this->prefDefault);            // then caps the first letter.
> +             } else{
> +                     if (strlen($this->prefDefault) > 30) {
> +                             $this->prefDefault = substr($this->prefDefault, 0, 27) . '...';
> +                     }
> +                     $this->prefDefault = $this->wikiConvert($this->prefDefault,true);
> +             }
> +
> +             // set name
> +             if ($param->help) {
> +                     $this->prefName = '((' . $param->help . '|' . $param->name . '))';
> +             }else {
> +                     $this->prefName = $param->name;
> +             }
> +             $this->prefName = $this->wikiConvert($this->prefName);
> +
> +             // set description
> +             $this->prefDescription = $param->description;
> +             if ($param->hint)
> +                     $this->prefDescription .= " ''Hint: ".$param->hint."''";
> +             foreach ($param->tags as $tag)
> +                     if ($tag === 'experimental')
> +                             $this->prefDescription .= ' (experimental)';
> +             $this->prefDescription = $this->wikiConvert($this->prefDescription);
> +     }
> +
> +
> +     /**
> +      * Preps a string from tiki prefs for insertion into tiki-syntax land
> +      *
> +      * @param $string string to be parsed
> +      *
> +      * @param $escape bool if $string should be enclosed in tiki no-parse tags
> +      *
> +      *
> +      * @return string parsed string sutable for wiki insertion
> +      *
> +      */
> +     private function wikiConvert($string, $escape = false){
> +             $escapedString = '';
> +             if ($string) {
> +                     if ($escape) {
> +                             $escapedString = ' ~np~';
> +                     }
> +                     $escapedString .= str_replace("\n", ' ', $string);
> +                     $escapedString = trim($escapedString);
> +                     if ($escape) {
> +                             $escapedString .= '~/np~';
> +                     }
> +             }
> +
> +             return $escapedString;
> +
> +     }
> +
> +     /**
> +      *
> +      * Generates a wiki syntax table for a specific version of tiki
> +      *
> +      * @param string $fileName  The file name to write to disk.
> +      *
> +      * @return bool false on error, true otherwise
> +      */
> +     private function genPrefVersion($fileName)
> +     {
> +             if (!is_file($fileName)){
> +                     $this->error .= "Cant read $fileName. ";
> +                     return false;
> +             }
> +             $this->docTable .= '{FANCYTABLE(head="Option | Description | Default" sortable="n")}';
> +             $FilePrefs = json_decode(file_get_contents($fileName));
> +             foreach ($FilePrefs->prefs as $prefName => &$pref) {
> +                     $this->prevFilePrefs;
> +
> +                     // carry over missing information filled out in a newer version
> +                     if (!$pref->description)
> +                             $pref->description = $this->prevFilePrefs->$prefName->description;
> +                     if (!$pref->help)
> +                             $pref->help = $this->prevFilePrefs->$prefName->help;
> +                     if (!$pref->hint)
> +                             $pref->hint = $this->prevFilePrefs->$prefName->hint;
> +                     $this->setParams($pref);
> +                     $this->docTable .= $this->prefName . '~|~' . $this->prefDescription . '~|~' . $this->prefDefault . "\n";
> +             }
> +             $this->prevFilePrefs = $FilePrefs->prefs;
> +             $this->docTable .= "{FANCYTABLE}";
> +             return true;
> +     }
> +
> +     /**
> +      *
> +      * Writes a pref file to disk
> +      *
> +      * @param $tabName string name of tab or pref file to write
> +      * @param $prefs array the prefs to write to file
> +      *
> +      * @return bool|string returns error message on failure, or false on success
> +      */
> +
> +
> +     private function writeFile($tabName,$prefs)
> +     {
> +             $version = (int)$this->getBaseVersion();
> +             $oldest = $version;
> +             $tabName = '-' . $tabName . '.json';                // Name of file to be written, minus prefex
> +
> +             while (is_file('storage/prefsdoc/' . ($oldest - 1) . $tabName)) {
> +                     $oldest--;
> +             }
> +
> +             $prefs = json_encode(array(
> +                     'oldest' => $oldest,
> +                     'prefs'  => $prefs,
> +             ));
> +
> +             if (is_file('storage/prefsdoc/' . $version . $tabName)) {
> +                     if (!unlink('storage/prefsdoc/' . $version . $tabName)) {
> +                             $this->error .= ("Cant overwrite existing $version-$tabName.json ");
> +
> +                             return false;
> +
> +                     }
> +             }
> +
> +             if (!file_put_contents('storage/prefsdoc/' . $version . $tabName, $prefs)) {
> +                     // write one file for each pref page on control panel
> +                     $this->error .= ("Unable to write $version.$tabName");
> +                     return false;
> +             }
> +             $this->fileCount++;
> +             return true;
> +     }
> +}
> +
>
> Modified: trunk/tiki-admin_system.php
> ===================================================================
> --- trunk/tiki-admin_system.php       2017-02-07 07:09:06 UTC (rev 61233)
> +++ trunk/tiki-admin_system.php       2017-02-07 08:27:25 UTC (rev 61234)
> @@ -22,6 +22,10 @@
>               // Also rebuild admin index
>               TikiLib::lib('prefs')->rebuildIndex();
>
> +             // also rebuild plugin prefdoc current version
> +             if (file_exists('storage/prefsdoc/state.json'))
> +                     unlink('storage/prefsdoc/state.json');
> +
>               // seems combination of clearing prefs and public now messes up the page, so reload
>               include_once('lib/setup/prefs.php');
>               initialize_prefs();
>
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Tikiwiki-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Tikiwiki-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel