[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 function get_validate_import_fields_js (&$req_fields,&$all_fields) 12 { 13 global $mod_strings; 14 15 $err_multiple = $mod_strings['ERR_MULTIPLE']; 16 $err_required = $mod_strings['ERR_MISSING_REQUIRED_FIELDS']; 17 $err_select_full_name = $mod_strings['ERR_SELECT_FULL_NAME']; 18 $print_required_array = ""; 19 20 foreach ($req_fields as $required=>$unused) 21 { 22 $print_required_array .= "required['$required'] = '". $all_fields[$required] . "';\n"; 23 24 } 25 26 $the_script = <<<EOQ 27 28 <script type="text/javascript" language="Javascript"> 29 <!-- to hide script contents from old browsers 30 31 function verify_data(form) 32 { 33 var isError = false; 34 var errorMessage = ""; 35 36 var hash = new Object(); 37 38 var required = new Object(); 39 40 $print_required_array 41 42 for(i=0;i < form.length;i++) 43 { 44 if ( form.elements[i].name.indexOf("colnum",0) == 0) 45 { 46 47 if ( form.elements[i].value == "-1") 48 { 49 continue; 50 } 51 if ( hash[ form.elements[i].value ] == 1) 52 { 53 // got same vtiger_field more than once 54 isError = true; 55 } 56 hash[form.elements[i].value] = 1; 57 } 58 } 59 60 if (isError == true) 61 { 62 alert( "$err_multiple" ); 63 return false; 64 } 65 66 if (hash['full_name'] == 1 && (hash['last_name'] == 1 || hash['first_name'] == 1) ) 67 { 68 alert( "$err_select_full_name" ); 69 return false; 70 } 71 72 for(var vtiger_field_name in required) 73 { 74 // contacts hack to bypass errors if full_name is set 75 if (field_name == 'last_name' && 76 hash['full_name'] == 1) 77 { 78 continue; 79 } 80 if ( hash[ vtiger_field_name ] != 1 ) 81 { 82 isError = true; 83 errorMessage += "$err_required " + required[field_name]; 84 } 85 } 86 87 if (isError == true) 88 { 89 alert( errorMessage); 90 return false; 91 } 92 93 94 return true; 95 } 96 97 // end hiding contents from old browsers --> 98 </script> 99 100 EOQ; 101 102 return $the_script; 103 } 104 105 106 107 108 function get_validate_upload_js () 109 { 110 global $mod_strings; 111 112 $err_missing_required_fields = $mod_strings['ERR_MISSING_REQUIRED_FIELDS']; 113 $lbl_select_file = $mod_strings['ERR_SELECT_FILE']; 114 $lbl_custom = $mod_strings['LBL_CUSTOM']; 115 116 $the_script = <<<EOQ 117 118 <script type="text/javascript" language="Javascript"> 119 <!-- to hide script contents from old browsers 120 121 function verify_data(form) 122 { 123 var isError = false; 124 var errorMessage = ""; 125 if (form.userfile.value == "") 126 { 127 isError = true; 128 errorMessage += "\\n$lbl_select_file"; 129 } 130 else 131 { 132 for(i=0;i < form.delimiter.length;i++) 133 { 134 if ( form.delimiter[i].value == "custom" 135 && form.delimiter[i].checked == true 136 && form.custom_delim.value == "") 137 { 138 isError = true; 139 errorMessage += "\\n$lbl_custom"; 140 break; 141 } 142 } 143 } 144 145 if (isError == true) 146 { 147 alert("$err_missing_required_fields" + errorMessage); 148 return false; 149 } 150 151 152 return true; 153 } 154 155 // end hiding contents from old browsers --> 156 </script> 157 158 EOQ; 159 160 return $the_script; 161 } 162 163 function getFieldSelect(&$column_fields,$colnum,&$required_fields,$suggest_field,$translated_fields,$module) 164 { 165 global $mod_strings; 166 global $app_strings; 167 global $outlook_contacts_field_map; 168 require_once ('include/database/PearDatabase.php'); 169 global $adb; 170 171 $output = "<select name=\"colnum" . $colnum ."\">\n"; 172 $output .= "<option value=\"-1\">". $mod_strings['LBL_DONT_MAP'] . "</option>"; 173 174 $count = 0; 175 $req_mark = ""; 176 177 require_once ("include/database/PearDatabase.php"); 178 179 $adb->println("Field select"); 180 $adb->println($translated_fields); 181 182 asort($translated_fields); 183 184 185 foreach ($translated_fields as $field=>$name) 186 { 187 188 if (! isset($column_fields[$field])) 189 { 190 continue; 191 } 192 $output .= "<option value=\"".$field; 193 194 if ( isset( $suggest_field) && 195 $field == $suggest_field) 196 { 197 $output .= "\" SELECTED>"; 198 } 199 else 200 { 201 $output .= "\">"; 202 } 203 if ( isset( $required_fields[$field])) 204 { 205 $req_mark = " ". $app_strings['LBL_REQUIRED_SYMBOL']; 206 } 207 else 208 { 209 $req_mark = ""; 210 } 211 212 $output .= $name . $req_mark."</option>\n"; 213 214 $count ++; 215 } 216 $output .= "</select>\n"; 217 218 return $output; 219 220 } 221 222 223 function get_readonly_js () 224 { 225 ?> 226 <script type="text/javascript" language="Javascript"> 227 <!-- to hide script contents from old browsers 228 229 function set_readonly(form) 230 { 231 232 if (form.save_map.checked) 233 { 234 form.save_map.value='on'; 235 form.save_map_as.readOnly=false; 236 form.save_map_as.focus(); 237 } 238 else 239 { 240 form.save_map.value='off'; 241 form.save_map_as.value=""; 242 form.save_map_as.readOnly=true; 243 } 244 } 245 246 // end hiding contents from old browsers --> 247 </script> 248 249 <?php 250 } 251 252 253 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |