Skip to content

Instantly share code, notes, and snippets.

View dwheeler's full-sized avatar

David Wheeler dwheeler

View GitHub Profile
@dwheeler
dwheeler / my-layout.php
Created April 13, 2015 23:46
Simple Custom Layout (#Accounts/layout/my-layout)
<?php
//custom/modules/Accounts/clients/base/layouts/my-layout/my-layout.php
$viewdefs['Accounts']['base']['layout']['my-layout'] = array(
'components' => array(
array(
'view' => 'my-view',
)
)
);
@dwheeler
dwheeler / required_resolution_dep2.php
Created March 13, 2012 18:04
Alternative required dependency
<?php
$dependencies['Cases']['required_resolution'] = array(
'hooks' => array("edit"),
'trigger' => 'equal($status, "Closed")',
'triggerFields' => array('status'),
'onload' => true,
//Actions is a list of actions to fire when the trigger is true
'actions' => array(
array(
'name' => 'SetRequired',
@dwheeler
dwheeler / doWhen4.html
Created September 20, 2011 19:44
doWhen Example 4
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js" /> <script type="text/javascript">
var checkJQLoaded = function(){ return (typeof $ != 'undefined')};
var myScope = {target:"#myDiv"};
SUGAR.util.doWhen(checkJQLoaded, function(toAppend){
$(this.target).append(toAppend);
}, "Hello World", myScope);
</script>
@dwheeler
dwheeler / doWhen3.html
Created September 20, 2011 19:43
doWhen Example 3
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js" /> <script type="text/javascript">
SUGAR.util.doWhen(function(){ return (typeof $ != 'undefined')}, function(){
$("#myDiv").append("Hello World");
});
</script>
@dwheeler
dwheeler / doWhen2.html
Created September 20, 2011 19:43
doWhen Example 2
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js" /> <script type="text/javascript">
SUGAR.util.doWhen("typeof $ != 'undefined'", function(){
$("#myDiv").append("Hello World");
});
</script>
@dwheeler
dwheeler / doWhen1.html
Created September 20, 2011 19:25
doWhen Example 1
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js" />
<script type="text/javascript">
$("#myDiv").append("Hello World");
</script>
@dwheeler
dwheeler / required_resolution_dep.php
Created June 9, 2011 21:05
Example of SugarLogic Dependency metadata
<?php
$dependencies['Cases']['required_resolution'] = array(
'hooks' => array("edit"),
'trigger' => 'true', //Optional, the trigger for the dependency. Defaults to 'true'.
'triggerFields' => array('status'),
'onload' => true,
//Actions is a list of actions to fire when the trigger is true
'actions' => array(
array(
'name' => 'SetRequired',
@dwheeler
dwheeler / sub_industry_dep.php
Created May 26, 2011 17:11
Subindustry Dropdown Vardef Extension Example
<?php
$dictionary['Account']['fields']['sub_industry_c']['visibility_grid'] = array(
'trigger' => 'industry',
'values' => array(
'Education' => array('edu_college', 'edu_high', 'edu_k12'),
'Banking' => array('bank_comm', 'bank_invest', 'bank_retail', 'bank_cred'),
),
);
@dwheeler
dwheeler / googleMenuItem.php
Created May 19, 2011 22:05
googleMenuItem extension for SugarCRM
<?php
$dynamicDCActions['GoogleSearch'] = array(
//Module is optional if action is defined
'module' => 'Home',
'label' => "Google Search",
//Action is javascript to fire when the button is clicked.
//We will bring up the custom showGoogle action
//if action is not defined, the default action of a quick create for the given module is used.
'action'=> "DCMenu.loadView('Title','index.php?module=Home&action=showGoogle&to_pdf=1');",
//Custom Icon to show in the menu bar
@dwheeler
dwheeler / showGoogle.php
Created May 19, 2011 22:00
Simple php file to show google in an iframe in SugarCRM.
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
?>
<iframe id="scGoogleSearch" src="http://www.google.com" width="750" height="400"></iframe>
<script>
//Encapsulate the call to protect the global scope.
(function(){
var name = document.getElementById("name") || document.getElementById("full_name");
var frame = document.getElementById("scGoogleSearch");
var url = "http://www.google.com/#";