Archive for June, 2009

Adding/Modifying the Shortcuts Menu

Monday, June 29th, 2009

Adding/Modifying the Shortcuts Menu

Suppose you want to modify the Opportunities Shortcuts menu to add a shortcut to create a new Lead (not tied to the existing opportunity).

Create a custom file called:

/custom/Extension/modules/Opportunities/Ext/Menus/CustomMenu.php

The filename is not very important.  Add the following contents:
<?php

if(ACLController::checkAccess(‘Leads’, ‘edit’, true))$module_menu[]=Array(“index.php?module=Leads&action=EditView&return_module=Opportunities&return_action=ListView”, “New From Canvass Form”,”CreateNotes”, ‘Leads’);

?>

Lets’s look at this code to see what it does.
if(ACLController::checkAccess(‘Leads’, ‘edit’, true))

This line of code checks to see if the user has access to the Leads module.  If they do then the system will all another shortcut menu.  This is not strictly required, but good coding practice so users don’t see menu items for modules they can’t create or edit.

The variable $module_menu contains the items the information used to create the menus.  The format is

$module_menu[]=Array($url,$menu_title,$image_icon,$module)

$url – this is where you want to go.  You can look at <install dir>/<ModuleName>/Menu.php to see the shortcuts for the existing modules

$menu_title – In this example, I hard coded the name to “New from Canvass Form”.  If you want the application to be multi-lingual and conform to Sugar standards, you should add a custom string and use something like $mod_strings['LNK_NEW_FROM_CANVASS_FORM']

$image_icon – The images are found in themes/default/images.  If you want to add a new icon, put it there.

$module – The name of the module

You must do a Quick Repair and Rebuild for this to take effect.

If you want to not show the out of the box shortcut menu items, you can just redeclare the array.  Putting the following code in your cusotm file:

<?php

$module_menu= array();

if(ACLController::checkAccess(‘Leads’, ‘edit’, true))$module_menu[]=Array(“index.php?module=Leads&action=EditView&return_module=Opportunities&return_action=ListView”, “New From Canvass Form”,”CreateNotes”, ‘Leads’);

?>

will have only 1 shortcut item.

IIS FastCGI support in Sugar 5.5

Thursday, June 11th, 2009

One of the most exciting features for those deploying Sugar on Windows stacks is the offical support for the new IIS/FastCGI support of PHP. This promises to bring great performance and stability boosts as compared to using the previous ISAPI method of using PHP.

What is FastCGI?

There has for sometime been two popular ways of using PHP with Microsoft’s IIS ( Internet Information Server ); either you could use the ISAPI hook which runs PHP in the same process as IIS, or CGI support which runs it in a seperate process. Both approaches had thier drawbacks; running PHP in ISAPI mode required thread-safety, which although PHP was reasonably good at, the many libraries PHP uses aren’t. So using CGI was the natural choice to help your web server avoid crashing, but it had the flaw of being very slow since each PHP request would have to spawn off a whole new PHP process. This made deploying on Windows something nobody would do for anything but the smallest web applications.

Microsoft fixed this issue by adding a FastCGI mode to IIS 7 ( and backwards to IIS 6 and 5.1 via an add-on ). The FastCGI appoach is similar to the CGI approach where PHP handles the requests externally from the IIS process. But instead of launching a new process each time, IIS instead pools them, saving the overhead costs of launching and destroying processes on every request. This results in a significant improvement in speed compared to CGI ( around 4x-8x on average ) and little to no stability issues unlike with ISAPI. Both PHP and Microsoft are putting lots of effort into improving stability on FastCGI as well, making deploying production web applications on a pure Windows stack a reality.

This sounds great! Now, what do I need to do?

Microsoft has dedicated instuctions for setting up PHP to work with IIS 6 and IIS 7, and the new Microsoft Web Platform Installer 2.0 Beta will also configure PHP correctly. In addtion, the PHP Windows Installer will configure PHP correctly with IIS 5.1,6, and 7; be sure to use the NTS ( Non thread safe ) binaries, as they will yield better performance than the standard thread safe ones since we don’t need thread-safety when using FastCGI.

We recommend changing a few of the default setting for FastCGI and PHP when using the IIS/FastCGI support. First, with FastCGI ( which can be changed in the fcgiext.ini file for IIS 5.1/6 and in the FastCGI panel in IIS 7 when you have installed the IIS Admin Pack ):

ActivityTimeout – change to 3600, which is the maximum value

RequestTimeout – change to 3600, also the maximum value

Those settings will allow IIS/FastCGI to not interfere with the PHP max_execution_time/request_timeout settings.

On the PHP side, be sure the following settings are set:

fastcgi.logging=0

fastcgi.impersonate=1

These help prevent wierd FastCGI errors and improve security for your Sugar instance.

If you are on IIS 7, you will need to install the URL Rewrite extension, which provide .htaccess like directory security for your Sugar install.

Once that is done, you should be ready to go. If you run into any issues with using IIS/FastCGI, just let us know.

SugarForge 2.0?

Monday, June 8th, 2009

I’ve been thinking a lot lately on how you (the developer community) and SugarCRM can work closer together.  We’ve come up with a few ideas that we’re working on here at Sugar.

For starters, I want to revamp SugarForge.  There are some features that I want and they do not currently exist.  My inspiration has come from sites I have been using lately – GitHub, BitBucket, and LaunchPad. I have also been playing with Trac a lot.  What all of these have in common is excellent source control and wikis. I also particularly like the project management & issue tracking available from Trac.

I don’t think its possible (or even wise) to replace SugarForge with any of the above mentioned developer collaboration services.  However, I do think we have some options.  These are the few that I have identified:

Is there any software collaboration suites that you think would be perfect for SugarForge 2.0?  Right now I’m leaning towards gForge because it’s PHP and SugarForge is already gForge based.  It looks like they’ve done some major updates since we initially started SugarForge.

If you have any other ideas that will help SugarCRM collaborate with you better PLEASE let me know. You can often find me hanging out in the IRC #sugarcrm channel (nick: roder).  That’s irc.freenode.net in channel #sugarcrm.

Have feedback for us? Drop us a line.
Terms & Conditions | Privacy | Trademark Info | Contact Info | FAQs | SugarCRM Inc.© 2004 - 2009 All rights reserved.