[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /*+*********************************************************************************** 2 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 3 * ("License"); You may not use this file except in compliance with the License 4 * The Original Code is: vtiger CRM Open Source 5 * The Initial Developer of the Original Code is vtiger. 6 * Portions created by vtiger are Copyright (C) vtiger. 7 * All Rights Reserved. 8 *************************************************************************************/ 9 Vtiger_Field_Js("Webforms_Field_Js",{},{}) 10 11 Vtiger_Field_Js('Webforms_Multipicklist_Field_Js',{},{ 12 /** 13 * Function to get the pick list values 14 * @return <object> key value pair of options 15 */ 16 getPickListValues : function() { 17 return this.get('picklistvalues'); 18 }, 19 20 /** 21 * Function to get the ui 22 * @return - select element and chosen element 23 */ 24 getUi : function() { 25 var html = '<select class="select2" multiple name="'+ this.getName() +'[]" style="width:60%">'; 26 var pickListValues = this.getPickListValues(); 27 var selectedOption = this.getValue(); 28 var selectedOptionsArray = selectedOption.split(' |##| ') 29 for(var option in pickListValues) { 30 html += '<option value="'+option+'" '; 31 if(jQuery.inArray(option,selectedOptionsArray) != -1){ 32 html += ' selected '; 33 } 34 html += '>'+pickListValues[option]+'</option>'; 35 } 36 html +='</select>'; 37 var selectContainer = jQuery(html); 38 return selectContainer; 39 } 40 }); 41 42 Vtiger_Field_Js('Webforms_Picklist_Field_Js',{},{ 43 44 /** 45 * Function to get the pick list values 46 * @return <object> key value pair of options 47 */ 48 getPickListValues : function() { 49 return this.get('picklistvalues'); 50 }, 51 52 /** 53 * Function to get the ui 54 * @return - select element and chosen element 55 */ 56 getUi : function() { 57 var html = '<select class="row-fluid chzn-select" name="'+ this.getName() +'" style="width:220px">'; 58 var pickListValues = this.getPickListValues(); 59 var selectedOption = this.getValue(); 60 for(var option in pickListValues) { 61 html += '<option value="'+option+'" '; 62 if(option == selectedOption) { 63 html += ' selected '; 64 } 65 html += '>'+pickListValues[option]+'</option>'; 66 } 67 html +='</select>'; 68 var selectContainer = jQuery(html); 69 this.addValidationToElement(selectContainer); 70 return selectContainer; 71 } 72 }); 73 74 Vtiger_Field_Js('Webforms_Date_Field_Js',{},{ 75 76 /** 77 * Function to get the user date format 78 */ 79 getDateFormat : function(){ 80 return this.get('date-format'); 81 }, 82 83 /** 84 * Function to get the ui 85 * @return - input text field 86 */ 87 getUi : function() { 88 var html = '<div class="input-append">'+ 89 '<div class="date">'+ 90 '<input class="dateField" type="text" name="'+ this.getName() +'" data-date-format="'+ this.getDateFormat() +'" value="'+ this.getValue() + '" />'+ 91 '<span class="add-on"><i class="icon-calendar"></i></span>'+ 92 '</div>'+ 93 '</div>'; 94 var element = jQuery(html); 95 return this.addValidationToElement(element); 96 } 97 }); 98 99 Vtiger_Field_Js('Webforms_Currency_Field_Js',{},{ 100 101 /** 102 * get the currency symbol configured for the user 103 */ 104 getCurrencySymbol : function() { 105 return this.get('currency_symbol'); 106 }, 107 108 getUi : function() { 109 var html = '<div class="input-prepend">'+ 110 '<span class="add-on">'+ this.getCurrencySymbol()+'</span>'+ 111 '<input type="text" name="'+ this.getName() +'" value="'+ this.getValue() + '" class="input-medium" style="width:210px" data-decimal-seperator="'+this.getData().decimalSeperator+'" data-group-seperator="'+this.getData().groupSeperator+'"/>'+ 112 '</div>'; 113 var element = jQuery(html); 114 return this.addValidationToElement(element); 115 } 116 }); 117 118 Vtiger_Field_Js('Vtiger_Percentage_Field_Js',{},{ 119 120 /** 121 * Function to get the ui 122 * @return - input percentage field 123 */ 124 getUi : function() { 125 var html = '<div class="input-append row-fluid">'+ 126 '<input type="number" class="input-medium" min="0" max="100" name="'+this.getName() +'" value="'+ this.getValue() + '" step="any"/>'+ 127 '<span class="add-on">%</span>'+ 128 '</div>'; 129 var element = jQuery(html); 130 return this.addValidationToElement(element); 131 } 132 }); 133 134 Vtiger_Field_Js('Webforms_Time_Field_Js',{},{ 135 136 /** 137 * Function to get the ui 138 * @return - input text field 139 */ 140 getUi : function() { 141 var html = '<div class="input-append time">'+ 142 '<input class="timepicker-default" type="text" name="'+ this.getName() +'" value="'+ this.getValue() + '" />'+ 143 '<span class="add-on"><i class="icon-time"></i></span>'+ 144 '</div>'; 145 var element = jQuery(html); 146 return this.addValidationToElement(element); 147 } 148 }); 149 150 151 Vtiger_Field_Js('Webforms_Reference_Field_Js',{},{ 152 153 getReferenceModules : function(){ 154 return this.get('referencemodules'); 155 }, 156 157 /** 158 * Function to get the ui 159 * @return - input text field 160 */ 161 getUi : function() { 162 var referenceModules = this.getReferenceModules(); 163 var html; 164 165 var fieldName = this.getName(); 166 var referredModuleName = referenceModules[0]; 167 html = '<input name="popupReferenceModule" type="hidden" value="'+referredModuleName+'" />'+ 168 '<input name="'+ fieldName +'" type="hidden" value="'+ this.getValue()+ '" class="sourceField" />'; 169 170 html += '<div class="row-fluid input-prepend input-append">'+ 171 '<span class="add-on clearReferenceSelection cursorPointer">'+ 172 '<i class="icon-remove-sign" title=""></i>'+ 173 '</span>'+ 174 '<input id="'+ fieldName +'_display" type="text" class="span7 marginLeftZero autoComplete referenceFieldDisplay" placeholder="'+app.vtranslate('JS_TYPE_TO_SEARCH')+'"/>'+ 175 '<span class="add-on relatedPopup cursorPointer">'+ 176 '<i class="icon-search relatedPopup"></i>'+ 177 '</span>'+ 178 '<span class="add-on cursorPointer createReferenceRecord">'+ 179 '<i class="icon-plus"></i>'+ 180 '</span>' 181 '</div>'; 182 183 var referenceFieldNames = fieldName.split('[defaultvalue]'); 184 var referredFieldName = referenceFieldNames[0]+'[referenceModule]'; 185 html += '<input type="hidden" name="'+referredFieldName+'" value="'+referredModuleName+'" class="referenceModuleName">'; 186 var element = jQuery(html); 187 return this.addValidationToElement(element); 188 } 189 }); 190 191 Vtiger_Field_Js('Webforms_Image_Field_Js',{},{ 192 193 /** 194 * Function to get the ui 195 * @return - input text field 196 */ 197 getUi : function() { 198 var html = '<input class="input-large" type="text" name="'+ this.getName() +'" readonly />'; 199 var element = jQuery(html); 200 return this.addValidationToElement(element); 201 } 202 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |