function get_coldef_definition($idx, $title, $rowspan, $collate = FALSE) { global $s_coldefs, $tb_strings, $s_domains; $coldefs = isset($s_coldefs[$idx]) ? $s_coldefs[$idx] : array(); $domain_names = array_keys($s_domains); $rowspan = !empty($domain_names) ? $rowspan - 1 : $rowspan; // preselect values for the form elements $domain_pre = isset($coldefs['domain']) ? $coldefs['domain'] : NULL; $comp_value = isset($coldefs['comp']) ? $coldefs['comp'] : ''; $default_value = isset($coldefs['default']) ? $coldefs['default'] : ''; $check_value = isset($coldefs['check']) ? $coldefs['check'] : ''; $ehandler_str = ' onClick="checkColConstraint(' . 'document.' . get_form_name($idx) . ", this.name, '" . $idx . "')"; $html = get_datatype_definition($idx, $title, $rowspan, $collate) . " <tr>\n" . " <td colspan=\"4\">\n"; if (!empty($domain_names)) { $html .= ' <b>' . $tb_strings['Domain'] . "</b><br>\n" . ' ' . get_selectlist('cd_def_domain' . $idx, $domain_names, $domain_pre, TRUE); } else { $html .= " \n"; } $html .= " </td>\n" . " <td colspan=\"2\" align=\"center\">\n" . ' <b>' . $tb_strings['NotNull'] . "</b><br>\n" . ' <input type="checkbox" name="cd_def_notnull' . $idx . '"' . $ehandler_str . '"' . (!empty($coldefs['notnull']) ? ' checked' : '') . ">\n" . " </td>\n" . " <td align=\"center\">\n" . ' <b>' . $tb_strings['Unique'] . "</b><br>\n" . ' <input type="checkbox" name="cd_def_unique' . $idx . '"' . $ehandler_str . '"' . (!empty($coldefs['unique']) ? ' checked' : '') . ">\n" . " </td>\n" . " <td align=\"center\">\n" . ' <b>' . $tb_strings['Primary'] . "</b><br>\n" . ' <input type="checkbox" name="cd_def_primary' . $idx . '"' . $ehandler_str . '"' . (!empty($coldefs['primary']) ? ' checked' : '') . ">\n" . " </td>\n" . " </tr>\n" . " <tr>\n" . " <td colspan=\"2\">\n" . ' <b>' . $tb_strings['CompBy'] . "</b><br>\n" . ' ' . get_textfield('cd_def_comp' . $idx, 27, 512, $comp_value) . " </td>\n" . " <td colspan=\"2\">\n" . ' <b>' . $tb_strings['Default'] . "</b><br>\n" . ' ' . get_textfield('cd_def_default' . $idx, 27, 256, $default_value) . " </td>\n" . " <td colspan=\"4\">\n" . ' <b>' . $tb_strings['Check'] . "</b><br>\n" . ' ' . get_textfield('cd_def_check' . $idx, 27, 256, $check_value) . " </td>\n" . " </tr>\n" . get_column_constraint_definition($coldefs, $idx); return $html; }
function aff_q_txt_i18n_empr($field, &$check_scripts) { global $charset, $base_path; global $msg, $langue_doc, $value_deflt_lang; if (!count($langue_doc)) { $langue_doc = new marc_list('lang'); $langue_doc = $langue_doc->table; } $options = $field['OPTIONS'][0]; $values = $field['VALUES']; $afield_name = $field["ID"]; $_custom_prefixe_ = $field["PREFIX"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } $requete = "select " . $_custom_prefixe_ . "_custom_list_value, " . $_custom_prefixe_ . "_custom_list_lib from " . $_custom_prefixe_ . "_custom_lists where " . $_custom_prefixe_ . "_custom_champ=" . $field['ID'] . " order by ordre"; $resultat = pmb_mysql_query($requete); $options['ITEMS'] = array(); if ($resultat) { $i = 0; while ($r = pmb_mysql_fetch_array($resultat)) { $options['ITEMS'][$i]['value'] = $r[$_custom_prefixe_ . "_custom_list_value"]; $options['ITEMS'][$i]['label'] = $r[$_custom_prefixe_ . "_custom_list_lib"]; $i++; } } foreach ($values as $value) { $exploded_value = explode("|||", $value); if (count($options['ITEMS']) == 1) { $type = "checkbox"; $ret .= "<input id='" . $field['NAME'] . "_qualification_" . $count . "' type='{$type}' name='" . $field['NAME'] . "_qualifications[" . $count . "]'"; if ($values[0] != "") { if ($options['ITEMS'][0]['value'] == $exploded_value[2]) { $ret .= " checked=checked"; } } else { //Recherche de la valeur par défaut s'il n'y a pas de choix vide if ($options['UNSELECT_ITEM'][0][VALUE] == "" || $options['UNSELECT_ITEM'][0][value] == "") { if ($options['DEFAULT_VALUE'][0][value] == "") { $ret .= " checked=checked"; } elseif ($options['ITEMS'][0]['value'] == $options['DEFAULT_VALUE'][0][value]) { $ret .= " checked=checked"; } } } $ret .= " value='" . $options['ITEMS'][0]['value'] . "'/><span id='lib_" . $field['NAME'] . "_" . $options['ITEMS'][0]['value'] . "'> " . $options['ITEMS'][0]['label'] . "</span>"; } else { $ret .= "<select id=\"" . $field['NAME'] . "_qualification_" . $count . "\" name=\"" . $field['NAME']; $ret .= "_qualifications[" . $count . "]"; $ret .= "\" "; if ($script) { $ret .= $script . " "; } $ret .= " data-form-name='" . $field[NAME] . "' >\n"; if ($options['UNSELECT_ITEM'][0][VALUE] != "" || $options['UNSELECT_ITEM'][0][value] != "") { $ret .= "<option value=\"" . htmlentities($options['UNSELECT_ITEM'][0][VALUE], ENT_QUOTES, $charset) . "\">" . htmlentities($options['UNSELECT_ITEM'][0][value], ENT_QUOTES, $charset) . "</option>\n"; } for ($i = 0; $i < count($options['ITEMS']); $i++) { $ret .= "<option value=\"" . htmlentities($options['ITEMS'][$i]['value'], ENT_QUOTES, $charset) . "\""; if ($values[0] != "") { if ($options['ITEMS'][$i]['value'] == $exploded_value[2]) { $ret .= " selected"; } } else { //Recherche de la valeur par défaut if ($options['ITEMS'][$i]['value'] == $options['DEFAULT_VALUE'][0][value]) { $ret .= " selected"; } } $ret .= ">" . htmlentities($options['ITEMS'][$i]['label'], ENT_QUOTES, $charset) . "</option>\n"; } $ret .= "</select>\n"; } $ret .= "<input id=\"" . $field['NAME'] . "_" . $count . "\" type=\"text\" size=\"" . $options['SIZE'][0]['value'] . "\" maxlength=\"" . $options['MAXSIZE'][0]['value'] . "\" name=\"" . $field['NAME'] . "[" . $count . "]\" data-form-name='" . $field["NAME"] . "_' value=\"" . htmlentities($exploded_value[0], ENT_QUOTES, $charset) . "\">"; $ret .= "<input id=\"" . $field['NAME'] . "_lang_" . $count . "\" class=\"saisie-10emr\" type=\"text\" value=\"" . ($exploded_value[1] ? htmlentities($langue_doc[$exploded_value[1]], ENT_QUOTES, $charset) : htmlentities($langue_doc[$value_deflt_lang], ENT_QUOTES, $charset)) . "\" autfield=\"" . $field['NAME'] . "_lang_code_" . $count . "\" completion=\"langue\" autocomplete=\"off\" data-form-name='" . $field["NAME"] . "_lang_' >"; $ret .= "<input class=\"bouton\" type=\"button\" value=\"...\" onClick=\"openPopUp('" . $base_path . "/select.php?what=lang&caller='+this.form.name+'&p1=" . $field['NAME'] . "_lang_code_" . $count . "&p2=" . $field['NAME'] . "_lang_" . $count . "', 'select_lang', 500, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\">"; $ret .= "<input class=\"bouton\" type=\"button\" onclick=\"this.form." . $field['NAME'] . "_lang_" . $count . ".value=''; this.form." . $field['NAME'] . "_lang_code_" . $count . ".value=''; \" value=\"X\">"; $ret .= "<input id=\"" . $field['NAME'] . "_lang_code_" . $count . "\" data-form-name='" . $field["NAME"] . "_lang_code_' type=\"hidden\" value=\"" . ($exploded_value[1] ? htmlentities($exploded_value[1], ENT_QUOTES, $charset) : htmlentities($value_deflt_lang, ENT_QUOTES, $charset)) . "\" name=\"" . $field['NAME'] . "_langs[" . $count . "]\">"; if ($options['REPEATABLE'][0]['value'] && !$count) { $ret .= '<input class="bouton" type="button" value="+" onclick="add_custom_q_txt_i18n_(\'' . $afield_name . '\', \'' . addslashes($field['NAME']) . '\', \'' . $options['SIZE'][0]['value'] . '\', \'' . $options['MAXSIZE'][0]['value'] . '\')">'; } $ret .= "<br />"; $count++; } if ($options['REPEATABLE'][0]['value']) { $ret .= '<input id="customfield_q_txt_i18n_' . $afield_name . '" type="hidden" name="customfield_text_' . $afield_name . '" value="' . $count . '">'; $ret .= '<div id="spaceformorecustomfieldtexti18n_' . $afield_name . '"></div>'; $ret .= "<script>\n\t\t\tfunction add_custom_q_txt_i18n_(field_id, field_name, field_size, field_maxlen) {\n\t\t var count = document.getElementById('customfield_q_txt_i18n_'+field_id).value;\n\n\t\t\t\tvar qualification = document.getElementById(field_name+'_qualification_'+(count-1)).cloneNode(true);\n\t\t\t\tqualification.setAttribute('id', field_name + '_qualification_' + count);\n\t\t qualification.setAttribute('name',field_name+'_qualifications[' + count + ']');\n\n\t\t\t\tvar text = document.createElement('input');\n\t\t\t\ttext.setAttribute('id', field_name + '_' + count);\n\t\t text.setAttribute('name',field_name+'[' + count + ']');\n\t\t text.setAttribute('type','text');\n\t\t text.setAttribute('value','');\n\t\t text.setAttribute('size',field_size);\n\t\t text.setAttribute('maxlength',field_maxlen);\n\n\t\t\t\tvar lang = document.createElement('input');\n\t\t\t\tlang.setAttribute('id', field_name + '_lang_' + count);\n\t\t\t\tlang.setAttribute('class', 'saisie-10emr');\n\t\t\t\tlang.setAttribute('type', 'text');\n\t\t\t\tlang.setAttribute('value', '');\n\t\t\t\tlang.setAttribute('autfield', field_name + '_lang_code_' + count);\n\t\t\t\tlang.setAttribute('completion', 'langue');\n\t\t\t\tlang.setAttribute('autocomplete', 'off');\n\n\t\t\t\tvar select = document.createElement('input');\n\t\t\t\tselect.setAttribute('class', 'bouton');\n\t\t\t\tselect.setAttribute('type', 'button');\n\t\t\t\tselect.setAttribute('value', '...');\n\t\t\t\tselect.addEventListener('click', function(){\n\t\t\t\t\topenPopUp('" . $base_path . "/select.php?what=lang&caller='+this.form.name+'&p1=' + field_name + '_lang_code_' + count + '&p2=' + field_name + '_lang_' + count, 'select_lang', 500, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes');\n\t\t\t\t}, false);\n\n\t\t\t\tvar del = document.createElement('input');\n\t\t\t\tdel.setAttribute('class', 'bouton');\n\t\t\t\tdel.setAttribute('type', 'button');\n\t\t\t\tdel.setAttribute('value', 'X');\n\t\t\t\tdel.addEventListener('click', function(){\n\t\t\t\t\tdocument.getElementById(field_name + '_lang_' + count).value=''; document.getElementById(field_name + '_lang_code_' + count).value='';\n\t\t\t\t}, false);\n\n\t\t\t\tvar lang_code = document.createElement('input');\n\t\t\t\tlang_code.setAttribute('id', field_name + '_lang_code_' + count);\n\t\t\t\tlang_code.setAttribute('type', 'hidden');\n\t\t\t\tlang_code.setAttribute('value', '');\n\t\t\t\tlang_code.setAttribute('name', field_name + '_langs[' + count + ']');\n\n\t\t space=document.createElement('br');\n\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(qualification);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(text);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(lang);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(select);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(del);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(lang_code);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(space);\n\n\t\t\t\tdocument.getElementById('customfield_q_txt_i18n_'+field_id).value = document.getElementById('customfield_q_txt_i18n_'+field_id).value * 1 + 1;\n\t\t\t\tajax_pack_element(lang);\n\t\t\t}\n\t\t</script>"; } if ($field[MANDATORY] == 1) { $caller = get_form_name(); $check_scripts .= "if (document.forms[\"" . $caller . "\"].elements[\"" . $field[NAME] . "[]\"].value==\"\") return cancel_submit(\"" . sprintf($msg["parperso_field_is_needed"], $field[ALIAS]) . "\");\n"; } return $ret; }
function aff_html_empr($field, &$check_scripts) { global $charset; global $msg; global $cms_dojo_plugins_editor; $options = $field[OPTIONS][0]; $values = $field[VALUES]; $afield_name = $field["ID"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } foreach ($values as $avalues) { $ret .= "<input type='hidden' name='" . $field[NAME] . "[{$count}]' value=''/>\r\n\t\t\t<div data-dojo-type='dijit/Editor' {$cms_dojo_plugins_editor}\tid='" . $field[NAME] . "_" . $count . "' class='saisie-80em' height='" . $options[HEIGHT][0][value] . "px' wrap='wrap' style='display:inline-block;width:" . $options[WIDTH][0][value] . "px'>" . $avalues . "</div>"; if ($options[REPEATABLE][0][value] && !$count) { $ret .= '<span style="vertical-align:top"><input class="bouton" type="button" value="+" onclick="add_custom_text_(\'' . $afield_name . '\', \'' . addslashes($field[NAME]) . '\',' . $options[HEIGHT][0][value] . ',' . $options[WIDTH][0][value] . ')"></span>'; } $ret .= "<br /><br / >"; $count++; } if ($options[REPEATABLE][0][value]) { $ret .= '<input id="customfield_text_' . $afield_name . '" type="hidden" name="customfield_text_' . $afield_name . '" value="' . count($values) . '">'; $ret .= '<div id="spaceformorecustomfieldtext_' . $afield_name . '"></div>'; $ret .= "<script>\n\t\t\tvar cpt = {$count};\n\t\t\n\t\t\tfunction add_custom_text_(field_id, field_name, field_height, field_width) {\n\t\t\t\tdocument.getElementById('customfield_text_'+field_id).value = document.getElementById('customfield_text_'+field_id).value * 1 + 1;\n\t\t count = document.getElementById('customfield_text_'+field_id).value;\n\t\t \n\t\t hid = document.createElement('input');\n\t\t hid.setAttribute('type','hidden');\n\t\t hid.setAttribute('name',field_name+'['+cpt+']');\n\t\t hid.setAttribute('value','');\n\t\t \n\t\t\t\tf_aut0 = document.createElement('div');\n\t\t\t\tf_aut0.setAttribute('data-dojo-type','dijit/Editor');\n\t\t\t\tf_aut0.setAttribute('class','saisie-80em');\n\t\t\t\tf_aut0.setAttribute('wrap','wrap');\n\t\t\t\tf_aut0.setAttribute('style','width:'+field_width+'px');\n\t\t\t\t\n\t\t space=document.createElement('br');\n\t\t \n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtext_'+field_id).appendChild(hid);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtext_'+field_id).appendChild(f_aut0);\n\t\t\t\tnew dijit.Editor({id : field_name+'_'+cpt, height : field_height+'px', extraPlugins:[\n\t\t\t{name: 'fontName', plainText: true}, \n\t\t\t{name: 'fontSize', plainText: true}, \n\t\t\t{name: 'formatBlock', plainText: true},\n\t\t\t'foreColor','hiliteColor',\n\t\t\t'createLink', 'unlink', 'insertImage',\n\t\t\t'fullscreen',\n\t\t\t'viewsource'\n\t\t]}, f_aut0);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtext_'+field_id).appendChild(space);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtext_'+field_id).appendChild(space);\n\t\t\t\tcpt++;\n\t\t\t}\n\t\t</script>"; } $caller = get_form_name(); $check_scripts .= "\n\tvar i = 0;\n\twhile(document.forms['" . $caller . "'].elements['" . $field[NAME] . "['+i+']']){\n\t\tif(dijit.byId('" . $field[NAME] . "_'+i).get('value') && (dijit.byId('" . $field[NAME] . "_'+i).get('value') != '<br _moz_editor_bogus_node=\"TRUE\" />') && (dijit.byId('" . $field[NAME] . "_'+i).get('value') != '<br />')) {\n\t\t\tdocument.forms['" . $caller . "'].elements['" . $field[NAME] . "['+i+']'].value = dijit.byId('" . $field[NAME] . "_'+i).get('value');\n\t\t}\n\t\ti++;\n\t}"; if ($field[MANDATORY] == 1) { $check_scripts .= "if (document.forms[\"" . $caller . "\"].elements[\"" . $field[NAME] . "[0]\"].value==\"\") return cancel_submit(\"" . sprintf($msg["parperso_field_is_needed"], $field[ALIAS]) . "\");\n"; } return $ret; }
function aff_marclist_empr($field, &$check_scripts, $script = "") { global $charset; $_custom_prefixe_ = $field["PREFIX"]; $options = $field[OPTIONS][0]; $values = $field[VALUES]; if ($values == "") { $values = array(); } $ret = ""; $marclist_type = new marc_list($options['DATA_TYPE'][0]['value']); if ($options["AUTORITE"][0]["value"] != "yes") { $ret = "<select id=\"" . $field[NAME] . "\" name=\"" . $field[NAME]; $ret .= "[]"; $ret .= "\" "; if ($script) { $ret .= $script . " "; } if ($options[MULTIPLE][0][value] == "yes") { $ret .= "multiple"; } $ret .= ">\n"; if ($options[UNSELECT_ITEM][0][VALUE] != "" || $options[UNSELECT_ITEM][0][value] != "") { $ret .= "<option value=\"" . htmlentities($options[UNSELECT_ITEM][0][VALUE], ENT_QUOTES, $charset) . "\">" . htmlentities($options[UNSELECT_ITEM][0][value], ENT_QUOTES, $charset) . "</option>\n"; } if ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "1") { asort($marclist_type->table); } elseif ($options[METHOD_SORT_VALUE][0][value] == "1" && $options[METHOD_SORT_ASC][0][value] == "1") { ksort($marclist_type->table); } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") { arsort($marclist_type->table); } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") { krsort($marclist_type->table); } reset($marclist_type->table); if (count($marclist_type->table)) { foreach ($marclist_type->table as $code => $label) { $ret .= "<option value=\"" . $code . "\""; if (count($values)) { $as = array_search($code, $values); if ($as !== FALSE && $as !== NULL) { $ret .= " selected"; } } $ret .= ">" . $label . "</option>"; } } $ret .= "</select>\n"; } else { $caller = get_form_name(); if (count($values)) { $values_received = $values; $values = array(); $libelles = array(); $i = 0; foreach ($values_received as $id => $value) { $as = array_key_exists($value, $marclist_type->table); if ($as !== null && $as !== false) { $values[$i] = $value; $libelles[$i] = $marclist_type->table[$value]; $i++; } } } $readonly = ''; $n = count($values); if ($options[MULTIPLE][0][value] == "yes") { $val_dyn = 1; } else { $val_dyn = 0; } if ($n == 0 || $options[MULTIPLE][0][value] != "yes") { $n = 1; } if ($options[MULTIPLE][0][value] == "yes") { $readonly = ''; $ret .= "<script>\n\t\t\tfunction fonction_selecteur_" . $field["NAME"] . "() {\n\t\t\t\tname=this.getAttribute('id').substring(4);\n\t\t\t\tname_id = name;\n\t\t\t\topenPopUp('./select.php?what=perso&caller={$caller}&p1='+name_id+'&p2=f_'+name_id+'&perso_id=" . $field["ID"] . "&custom_prefixe=" . $_custom_prefixe_ . "&dyn={$val_dyn}&perso_name=" . $field['NAME'] . "', 'select_author2', 400, 400, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');\n\t\t\t}\n\t\t\tfunction fonction_raz_" . $field["NAME"] . "() {\n\t\t\t\tname=this.getAttribute('id').substring(4);\n\t\t\t\tdocument.getElementById(name).value=0;\n\t\t\t\tdocument.getElementById('f_'+name).value='';\n\t\t\t}\n\t\t\tfunction add_" . $field["NAME"] . "() {\n\t\t\t\ttemplate = document.getElementById('div_" . $field["NAME"] . "');\n\t\t\t\tperso=document.createElement('div');\n\t\t\t\tperso.className='row';\n\n\t\t\t\tsuffixe = eval('document.{$caller}.n_" . $field["NAME"] . ".value')\n\t\t\t\tnom_id = '" . $field["NAME"] . "_'+suffixe\n\t\t\t\tf_perso = document.createElement('input');\n\t\t\t\tf_perso.setAttribute('name','f_'+nom_id);\n\t\t\t\tf_perso.setAttribute('id','f_'+nom_id);\n\t\t\t\tf_perso.setAttribute('completion','perso_" . $_custom_prefixe_ . "');\n\t\t\t\tf_perso.setAttribute('persofield','" . $field["NAME"] . "');\n\t\t\t\tf_perso.setAttribute('autfield',nom_id);\n\t\t\t\tf_perso.setAttribute('type','text');\n\t\t\t\tf_perso.className='saisie-50emr';\n\t\t\t\t{$readonly}\n\t\t\t\tf_perso.setAttribute('value','');\n\n\t\t\t\tdel_f_perso = document.createElement('input');\n\t\t\t\tdel_f_perso.setAttribute('id','del_" . $field["NAME"] . "_'+suffixe);\n\t\t\t\tdel_f_perso.onclick=fonction_raz_" . $field["NAME"] . ";\n\t\t\t\tdel_f_perso.setAttribute('type','button');\n\t\t\t\tdel_f_perso.className='bouton';\n\t\t\t\tdel_f_perso.setAttribute('readonly','');\n\t\t\t\tdel_f_perso.setAttribute('value','X');\n\n\t\t\t\tsel_f_perso = document.createElement('input');\n\t\t\t\tsel_f_perso.setAttribute('id','sel_" . $field["NAME"] . "_'+suffixe);\n\t\t\t\tsel_f_perso.setAttribute('type','button');\n\t\t\t\tsel_f_perso.className='bouton';\n\t\t\t\tsel_f_perso.setAttribute('readonly','');\n\t\t\t\tsel_f_perso.setAttribute('value','...');\n\t\t\t\tsel_f_perso.onclick=fonction_selecteur_" . $field["NAME"] . ";\n\n\t\t\t\tf_perso_id = document.createElement('input');\n\t\t\t\tf_perso_id.name=nom_id;\n\t\t\t\tf_perso_id.setAttribute('type','hidden');\n\t\t\t\tf_perso_id.setAttribute('id',nom_id);\n\t\t\t\tf_perso_id.setAttribute('value','');\n\n\t\t\t\tperso.appendChild(f_perso);\n\t\t\t\tspace=document.createTextNode(' ');\n\t\t\t\tperso.appendChild(space);\n\t\t\t\tperso.appendChild(sel_f_perso);\n\t\t\t\tspace=document.createTextNode(' ');\n\t\t\t\tperso.appendChild(space);\n\t\t\t\tperso.appendChild(del_f_perso);\n\t\t\t\tperso.appendChild(f_perso_id);\n\n\t\t\t\ttemplate.appendChild(perso);\n\n\t\t\t\tdocument.{$caller}.n_" . $field["NAME"] . ".value=suffixe*1+1*1 ;\n\t\t\t\tajax_pack_element(document.getElementById('f_'+nom_id));\n\t\t\t}\n\t\t\t</script>\n\t\t\t"; } $ret .= "<input type='hidden' value='{$n}' name='n_" . $field["NAME"] . "'/>\n<div id='div_" . $field["NAME"] . "'>"; $readonly = ''; for ($i = 0; $i < $n; $i++) { $ret .= "<input type='text' class='saisie-50emr' id='f_" . $field["NAME"] . "_{$i}' completion='perso_" . $_custom_prefixe_ . "' persofield='" . $field["NAME"] . "' autfield='" . $field["NAME"] . "_{$i}' name='f_" . $field["NAME"] . "_{$i}' {$readonly} value=\"" . htmlentities($libelles[$i], ENT_QUOTES, $charset) . "\" />\n"; $ret .= "<input type='hidden' id='" . $field["NAME"] . "_{$i}' name='" . $field["NAME"] . "_{$i}' value=\"" . htmlentities($values[$i], ENT_QUOTES, $charset) . "\">"; $ret .= "<input type='button' class='bouton' value='...' onclick=\"openPopUp('./select.php?what=perso&caller={$caller}&p1=" . $field["NAME"] . "_{$i}&p2=f_" . $field["NAME"] . "_{$i}&perso_id=" . $field["ID"] . "&custom_prefixe=" . $_custom_prefixe_ . "&dyn={$val_dyn}&perso_name=" . $field['NAME'] . "', 'select_perso_" . $field["ID"] . "', 700, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes')\" />\n\t\t\t<input type='button' class='bouton' value='X' onclick=\"this.form.f_" . $field["NAME"] . "_{$i}.value=''; this.form." . $field["NAME"] . "_{$i}.value=''; \" />\n"; if ($i == 0 && $options[MULTIPLE][0][value] == "yes") { $ret .= " <input type='button' class='bouton' value='+' onClick=\"add_" . $field["NAME"] . "();\"/>"; } $ret .= "<br />"; } $ret .= "</div>"; } return $ret; }
function aff_text_i18n_empr($field, &$check_scripts) { global $charset, $base_path; global $msg, $langue_doc, $value_deflt_lang; if (!count($langue_doc)) { $langue_doc = new marc_list('lang'); $langue_doc = $langue_doc->table; } $options = $field['OPTIONS'][0]; $values = $field['VALUES']; $afield_name = $field["ID"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } foreach ($values as $value) { $exploded_value = explode("|||", $value); $ret .= "<input id=\"" . $field['NAME'] . "_" . $count . "\" type=\"text\" size=\"" . $options['SIZE'][0]['value'] . "\" maxlength=\"" . $options['MAXSIZE'][0]['value'] . "\" name=\"" . $field['NAME'] . "[" . $count . "]\" value=\"" . htmlentities($exploded_value[0], ENT_QUOTES, $charset) . "\">"; $ret .= "<input id=\"" . $field['NAME'] . "_lang_" . $count . "\" class=\"saisie-10emr\" type=\"text\" value=\"" . ($exploded_value[1] ? htmlentities($langue_doc[$exploded_value[1]], ENT_QUOTES, $charset) : htmlentities($langue_doc[$value_deflt_lang], ENT_QUOTES, $charset)) . "\" autfield=\"" . $field['NAME'] . "_lang_code_" . $count . "\" completion=\"langue\" autocomplete=\"off\">"; $ret .= "<input class=\"bouton\" type=\"button\" value=\"...\" onClick=\"openPopUp('" . $base_path . "/select.php?what=lang&caller='+this.form.name+'&p1=" . $field['NAME'] . "_lang_code_" . $count . "&p2=" . $field['NAME'] . "_lang_" . $count . "', 'select_lang', 500, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\">"; $ret .= "<input class=\"bouton\" type=\"button\" onclick=\"this.form." . $field['NAME'] . "_lang_" . $count . ".value=''; this.form." . $field['NAME'] . "_lang_code_" . $count . ".value=''; \" value=\"X\">"; $ret .= "<input id=\"" . $field['NAME'] . "_lang_code_" . $count . "\" type=\"hidden\" value=\"" . ($exploded_value[1] ? htmlentities($exploded_value[1], ENT_QUOTES, $charset) : htmlentities($value_deflt_lang, ENT_QUOTES, $charset)) . "\" name=\"" . $field['NAME'] . "_langs[" . $count . "]\">"; if ($options['REPEATABLE'][0]['value'] && !$count) { $ret .= '<input class="bouton" type="button" value="+" onclick="add_custom_text_i18n_(\'' . $afield_name . '\', \'' . addslashes($field['NAME']) . '\', \'' . $options['SIZE'][0]['value'] . '\', \'' . $options['MAXSIZE'][0]['value'] . '\')">'; } $ret .= "<br />"; $count++; } if ($options['REPEATABLE'][0]['value']) { $ret .= '<input id="customfield_text_i18n_' . $afield_name . '" type="hidden" name="customfield_text_' . $afield_name . '" value="' . $count . '">'; $ret .= '<div id="spaceformorecustomfieldtexti18n_' . $afield_name . '"></div>'; $ret .= "<script>\n\t\t\tfunction add_custom_text_i18n_(field_id, field_name, field_size, field_maxlen) {\n\t\t var count = document.getElementById('customfield_text_i18n_'+field_id).value;\n\t\t\t\tvar text = document.createElement('input');\n\t\t\t\ttext.setAttribute('id', field_name + '_' + count);\n\t\t text.setAttribute('name',field_name+'[' + count + ']');\n\t\t text.setAttribute('type','text');\n\t\t text.setAttribute('value','');\n\t\t text.setAttribute('size',field_size);\n\t\t text.setAttribute('maxlength',field_maxlen);\n\t\t\t\t\n\t\t\t\tvar lang = document.createElement('input');\n\t\t\t\tlang.setAttribute('id', field_name + '_lang_' + count);\n\t\t\t\tlang.setAttribute('class', 'saisie-10emr');\n\t\t\t\tlang.setAttribute('type', 'text');\n\t\t\t\tlang.setAttribute('value', '');\n\t\t\t\tlang.setAttribute('autfield', field_name + '_lang_code_' + count);\n\t\t\t\tlang.setAttribute('completion', 'langue');\n\t\t\t\tlang.setAttribute('autocomplete', 'off');\n\t\t\t\t\n\t\t\t\tvar select = document.createElement('input');\n\t\t\t\tselect.setAttribute('class', 'bouton');\n\t\t\t\tselect.setAttribute('type', 'button');\n\t\t\t\tselect.setAttribute('value', '...');\n\t\t\t\tselect.addEventListener('click', function(){\n\t\t\t\t\topenPopUp('" . $base_path . "/select.php?what=lang&caller='+this.form.name+'&p1=' + field_name + '_lang_code_' + count + '&p2=' + field_name + '_lang_' + count, 'select_lang', 500, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes');\n\t\t\t\t}, false);\n\t\t\t\t\n\t\t\t\tvar del = document.createElement('input');\n\t\t\t\tdel.setAttribute('class', 'bouton');\n\t\t\t\tdel.setAttribute('type', 'button');\n\t\t\t\tdel.setAttribute('value', 'X');\n\t\t\t\tdel.addEventListener('click', function(){\n\t\t\t\t\tdocument.getElementById(field_name + '_lang_' + count).value=''; document.getElementById(field_name + '_lang_code_' + count).value='';\n\t\t\t\t}, false);\n\t\t\t\t\t\t\t\n\t\t\t\tvar lang_code = document.createElement('input');\n\t\t\t\tlang_code.setAttribute('id', field_name + '_lang_code_' + count);\n\t\t\t\tlang_code.setAttribute('type', 'hidden');\n\t\t\t\tlang_code.setAttribute('value', '');\n\t\t\t\tlang_code.setAttribute('name', field_name + '_langs[' + count + ']');\n\t\t\t\t\n\t\t space=document.createElement('br');\n\t\t\t\t\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(text);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(lang);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(select);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(del);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(lang_code);\n\t\t\t\tdocument.getElementById('spaceformorecustomfieldtexti18n_'+field_id).appendChild(space);\n\t\t\t\t\n\t\t\t\tdocument.getElementById('customfield_text_i18n_'+field_id).value = document.getElementById('customfield_text_i18n_'+field_id).value * 1 + 1;\n\t\t\t}\n\t\t</script>"; } if ($field[MANDATORY] == 1) { $caller = get_form_name(); $check_scripts .= "if (document.forms[\"" . $caller . "\"].elements[\"" . $field[NAME] . "[]\"].value==\"\") return cancel_submit(\"" . sprintf($msg["parperso_field_is_needed"], $field[ALIAS]) . "\");\n"; } return $ret; }