Home
MODELBAKER 2.1
Contents
1. 000 Untitled Template Path 3 Entity Model Address Book Users jonathan Library Application Support ModelBaker Templates AddressBook mbtemplate Blog Users jonathan Library Application Support ModelBaker Templates Blog mbtemplate Classroom Users jonathan Library Application Support ModelBaker Templates Classroom mbtemplate Invoices Users jonathan Library Application Support ModelBaker Templates Invoices mbtemplate ful Photos Users jonathan Library Application Support ModelBaker Templates Photos mbtemplate T Real Estate Users jonathan Library Application Support ModelBaker Templates RealEstate mbtemplate tic Recipes Users jonathan Library Application Support ModelBaker Templates Recipes mbtemplate Template Version Date Real Fstate Real Estate 2 1 Sunday July 31 2011 2 00 00 AM E 3s ORG Author Contact D Widget Press Inc inquiry widgetpress com NAME D i pescRIP Summary DESCRIPI ION A small foundation application to build upon a listing system Uses two entity models with some validation rules Vf Don t show this dialog again Open an Existing Web App Close Choose ModelBaker provides templates to help quickly build a foundation for your web application Each templates includes a simple skeleton of entity models with predefined attributes and associations ModelBaker comes with a variety of templates to suit different kinds of busi ness needs ModelBaker The Users Manual 22 STARTIN
2. field NOT EMPTY Checks that a string contains something other than whitespace NUMERIC Checks if the field contains a numeric value PHONE Checks if the field contains a phone number that conforms to the standard of the country selected in the Country pulldown menu You can choose to write a regular expression in the Or Regex field and this expression will be used instead of the other fields POSTAL Checks if the field contains a postal code that conforms to the standard of the country se lected in the Country pulldown menu You can choose to write a regular expression in the Or Regex field and this expression will be used instead the other fields ModelBaker The Users Manual 4I RANGE Validates that a number is in a specified range If the Lower and Upper values are not set it will return true if the checking value is a legal finite on running platform SSN Checks if the field contains a Social Security Number SSN that conforms to the standard of the country selected in the Country pulldown menu You can choose to write a regular expression in the Or Regex field and this expression will be used instead the other fields URL Checks if the value of the field is a valid URL address USER DEFINED This rule allows you to add custom validation for the data entered by the user The Object field is the class name that holds the validation method The Method is the va
3. lt Ea FAVORITES E All My Files Work HD x Desktop bg_dark687 gif jonathan J Applications M Documents Downloads LJ Application Support bg nav off gif Preferences Sites z m DD nmi ilil ModelBaker The Users Manual 63 FAVORITES L All My Files i Work HD 1 Desktop Gt jonathan J Applications M Documents default css Downloads Application Support gt __ Preferences Sites FAVORITES ed work All My Files i Work HD Desktop G jonathan y Applications M Documents default css Downloads Application Support 66 Move your default ctp file into layouts folder at the same level with js rss and xml folders um T G OFri 7 41AM j layouts 4 os fmf w amp O Q FAVORITES youts gt default ctp E All My Files ebroot iis d i a im rss P em Desktop f jonathan Macintosh HD Applications cmm Documents default css Downloads Name default ctp Kind TextMate Document __ Application Support Size 775 bytes Preferences Z ne d io mE a odified Yesterday 1 50 Web Site Assets J Sites Last opened Yesterday 1 50 PM La work Assets Q Move your preview RedRuby png file and the info plist file to the main RedRuby di rectory level It should be on the same tree level as the second RedRuby directory ModelBaker
4. 37 lt html gt 0 0O00 default ctp 1 jg 4 html xmlns 5 lt head gt 6 php echo gt charset gt 7 lt title gt 8 php echo 3 title 10 lt php 11 echo gt gt css 12 echo metac 3s 13 echo 14 7 gt 15 Eats 16 5E 17 Baw 18 HEADER 19 NAVBAR 20 div 21 div gt 22 lt php 23 iur check 24 flashQ 25 endif 26 27 php echo 29 div 30 div 31 div 32 div 33 FOOTER 34 lt div gt Line 1 Column 1 v TabSize 4 2 ModelBaker The Users Manual 60 Step 2 Creating a new folder RedRuby e Create a new folder on your desktop and name it RedRuby This folder will function as the foundation folder for our theme m gt 4 CG Thu 5 34PM jonathan Q Macintosh HD 7 O Web Site Assets Step 3 Creating another new folder RedRuby e Create another folder called RedRuby within the RedRuby folder mA 4 G Thu5 59PM_jonathan Q _ All My Files Macintosh HD __ Work HD J s Desktop err gt z7 jonathan A till e f Applications Documents Downloads a FY MR 2 i 1 ants E TOM Web Site Assets __ Application Support m J B Preferences FAVORITES L Sites work wp ModelBaker The Users Manual 61 Step 4 Creating the theme directory structure Create a new folder within the innermost RedRuby folder called views S 4 CG Thu 6 03PM jonathan Q M
5. Admin URL you have just entered you need to enable it for each action To setup the routing admin name to each action do the following In the Controllers tab 382 select a controller from the Controller table located on the left hand side of the window e Next select the action you would like to include the Routing Admin URL The Admin routing action checkbox is now available to be selected Select the checkbox and you will see the string shown next to the label URL Path change to include the Rout ing Admin URL ModelBaker The Users Manual 49 INTERNATIONALIZATION amp LOCALIZATION This chapter describes the steps you take to change your application into mul tiple languages Changing the strings in your application is simple and straight forward ModelBaker gener ates a simple PO file saved in the UTF 8 format that you can modify for your application After building your project this PO file will be located at app locale eng LC_MESSAGES default po Within the default po file are the string values you will change to include another language ModelBaker The Users Manual 50 CREATING CUSTOM TEMPLATES This chapter describes how to create a new ModelBaker template based on an existing ModelBaker project Note This chapter assumes you already have created a ModelBaker project called college populated with entities and attributes Pay special attention to
6. If your controller is named Autos and there is a autos_controller php located within this Controller Templates directory then the checkbox User Controller Template will become selectable below the Name and URL Path textfields inside Controllers 3882 in the main window During build the autos controller php from the Controller Templates directory will be copied to your app controllers directory Must use php file extensions Helpers Gives the ability to extend and add behaviors to views Any php file in this di rectory will be listed under the Helpers tab in Controllers 8 2 in the main window Dur ing Build any helper selected will be copied to the app views helpers directory Must use php file extensions e Javascripts Gives you the ability to add custom Javascript scripts to views or layouts Added scripts appear under the Javascripts tab in Views 83 in the main window By ModelBaker The Users Manual I2 adding Javascript files to this directory you can select to have these files copied to app webroot js directory during the Build process Must use js file extensions Model Templates Offers the ability to use custom models that will replace the Model Baker generated models in the app models directory If an Entity model is named Big Tree and there is corresponding big tree php file located in the Model Templa
7. Report would have a MySQL table named web_reports If you add a name attribute with the type ModelBaker The Users Manual 3I String to the Web Report entity model ModelBaker will generate an SQL statement to insert the appropriate column for that attribute Terminal mysql 90x12 Field fey Default Extra MAT Kar re Ll aoa id int 18 unsigned NO name varchar 50 NO created datetime TES modified datetime Erste C SA SOR Var sie dE Neen 4 rows in set B AL Sec NULL quto_increment NULL NULL n M PRI E 4 ivsal Notice the Terminal screen above the id name created and modified attributes are contained within the web_reports table ModelBaker automatically adds these attributes by default for each table it builds T here is no need to create either these attributes or any for eign key id ModelBaker you focus on the design of the entity model while it builds the rela tionship keys and SQL for you eoo0 NEN Controllers Views Settings Entity Model Use Table Attribute I3 Department Til name KS Employee vf W Web Report vf Model ModelBaker The Users Manual 32 DEFAULT BINDING ATTRIBUTE ModelBaker uses
8. The Users Manual 64 ME T CG Fri 750 AM jonathan Q FAVORITES i RedRuby info plist LJ views All My Files L3 Web Site Assets E RedRuby J RedRuby png Work HD Gt jonathan Macintosh HD f Applications D O H Documents default css 3 Downloads _ Application Support Preferences __ Sites Web Site Assets work wp Important Please note the naming conventions used make sure the folders and preview image are named tbe same Step 6 Renaming the file with ModelBaker theme extension Add the mbtheme file extension to the RedRuby folder e Macintosh HD rT u c pee RedRuby mbthemel H Um Web Site Assets ModelBaker The Users Manual 65 Macintosh HD AUN E e c a v RedRuby mbtheme q m XT P p A 3 B mJ gt x AE E Web Site Assets Step 7 Adding the file to Application Support You can add the RedRuby mbtheme in two different ways One by adding it from the Ex tensions Manager located in the Preference window or by dragging and dropping the theme into the Themes folder ModelBaker The Users Manual 66 Behaviors BlueSapphire mbtheme CakePHP BurntAmber mbtheme Components CocoaCitrine mbtheme Controller Templates CornFlowerBlue mbtheme Helpers GreenEmerald mbtheme Javascripts GreySmoke mbtheme Model Templates PurpleAmethyst mbtheme Stylesheets RedRuby mbtheme Templates Themes Drag t
9. and install MAMP from Living e you get both versions MAMP free and MAMP PRO paid MAMP PRO requires a paid license to operate Please consult the MAMP PRO website for details on obtaining a license 1 Download MAMP to your Mac 2 Double click the MAMP installation icon and follow the instructions ModelBaker The Users Manual 9 3 After installation note the location of the Applications MAM P htdocs folder For the free MAMP version this will be your Build Path for your ModelBaker projects With the MAMP PRO version you can serve ModelBaker projects from any folder INSTALLING USING XAMPP Another simple solution to have all three components installed on your Mac is from Apache Friends called XAMPP For detailed download and installation instructions please visit the www apachefriends org website 1 Download XAMPP to your Mac 2 Double click the XAMP installation package icon and follow the instructions 3 After installation note the location of the Applications X AMPP htdocs folder This folder will be your Build Path for your ModelBaker projects Note that this folder is ac tually an alias that points to the Applications X AMPP xamppfiles htdocs folder ModelBaker The Users Manual IO BEGINNING WITH MODELBAKER In this chapter we discuss the basic overall principles and ideas to keep zn mind while developing projects with ModelBaker When developing and testing your ModelBaker proje
10. entity model name will be Customer Or if you want to have a web application that will store different types of per ennials an entity model name might be Flowering Perennial Remember not to create plural model names like Customers or Perennials this will cre ate complications when you build your project ModelBaker will automatically create a Controller for you with Actions It will also create the corresponding Views as well Re member that ModelBaker uses the CakePHP framework which uses convention over con figuration Important Save your work often by choosing File gt Save For more details about saving ModelBaker projects see Step 5 Saving Your Project Step 3 Adding Attributes Add attributes to your entity model as you need them to store different types of data To add an attribute to an entity model do the following e Select the entity model needing an attribute from the Entity Model table e Click the New button at the lower left of the attribute table You can also choose Design gt Entity Model Add Attribute C T to insert a new attribute e Rename New Attribute to a single noun name For example if your have a Customer model a very likely attribute you might want to store is a First Name If you are having your Great Perennial Application online a good attribute might be Expired for the Flowering Perennial model to indicate whether
11. tbe naming conventions in this chapter because a template needs to adhere to specific naming conventions Step 1 Creating a new ModelBaker project For this example create a project rename it college modelbaker and save it to the desk top ModelBaker The Users Manual I Step 2 Adding project files to a new folder Create a new folder on your desktop and name it college After you create the college folder drag the college modelbaker file into the college folder P L MES 2 MI b eoo L college e vM sje P e e a DEVICES college college t P SHARED Y PLACES Detop A widgetpress A Aggicatont 9 Sites Decumeets b SEARCH FOR Step 3 Creating an XML plist file Create a new text file called info plist and save it to your college folder The info plist 99 file can be edited with TextEdit or any similar text editing application If you have Apple s Xcode installed you can use this to edit the plist file in a nice GUI Follow the XML ele ments and values examples below and save your file ModelBaker The Users Manual 52 m lt xml version 1 0 encoding UTF 8 2 lt DOCTYPE PUBLIC Apple DTD PLIST 1 0 EN http www apple com DTDs Propertylist 1 0 dtd 3 O plist version 1 0 gt 17 0 lt dict gt 18 lt plist gt 19 4 dict 5 lt key gt Author lt key gt 6 string My Univers
12. the first attribute you add to an entity model as the default Binding at tribute for that model Each model can have only one attribute as the binding attribute for that model eoo Bh departments model Models Controllers Views Settings uw i e E 4 se a oe D Use Table Attribute Type Binding Department T name String M Employee vf building String gt Gon D Web Report Al ias One MRTA Model Conditions E EN NI xI DE This means that a Be ongs To relationship will have a drop down menu appear next to this attribute in the user interface For example take a Department model with the attribute name add a Belongs To relationship from the Employee model to the Department model and when you build your project the add edit views would generate a drop down menu bound to the Department model s name attribute See the screen shot below ModelBaker The Users Manual 33 MyWeb Application Employees Web Reports Actions Add Employee Department Add Department Human Resources List Of Departments _ Add Employee First Name List Of Employees Add Web Report List Of Web Reports The Human Resources value listed next to Department in the image above is one of many re cords from the column attribute name in the depar
13. this type of perennial has expired or not ModelBaker The Users Manual 24 eoo Untitled Controllers Views Settings il b Entity Model s UseT Attribute Type Bi Validation Rule WW actribute coste 4 Sa oc M Flowering Perennial M Name expired Vi Default Binding Attribute Model Conditions Fields Order D Customer FloweringPerennial first name expired e Change the attribute type if needed For both the above examples the default String would work just fine for the Customer First Name attribute A Boolean would be the choice for the Flowering Perennial Expired attribute Step 4 Adding Validation Rules Add validation to your attributes when you need constraints around that saving models To add a validation rule to an attribute do the following e Select the attribute that is needing a validation rule from the Attribute table e Click the New button at the lower left of the validation table You can also choose Design gt Entity Model Add Entity Model Add Validation Rule CR to insert a new vali dation rule e By default a User Defined rule is selected for your attribute ModelBaker included sev eral redefined validation rules including Alphanumeric Date Credit Card Phone and ModelBaker The Users Manual 25 SSN Social Security Number If want an attribute to be required click the R
14. 1 ModelBaker The Users Manual 35 ModelBaker The Users Manual Binding Validation 36 Adding Validation Rules ModelBaker s validation rules are based on the CakePHP framework s validation rule mechanism ModelBaker provides 23 default validation rules you can use on attributes If validation rule fails then no data will be saved to the database In the event of a rule failure it is possible to display a custom error message to the user explain what has occurred AII validation rules have a minimum of four options that can be applied to the selected at tribute Each validation rule can use one or more of the following options REQUIRED When the Reguzred checkbox is selected ModelBaker generates the code necessary to make sure that when a user saves a form this attribute must have a valid value If validation fails then the comment in the Message textfield will be displayed to the user ALLOW BLANK When Allow Blank is selected ModelBaker will allow the user to submit the form with no data or empty data for the this field When the checkbox is unselected the user must sub mit real nonempty data for this field If validation fails then the comment in the Message textfield will be displayed to the user ON This drop down menu will determine when the validation rules for this attribute are ap plied If Create is selected this rule only applies when the user is adding a new recor
15. 4unes 3 2008 19 26 133220 ass CSNs styles are separated from the layout structure ModelBaker s default theme sets are Blue Sapphire Burnt Amber Cocoa Citrine Corn Flower Blue Green Emerald Grey Smoke Purple Amethyst and Red Ruby ModelBaker The Users Manual 7 MODELBAKER TEMPLATES Templates are standard ModelBaker projects that you can create and edit Once you are sat isfied with a project you can save that template down and include it in ModelBaker as a foundation for future projects You can easily save your projects as ModelBaker templates by adding your mbtemplate files to the Library Application Support ModelBaker Templates folder Note that the file extension mbtemplate is actually a folder which has been renamed and contains your modelbaker project file Resources for Learning More To get the most out of ModelBaker please consult the following resources MODELBAKER USER S MANUAL This full color PDF document provides detailed information about ModelBaker features and instructions for working with your project ONSCREEN TOOLTIP HELP To see the help open ModelBaker and create a new project You can hover over a sections and labels to receive information in a tooltip format WEB RESOURCES Go to www widgetpress com support to get the latest information about updates articles forums and how to guides You can also purchase a ModelBaker license key on the web ModelBa
16. G A NEW PROJECT Whenever you create a new ModelBaker project you can select a template in the Template Chooser You can easily create new ModelBaker templates based upon ModelBaker projects you have created TO STARTA NEW PROJECT 1 Double click the ModelBaker icon and select a template 2 Click Choose Whichever template you choose you will probably want to add additional entity models attributes and validation rules for those attributes You do not have to select a template you can simply click Close to ignore the Template Chooser and a new empty project window will be available Step 2 Creating an Entity Model You can add new entity models to your project as needed from the Models Tab 38 1 eoo Untitled Controllers Views Settings il b Entity Model a Use T Attribute Type Bi Validation Rule Model E New entity Ti e pup Model New ntity V Use Table _ Use Model Template Model Conditions Fields Order D NewEntity ModelBaker The Users Manual 23 To add an entity model do the following e Click the New button at the lower left of the entity model table You can also choose Design gt Entity Model v Add Entity Model CM to insert a new entity model e Rename New Entity to a single noun name For example if you want to have a customers interact with your web application a good choice for a new
17. MODELBAKER 2 1 The Users Manual Last Updated August 2 2011 ModelBaker The Users Manual Widget Press Inc Copyright 2011 Widget Press Inc All rights reserved Widget Press and the Widget Press logo are trademarks of Widget Press Inc ModelBaker is a trademark of Widget Press Inc Acknowledgements Portions of this Widget Press Software may utilize the following copyrighted material the use of which is hereby acknowledged Cake Software Foundation CakePHP Rapid Development Framework www cakephp org Copyright 2005 2011 Cake Software Foundation Inc ModelBaker The Users Manual 2 CONTENTS Welcome to ModelBaker ModelBaker Features at a Glance Resources for Learning More ModelBaker Setup Installing ModelBaker Installing Apache MySQL and PHP Beginning With ModelBaker Configuration Web Frameworks Extending ModelBaker Using the Extensions Manager An Overview of ModelBaker The Models Tab 881 The Controllers Tab 882 The Views Tab 8 3 The Settings Tab 884 Creating a Web Application Step 1 Starting with New Project or Template ModelBaker The Users Manual II II II I2 13 14 Ty 17 20 AI 22 22 Step 2 Creating an Entity Model Step 3 Adding Attributes Step 4 Adding Validation Rules Step 5 Saving Your Project Step 7 Adding Database Credentials Step 8 Dropping amp Inserting Tables Step 9 Building Your Web App Entity Model Basics Addi
18. Mode Users jonathan Library Application Support Mode 69 MOVING IO A HOSIING SERVER This chapter discusses some of the aspects of moving your web application to a remote bosting server Important This chapter assumes you have sufficient access and permissions to up load files to your hosting server It is also assumed you know how to log in and upload files and that you have created a database Make sure you know the user name pass word and database name along with any other additional settings Step 1 Changing your Database Settings Since you have been developing locally on your Mac you ve been updating with your local MySQL database settings We will need to change these settings before we upload our pro ject to your remote web server To update your database settings do the following e Duplicate the app config database php file and rename it to database local php e Open the database php file in a text editor and change the default settings to reflect your hosting environment settings You will typically update the ost login password and da tabase values Save then edited database php file lt php class DATABASE CONFIG var Sdefault array driver gt mysql persistent gt false host gt localhost port gt login gt foo password gt bar database acme Schema gt prefix gt encoding g
19. TION In this chapter we will discuss basic HTTP authentication using ModelBaker Wikipedia defines basic access authentication as In the context of an HTTP transaction the ba sic access authentication is a method designed to allow a web browser or other client program to pro vide credentials in the form of a user name and password when making a request Step 1 Setting up the Controller To have an action become protected we need to tell the action s Controller To setup a Controller for authentication do the following In the Controllers tab 882 select the controller to which you would like to add Authenti cation NB e Enable the checkbox for Basic HTTP Authentication e Select the Basic HTTP Authentication user icon Enter basic in the Type textfield e Enter a desired message i e Protected for Members Only in the Realm textfield e Click the New button to add a user name and password i e foo and bar gt departments modelbaker 5 il gt Controller NE V Enable Basic HTTP Authentication Type basic Realm Protected for Members Only User Password admin admin ModelBaker The Users Manual 46 Step 2 Setting the Action for Authentication Now that a controller is aware of HTTP authentication we can tell it which actions will use the user names and passwords Notice that when you select an Action to edit the P
20. acintosh HD RedRuby FAVORITES C RedRuby S All My Files 2 F i Work HD Desktop jonathan J Applications Documents 3 Downloads __ Application Support Preferences L Sites C work Lj wp __ Dropbox In the views folder create two folders one called titled layouts and the other titled webroot In the layouts folder create three new folders js rss and xml eoo 3 layouts a se im m v Q L All My Files Lj webroot gt rss E xmi 1 Work HD La Desktop jonathan J Applications i Documents o Downloads In the webroot folder create four new folders css files img and js ModelBaker The Users Manual 62 eoo CJ webroot FAVORITES aan jews l Gy layouts E All My Files B files i img usi Work HD GE js Desktop Gt jonathan J Applications ch Documents Downloads Application Support Preferences Sites work L wp Dropbox FormEntryiOS Step 5 Adding your assets e Drag and drop your assets into the appropriate folders e g graphics into the img folder stylesheets into the css folder FAVORITES E All My Files rebroot gt ii files gt Work HD Tg o d S Desktop E jonathan ye Applications su Documents Downloads J Application Support Preferences L Sites ie isisieisinis
21. any text editor ModelBaker The Users Manual II Extending ModelBaker ModelBaker can be extended through a number of methods including style sheets and Javas cript Inside your Library Application Support ModelBaker folder are the directories where you add files to expand ModelBaker s functionality Within the Library Application Support ModelBaker you will see the following direc tories not if you are using Mac OS X 10 7 the Library folder is hidden e Behaviors Adds additional functionality to models This folder holds the php behavior files that will show up in the Behaviors tab above the model browser under Models 38 1 in the main window Must use php file extensions CakePHP Give you the ability to use a different CakePHP version build Must use tar gz file extensions You can download a number of CakePHP versions from www cakephp org Components Give your controllers additional functionality and behaviors This folder holds the php component files that you can use in multiple projects These appear in the Components tab inside Controllers 882 in the main window If a component is se lected this component will be added to the build path s app controllers components directory Must use php file extensions Controller Templates Offers the ability to use a custom controller that will replace the ModelBaker generated controller
22. attribute with the special name of filename eoo Untitl Models Controllers Views Settings Entity Model 4 Use Table Attribute Type Binding Wi Photo ivi Ly filename String M Eq description String EY name String To add an entity model and attribute do the following e Click the New button at the lower left of the Entity Model table You can also choose Design gt Entity Model Add Entity Model CM to insert a new entity model e Rename this entity model to Photo ModelBaker The Users Manual 43 e With the Photo entity model selected click the New button at the lower left of the Attribute table You can also choose Design gt Entity Model Add Attribute C T to insert a new attribute e Rename this attribute to filename and make sure the Type is set to file Important Make sure the filename attribute s Type is set to file If this is not set correctly the upload system will not be created properly Step 2 Adding Validation Rules for filename The following steps add the final parameters needed for the upload system Untitled n Binding Validation Rule 7 Validate j i Required Allow Blank Last On Both a J Message Please enter a filename for Filename Max Size 1 MB Path photos Allowed File Upload Types image jpg image jpeg Has Many Belongs To Has amp Belo
23. cts your local requirements are to have a web server a MySQL database and the PHP runtime ModelBaker generates code de signed to run on top of the open source LAMP Linux our case the Mac Apache MySQL and PHP web stack This means you can deploy your applications to thousands of web hosting providers or deploy your application internally within your organization Configuration ModelBaker assumes you have Apache MySQL and PHP configured and working together on your Mac Apple offers Apache and PHP on the Mac OSX 10 5 and higher operating system however you still need to set up and integrate MySQL There are downloadable packages such as MAMP and XAMPP that offer Apache MySQL and PHP together that can be easily installed on your Mac These packages simplify the process of trying to configure these three components ModelBaker looks for your local MySQL database and injects the schema based on the en tity models you create If your MySQL database server is not running or is not configured properly when you build your projects then your database tables will not probably be cre ated Web Frameworks ModelBaker uses the CakePHP framework as the web deployment framework for your pro jects CakePHP http cakephp org is an open source project and tens of thousands of de velopers have chosen CakePHP as their MVC web framework All generated code from ModelBaker is open code meaning you can edit and customize it within
24. d If Update is selected this rule only applies when a record is being edited by the user Selecting Both applies the rule when a record is created or updated MESSAGE This is the text message that will be displayed when a validation rule fails ModelBaker The Users Manual 27 The default validation rules are listed below ALPHANUMERIC Checks a string to make sure it contains only letters or integers BETWEEN Checks to see if the input is within a specified range The Mzn and Max values should be integers BLANK Checks to see if a field is left blank or contains only whitespace characters Space Tab Car riage Return or New Line Keep in mind the 4 ow Blank option described in the previ ous section must be selected if you want this rule to take into effort Leaving the Allow Blank unselected for this rule will cause the rule to be ignored BOOLEAN Boolean validation determines if value passed is a boolean integer or true false COMPARISON Checks the value of the attribute and compares it to an integer value you provide Compari sons include Is Greater Greater or Equal Less or Equal Is Less Equal To and Not Equal CREDIT CARD Checks the value in the textfield is a valid credit card number Selecting 47 will check all 13 credit card types while selecting Fast will check the major credit card numbering formats If Luhn Algorith
25. d 2 Attribute Model Display As Text first name Author v v ModelBaker generates all of your views as template files These files can be edited in any text editor Template files have the CTP CakePHP Template extension and contain all the presentation logic needed to render an XHTML view to your audience View files are stored in the folder app views inside subfolders named after the controller that uses the files and named after the view it corresponds to For example The view0 action of the Products controller would be found in app views products view ctp ModelBaker The Users Manual 20 The Settings Tab 884 The Settings Tab contains the configurations for your project There are twelve main cate gories that provide access to an application s functionality and configurations The two set tings required in order for you to build a successful web app are Build and Database Volumes Work HD Users widgetpress Sites modelbaker cakephp cakephp 1 3 11 6 9b5a533b tar gz Applications MAMP library bin mysql Applications MAMP tmp mysq mysql sock ModelBaker The Users Manual 2I CREATING A WEB APPLICATION This chapter outlines the basic steps for completing a professional quality web application Step 1 Starting with New Project or Template To create a new ModelBaker project simply select File gt New Project 8 N and an empty project window will appear
26. e Step 3 Installing your Database Schema ModelBaker The Users Manual 0 I 1 2 2 53 54 55 6 6 58 6I 6I 62 63 65 66 69 70 70 7I JI ModelBaker The Users Manual WELCOME IO MODELBAKER With ModelBaker impressive web applications are just the beginning This section will provide an overview of ModelBaker s features and list resources for learning more ModelBaker is a rapid development tool for create professional quality web applications ModelBaker delivers powerful applications backed by a database that persists your informa tion ModelBaker Features at a Glance The next few pages provide a high level overview of the key ModelBaker features The re mainder of the manual provides the details on creating and building your web application PROFESSIONAL QUALITY THEMES ModelBaker provides seven high quality professionally designed themes to help you get started working on your web projects Every theme includes images style Grey Smoke sheets and the necessary javascript files You can easily change a theme My Web Application Groups and apply those changes to other web applications You can even modify the generated theme code in a text editor List Of Users to add additional polish to your web app Each of the default themes is a CSS based layout meaning the presentation Username Paseeced t 2006 11 26133223 sane 1 2 2006 11 26133223 rer 3 V
27. e modelbaker_db import the schema file located at www app config schema schema sql ModelBaker The Users Manual 72
28. e if you have not already done so e Select the Build 46 B button from the toolbar or Save your project 3S and select Build and Go lt from the toolbar if you have en tered a URL in the Local Web Server URL textfield under the Build and Go section in the Build setting After you ve built your project you should also see the directory and file structure at your build path FAVORITES htaccess DS Store DS Store E All My Files E app htaccess C behaviors z C cake gt app controller php datasources Work HD index php app model php department php ca Desktop 3 plugins B config employee php e jonathan README c controllers d ip_address php 3 vendors gt index php multiple php Applications amp libs web report php 5 Documents J locale Downloads C plugins Application Support E tests Preferences Gj tmp Oe Sites Lj vendors Lj views J webroot ModelBaker The Users Manual 29 ENTITY MODEL BASICS This chapter will explore the foundation of ModelBaker and why we build from the ground up ModelBaker s takes a ground up approach to development building models with agility and quick prototyping Much like a home s foundation ModelBaker is targeted at develop ing the foundation of your web project You build entity models that will have attributes to hold our data relationships to connect entities to
29. e a regular expression in the Or Regex textfield and this expression will be used instead of the other fields For example if you want to check the C Style hex decimal 0xcAFE and 0x042 style for a field the following regex would suffice NbO xX 0 9a fA F Nb EMAIL Checks to see if the field contains a valid email address If the checkbox for Check availabil ity of host is selected ModelBaker will check if the email host is currently active and avail able You can choose to write a regular expression in the Regex field and this expression will be used instead of the other fields The following regex will check to make sure the attribute contains a valid URL ModelBaker The Users Manual 39 A 20 9 A Z0 9 A Z 2 com org net biz info name aero biz in fo jobs museum name EXACTLY EQUAL Checks if the value in the field exactly matches the value contained in the To field EXTENSION Checks the field against all the extensions provided in the File Extenszon table When adding extensions to validate use dot syntax For example jpg or xls FILE Checks if the field validates against the maximum file upload size Max Size in MegaBytes and the allowed upload file types listed in the Allowed File Upload Types table If the file size is too large or does not match an upload file type the user will receive the Message value The location specif
30. equired checkbox Choose if you want to apply this rule to New Entries Existing Entries or Both Change the Message if you want a custom message for your users if the validation fails Step 5 Saving Your Project Saving your project frequently is typically the best practice when developing a web applica tion To save your project do the following e Select File Save dS and choose the save path and file name of your ModelBaker project file Step 6 Adding a Build Path Choose the location where ModelBaker will build your web application This path should also be the web serving directory on your Mac eoo modelbaker modelbaker Volumes Work HD Users widgetpress Sites modelbaker cakephp cakephp 1 3 11 6 9b5a533b tar gz Applications MAMP library bin mysql Applications MAMP tmp mysq mysql sock To add your Build Path do the following ModelBaker The Users Manual 26 e Select Settings 464 and choose the Build setting from the list under Setting e Press the Choose button next to the Build Path textfield and select the folder where you want ModelBaker to build your project Important If you are using the free version of MAMD this directory is Abplications MA MP htdocs If you are using XAMPP this directory is Applications XAMPP htdocs Step 7 Adding Database Credentials Your web application is backed by a MySQL database To perf
31. gether and validation rules to ensure data consistency just like a house would have a floor foundation walls electrical wiring and plumbing held together between the flooring and walls ModelBaker s Entity Model foundation is not exactly the same as the database world s en tity model Borrowing database terminology and applying common object oriented terms ModelBaker provides a collage for constructing an entity model For example you do not need to worry about MySQUs id or foreign_key_id when you construct your project sim ply think about the task at hand and add attributes relationships and validation rules to your entities ModelBaker takes care of building your MySQL database and more Adding an Entity Model When you add an entity model within ModelBaker you are really creating a place holder ob ject for the model definition Only when you build your project are a MySQL database table and PHP model class file created An entity model name should be both a noun and singular Two or more words in an entity model name are acceptable i e Web Report or Visitor Trend ModelBaker will alert you if the name you have chosen is plural or violates a PHP CakePHP or MySQL reserved word After an entity is created ModelBaker creates a corresponding controller with CRUD ac tions and places it under Controllers in the main window Additionally four views Cadd edit index a
32. giat purus Aenean portio orci eget prior Sed vehicula cursus pede Donec dul Duis viverra imperdet quam Suspendisse scelerisque bero of aliguet iaculs a a e ulthoas Gam ut elementum erat lectus non magna Duis vea Nuls egestas purus ut rus Nunc Step 7 lesting the template Launch ModelBaker and select File New from Template Chooser You should see your template listed in the window sheet that appears By choosing your template you will create a new untitled project with all your entity models attributes relationships validation rules and so on ModelBaker The Users Manual 56 4 Template Path T Address Book Users widgetpress Library Application Support ModelBaker Templates AddressBook mbtemplate E iog Users widgetpress Library Application Support ModelBaker Templates Blog mbtemplate Classroom Users widgetpress Library Application pices Users widgetpress Library Application tiae nae airs mbtemplate i y E Photos Users widgetpress Library Application Support ModelBaker Templates Photos mbtemplate Ba Real Estate Users widgetpress Library Application Support ModelBaker Templates RealEstate mbtemplate Template Version Date College 1 0 Monday January 5 2009 2 00 00 A Author Contact My University inquiryOwidgetpress com so MAS ge aa EPI GR ERU ae This is our university template for intranet sites LET CL Sees c dmm me o
33. he RedRuby mbtheme file to your Library Application Support ModelBaker Themes folder This is how ModelBaker themes are installed Once installed relaunch ModelBaker ModelBaker The Users Manual 67 Desktop Bh BlueSapphire mbtheme Bh BurntAmber mbtheme B CocoaCitrine mbtheme B CornFlowerBlue mbtheme GreenEmerald mbtheme Macintosh HD Bh GreySmoke mbtheme Bh PurpleAmethyst mbtheme QG jonathan C Components Applications LJ Controller Templates 3 C3 Helpers Documents Javascripts Downloads C3 Model Templates ffl Application Support G3 Stylesheets LJ Templates i Preferences Sites work ea wp e LJ Dropbox Web Site Assets 7 7 7 7 7 7 7 7 RedRuby mbtheme 1 gt ModelBaker The Users Manual Step 8 Testing the new theme Your custom ModelBaker Theme is now installed In the Settings tab 84 select Themes from the Setting table located on the left hand side of the window e You newly added created theme should appear in the Theme list e Select the new template to apply it to your project ModelBaker The Users Manual Users jonathan Library Application Support Mode Users jonathan Library Application Support Mode Users jonathan Library Application Support Mode Users jonathan Library Application Support Mode Users jonathan Library Application Support Mode Users jonathan Library Application Support
34. idunt liaula neque tempor iusto ut imperdiet nulla diam non sem In hac habitasse platea dictumst CJ college ES college gt D college Y Preview D info plist gt k sktop igetpress plications S E cuments Name college png Step 5 Renaming a folder to a ModelBaker template file Rename your college folder to college mbtemplate By renaming the college folder you are creating a plugin bundle which we will add to ModelBaker s Application Support folder is auctor mi ac tellus Sed ut nisl Donec dignissim ultrices aretra porta tortor Pellentesque habitant morbi tristique teger nibh justo adipiscing sed facilisis et ultricies nec leo Nn mauris Pellentesque auctor enim a massa ante nisl fermentum at gravida sed molestie sed leo Etiam t nunc Nulla in arcu Etiam fermentum mauris Sed luisque consequat Fusce viverra erat Nunc placerat feugiat purus Aenean porttitor orci eget nperdiet quam Suspendisse scelerisque libero et aliquet ion magna Duis uma Nulla egestas purus ut risus Nunc college mbtemplat ModelBaker The Users Manual 54 Step 6 Moving the template file to Application Support You can add the college mbtemplate to ModelBaker in two ways One by adding it from the Extensions Manager from within the Preferences Window and the other by dragging and dropping the template file into the templates folder within Applica
35. ied in the Path field will place these uploaded files in the app webroot files lt PATH gt folder When you build your project ModelBaker will create the directory using the path app webroot files so your users can upload to this directory behind the scenes To add a file type to the Allowed File Upload Types list you will need to add the known MIME type for the file For example for a Portable Network Graphics file the correct MIME type is image png A complete listing can be found at www iana org assignments media types IPv4 ADDRESS Checks the field for a valid IP input value provided by the user such as 10 77 188 166 You can also check for IPv6 such as 2001 0db8 1428 57ab and you can even check both IN LIST Checks if a value is in a given list Is UNIQUE Checks if a value is in a given list ModelBaker The Users Manual 40 MAX LENGTH Check to see if the input value stays below the length requirement shown in the Maximum field MIN LENGTH Conversely this will check to see if the input value stays above the length requirement listed in the Minimum field MONEY Checks if field passes with a monetary amount It also checks the position of the currency symbol whether it is on the left or the right in accordance with the Symbol pulldown menu MULTIPLE This is rule is used to validates multiple selection with the regular expression listed in the Regex
36. ity lt string gt lE lt key gt Contact lt key gt 8 i lt string gt inqui rYevidpstpress con 10 date 2009 01 05T07 00 002 date 11 key Name key 12 string College string 13 key Summary key 14 string This is our university template for intranet sites string 15 lt key gt Version lt key gt 16 lt string gt 1 0 lt string gt Step 4 Creating a PNG graphic file Create a ModelBaker preview image by saving a college png file into the college folder This PNG file gets loaded when you are reviewing the selection of Templates from the Template Chooser These preview files are typically screenshots of your web application You can use the Preview application to resize and crop your screenshot ModelBaker will even tually scale this PNG file to a resolution size of 252 w x 192 h ModelBaker The Users Manual 53 ipsum dolor sit amet consectetuer adipiscing elit Aenean sit amet felis eu tellus rhoncus accumsan Vestibulum a sit amet mi ultricies gravida Nunc eu tortor at nisi accumsan sollicitudin Mauris ultricies egestas felis Morbi ut Aliquam erat volutpat Praesent ut lectus ac elit vestibulum pharetra Nulla sed arcu Duis scelerisque interdum dui ant auctor lacus eu purus Aenean justo leo rutrum nec condimentum nec cursus vel lacus Proin a lectus Integer is elit ac velit facilisis placerat Fusce congue sagittis nibh Maecenas lobortis Aenean malesuada lorem eget tinc
37. ker The Users Manual 8 MODELBAKER SETUP To make your development environment fully operational with ModelBaker you will need to have the Apache web server MySQL database engine and PHP run time language module installed Installing ModelBaker ModelBaker installation is very straight forward Download ModelBaker to your Mac from the Mac App Store Installing Apache MySQL and PHP ModelBaker uses three open source software components to build your web applications Apache MySQL and PHP Since ModelBaker builds web applications you will need to in stall and configure a web server Apache a database MySQL and a runtime language en gine PHP There are different ways to install and setup these three components but they each achieve the same end goal A web server that can dynamically generate content that is connected to a backend database CUSTOM INSTALLATION Providing installation instructions for Apache MySQL and PHP is beyond the scope of this manual However Mac OS X 10 5 and above does come with Apache and PHP already installed If you are an experienced web developer you will probably want to refer the documentation at http developer apple com for additional tips INSTALLING USING MAMP AND MAMP PRO A simple solution to install and configure Apache MySQL and PHP is to use MAMP from Living e For detailed download and installation instructions please visit http www mamp info en index html When you download
38. les and columns do the following e Select Settings 8 4 and choose the Build setting from the list under Setting e Enable the checkbox for Drop and insert MySQL tables during build e Enter the full MySQL command path location in the MySQL Command Path textfield For MAMP the path it is Applications MAMP Library bin mysql and for XAMPP it is Applications X AMPP xamppfiles bin mysql For any other configuration please refer to the included documentation for the full path e Enter the full MySQL socket path location in the MySQL Socket Path textfield For MAMP it is Applications MAMP tmp mysql mysql sock and for XAMPP it is Applications XAMPP xamppfiles temp mysql sock Important To successfully build your web application with ModelBaker you need to have the MySQL server running and a database created with the name matching the Database textfield under the Database setting This database needs to have the Login user name with the Password already set ModelBaker The Users Manual 28 Step 9 Building Your Web App At this step the last thing to do is save your project and build it After building your project you should be able to see the result in a web browser and view the database with a database query tool To build your web application do one the following e Select File Save dS and choose the save path and file name of your ModelBaker project fil
39. lidation method to execute The 4rgs field holds the arguments to send to the chosen method ModelBaker The Users Manual 42 CREATING FILE UPLOADS In this chapter we will discuss the steps needed to build a file upload system for your web application We will collect the uploaded files on the web server side in a specified upload directory Uploading files from the web browser is a common activity these days for some web applica tions such as Flicker or Facebook ModelBaker provides the base methods for your project to have a working fully functioning upload system Unfortunately not all browsers will allow standard file uploads Your generated uploading system works with all Class web browsers with a few exceptions Mobile Safari on the iPhone and iPod Touch and the Google Android Browser on Google s Android platform As of the writing of this manual both Apple and Google have determined to not allow mobile browser based file uploads Hopefully this policy will change soon If you need further details about the File validation rule please refer to the Fie listing in the Adding Validation Rules chapter in this guide The following steps illustrate the process for enabling a file upload system within your project Step 1 Create an Entity Model and Attribute filename You can add new entity models to your project as needed from the Models tab 8 1 The key for the upload system is having an
40. llers Tab 382 CONTROLLERS A controller is used to manage the logic for a part of your application Most commonly con trollers are used to manage the logic for a single model For example if you were building a site for an online bakery you might have a RecipesController and an IngredientsController managing your recipes and their ingredients respectively Since ModelBaker uses CakePHP controllers are named after the model they handle in plural form The Recipe model is handled by the RecipesController the Ingredients model is handled by the IngredientsController and so on Your application s controllers are classes that extend the CakePHP AppController class which in turn extends a core Controller class The AppController class can be defined in app app_controller php and should contain methods that are shared between all of your application s controllers It extends the Controller class which is a part of the standard CakePHP library Controllers can include any number of methods which are usually referred to as actions Ac tions are controller methods used to display views An action is a single method of a control ModelBaker The Users Manual 17 ler CakePHP s dispatcher calls actions when an incoming request matches the URL of a controller s action Returning to our online bakery example our RecipesController might contain the view Q shareQ and search acti
41. m is selected it will use this algorithm for validation For more information on this algorithm see this Wikipedia article You can choose to write a regular expression in the Or Regex field and this expression will be used instead of the other fields CUSTOM Checks if the attribute value passes the regular expression contained in the Regex field For example if you want to make sure only US state codes are only allowed you can add the following regular expression in the Regex field ModelBaker The Users Manual 38 b A KLRZ C AOT D CE FL GA HI I ADLN K SY LA M ADEINOST N CDEHJMVY lO HKR PA RI S CD T NX UT V AT W AIVY b If you need to match a word where the first letter was b and the last letter was g the fol lowing regex would suffice b aoiu g DATE Checks for a valid date string You can choose to write a regular expression in the Or Regex field and this expression will be used instead of the other fields For example if you want to match the following date ranges with dates of 1 1 00 through 31 12 99 and o1 o1 1900 through 31 12 2099 then the following regex would work Nb 02 1 9 1 12 0 9 3 01 0 1 9 1 012 19 20 0 9 2 bs3 DECIMAL Checks if the attribute value contains the correct number of places from the decimal point based on the Places field The Places field takes an integer value You can choose to writ
42. nd view are created and under the main window s Views tab ModelBaker The Users Manual 30 For example if you create an entity model named Web Report ModelBaker will create a PHP model class called WebReport and the file web report php after you build your pro ject BAO Terminal mysql 90x13 departments e p D Yees web_reports 3 rows in set 0 00 sec mysql gt The Web Report model class will also be backed by the corresponding MySQL database table named web_reports a controller class named WebReports and will have the file web_reports_controller php USE TABLE By default ModelBaker expects to create database tables for your entity model If you un check the User Table checkbox ModelBaker updates your model class to not use a MySQL table USE MODEL TEMPLATE ModelBaker provides the ability to use an existing model class file to replace the generated model file during the build process To replace the generated model with your own model simply add your model class file into the Application Support ModelBaker Model Tem plates folder The Use Model Template checkbox will become enabled and you can select the desired template Adding an Attribute with Type Attributes are the properties of your entity model and map directly to the model s MySQL table column For example the WebReport PHP class the entity model of Web
43. ng an Entity Model Adding an Attribute with Type Adding Custom Database Attribute Types Adding Validation Rules Creating File Uploads Step 1 Create an Entity Model and Attribute filename Step 2 Adding Validation Rules for filename Basic HTTP Authentication Step 1 Setting up the Controller Step 2 Setting the Action for Authentication Admin Routing Actions Step 1 Setting up the Admin Routing Name Step 2 Setting Action to the Routing Name ModelBaker The Users Manual 23 24 25 26 27 28 29 30 30 3I 34 37 43 43 44 46 46 47 48 49 Internationalization amp Localization Creating Custom Templates Step 1 Creating anew ModelBaker project Step 2 Adding project files to a new folder Step 3 Creating an XML plist file Step 4 Creating a PNG graphic file Step 5 Renaming a folder to a ModelBaker template file Step 6 Moving the template file to Application Support Step 7 Testing the template Creating a Custom Theme Step 1 Collecting your graphical assets Step 2 Creating a new folder RedRuby Step 3 Creating another new folder RedRuby Step 4 Creating the theme directory structure Step 5 Adding your assets Step 6 Renaming the file with ModelBaker theme extension Step 7 Adding the file to Application Support Step 8 Testing the new theme Moving to a Hosting Server Step 1 Changing your Database Settings Step 2 Uploading to your Hosting Sit
44. ngs To Many Behaviors Conditions Fields Order Dependent To add the file validation rule with parameters do the following e Select the filename attribute by clicking on its row in the Attribute table o Click the New button at the lower left of the Attribute table You can also choose De sign gt Entity Model v Add Attribute CT to insert a new attribute e Click the New button at the lower left of the Validation Rule table You can also choose Design gt Entity Model Add Validation Rule CR to insert a new validation rule Change the validation rule type to file ModelBaker The Users Manual 44 e In the Max Size input field set the desired maximum size allowed for uploads in Mega Bytes MB e In the Path input field type the directory path where the uploaded files will be stored In the A owed File Upload Types table add the MIME file types to allow by clicking the New button at the lower left of the table A complete listing of the standard MIME file types can be found at www iana org assignments media types Note that if two users upload the same file with the exact same name i e both upload spreadsbeet xls then the second spreadsheet file will be appended with a sequential number This will prevent the second user from overwriting the first user s spreadsheet ModelBaker The Users Manual 45 BASIC HTTP AUTHENTICA
45. on oe ir d pu gamed eee 949 e ee ee ee Oe LL te LLL Sul LL LGQLuLLULULL LLL LLL SL LL A ana coe hoes TOTS Feet o re fF ois ow ots vt See amp SS 41999129 ee het eee s 288 Gee Se Ld sl IL LL A n D e C Don t show this dialog again ModelBaker The Users Manual 57 CREATING A CUSTOM THEME In this chapter we describes how to create a ModelBaker theme from scratch Note This chapter assumes you have already created all of the required CSS FS and Layout files and that they are collected within a folder on your desktop Pay special attention to the naming conventions in this chapter because a template needs to ad here to specific naming conventions Step 1 Collecting your graphical assets This step assumes you have already created your graphics assets Collect these graphics assets together including any info plist image style sheet javas cript and layout ctp files Place them in a folder on your desktop called Web Site As sets m gt 4 CG Thu 5 30PM jonathan Q o Macintosh HD s T DOS 7 Web Site Assets ModelBaker The Users Manual 58 Your collection of graphical assets should look something like the following T 4 CG Thu 5 31PM jonathan Q C Web Site Assets Mr LO e FAVORITES All My Files Work HD sa Desktop bg_dark687 gif bg header gif bg na
46. ons COMPONENTS Components are special packaged bundles of code that add additional functionality to con trollers These bundles can be shared across all controllers and can even be added to the base AppController class Using the foundation framework of CakePH P ModelBaker can add the default components or your custom components to a project with a simple checkbox The following built in components are included to aid in the creation of your web app Security Sessions Access Control Lists Emails Cookies Authentication and Request Handling HELPERS Helpers are utility objects that assist with the presentation logic of the view layer They are set from within the Controller layer to be pushed to the view They can be shared among layouts views and elements You can use CakePHP s built in helpers extend them or create your own ModelBaker currently ships with the Cache Form HTML Js Number Pagina tor RSS Session Text Time and XML helper objects ModelBaker The Users Manual 18 Actions are mapped to url paths www examples com author Basic HTTP Authentication ModelBaker The Users Manual Uses Components and Helpers 19 The Views Tab 33 VIEWS The view layer of your web application is what users see and interact with Most of the time your application will be serving XHTML to your web and mobile users but it can also de liver CSV or even straight XML like an RSS feed eoo Untitle
47. orm any testing locally Mod elBaker needs to talk to the same database when it builds and configures your web applica tion Settin gs 8 e Schema Type Form Helper Type NULL Default Len BLOB DEFAULT NULL blob file TINYINT 1 NOT NULL DEF integer DATE DEFAULT NULL date DATETIME DEFAULT NULL datetime DECIMAL 10 2 NOT NULL string M Pe 4 ta orm To add the database credentials do the following e Select Settings 8 4 and choose the Database setting from the list under Setting e Enter the login user name of the MySQL database in the Login field e Enter the password of the MySQL database in the Password field ModelBaker The Users Manual 27 e Enter the name of the MySQL database in the Database Important ModelBaker will not create the database for you You will need to create the MySQL da tabase with the user name password and database name before building your project Step 8 Dropping amp Inserting Tables ModelBaker needs to insert your project s schema into the database during each build You will need to know two very important path locations on for the MySQL command and one for the active MySQL socket vf Drop and insert MySQL tables during build Use Database Credentials of Default a MySQL Command Path Applications MAMP library bin mysal MySQL Sock Path Applications MAMP tmp mysql mysql sock To allow ModelBaker to insert new tab
48. rotect with Basic HTTP Authentication is now available To add basic authentication for an action do the following e Select the desired action to protection e Select the checkbox for Protect with Basic HTTP Authentication for each of the actions you with to add HTTP Authentication to Bh departments modelbaker LPEIFICIS Uses 1 Components Helpers ModelBaker The Users Manual 47 ADMIN ROUTING ACIIONS This chapter describes how to create a simple admin routing action Sometimes we would like to move certain actions perhaps the Add Edit or Delete ac tions behind an administration URL For example www example com authors add would become www example com admin authors add Step 1 Setting up the Admin Routing Name To have an action become protected behind an administration URL we need to provide the Core Routing File of your generated web app with a Routing Admin name To setup the core routing file with a routing admin name do the following In the Settings tab 384 select Core from the Setting table located on the left hand side of the window e Locate the Genera settings box Enter admin in the Routing Admin field D departments modelbaker High YhG93bO0qylflxfs2guVoU 6859309657453542496 DbAcI default ModelBaker The Users Manual 48 Step 2 Setting Action to the Routing Name To have an action use the Routing
49. rver does not have cached files from your local de velopment Step 3 Installing your Database Schema When you build ModelBaker projects locally you are actually dropping and inserting tables into your local version of MySQL Your entire database schema gets generated with all your database types relationships and even random data if applied into a local schema script file You will need to use this file to insert into your remote database hosting environment ModelBaker The Users Manual 71 Installing this schema file depends on the access you and the type of admin access you use for your remote database Please consult your internet hosting provider for the details of your database configuration To update your database remotely you can probably do the following e Locate the app config schema schema sql file e If you are using phpMyAdmin you can copy and paste the text from this file into the query text area of your web browser and execute the query If you have shell SSH access can typically execute commands with parameters from a terminal command line against your remote MySQL database This would typically look something like mysql hmysql example com ufoo pbar modelbaker db lt www app config schema schema sql Here is what the above command line basically does tell mysql at the host mysql example com to log in using the user name foo and the password ar Then on the da tabas
50. s Manual 13 CakePHP Components Controller Templates Helpers Javascripts Model Templates Stylesheets Templates Themes cakephp cakephp 1 3 10 0 g867 laa3 tar gz cakephp cakephp 1 3 11 6 gb5a533b tar gz cakephp cakephp 1 3 9 0 g91391fd tar gz AN OVERVIEW OF MODELBAKER This chapter highlights the four main sections in ModelBaker Models Controllers Views and Settings ModelBaker The Users Manual 14 The Models Tab 38 1 MODELS Models are the building blocks for your web application They represent the data and busi ness rules you will need for your application ModelBaker makes creating models a one click process eoo Untitled 2 Controllers Views Settings MH E Entity Model amp Use Table Attribute Type Binding Validation Rule 7 Validate Author v E User Defined Required Allow Blank Last Blog v body wes 5 On Message Please enter a value for Title Object Method dl j Args Fields Counter Cache Author first name last name email ModelBaker takes this a step further and abstracts your model into Entity Models You can add attributes to your high level entity model which will be used as database columns When you define the model s attributes all of the model classes and SQL code will be automatically generated Adding custom validations to your attributes is only a click away Generated web apps will contain all the validations for your
51. t ModelBaker The Users Manual 70 Step 2 Uploading to your Hosting Site Note uploading to your hosting site is dependent upon the types of access you have You may have FTP SFTP or browser based uploading access Please consult your internet hosting provider for the type of access you have You will need to upload the contents of the folder located in your build path setting The build path folder contains all the files needed for your web application Do not upload the cached files in the app tmp directory but do upload the directory structure Also make sure you upload everything including the hidden htaccess files These files are not visi ble in the Apple Finder ADAM Terminal bash 81x15 macbookpro acme jonathan pwd f Users jonathan Sites acme macbookpro acme jonathan ls la total 24 drwxr xr x 6 jonathan staff 272 zu 11 88 drwxr xr x 12 jonathan staff 465 2 14 56 rw r r 1 jonathan staff 13 14 2886 rw r r 8 1 jonathan staff 25 16 21 README drwxr xr x 16 jonathan staff 25 11 82 app drwxr xr x 11 jonathan staff 370 20 11 02 cake rw r r 8 1 jonathan staff 129 2o 11 82 index php drwxr xr x 5 jonathan staff 20 11 82 vendors macbookpro acme jonathan After upload make sure the remote app tmp directory is readable and writable Also make sure the directories within the tmp folder are readable and writable as well Important Make sure the uploaded se
52. tes folder the Use Model Template checkbox in Models 2 will be available Must use php file extensions Stylesheets This directory can hold any custom Cascading Style Sheets for your web pro jects Must use css file extensions Templates Gives you the ability to build new projects from custom ModelBaker projects Templates are a way to take existing projects and use them over and over again They fol low a similar naming pattern to Plugins but use the mbtemplate extension You can read more about templates at the Creating Custom Template chapter Must use mbtemplate file extensions Themes Simplifies changing of the look and feel of your projects Adding themes follows the CakePHP design pattern for theming your project A ModelBaker theme is actually a directory that has been renamed with the extension mbtheme Placing this file in the Application Support ModelBaker Themes folder makes the theme available to other ModelBaker projects Must use mbtheme file extensions Using the Extensions Manager From the Preferences 8 Window you can manage the Extensions by selecting the Exten sions tab You have the ability to add and remove extensions that will all ModelBaker pro jects If you have any open ModelBaker projects during the adding or removal of Extensions you will need to close and re open the project to implement the changes ModelBaker The User
53. tion Support Extensions Filename AddressBook mbtemplate Blog mbtemplate Extensions Components Classroom mbtemplate Controller Templates Invoices mbtemplate Photos mbtemplate RealEstate mbtemplate Recipes mbtemplate Helpers Javascripts Model Templates Stylesheets Templates Themes Close amp reopen projects to enable changes Drag the college mbtemplate plugin bundle to your Library Application Support ModelBaker Templates folder ModelBaker The Users Manual index r rors conents gt Bog mixemolate troller Templates I Classroom mbtemplate t 1 itwoices mbtemplate Macintosh HD vers gt B Procos mbtemplate 5 gt D Realfstate motemplte scripts gt B Recipes miteempute Sues gt TEM J bel Templates yee ui pos 5 Name Addresibook mb esheets zi Din a lectus Integer Template va ey eget Sire 120 KB on disk dors LI Created 11 39 08 27 pas cU ac Quam Modified Today at 12 35 nisi sed ipsum PM umoes Last opened Today at 12 35 6 Naidque PM Luitmoes nec ieo lt sed ito Enam amp Sed SEL a y Yi by A eR e atu oT ay t e y rn d us AURA Ko Wee f at s sf Vestibulum just arcu hencverit a lacreet id soliowdin a erat Nunc placerat feu
54. tments table The name attribute is the default binding attribute Adding Custom Database Attribute Types ModelBaker comes with a default list of database attribute types that can be applied to your entity model attributes Theses default database types can only be modified and added to each project individually ModelBaker The Users Manual 34 SQL Insert BLOB DEFAULT NULL TINYINT 1 NOT NULL DEF DATE DEFAULT NULL DATETIME DEFAULT NULL DECIMAL 10 2 NOT NULL VARCHAR 100 NOT NULL If you need to add a custom database attribute type to your project e Select Settings 8 4 and choose the Database setting from the list under Setting Click the Add button located near the bottom of the window e In the Kind column enter the name of the Database Type i e String Medium This name will appear in the drop down menu in the Attribute table on the Models screen e In the SQL Insert column enter the raw SQL type For this example the type is VARCHARO NOT NULL In the Schema Type column enter the SQL schema type for this attribute type in this case the type is string e Next change the Form Helper Type to text It is also possible to set whether the attribute can be NULL its default setting and a maxi mum length The new database attribute type String Medium will now appear in the Type drop down menu under Models 3
55. users Naming your entity model is very important Entity models names should be in the singular format Automobile Person and Jet Airplane are valid entity model names Automo biles Persons and Jet Airplanes are not If the Use Table checkbox is selected an entity ModelBaker The Users Manual I model named Jet Airplane will generate after a build the database table jet airplanes with the any defined attributes as column names The Jet Airplane entity model will also create a PHP class file titled jet airplane php lo cated at app models jet airplane php ModelBaker will generate the entity model s corre sponding controller with all required actions views ATTRIBUTES Adding attributes to your entity model is in affect adding MySQL table columns When users save information in your web application this information will be saved in the col umns of the database table ASSOCIATIONS One of the powerful features of ModelBaker is the ability to link different models together through associations Mapping your models through associations will automatically generate the necessary SQL and class model relationships BEHAVIORS Behaviors are a way to organize non business functionality and attach them to your mod els ModelBaker provides access to CakePHP s default behaviors ACL Containable Trans late and Tree ModelBaker The Users Manual 16 The Contro
56. v hov gif bg nav li off gif 1 jonathan Macintosh HD y Applications x rT wu A Documents i Downloads bg nav off gif bg nav on gif bg wrapper gif icon add gif l j __ Application Support Preferences Sites 1 Web Site Assets work css PLIST wp default css default ctp info plist Dropbox RedRuby png The info plist is a simple XML document that has plist file extension The following screenshot shows the structure of the elements within the XML file 900 Info plist gm os DOCTYPE plist M m 3 lt pList version 1 0 gt 4 ED 5 key key 6 string Widget Press Inc string 7 key lt key gt 8 lt string gt inquiry widgetpress com lt string gt 9 lt key gt lt key gt 10 lt date gt lt date gt 11 lt key gt lt key gt 12 lt string gt Red Ruby lt string gt 13 lt key gt lt key gt 14 lt string gt A simple single column fixed format web application theme with rich red tones throughout the application string 15 key key 16 string 2 1 string 17 lt dict gt 18 OB Q Line 1 Column 1 Property List v Tab Size 4 3 ModelBaker The Users Manual 59 The default ctp is a standard CakePHP template file that has a ctp file extension There are three places holders HEADER P INAVBARII and IIFOOTERJ P where Model Baker will inject HTML PHP content during its building php echo element D
Download Pdf Manuals
Related Search
Related Contents
Sharp PN-V601A Quick Guide StarTech.com 2m USB 2.0 A to A Cable - M/M Guia Modem allgemeine bedienungshinweise Pioneer PWM-6121 User's Manual ME Contrat de generation 取扱説明書 - マックスレイ Copyright © All rights reserved.
Failed to retrieve file