This little post describes how to enhance modules generated via the module builder so that the modules can offer functionality like, some of these features have been included in the 5.0 GA/Release version of SugarCrm. There are still a few things described here that needs manual tweaking.
Ajax Inline QuickCreate
SideQuickCreate (in Shortcut area)
Custom fields
Studio Support for drag and drop
If you go to the "Cases" tab (or any of the other built in tabs) and try to create a Bug you will see that you will creating the bug using AJAX, json (i.e no page reload).
You can also see that when clicking on the Cases tab there is a side quick create option ( on the left side in the screen shot attached).
If you go to Admin/Studio you will see that you can modify already installed modules (and notice that Studio actually gives you more freedom than the Module Builder does currently)
Download your zip file.
Extract.
MISSING SELECT LINK IN POPUP SEARCH:
Missing or not using the name field and thus missing a way to select the specific data row in a popup select box?
Modify the relevant module ZIP\SugarModule\modules\SOMEMODULE\metadata\listvi ewdefs.php
'START_DATE' =>
array (
'width' => '10',
'label' => 'LBL_START_DATE',
'default' => true,
'link' => true, // this is the one to set on the field you want to use as a link
),
SHOW THIRD MODULE RELATED INFO IN A SUBPANEL:
See post: HOWTO - Hack Sugar to support related module info in subpanel (one-many)
HIDE A TAB BUT SHOW SUBPANEL:
When you generate packages via the builtin module builder most of the modules in the package makes sense to show as main tabs, however some of the modules does not make sense to show as a main tab since you only use then in relation to another module which most likely allows access to the related data. Example, you build a CV database in Sugar. CV is main entry, a CV has some related data like skills, interests, education, work experience ...
Skills will most likely have its own tab since this can be reused to enhance the project builtin SugarCrm module, but interests, education and work experience will most likely be unique to the specific CV. To avoid cluttering up the main tab menu we want to hide the interests, education and work experience tabs but we want to show them as subpanels.
in the manifest.php locate
'beans' =>
array (
0 =>
array (
'module' => 'inux_Skill',
'class' => 'inux_Skill',
'path' => 'modules/inux_Skill/inux_Skill.php',
'tab' => true, // set this to false to hide the main tab
),
then in the relevant modules where this hidden tab/modules is to be used as a subpanel you should add the following
(most likely to be in the following locations (for CV))
ZIP\SugarModules\layoutdefs\CV.php
ZIP\SugarModules\modules\CV\metadata\subpaneldefs. php
// Allow these modules to be shown in subpanels even if they do not have their own tab
global $modules_exempt_from_availability_check;
$modules_exempt_from_availability_check['Education'] = 'Education';
$modules_exempt_from_availability_check['WorkExperience'] = 'WorkExperience';
$modules_exempt_from_availability_check['Interests'] = 'Interests';
(thank you for this information goes to Andopes for answering my question about this in this thread Hiding a tab but still showing the subpanels in related modules.)
DROPDOWN LISTS USED IN THE MODULE ARE NOT EXPORTED
You can find the definition in the /cache/jslanguage/en_us.js file. Search for the list name (this is on the sugar instance you used to generated the module and also created the dropdown list)
This needs to be added to the following file in the zip.
ZIP\SugarModules\language\application\en_us.lang.p hp
Example:
(/cache/jslanguage/en_us.js )
"status_list":{"Draft":"Draft","Inprogress":"Inpro gress","Done":"Done","Review":"Review","Finished": "Finished"}
put the following in ZIP\SugarModules\language\application\en_us.lang.p hp
$GLOBALS['app_list_strings']['status_list']=array (
'Draft' => 'Draft',
'Inprogress' => 'Inprogress',
'Done' => 'Done',
'Review' => 'Review',
'Finished' => 'Finished',
);
STUDIO SUPPORT:
To enable studio support in a module please add a file named studio.php to the ZIP/SugarModules/modules/MODULENAME/metadata folder (see attachment for studio.php)
SUBPANEL AJAX SUPPORT:
To add AJAX support we need to go to ZIP/SugarModules/layoutdefs/MYMODULE.php and add this to the end of the array found in that file). You need to decide on which of the buttons you would like to keep.
// You need to define this if you would like AJAX func builtin in the generated module
'top_buttons' => array(
// Quick create button, you need to have a MODULENAMEQuickCreate.php file in the ZIP/SugarModules/modules/MODULENAME/ directory
array('widget_class' => 'SubPanelTopButtonQuickCreate'),
// Simple select
array('widget_class' => 'SubPanelTopSelectButton'),
// Advanced multiselect functionality in the select popup form
array(
'widget_class' => 'SubPanelTopSelectButton', // select button
'popup_module' => 'test_master', // just enter the same module as the current module here, is no related module
'mode' => 'MultiSelect', // multi select
'initial_filter_fields' => array(), // here you can prefilter the data before it even starts to look at relations ships between parent /child
),
),
Create a file in ZIP/SugarModules/modules/MYMODULE/MYMODULEQuickCreate.php (you can use the one in the attachment)
Search and replace in this file "MODULE_NAME" with the actual full module name.
You can see the available widgets included in Sugar here SugarCE/include/generic/SugarWidgets. Please note that it is not all widgets that makes sense to use here.
STUDIO SUBPANEL SUPPORT:
When you are done, copy ZIP/SugarModules/layoutdefs/MYMODULE.php to the metadata folder and rename it to subpaneldefs.php (this allows you to drag-n-drop-change the subpanel definitions from within studio)
SIDEQUICKCREATE
1. Add a label definition in the ZIP/SugarModules/modules/MYMODULE/language/LANGUAGE_NAME.lang.php named "LBL_NEW_FORM_TITLE"
'LBL_NEW_FORM_TITLE' => 'New MYMODULE',
2. Quick Repair Sugar
3. Copy the (accompaning) sidecreateviewdefs.php to ZIP/modules/<MODULENAME>/metadata/sidecreateviewdefs.php
and modify it to show and edit the fields required. A good way to figure out how to add/remove fields from
these arrays is to either copy something from the built in modules, or use studio to generate the quickcreatedefs.php for the module.
Then Save and deploy. Go to SugarINSTALL/custom/modules/MYMODULE/metadata/quickcreatedefs.php and copy paste the "panels" array to the
ZIP/modules/<MODULENAME>/metadata/sidecreateviewdefs.php. Please remeber to on use one column and not make it too wide if using studio.
Also remeber to remove the generated file from SugarINSTALL/custom/modules/MYMODULE/metadata/quickcreatedefs.php
For some reason quickcreatedefs.php is causing a bug in the system so make sure you remove that file ([see the filed bug here )
MODIFYING SUBPANELS:
There is one thing missing, the attends school checkbox does not come up as planned in the child subpanel (when viewing related children from a parent)
Uninstall the generated module from Module Builder using Admin/Module Loader
Zip up the files in a zip file and make sure manifest.php is in the root of this zip
Install the module using Admin/Module Loader
This can be fixed in 2 ways edit the module in Studio (You might have to do a Admin/Repair: Quick Repair and possibly Repair Relationships before this will work) and drag and drop the subpanel
(please note that all the changes you are doing here will result in a file being created by studio at the following location SUGARINSTALL/custom/modules/MODULENAME/metadata)
or do it manually by copying the file (normally this would be default.php) located at SUGARINSTALL/modules/MODULENAME/metadata/subpanels to SUGARINSTALL/custom/modules/MODULENAME/metadata and add or change the existing value for
attends_school to look like the change it to look
'MY_CHECKBOX_FIELD'=>array(
'vname' => 'LBL_MY_CHECKBOX_FIELD',
'width' => '5%',
'widget_class' => 'Fieldbool',
),
REMEMBER THAT THE WIDGET CLASS IS CASE SENSITIVE ON LINUX SYSTEMS SO TO AVOID PROBLEMS KEEP THE CASING EXACT.
SUMMARY
It seems like the defs files are using almost the same syntax or maybe even exactly the same syntax.
So if you are not into handediting files use the Studio support to create, modify, order things and the copy paste the def
to the appropriate file.
USE THIS AT YOUR OWN RISC


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks