Sugar Developer Guide 6.5
Total Page:16
File Type:pdf, Size:1020Kb
Sugar Developer Guide 6.5 1 / 756 Sugar Developer Guide 6.5 ........................................... 40 Preface .......................................................... 40 Overview ....................................................... 40 The Sugar Application .............................................. 40 The Sugar Community .............................................. 40 Audience ........................................................ 41 Application Overview ............................................... 41 Core Features ................................................... 41 Sales Force Automation ............................................ 41 Marketing Automation ............................................. 42 Customer Support ............................................... 42 Collaboration .................................................. 42 Reporting .................................................... 42 Administration ................................................. 43 Introduction ....................................................... 43 Overview ....................................................... 43 Background ...................................................... 43 6 Basic Development Rules for Sugar Products ............................. 44 Application Framework .............................................. 44 Directory Structure ................................................ 45 Key Concepts ................................................... 46 Application Concepts .............................................. 46 Files ....................................................... 47 Variables ..................................................... 47 Entry Points ................................................... 47 Module Framework ................................................ 48 User Interface Framework ........................................... 51 Extension Framework ............................................... 51 Sugar Dashlets ................................................... 52 Web Services ..................................................... 52 Connectors ...................................................... 52 Application Framework .............................................. 53 Introduction ..................................................... 53 Application Framework ............................................. 53 Directory Structure ............................................... 54 Key Concepts .................................................. 55 Application Concepts ............................................. 55 Files ..................................................... 56 Variables ................................................... 56 Entry Points .................................................. 56 ACL ........................................................... 57 Overview ...................................................... 57 Access Control Lists ............................................... 57 Checking Access ................................................. 57 Parameters ................................................... 57 Example ..................................................... 58 2 / 756 Administration Links ............................................... 58 Overview ...................................................... 58 Administration Links ............................................... 58 Example ....................................................... 58 AjaxUI ......................................................... 60 Overview ...................................................... 60 About the AjaxUI ................................................. 60 Reduced server load .............................................. 60 No Full Rebuild of the Dom .......................................... 60 Script Files are not Parsed ........................................... 60 Fewer Requests Per Page ........................................... 61 Side Effects .................................................... 61 document.write ................................................. 61 onLoad ...................................................... 61 Page Order vs Execution Order ........................................ 61 JSON Responses ................................................ 62 Authentication .................................................... 63 Oauth ........................................................ 63 Overview ..................................................... 63 Using OAuth with Sugar ............................................ 63 Step 1: Establishing Consumer Key ...................................... 63 Step 2: Creating Request Token ........................................ 63 Step 3: Approve Request Token ........................................ 64 Step 4: Request Access Token ......................................... 64 Step 5: Using Access Token .......................................... 65 Charts ......................................................... 66 Custom Charts ................................................... 66 Overview ..................................................... 66 Custom Charts ................................................. 66 Connectors ...................................................... 68 Introduction .................................................... 68 Factories ...................................................... 68 Sources ....................................................... 69 Formatters ..................................................... 74 Class Definitions ................................................. 76 Examples ...................................................... 77 Creating A Custom Connector ......................................... 78 Overview ................................................... 78 Connectors .................................................. 78 Protocol Type ................................................. 78 Source .................................................... 79 Connector Class (.php) ............................................ 79 getList() ................................................. 79 getItem() ................................................ 80 test() .................................................. 81 Class Example .............................................. 82 3 / 756 Vardefs (vardefs.php) ............................................ 84 Things to Note .............................................. 86 Configuration (config.php) .......................................... 87 Labels (.lang.php) .............................................. 87 Mappings (mapping.php) ........................................... 88 Formatter ................................................... 89 Building a Module Loadable Package ..................................... 91 Dashlets ........................................................ 92 Introduction .................................................... 93 Sugar Dashlets ................................................. 93 Sugar Dashlet Files .............................................. 93 Templating .................................................. 94 Categories .................................................. 94 Sugar Dashlet base class ........................................... 94 Sugar Dashlets JavaScript ........................................... 95 Custom Dashlets ................................................. 95 Overview ..................................................... 95 Sugar Dashlets ................................................. 95 Custom Sugar Dashlets ........................................... 100 JotPadDashlet.php ............................................. 101 JotPadDashletOptions.tpl .......................................... 104 JotPadDashletScripts.tpl .......................................... 106 Refreshing the Sugar Dashlet Cache ..................................... 106 Packaging Generic Sugar Dashlets ...................................... 106 Creating Custom Chart Dashlets ....................................... 108 Databases ...................................................... 110 Indexes ...................................................... 110 Primary Keys, Foreign Keys, and GUIDs .................................. 111 Entry Points .................................................... 113 Introduction ................................................... 113 Overview .................................................... 113 Introduction to Entry Points ......................................... 113 Accessing Entry Points ............................................ 114 Custom Entry Points .............................................. 114 Overview .................................................... 114 Creating a Custom Entry Point ........................................ 114 Example .................................................. 115 File Caching .................................................... 115 Overview ..................................................... 116 What It Does ................................................... 116 Where is the Cache? .............................................. 116 Developer Mode ................................................. 116 Global Control Links ............................................... 116 Overview ..................................................... 116 Link Location .................................................. 117 Modifying the Links .............................................