Page 2 of 2

Re: Writing own components

Posted: Mon Feb 13, 2012 10:42 am
by mguthrie
Box293 is correct.

In the include file that has all of the component registration information, you'll also need to have the following constant defined:

( Example from BPI component):

Code: Select all

COMPONENT_CONFIGFUNCTION => "bpi_component_config_func",

Then in that function you'll need it to be something like this:

Code: Select all

function bpi_component_config_func($mode="",$inargs,&$outargs,&$result)
{
     	$result=0;
	$output="";
	switch($mode)
	{
		case COMPONENT_CONFIGMODE_GETSETTINGSHTML:
                      //the web form to handle config options
                 break;

                 case COMPONENT_CONFIGMODE_SAVESETTINGS:
                     //config validation and save to xi_options 
                break; 
      }
    return $output;
}

Use XI's built-in "get_option()" and "set_option()" functions to store arbitrary config options in the postgresql database.

Re: Writing own components

Posted: Fri Feb 17, 2012 11:58 am
by SDohmen
We got so far that we have the link added when it gets installed. However it does not use the builtin security of the core config manager due too the sourceguardian security. My co-worker managed to use "Can (re)configure hosts and services:" which can be set in the user options.

Is there a way to use the core config manager security? or is this prohibited?

Re: Writing own components

Posted: Fri Feb 17, 2012 1:46 pm
by scottwilkerson
Do you have this at the top of your component?

Code: Select all

//include the helper file
require_once(dirname(__FILE__).'/../componenthelper.inc.php');