Go Back   SugarCRM Forums > Community Forums > Developer Help
 Create an account

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2010-02-08, 08:57 PM
jjwdesign's Avatar
jjwdesign jjwdesign is offline
A Prolific Poster
 
Join Date: Dec 2006
Location: Orlando, FL
Posts: 437
Default Google Maps: How should I attempt to package the custom controllers and views?

I've got some Google Maps code that I've been working on, that I would like to release on SugarForge, but I'm not sure how to package it. I'm hoping someone can help point me in the right direction.

In the past, I have managed to package two custom modules to create the JJW Design Tools and Reports package.
http://www.sugarforge.org/projects/jjwtoolsreports/

The Google Maps code is a bit different as it works with existing modules. The Google Maps code is attached to this post. It works with the Contacts, Accounts and Leads modules. It uses custom controllers and views. Concerning the controllers, I can't assume that this will be the "only" custom controller per module. Should I consider rewriting this into custom dashlets instead of action/views?

Here's my current install notes (leads example):
Code:
 
GOOGLE MAPS INSTALL NOTES:
Most files are located in the custom/modules/Leads dir.
 
IN STUDIO:
Got to Leads - Fields
Create two new custom fields: 
Data Type: Decimal
Name: maps_lat (will generate field maps_lat_c)
Display Label: Latitude
Max Size: 10
Precision: 6
 - Will generate float 10,6
Data Type: Decimal
Name: maps_lng (will generate field maps_lng_c)
Display Label: Longitude
Max Size: 10
Precision: 6
 - Will generate float 10,6
 
COPY:
custom/modules/Leads/controller.php
- This file contains the map actions necessary; xml generation, etc.
 
COPY:
custom/modules/Leads/LeadMapsLogicHook.php
- This file contains the logic hook to remove the geocode information any time an lead is saved/modified.
- This ensures the longitude (maps_lng_c) and latitude (maps_lat_c) values are re-geocoded properly.
 
ADD LOGIC HOOK:
Add the following into the logic_hooks.php file (note 1 - change to your array def).
custom/modules/Leads/logic_hooks.php
$hook_array['after_save'][] = Array(1, 'removeGeocodeInfo', 'custom/modules/Leads/LeadMapsLogicHook.php', 'LeadMapsLogicHook', 'removeGeocodeInfo');
or create new file, such as:
<?php
// custom/modules/Leads/logic_hooks.php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(1, 'removeGeocodeInfo', 'custom/modules/Leads/LeadMapsLogicHook.php', 'LeadMapsLogicHook', 'removeGeocodeInfo');
?>
 
COPY: 
custom/modules/Leads/views/view.map_display.php
 
COPY: 
custom/modules/Leads/views/view.map_markers.config.php
 
COPY: 
custom/modules/Leads/views/view.map_markers.php
 
MENU AND LANGUAGE CHANGES
See the following doc:
http://developers.sugarcrm.com/docs/...4.html#9002195
custom/Extension/module/Leads/Ext/Menus/
 
COPY MENU CHANGES:
custom/Extension/modules/Leads/Ext/Menus/maps_menu.php
<?php
if (ACLController::checkAccess('Leads', 'view', true)) {
    $module_menu[]=Array("index.php?module=Leads&action=geocode_adddress", $mod_strings['LBL_LABEL_FOR_MAP_DISPLAY'], "Leads");
}
?>
ADD LANGUAGE:
custom/Extension/modules/Leads/Ext/Language/en_us.maps.php
<?php
$mod_strings['LBL_LABEL_FOR_MAP_DISPLAY'] = 'Display Map';
?>
 
COPY IMAGES FOR MAPS: (15 .png files)
themes/default/ext/resources/images/map_icons/

Thanks,
Jeff Walters
Attached Images
 
Attached Files
File Type: zip GoogleMaps_Custom_20100208.zip (41.9 KB, 24 views)
__________________
SugarCRM Community Edition: 5.2
Server: Apache2, PHP 5.2.5, MySQL 5.0.24
SugarForge Projects:
JJWDesign Google Maps
JJWDesign Tools and Reports

Last edited by jjwdesign; 2010-02-08 at 09:17 PM.
Reply With Quote
  #2  
Old 2010-02-09, 07:09 AM
hileon's Avatar
hileon hileon is offline
Sugar Team Member
 
Join Date: May 2008
Location: Shanghai
Posts: 187
Send a message via MSN to hileon Send a message via Yahoo to hileon Send a message via Skype™ to hileon
Default Re: Google Maps: How should I attempt to package the custom controllers and views?

looks awesome.
but it seems missed some files, like custom/include/SFL/sfl_SugarMaps.php, in the attachment
__________________
Open source, open data, open life in the commercial environment.
Reply With Quote
  #3  
Old 2010-02-09, 08:17 AM
SugarDev.net SugarDev.net is offline
A Sugar Hero
 
Join Date: Feb 2008
Posts: 1,402
Default Re: Google Maps: How should I attempt to package the custom controllers and views?

Quote:
I can't assume that this will be the "only" custom controller per module
That is a very good comment and something that I would like to call "Grey". It's not core hacking per se, but it's not set-and-forget either. Please try to rewrite your customizations so that they fit in the view files. If you really cannot, there is no choice but to overwrite and hope for the best.
__________________
Developers go here
Businesses go there (Dutch)

Modules:
SugarDev.net Developer Tools | Config | Dutch Language Pack
"Nothing gets fixed unless there is a bug"
Reply With Quote
  #4  
Old 2010-02-09, 01:04 PM
jjwdesign's Avatar
jjwdesign jjwdesign is offline
A Prolific Poster
 
Join Date: Dec 2006
Location: Orlando, FL
Posts: 437
Default Re: Google Maps: How should I attempt to package the custom controllers and views?

SugarDev,

Are you saying I should write the Controller Action logic into the views? That seems very anti-MVC, yet I've done that before. I assume the action to file mapping doesn't get overridden and can get included from the Extensions directory?

Here's the Project on SugarForge for those looking for the files:

http://www.sugarforge.org/projects/jjwgooglemaps/

Install at your own risk.

Thanks,
Jeff
__________________
SugarCRM Community Edition: 5.2
Server: Apache2, PHP 5.2.5, MySQL 5.0.24
SugarForge Projects:
JJWDesign Google Maps
JJWDesign Tools and Reports
Reply With Quote
  #5  
Old 2010-02-09, 07:01 PM
SugarDev.net SugarDev.net is offline
A Sugar Hero
 
Join Date: Feb 2008
Posts: 1,402
Default Re: Google Maps: How should I attempt to package the custom controllers and views?

I'll take a look at it .

No, action_file_map gets overwritten too, no extensions. Gotta love it, eh.
__________________
Developers go here
Businesses go there (Dutch)

Modules:
SugarDev.net Developer Tools | Config | Dutch Language Pack
"Nothing gets fixed unless there is a bug"
Reply With Quote
  #6  
Old 2010-02-09, 09:13 PM
jjwdesign's Avatar
jjwdesign jjwdesign is offline
A Prolific Poster
 
Join Date: Dec 2006
Location: Orlando, FL
Posts: 437
Default Re: Google Maps: How should I attempt to package the custom controllers and views?

Love it? Eh, it's not that bad. I've delt with worse; hell, I've done Web development in PERL! Doh! It just makes it harder to contribute.

Maybe I'll just write them into custom Dashlets. I believe that will let me make it custom/install safe.

Cheers, Jeff
__________________
SugarCRM Community Edition: 5.2
Server: Apache2, PHP 5.2.5, MySQL 5.0.24
SugarForge Projects:
JJWDesign Google Maps
JJWDesign Tools and Reports
Reply With Quote
  #7  
Old 2010-07-14, 11:02 PM
nmteck nmteck is offline
Member
 
Join Date: Jul 2010
Posts: 5
Default Re: Google Maps: How should I attempt to package the custom controllers and views?

jjwdesign, I am new to sugar and I'm trying to install your module. Could you point me in the right direction once I copy all the files and create the fields in the studio? Sorry if this is a really newbie question.

Thanks in advance.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can google maps be integrated in to sugarcrm shivaranjani Help 0 2009-06-22 06:27 AM
Sugar CE and CRMUpgrades: Google Maps andydav Help 17 2008-03-18 07:05 PM
SugarCubed: Google Maps hubdigital Help 0 2006-09-08 05:42 AM
Integrate MapQuest, Yahoo, Google Maps for Contacts weboffice Feature Requests 3 2006-07-05 03:51 PM


All times are GMT. The time now is 07:44 AM.


Powered by: vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SourceForge.net Logo