]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/ModuleBuilder/tpls/studioRelationship.tpl
Release 6.5.0
[Github/sugarcrm.git] / modules / ModuleBuilder / tpls / studioRelationship.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37 *}
38
39 <form name='relform' onsubmit='return false;'>
40 <input type='hidden' name='to_pdf' value='1'>
41 <input type='hidden' name='module' value='ModuleBuilder'>
42 <input type='hidden' name='action' value='SaveRelationship'>
43 <input type='hidden' name='remove_tables' value='true' id="rel_remove_tables">
44 {if ! empty($view_package)}
45 <input type='hidden' name='view_package' value='{$view_package}'>
46 {/if}
47 <input type='hidden' name='view_module' value='{$view_module}' />
48 {if $rel.relationship_only}
49 <input type='hidden' name='relationship_only' value='1'>
50 {/if}
51 <table style="width:100%;" class="relform">
52         <tr>
53                 <td colspan='2' style="padding:5px 5px 15px 5px">
54                         {if !$rel.readonly}
55                                 {if empty($view_package)}
56                                 <input type='button' name='saverelbtn' value='{$mod_strings.LBL_BTN_SAVEPUBLISH}' onclick='if(check_form("relform"))
57                                 {else}
58                                 <input type='button' name='saverelbtn' value='{$mod_strings.LBL_BTN_SAVE}' onclick='if(check_form("relform"))
59                                 {/if}
60                                 ModuleBuilder.submitForm("relform");' class='button'>
61                                 {if ! empty($view_package)}
62                                 &nbsp;
63                                 {/if}
64                         {/if}
65                         {if ($rel.from_studio  || $rel.readonly && !$is_new) && $rel.relationship_type != 'one-to-one'}
66                         <input type='button' name='saverelbtn' value='{$mod_strings.LBL_BTN_SAVE}' onclick='if(check_form("relform")){ldelim} this.form.action.value="SaveRelationshipLabel"; ModuleBuilder.submitForm("relform");{rdelim}' class='button'>
67                         {/if}
68                         <input type='button' name='cancelbtn' value='{$mod_strings.LBL_BTN_CANCEL}' onclick='ModuleBuilder.tabPanel.removeTab(ModuleBuilder.findTabById("relEditor"));' class='button'>
69             {if $hideLevel < 3 && ($rel.from_studio || !$rel.readonly && !$is_new)}
70                         <input type='button' name='deleterelbtn' value='{$mod_strings.LBL_BTN_DELETE}' onclick='ModuleBuilder.deleteRel()' class='button'>
71             {/if}
72
73                 </td>
74         </tr>
75         {if empty($view_package) && $rel.relationship_type != 'one-to-one'}
76         <tr>
77                 <td class='mbLBLL'>
78                         {$mod_strings.LBL_DROPDOWN_LANGUAGE}:&nbsp;
79                         {html_options name='relationship_lang' id='relationship_lang' options=$available_languages selected=$selected_lang onchange='ModuleBuilder.moduleLoadRelationship2(document.relform.relationship_name.value, null, "true");'}
80                 </td>
81         </tr>
82         {/if}
83         <tr >
84        <td>
85        {if !empty($rel.relationship_name)}
86        <span align="right" scope="row">{$mod_strings.LBL_REL_NAME}:&nbsp;</span><span>{$rel.relationship_name}</span>
87        {/if}
88        <input type="hidden" value="{$rel.relationship_name}" name="relationship_name" />
89        </td>
90     </tr>
91         <tr><td colspan=2>
92                 <table class="edit view">
93                     <tr><th align="center" colspan=2>{$mod_strings.LBL_LHS_MODULE}</th><th>{$mod_strings.LBL_REL_TYPE}</th><th colspan=2>{$mod_strings.LBL_RHS_MODULE}</th></tr>
94                         <tr>
95                                 <td align="right" scope="row">
96                                 {sugar_translate label='LBL_MODULE'}:
97                                 </td>
98                                 <td>
99                                         <input name='ignore' value="{sugar_translate label=$module_key}" disabled >
100                                         <input type='hidden' name='lhs_module' value='{$module_key}'>
101                                 </td>
102                                 <td>
103                                 {if $rel.readonly}
104                     {html_options disabled=true name="relationship_type" id="relationship_type_field" output=$translated_cardinality values=$cardinality selected=$selected_cardinality }
105                                 {else}
106                     {html_options name="relationship_type" id="relationship_type_field" output=$translated_cardinality values=$cardinality selected=$selected_cardinality onchange='ModuleBuilder.moduleLoadRelationship2(document.relform.relationship_name.value);' }
107                                 {/if}
108                                 </td>
109                                 <td align="right" scope="row">
110                                 {sugar_translate label='LBL_MODULE'}:
111                                 </td>
112                                 <td>{if $rel.readonly}
113                                         <input name="rhs_module" id="rhs_mod_field" value="{$rel.rhs_module}" disabled>
114                                         {else}
115                     {html_options name="rhs_module" id="rhs_mod_field" output=$translated_relatable values=$relatable selected=$rel.rhs_module onchange='ModuleBuilder.moduleLoadRelationship2(document.relform.relationship_name.value, true);'}
116                                         {/if}
117                                 </td>
118                         </tr>
119
120             {if $rel.relationship_only}
121                 <tr>
122                     <td colspan=3>
123                     {$mod_strings.LBL_RELATIONSHIP_ONLY}
124                     </td>
125                 </tr>
126             {else}
127                         {* add in subpanels and optional extended relationship condition *}
128                         {if !empty($rel.rhs_module) && $rel.relationship_type != 'one-to-one'}
129                         <tr>
130                 {if $rel.relationship_type == 'many-to-many' || $rel.relationship_type == 'many-to-one'}
131                     <td align="right" scope="row">{sugar_translate label="LBL_REL_LABEL"}:</td>
132                     <td><input name="lhs_label" id="lhs_label" value="{$rel.lhs_label}"  ></td>
133                 {else}
134                     <td></td><td><input type="hidden" name="lhs_label" id="lhs_label" value="{$rel.lhs_label}"  ></td>
135                 {/if}
136                 <td></td>
137                 {if $rel.relationship_type != 'many-to-one'} 
138                 <td align="right" scope="row">{sugar_translate label="LBL_REL_LABEL"}:</td>
139                 <td><input name="rhs_label" id="rhs_label" value="{$rel.rhs_label}"  ></td>
140                 {else}
141                     <td></td><td><input type="hidden" name="rhs_label" id="rhs_label" value="{$rel.rhs_label}"  ></td>
142                 {/if}
143             </tr>
144             <tr>
145                 {if $rel.relationship_type == 'many-to-many' || $rel.relationship_type == 'many-to-one'}
146                 <td align="right" scope="row">{$mod_strings.LBL_SUBPANEL_FROM} {sugar_translate label=$rel.lhs_module}:</td>
147                 <td> {if $rel.readonly}
148                     <input name="lhs_subpanel" id="lhs_subpanel" value="{$rel.lhs_subpanel}" disabled>
149                     {else}
150                     {html_options name="lhs_subpanel" id="lhs_subpanel"  output=$lhspanels values=$lhspanels selected=$rel.lhs_subpanel alt=$mod_strings.LBL_MSUB}
151                     {/if}
152                 </td>
153                 {else}<td></td><td></td>{/if}
154                 <td></td>
155                 {if $rel.relationship_type != 'many-to-one'} 
156                 <td align="right" scope="row">{$mod_strings.LBL_SUBPANEL_FROM} {sugar_translate label=$rel.rhs_module}:</td>
157                 <td>
158                 {if $rel.readonly}
159                     <input name="lhs_subpanel" id="lhs_subpanel" value="{$rel.rhs_subpanel}" disabled>
160                 {else}
161                     {html_options name="rhs_subpanel" id="rhs_subpanel"  output=$rhspanels values=$rhspanels selected=$rel.rhs_subpanel alt=$mod_strings.LBL_RSUB}
162                 {/if}
163                                 </td>
164                                 {/if}
165                                 
166                                 
167             </tr>
168                         <tr>
169                 {* add in the extended relationship condition *}
170                 {* comment out for now as almost no expressed need for this - to revert, uncomment and test, test, test...
171                 <td></td>
172                 <td></td>
173                 <td align="right" scope="row">{$mod_strings.LBL_RELATIONSHIP_ROLE_ENTRIES}:</td>
174                 </tr>
175                 {if $rel.relationship_type == 'one-to-many'}
176                 <tr>
177                     <td></td>
178                     <td><span style='float:right;'>{$mod_strings.LBL_RELATIONSHIP_ROLE_COLUMN}:</span></td>
179                     <td>
180                     <input name="relationship_role_column" id="relationship_role_column_field" value="{$rel.relationship_role_column}" {if $rel.readonly}disabled{/if} />
181                 </td>
182                 </tr>
183                 {/if} {* one-to-many *}
184                 {*
185                 <tr>
186                     <td></td>
187                     <td align="right" scope="row"><span style='float:right;'>{$mod_strings.LBL_RELATIONSHIP_ROLE_VALUE}:</span></td>
188                     <td>
189                         <input name="relationship_role_column_value" id="relationship_role_column__value_field" value="{$rel.relationship_role_column_value}" {if $rel.readonly}disabled{/if} />
190                     </td>
191                 </tr>
192                 *}
193
194                         {/if} {* subpanels etc for all but one-to-one relationships *}
195                         {/if} {* if relationship_only *}
196                 </table>
197         </td></tr>
198 </table>
199 </form>
200 <script>
201 {literal}
202 ModuleBuilder.deleteRel = function()
203 {
204     YAHOO.util.Dom.get("rel_remove_tables").value = true;
205         YAHOO.SUGAR.MessageBox.show(
206         {
207             type:'confirm',
208                 width: 300,
209             {/literal}
210             msg:'<b>{sugar_translate label="LBL_CONFIRM_RELATIONSHIP_DELETE"}</b>' + 
211                "<div style='height:1em;'>&nbsp;</div><p><input type='checkbox' onclick='YAHOO.util.Dom.get(\"rel_remove_tables\").value = this.checked ? \"\" : true;' />" +
212                    "&nbsp;{sugar_translate label="ML_LBL_DO_NOT_REMOVE_TABLES" module="Administration"}</p>",
213             {literal}
214             fn: function(confirm) {
215                     if (confirm == 'yes') {
216                         document.forms.relform.action.value="DeleteRelationship";
217                             ModuleBuilder.submitForm("relform");
218                             ModuleBuilder.tabPanel.removeTab(ModuleBuilder.findTabById("relEditor"));
219                         }
220                 }
221         });             
222 }
223 {/literal}      
224 addForm('relform');
225 addToValidate('relform', 'label', 'varchar', true, '{$mod_strings.LBL_JS_VALIDATE_REL_LABEL}');
226 {if $fromModuleBuilder}
227 ModuleBuilder.helpSetup('relationshipsHelp','addRelationship');
228 {else}
229 ModuleBuilder.helpSetup('studioWizard','relationshipHelp');
230 {/if}
231
232 </script>