Issue:Backward compatibility with DynamicPageList2 'suppresserrors' parameter

From FollowTheScore
Revision as of 17:33, 19 September 2008 by Gero (talk | contribs) (Reply)
Jump to: navigation, search
Description: make DPL backward compatible with DynamicPageList2 <suppresserrors> parameter
Extension / Version: DPL   /   1.7.4
Type / Status: Change Request   /   open

Change request

I'm one of the admins at ChoralWiki (www.cpdl.org), a free Public Domain scores library, and we use DynamicPageList2 a lot in it, with parameter <suppresserrors> set to 'true'. We were doing an upgrade test to the newest version of DynamicPageList and after the upgrade all our DPL queries started showing this warning:

 %DPL-1.7.4-WARNING: Unknown parameter '$0' is ignored. Help: available parameters: suppresserrors.

After a quick research we realized that parameter <suppresserrors> is no longer supported by the new DPL. It would be a pain to edit all pages where it appears, so we decided to tweak the DPL code to recognize it and behave as expected. We made the changes below (lines in red added to file DinamicPageList2.php), tested it and it worked fine. So we'd like to know what do you think of including it in the next releases of DPL.

line 682:

       /**
        * noresultsheader / footer is some wiki text which will be output (instead of a warning message)
        * if the result set is empty; setting 'noresultsheader' to something like ' ' will suppress
        * the warning about empty result set.
        */
       'suppresserrors'       => array('default' => 'false', 'true', 'no', 'yes', '0', '1', 'off', 'on'), 
       'noresultsheader'      => array('default' => ),
       'noresultsfooter'      => array('default' => ),

line 1157:

       $bSuppressErrors  = self::argBoolean(self::$options['suppresserrors']['default']);
       $sResultsHeader   = self::$options['resultsheader']['default'];
       $sResultsFooter   = self::$options['resultsfooter']['default'];

line 2095:

               case 'noresultsheader':
                   $sNoResultsHeader = $sArg;
                   break;
               case 'suppresserrors':
                   if( in_array($sArg, self::$options['suppresserrors'])) {
                       $bSuppressErrors = self::argBoolean($sArg);
                       if( $bSuppressErrors )
                           $sNoResultsHeader = ' ';
                   }
                   else
                       $output .= $logger->msgWrongParam('suppresserrors', $sArg);
                   break;
               case 'noresultsfooter':
                   $sNoResultsFooter = $sArg;
                   break;

After the change, if <suppresserrors=true> is used in the query and 0 pages are returned, it won't show any warning message; if <noresultsheader='text'> is also used, it will show the 'text' supplied. Thanks!! Capmo 13:40, 18 September 2008 (UTC)

Reply

I see your point. I will make your changes part of the next release. Gero 16:33, 19 September 2008 (UTC)