OK the fix is rather simple actually. In includ/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php locate the
/** This default function is used to create the HTML for a simple button */
function display($defines, $additionalFormFields = null)
{
$temp='';
if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){
$button = "<input title='$this->title' class='button' type='button' name='button' value=' $this->form_value ' disabled/>\n</form>";
return $temp;
}
global $app_strings;
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<input title='$this->title' accesskey='$this->access_key' class='button' type='submit' name='button' value=' $this->form_value ' />\n</form>";
return $button;
}
and change it like this
/** This default function is used to create the HTML for a simple button */
function display($defines, $additionalFormFields = null)
{
$temp='';
if(!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)){
$button = "<input title='$this->title' class='button' type='button' name='button' value=' $this->form_value ' disabled/>\n</form>";
return $temp;
}
global $app_strings;
$button = $this->_get_form($defines, $additionalFormFields);
$button .= "<div id='createbutton_subpanel_". strtolower($defines['module']) ."' style='display:visible'>";
$button .= "<input title='$this->title' accesskey='$this->access_key' class='button' type='submit' name='button' value=' $this->form_value ' />\n</div>\n</form>";
return $button;
}
and in the javascript template file located at
jssource\src_files\include\SubPanel\SubPanelTiles. js
and change this
sendAndRetrieve: function(theForm, theDiv, loadingStr, subpanel) {
function success(data) {
theDivObj = document.getElementById(theDiv);
subpanelContents[theDiv] = new Array();
subpanelContents[theDiv]['list'] = theDivObj;
subpanelContents[theDiv]['newDiv'] = document.createElement('div');
subpanelContents[theDiv]['newDiv'].innerHTML = data.responseText; // fill the div
theDivObj.style.display = 'none';
theDivObj.parentNode.insertBefore(subpanelContents[theDiv]['newDiv'], theDivObj);
// if IE, evaluate the script on return
if(isIE) SUGAR.util.evalScript(data.responseText);
subpanelLocked[theDiv] = false;
ajaxStatus.hideStatus();
}
...
},
to this
sendAndRetrieve: function(theForm, theDiv, loadingStr, subpanel) {
function success(data) {
theDivObj = document.getElementById(theDiv);
subpanelContents[theDiv] = new Array();
subpanelContents[theDiv]['list'] = theDivObj;
subpanelContents[theDiv]['newDiv'] = document.createElement('div');
subpanelContents[theDiv]['newDiv'].innerHTML = data.responseText; // fill the div
theDivObjCreateButton = document.getElementById('createbutton_'+theDiv);
theDivObjCreateButton.style.display = 'none';
//theDivObj.style.display = 'none';
theDivObj.parentNode.insertBefore(subpanelContents[theDiv]['newDiv'], theDivObj);
// if IE, evaluate the script on return
if(isIE) SUGAR.util.evalScript(data.responseText);
subpanelLocked[theDiv] = false;
ajaxStatus.hideStatus();
}
...
},
cancelCreate: function(theDiv) {
subpanelContents[theDiv]['newDiv'].parentNode.removeChild(subpanelContents[theDiv]['newDiv']);
subpanelContents[theDiv]['list'].style.display = '';
return false;
}
and change it to this
cancelCreate: function(theDiv) {
subpanelContents[theDiv]['newDiv'].parentNode.removeChild(subpanelContents[theDiv]['newDiv']);
subpanelContents[theDiv]['list'].style.display = '';
theDivObjCreateButton = document.getElementById('createbutton_'+theDiv);
theDivObjCreateButton.style.display = '';
return false;
}
Please note that this javascript file is not the file actually used there is a space stripped version of it located at \include\SubPanel\SubPanelTiles.js which is the real file in use. Not really sure how you regenerate the space stripped version. Anyone?
Regards
Ken
Bookmarks