Skip to content

Instantly share code, notes, and snippets.

View mmarum-sugarcrm's full-sized avatar

Matt Marum mmarum-sugarcrm

View GitHub Profile
@mmarum-sugarcrm
mmarum-sugarcrm / CssLoader.js
Created January 28, 2016 16:23
CssLoader.js
/**
* Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
(function (app) {
app.events.on('app:init', function () {
/**
* This plugin allows components to dynamically load CSS files.
*
* <pre><code>
* // Sample component:
@mmarum-sugarcrm
mmarum-sugarcrm / ScriptLoader.js
Created January 28, 2016 16:03
ScriptLoader plug-in example
/**
* Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
(function (app) {
/**
* Allow jquery and moment.js to be used in requirejs modules.
*/
var bootstrapScriptLoader = function() {
define('jquery', [], function() {
return jQuery;
@mmarum-sugarcrm
mmarum-sugarcrm / highcharts-example.hbs
Last active January 28, 2016 17:11
Highcharts Sugar Dashlet Example
{{! Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. }}
<h3>Example Button</h3>
{{! Unicorn UI styled buttons }}
<span class="button-wrap">
<a class="button button-pill button-raised button-royal">Go</a>
</span>
<a class="button button-3d button-primary button-rounded">Check out the new site!</a>
<h3>Example Highchart</h3>
{{!
div element we are reserving for use with our Highchart.
@mmarum-sugarcrm
mmarum-sugarcrm / apache22.sh
Created December 22, 2015 18:42
Set up Apache 2.2 for Ubuntu 12.04 for easy development by Vagrant user
#!/bin/bash
# Add phpinfo to web dir as a convenience
echo "<?php phpinfo();" > /var/www/phpinfo.php
# We will have Apache run as Vagrant user because this will help prevent permissions issues on a dev setup
sed -i "s/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=vagrant/" /etc/apache2/envvars
chown -R vagrant /var/www/
usermod -a -G www-data vagrant
@mmarum-sugarcrm
mmarum-sugarcrm / php54.sh
Last active December 22, 2015 18:32
Provision Apache 2, MySQL 5.5, Elasticsearch and PHP 5.4.x on an Ubuntu 12.04 machine
#!/bin/bash
#
# Setup the the box. This runs as root
apt-get -y update
# MySQL default username and password is "root"
echo "mysql-server-5.5 mysql-server/root_password password root" | debconf-set-selections
echo "mysql-server-5.5 mysql-server/root_password_again password root" | debconf-set-selections
@mmarum-sugarcrm
mmarum-sugarcrm / addCustomButtonJS.php
Last active December 14, 2015 15:35
Custom Button event handling code
<?php
/**
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
//Loop through the groupings to find grouping file you want to append to
foreach ($js_groupings as $key => $groupings)
{
foreach ($groupings as $file => $target)
{
//if the target grouping is found
@mmarum-sugarcrm
mmarum-sugarcrm / custom_button.php
Last active December 14, 2015 15:35
Adding a custom button to Sugar 7 Accounts Record view using metadata
<?php
/**
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
//Insert our custom button definition into existing Buttons array before the sidebar toggle button
array_splice($viewdefs['Accounts']['base']['view']['record']['buttons'], -1, 0, array(
array(
'name' => 'custom_button',
'type' => 'button',
'label' => 'My Custom Button',
@mmarum-sugarcrm
mmarum-sugarcrm / dashlet-config.hbs
Created October 16, 2015 22:49
Contextual Frame Dashlet templates
{{!--
Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
--}}
<div class="record">
{{#each dashletConfig.config.fields}}
<div class="row-fluid panel_body">
<div class="record-cell">
<div class="record-label">{{str label}}</div>
{{field ../this model=../this.settings template=../this.action}}
</div>
@mmarum-sugarcrm
mmarum-sugarcrm / xyz_contextual-iframe.js
Created October 16, 2015 22:40
Contextual Frame Dashlet javascript
({
/**
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
plugins: ['Dashlet'],
/**
* Record ID that is in context
*/
record: undefined,
@mmarum-sugarcrm
mmarum-sugarcrm / xyz_contextual-iframe.php
Created October 16, 2015 22:30
Contextual Frame Dashlet metadata
<?php
/**
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
*/
$viewdefs['base']['view']['xyz_contextual-iframe'] = array(
//Dashlet metadata
'dashlets' => array(
array(
'label' => 'LBL_XYZ_IFRAME_DASHLET_LABEL',
'description' => 'LBL_XYZ_IFRAME_DASHLET_DESCRIPTION',