2 if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3 die ( 'Not A Valid Entry Point' ) ;
5 /*********************************************************************************
6 * SugarCRM is a customer relationship management program developed by
7 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU Affero General Public License version 3 as published by the
11 * Free Software Foundation with the addition of the following permission added
12 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
13 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
14 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
21 * You should have received a copy of the GNU Affero General Public License along with
22 * this program; if not, see http://www.gnu.org/licenses or write to the Free
23 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
27 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
29 * The interactive user interfaces in modified source and object code versions
30 * of this program must display Appropriate Legal Notices, as required under
31 * Section 5 of the GNU Affero General Public License version 3.
33 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
34 * these Appropriate Legal Notices must retain the display of the "Powered by
35 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
36 * technical reasons, the Appropriate Legal Notices must display the words
37 * "Powered by SugarCRM".
38 ********************************************************************************/
41 require_once 'modules/ModuleBuilder/parsers/constants.php' ;
49 * @param string $view The view, for example EditView or ListView. For search views, use advanced_search or basic_search
50 * @param string $moduleName Module name
51 * @param string $packageName Package name. If present implies that we are being called from ModuleBuilder
52 * @return AbstractMetaDataParser
55 function getParser ( $view , $moduleName , $packageName = null , $subpanelName = null )
57 $GLOBALS [ 'log' ]->info ( "ParserFactory->getParser($view,$moduleName,$packageName,$subpanelName )" ) ;
58 if ( empty ( $packageName ) || ( $packageName == 'studio' ) )
60 switch ( strtolower ( $view ))
65 require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php' ;
66 return new GridLayoutMetaDataParser ( $view, $moduleName, $packageName ) ;
68 case MB_ADVANCEDSEARCH :
69 require_once 'modules/ModuleBuilder/parsers/views/SearchViewMetaDataParser.php' ;
70 return new SearchViewMetaDataParser ( $view, $moduleName, $packageName ) ;
72 if ($subpanelName == null)
74 require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php' ;
75 return new ListLayoutMetaDataParser ( MB_LISTVIEW, $moduleName, $packageName ) ;
78 require_once 'modules/ModuleBuilder/parsers/views/SubpanelMetaDataParser.php' ;
79 return new SubpanelMetaDataParser ( $subpanelName, $moduleName, $packageName ) ;
82 case MB_DASHLETSEARCH :
83 require_once 'modules/ModuleBuilder/parsers/views/DashletMetaDataParser.php' ;
84 return new DashletMetaDataParser($view, $moduleName, $packageName );
87 require_once 'modules/ModuleBuilder/parsers/views/PopupMetaDataParser.php' ;
88 return new PopupMetaDataParser($view, $moduleName, $packageName );
90 require_once 'modules/ModuleBuilder/parsers/parser.label.php' ;
91 return new ParserLabel ( $moduleName, $packageName ) ;
93 require_once 'modules/ModuleBuilder/parsers/parser.visibility.php' ;
94 return new ParserVisibility ( $moduleName, $packageName ) ;
97 if(!is_null ( $packageName )){
98 $prefix = empty($packageName) ? 'build' :'modify';
100 $fileName = "modules/ModuleBuilder/parsers/parser." . strtolower ( $prefix . $view ) . ".php" ;
101 if (file_exists ( $fileName ))
103 require_once $fileName ;
104 $class = 'Parser' . $prefix . ucfirst ( $view ) ;
105 if (class_exists ( $class ))
107 $GLOBALS [ 'log' ]->debug ( 'Using ModuleBuilder Parser ' . $fileName ) ;
108 $parser = new $class ( ) ;
115 $GLOBALS [ 'log' ]->fatal ( get_class ( $this ) . ": cannot create ModuleBuilder Parser $fileName" ) ;