THIS IS A HACK TO THE SUGAR CODE AND IS NOT UPGRADE SAFE
By manually editing the layoutdefs of a custom module you can achieve the same AJAX functionality as the builting Sugar modules. I was wondering why they did not implement this in Sugar straight away since it is fairly simple code to include in the layoutdefs file. Please see more information about the manual steps here (HOWTO - Enhance ModuleBuilder generated modules to include AJAX)
Well I have attached the subversion diff/patch files for a Sugar 5.0.0e.
But in essence
Sugar500e\modules\ModuleBuilder\MB\MBRelationship. php
change line 39
from this
var $relParams = array('name', 'relate', 'rsub', 'msub', 'label');
to this
var $relParams = array('name', 'relate', 'rsub', 'msub', 'label', 'quickCreateButton', 'singleSelectButton', 'multiSelectButton');
and add the following at line 392 just after this line
//$props['top_buttons'] = array(array('widget_class' => 'SubPanelTopSelectButton'));
// Hack by Kenneth Thorman to allow inclusion of AJAX functionality into the custome modules.
if ($this->relationships[$def_name]['quickCreateButton'] == "true" ||
$this->relationships[$def_name]['singleSelectButton'] == "true" ||
$this->relationships[$def_name]['multiSelectButton'] == "true") {
$x = 0;
$props['top_buttons'] = array();
if ($this->relationships[$def_name]['quickCreateButton'] == "true") {
$props['top_buttons'][$x] = array('widget_class' => 'SubPanelTopButtonQuickCreate');
$x++;
}
if ($this->relationships[$def_name]['singleSelectButton'] == "true") {
$props['top_buttons'][$x] = array('widget_class' => 'SubPanelTopSelectButton');
$x++;
}
if ($this->relationships[$def_name]['multiSelectButton'] == "true") {
$props['top_buttons'][$x] = array(
'widget_class' => 'SubPanelTopSelectButton',
'popup_module' => $this_name,
'mode' => 'MultiSelect',
'initial_filter_fields' => array()
);
$x++;
}
}
// Hack by Kenneth Thorman to allow inclusion of AJAX functionality into the custome modules.
in Sugar500e\modules\ModuleBuilder\tpls\MBRelationshi p\relationship.tpl
add this at line 97 just before the {/if}
<tr>
<td colspan="2"><br/><br/>When showing {$rel.relate} as a subpanel <br/>of {$module->name} you have the following options:<br/><br/></td>
</tr>
<tr>
<td class='mbLBL'>Show AJAX QuickCreate Button : </td><td><INPUT TYPE=RADIO NAME="quickCreateButton" VALUE="true" {if !empty($rel.quickCreateButton) && $rel.quickCreateButton == "true"}checked{/if}>true <INPUT TYPE=RADIO NAME="quickCreateButton" VALUE="false" {if empty($rel.quickCreateButton) || $rel.quickCreateButton == "false"}checked{/if}>false </td>
</tr>
<tr>
<td class='mbLBL'>Show AJAX SingleSelect Button : </td><td><INPUT TYPE=RADIO NAME="singleSelectButton" VALUE="true" {if !empty($rel.singleSelectButton) && $rel.singleSelectButton == "true"}checked{/if}>true <INPUT TYPE=RADIO NAME="singleSelectButton" VALUE="false" {if empty($rel.singleSelectButton) || $rel.singleSelectButton == "false"}checked{/if}>false </td>
</tr>
<tr>
<td class='mbLBL'>Show AJAX MultiSelect Button : </td><td><INPUT TYPE=RADIO NAME="multiSelectButton" VALUE="true" {if !empty($rel.multiSelectButton) && $rel.multiSelectButton == "true"}checked{/if}>true <INPUT TYPE=RADIO NAME="multiSelectButton" VALUE="false" {if empty($rel.multiSelectButton) || $rel.multiSelectButton == "false"}checked{/if}>false </td>
</tr>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks