';
print '
'.$langs->trans("PageForList").' :
'.$pathtolist.'';
@@ -1138,8 +1161,38 @@ elseif (! empty($module))
if ($tab == 'hooks')
{
- print $langs->trans("FeatureNotYetAvailable");
+ if ($action != 'editfile' || empty($file))
+ {
+ $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php';
+ print '
'.$langs->trans("HooksFile").' :
'.$pathtohook.'';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').'';
+ print '
';
+ }
+ else
+ {
+ $fullpathoffile=dol_buildpath($file, 0);
+ $content = file_get_contents($fullpathoffile);
+
+ // New module
+ print '
';
+ }
}
if ($tab == 'triggers')
@@ -1155,7 +1208,7 @@ elseif (! empty($module))
{
$pathtofile = $trigger['relpath'];
- print '
'.$langs->trans("TriggerFile").' :
'.$pathtofile.'';
+ print '
'.$langs->trans("TriggersFile").' :
'.$pathtofile.'';
print '
'.img_picto($langs->trans("Edit"), 'edit').'';
print '
';
}
@@ -1189,8 +1242,46 @@ elseif (! empty($module))
if ($tab == 'widgets')
{
- print $langs->trans("FeatureNotYetAvailable");
+ require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
+ $widgets = ModeleBoxes::getWidgetsList(array('/'.strtolower($module).'/core/boxes'));
+
+ if ($action != 'editfile' || empty($file))
+ {
+ foreach ($widgets as $widget)
+ {
+ $pathtofile = $widget['relpath'];
+
+ print '
'.$langs->trans("WidgetFile").' :
'.$pathtofile.'';
+ print '
'.img_picto($langs->trans("Edit"), 'edit').'';
+ print '
';
+ }
+ }
+ else
+ {
+ $fullpathoffile=dol_buildpath($file, 0);
+
+ $content = file_get_contents($fullpathoffile);
+
+ // New module
+ print '
';
+ }
}
if ($tab == 'buildpackage')
diff --git a/htdocs/modulebuilder/template/ChangeLog.md b/htdocs/modulebuilder/template/ChangeLog.md
new file mode 100644
index 00000000000..0f04e316f58
--- /dev/null
+++ b/htdocs/modulebuilder/template/ChangeLog.md
@@ -0,0 +1,5 @@
+# CHANGELOG FOR DOLIBARR ERP CRM
+
+## 1.0
+Initial version
+
diff --git a/htdocs/modulebuilder/template/core/boxes/mybox.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php
similarity index 83%
rename from htdocs/modulebuilder/template/core/boxes/mybox.php
rename to htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php
index 3b3fedcca08..85592006a14 100644
--- a/htdocs/modulebuilder/template/core/boxes/mybox.php
+++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php
@@ -17,9 +17,9 @@
*/
/**
- * \file core/boxes/mybox.php
+ * \file modulebuilder/template/core/boxes/mymodulewidget1.php
* \ingroup mymodule
- * \brief Example box definition.
+ * \brief Widget provided by MyModule
*
* Put detailed description here.
*/
@@ -33,12 +33,12 @@ include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
* Warning: for the box to be detected correctly by dolibarr,
* the filename should be the lowercase classname
*/
-class MyBox extends ModeleBoxes
+class mymodulewidget1 extends ModeleBoxes
{
/**
* @var string Alphanumeric ID. Populated by the constructor.
*/
- public $boxcode = "mybox";
+ public $boxcode = "mymodulebox";
/**
* @var string Box icon (in configuration page)
@@ -90,7 +90,7 @@ class MyBox extends ModeleBoxes
parent::__construct($db, $param);
- $this->boxlabel = $langs->transnoentitiesnoconv("MyBox");
+ $this->boxlabel = $langs->transnoentitiesnoconv("MyWidget");
$this->param = $param;
@@ -114,7 +114,7 @@ class MyBox extends ModeleBoxes
//include_once DOL_DOCUMENT_ROOT . "/mymodule/class/mymodule.class.php";
// Populate the head at runtime
- $text = $langs->trans("MyBoxDescription", $max);
+ $text = $langs->trans("MyModuleBoxDescription", $max);
$this->info_box_head = array(
// Title text
'text' => $text,
@@ -142,18 +142,21 @@ class MyBox extends ModeleBoxes
'tr' => 'align="left"',
// HTML properties of the TD element
'td' => '',
- // Fist line logo
- 'logo' => 'mymodule@mymodule',
- // Main text
- 'text' => 'My text',
- // Secondary text
- 'text2' => '
Another text
',
- // Unformatted text, usefull to load javascript elements
- 'textnoformat' => '',
+
+ // Main text for content of cell
+ 'text' => 'First cell of first line',
// Link on 'text' and 'logo' elements
'url' => 'http://example.com',
// Link's target HTML property
'target' => '_blank',
+ // Fist line logo (deprecated. Include instead logo html code into text or text2, and set asis property to true to avoid HTML cleaning)
+ //'logo' => 'monmodule@monmodule',
+ // Unformatted text, added after text. Usefull to add/load javascript code
+ 'textnoformat' => '',
+
+ // Main text for content of cell (other method)
+ //'text2' => '
Another text
',
+
// Truncates 'text' element to the specified character length, 0 = disabled
'maxlength' => 0,
// Prevents HTML cleaning (and truncation)
@@ -164,19 +167,27 @@ class MyBox extends ModeleBoxes
1 => array( // Another column
// No TR for n≠0
'td' => '',
- 'text' => 'Another cell',
+ 'text' => 'Second cell',
)
),
1 => array( // Another line
0 => array( // TR
'tr' => 'align="left"',
'text' => 'Another line'
+ ),
+ 1 => array( // TR
+ 'tr' => 'align="left"',
+ 'text' => ''
)
),
2 => array( // Another line
0 => array( // TR
'tr' => 'align="left"',
- 'text' => 'Yet another line'
+ 'text' => ''
+ ),
+ 0 => array( // TR
+ 'tr' => 'align="left"',
+ 'text' => ''
)
),
);
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index cd3fb22be80..d91b4c6a495 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -173,15 +173,13 @@ class modMyModule extends DolibarrModules
*/
- // Boxes
- // Add here list of php file(s) stored in core/boxes that contains class to show a widget.
- $this->boxes = array(); // List of boxes
- // Example:
- //$this->boxes=array(
- // 0=>array('file'=>'myboxa.php@mymodule','note'=>'','enabledbydefaulton'=>'Home'),
- // 1=>array('file'=>'myboxb.php@mymodule','note'=>''),
- // 2=>array('file'=>'myboxc.php@mymodule','note'=>'')
- //);
+ // Boxes/Widgets
+ // Add here list of php file(s) stored in mymodule/core/boxes that contains class to show a widget.
+ $this->boxes = array(
+ 0=>array('file'=>'mymodulewidget1.php@mymodule','note'=>'Widget provided by MyModule','enabledbydefaulton'=>'Home'),
+ //1=>array('file'=>'mymodulewidget2.php@mymodule','note'=>'Widget provided by MyModule'),
+ //2=>array('file'=>'mymodulewidget3.php@mymodule','note'=>'Widget provided by MyModule')
+ );
// Cronjobs
diff --git a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang
index 478d589a7e6..e09e396dce0 100644
--- a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang
+++ b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang
@@ -44,5 +44,5 @@ MyPageName = My page name
#
# Sample box
#
-MyBox = My box
-MyBoxDescription = My box description
\ No newline at end of file
+MyWidget = My widget
+MyWidgetDescription = My widget description
\ No newline at end of file
diff --git a/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang b/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang
index c946ad6691c..aa271536edf 100644
--- a/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang
+++ b/htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang
@@ -44,5 +44,5 @@ MyPageName = Nom de ma page
#
# Box d'exemple
#
-MyBox = Ma boîte
-MyBoxDescription = Description de ma boîte
\ No newline at end of file
+MyWidget = Mon widget
+MyWidgetDescription = Description de mon widget
diff --git a/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php
index 547b48a32af..a70cc9bee8d 100644
--- a/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php
+++ b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php
@@ -231,7 +231,7 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
{
$this->url('/admin/boxes.php');
$this->authenticate();
- return $this->assertContains('mybox', $this->source(), "Box enabled");
+ return $this->assertContains('mymodulewidget1', $this->source(), "Box enabled");
}
/**
@@ -244,7 +244,7 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
$this->url('/admin/triggers.php');
$this->authenticate();
return $this->assertContains(
- 'interface_99_modMyModule_MyTrigger.class.php',
+ 'interface_99_modMyModule_MyModuleTriggers.class.php',
$this->byTag('body')->text(),
"Trigger declared"
);