1
Peekay
Xoops 2.5 Module Admin Class - some observations
  • 2013/2/16 23:06

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


The PDF guide and tutorial for updating modules to the new Xoops 2.5 admin class is very good. The only problem I found was this instruction:

Quote:
open main.php and rename all occurrences of 'index.php' to 'main.php', except the 'redirect_header' entries like this:

redirect_header("index.php",1,_MD_VOTEDELETED);

They need to stay the same, i.e. don’t replace the index.php here.

I'm not sure how often this will be appropriate. If 'main.php' submits a form, it will generally need to redirect back to 'main.php' after the form is submitted. On the module I am working on, I found that changing all the links to main.php, including the redirects, worked properly for me, otherwise I wound up back at the module homepage.

Also, if you are tackling a really old module, make sure 'xoops_version.php' has the entry:

$modversion['adminmenu'] = "admin/menu.php";

...otherwise nothing will work. This entry was not used by older modules when they had a stand-alone menu function.

Other than this, I found it a great guide to the recommended module structure for 2.5 and was easy to follow. Thanks for providing that information.

2
Mamba
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/17 7:35

  • Mamba

  • Moderator

  • Posts: 11555

  • Since: 2004/4/23


Yes, Mage did a great job with the Module Admin Class!
It is a big help in converting older modules to XOOPS 2.5.5, and having the same "look & feel" among them.
Support XOOPS => DONATE
Use 2.7.x | Docs | Modules | Bugs

3
Peekay
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/18 20:54

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


The lang definitions for xoops_version.php in the tutorial include the licence link:

$modversion['license_url'] = "www.gnu.org/licenses/gpl-2.0.html/";

but this gives a 404. You just need to lose the trailing slash from the URL.

Also, the cut-n-paste code for modinfo.php includes the following:

define _MI_XDIR__ADMENU2_DESC" , "Add/Edit Links");
define _MI_XDIR__ADMENU3_DESC" 
, "List New Links");
define _MI_XDIR__ADMENU4_DESC" , "List Broken Links");
define _MI_XDIR__ADMENU5_DESC" 
, "List Requested Modifications");

which are missing an opening bracket and double-quote, e.g.

define("_MI_XDIR__ADMENU5_DESC" , "List Requested Modifications");

Much as I hate to say it, this code also has... spaces, which will probably make Transifex scream like a girl.



4
Mamba
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/18 21:02

  • Mamba

  • Moderator

  • Posts: 11555

  • Since: 2004/4/23


1) Thanks for the catch on the GPL link. We'll need to fix it.

2) The conversion tutorial is unfortunately a little bit outdated

It will need to be updated, as there are some changes on how we set the files. I hope, I can do it in the next few weeks.

Thanks for pointing it out!
Support XOOPS => DONATE
Use 2.7.x | Docs | Modules | Bugs

5
Peekay
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/18 21:07

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


No problems. It's a great utility. Still working my way through it.

6
Peekay
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/22 22:35

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


The config check is very good and I found the entries in index.php, e.g.

$index_admin->addLineConfigLabel(_AM_FILEBOX_CONFIG_PHP, $xoopsModule->getInfo("min_php"), 'php') ;

but is it possible to check and display (green or red) other server settings?. I would really like to detect 'PHP safe-mode' (I know it is deprecated in PHP 5.3 but I still need to detect it) and also 'URL fopen'. I know the INI_GET methods, I just wondered if there was a built-in function.

7
Peekay
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/23 14:57

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I was going to adopt the Xoops versioning system for a module I'm working on, but if you enter a second period in the version number in xoops_version.php, you get a blank module page.

This works:

$modversion['version'] = 1.02;

This doesn't:

$modversion['version'] = 1.0.2;

8
irmtfan
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/24 3:26

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


you must use "" or '' in version like this.
$modversion['version'] = '1.0.2';

9
Peekay
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/24 10:12

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Sorry Irmtfan, that doesn't work. Works in the 'about' screen, but displays as '1' in Xoops module admin.

10
irmtfan
Re: Xoops 2.5 Module Admin Class - some observations
  • 2013/2/24 13:49

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


yeah you are right. i didnt notice that.

IMO it is a little bug in core. a displaying issue.

to correct that open XOOPS255/modules/system/admin/modulesadmin/main.php around line 100 add one line:

$listed_mods[$i]['version']     = round( $module->getVar('version') / 100, 2 );
            
$listed_mods[$i]['last_update'] = formatTimestamp( $module->getVar('last_update'), 'm' );
            
$listed_mods[$i]['author']      = $module->getInfo('author');
            
$listed_mods[$i]['credits']     = $module->getInfo('credits');
            
$listed_mods[$i]['license']     = $module->getInfo('license');
            
$listed_mods[$i]['description'] = $module->getInfo('description');
            if ( 
round( $module->getInfo( 'version' ), 2 ) != $listed_mods[$i]['version']){
                
$listed_mods[$i]['warning_update'] = true;
            }else{
                
$listed_mods[$i]['warning_update'] = false;
            }
            
// added by irmtfan to show the real version
            
$listed_mods[$i]['version'] = $module->getInfo('version');
            
$install_mods[] = $module->getInfo('dirname');
            unset(
$module);
            
$i++;

actually you can see previous core developers use a tricky way to warn the user to update module after upload a newer version.

anyway it should be solved in 2.6