fray...@users.adullact.net
unread,Apr 23, 2024, 9:39:06 AMApr 23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openmairie...@googlegroups.com
Author: fraynaud
Date: 2024-04-23 15:39:04 +0200 (Tue, 23 Apr 2024)
New Revision: 4936
Modified:
openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php
openmairie_exemple/branches/om5_rad/app/js/script.js
openmairie_exemple/branches/om5_rad/obj/om_forms.class.php
openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php
Log:
ajout des scripts de presentation om_forms
simplfication avec eneleve om_champs du menu et formulaire
Modified: openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php 2024-04-19 15:09:20 UTC (rev 4935)
+++ openmairie_exemple/branches/om5_rad/app/framework_openmairie.class.php 2024-04-23 13:39:04 UTC (rev 4936)
@@ -210,7 +210,7 @@
// {{{ Rubrique pg admin
//
$rubrik = array(
- "title" => _("pg admin"),
+ "title" => _("om5 no code"),
"class" => "application",
);
//
@@ -232,7 +232,7 @@
);
-
+ /*
$links[] = array(
"href" => OM_ROUTE_FORM."&obj=om_champs&idx=0&action=4",
"class" => "om_champs",
@@ -246,7 +246,7 @@
"index.php|om_champs[module=form]",
),
);
-
+ */
$links[] = array(
"href" => OM_ROUTE_FORM."&obj=om_forms&idx=0&action=4",
"class" => "om_forms",
Modified: openmairie_exemple/branches/om5_rad/app/js/script.js
===================================================================
--- openmairie_exemple/branches/om5_rad/app/js/script.js 2024-04-19 15:09:20 UTC (rev 4935)
+++ openmairie_exemple/branches/om5_rad/app/js/script.js 2024-04-23 13:39:04 UTC (rev 4936)
@@ -1,8 +1,9 @@
-/**
- * Gestion de l'ergonomie du formulaire OM_TABLES
- * ne fonctionne pas en sous formulaire
- */
-// Au chargement de la page recupere valeur nombre colonne
+
+// Gestion de l'ergonomie du formulaire OM_TABLES
+// ne fonctionne pas en sous formulaire
+
+
+//Au chargement de la page recupere valeur nombre colonne
$(function() {
// Au chargement de la page donc du formulaire on appelle la fonction
change_form_om_tables_nombre_colonne($("select#nombre_colonne").val());
@@ -36,121 +37,58 @@
}
}
-/**
- * Gestion de l'ergonomie du formulaire OM_CHAMPS
- * appel methode on_change et methode afterSousFormSpecificContent (initialisation)
- * F2 = sous formulaire
- */
+// Gestion de l'ergonomie du formulaire OM_FORMS
+// F2 = sous formulaire
-//
-function change_form_om_champs(champ) {
+function change_form_om_forms(champ) {
//alert(champ);
if (champ == undefined) {
- //champ='inconu';
- //select_type_minimum(champ); // cas ou data_type est hiddenstatic -> bloque ???
return;
}
-
-
+
+ // select type options
+ select = document.getElementById('type');
+ var options = select.options;
if(champ == 'cle_secondaire'){
- om_champs_standard(champ);
- // type minimum
- select_type_minimum(champ);
- }
- if(champ == 'character varying'){
- om_champs_standard(champ);
- // type file en plus
- select = document.getElementById('type');
- var options = select.options;
+ // nom de champ
+ document.f2.elements['tables'].hidden=false;
+ document.f2.elements['column_name'].hidden=true;
+ document.getElementById('lib-column_name').innerHTML='';
+ document.getElementById('lib-tables').innerHTML='Nom du champs';
+ // calcul
+ document.f2.elements['calcul'].hidden=true;
+ // type om
for (var i = 0; i < options.length; i++) {
if (options[i].value == 'html') {
- if(options[i].disabled===false)
- options[i].disabled=true;
+ options[i].disabled=true;
}
if (options[i].value == 'file') {
- if(options[i].disabled===true)
- options[i].disabled=false;
+ options[i].disabled=true;
}
}
- }
- if(champ == 'text'){
- om_champs_standard(champ);
- // type html en plus
- select = document.getElementById('type');
- var options = select.options;
+ }else{
+ document.f2.elements['tables'].hidden=true;
+ document.f2.elements['column_name'].hidden=false;
+ document.getElementById('lib-column_name').innerHTML='Nom du champs';
+ document.getElementById('lib-tables').innerHTML='';
+ // calcul
+ if(champ == 'integer' || champ == 'double precision' ){
+ document.f2.elements['calcul'].hidden=false;
+ }else{
+ document.f2.elements['calcul'].hidden=true;
+ }
for (var i = 0; i < options.length; i++) {
+ if (options[i].value == 'html') {
+ options[i].disabled=false;
+ }
if (options[i].value == 'file') {
- if(options[i].disabled===false);
- options[i].disabled=true;
+ options[i].disabled=false;
}
- if (options[i].value == 'html') {
- if(options[i].disabled===true);
- options[i].disabled=false;
- }
- }
+ }
+ //if(champ == 'text' || or champ =='character varying'){
+
}
- if(champ == 'integer'){
- om_champs_standard(champ);
- select_type_minimum(champ);
- }
- if(champ == 'date'){
- om_champs_standard(champ);
- select_type_minimum(champ);
- }
- if(champ == 'boolean'){
- om_champs_standard(champ);
- select_type_minimum(champ);
- }
- if(champ == 'double precision'){
- om_champs_standard(champ);
- select_type_minimum(champ);
- }
-}
-function select_type_minimum(champ) {
- // select type options
- select = document.getElementById('type');
- var options = select.options;
- for (var i = 0; i < options.length; i++) {
- if (options[i].value == 'html') {
- if(options[i].disabled===false)
- options[i].disabled=true;
- }
- if (options[i].value == 'file') {
- if(options[i].disabled===false)
- options[i].disabled=true;
- }
- }
+
}
-
-function om_champs_standard(champ) {
- if(champ == 'cle_secondaire'){
- // form specifique
- document.f2.elements['column_default'].hidden=true;
- document.f2.elements['tables'].hidden=false;
- document.f2.elements['column_name'].hidden=true;
- document.getElementById('lib-column_name').innerHTML='';
- document.getElementById('lib-tables').innerHTML='Nom du champs';
- //document.f2.elements['calcul'].hidden=true;
- //document.getElementById('lib-calcul').innerHTML='';
- }else{
-
- //if($champ=='double precision'){
- // document.f2.elements['calcul'].hidden=false;
- // document.getElementById('lib-calcul').innerHTML='calcul';
- //}else{
- // document.f2.elements['calcul'].hidden=true;
- // document.getElementById('lib-calcul').innerHTML='';
- //}
-
- document.f2.elements['type'].hidden=false;
- document.f2.elements['column_default'].hidden=true; //test
- document.f2.elements['tables'].hidden=true;
- document.f2.elements['column_name'].hidden=false;
- document.getElementById('lib-column_name').innerHTML='Nom du champs';
- document.getElementById('lib-tables').innerHTML='';
- }
-
-}
-
Modified: openmairie_exemple/branches/om5_rad/obj/om_forms.class.php
===================================================================
--- openmairie_exemple/branches/om5_rad/obj/om_forms.class.php 2024-04-19 15:09:20 UTC (rev 4935)
+++ openmairie_exemple/branches/om5_rad/obj/om_forms.class.php 2024-04-23 13:39:04 UTC (rev 4936)
@@ -34,12 +34,19 @@
// =======================
// Ergonomie du formulaire
// =======================
+
+ function afterSousFormSpecificContent() {
+ // initialiser les affichages des champs avec change_form_om_forms de script.js
+ // pb de cle secondaire qui est integer
+ echo '<script type="text/javascript">change_form_om_forms($("select#data_type").val());</script>';
+ }
+
+
function get_var_sql_forminc__champs() {
return array(
-
- "column_name", // clé ne peut pas être mis dans une autre position
"'' as data_type",
+ "column_name", // clé ne peut pas être mis dans une autre position sauf si exists return true
"'' as tables", // pour clé secondaire
"table_name",
"'' as table_schema",
@@ -53,11 +60,25 @@
"parametres->>'bloc' as bloc",
"parametres->>'position' as position",
"parametres->>'liste' as liste",
- "parametres->>'calcul' as calcul",
-
+ "parametres->>'calcul' as calcul",
);
}
+ function exists() {
+ //if (!isset($this->val[0]) || $this->val[0] == "") {
+ // return false;
+ //}
+ return true;
+ }
+
+
+
+ function get_default_libelle() {
+ return $this->getVal($this->clePrimaire);
+ }
+
+
+
function set_form_default_values(&$form, $maj, $validation) {
parent::set_form_default_values($form, $maj, $validation);
if($maj==0){
@@ -231,7 +252,7 @@
function setOnchange(&$form, $maj) {
//javascript controle client
$form->setOnchange('position','VerifNum(this)');
- // $form->setOnchange('data_type','change_form_om_forms(this.value)'); // a voir ***
+ $form->setOnchange('data_type','change_form_om_forms(this.value)'); // a voir ***
}
// ====================
Modified: openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php
===================================================================
--- openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php 2024-04-19 15:09:20 UTC (rev 4935)
+++ openmairie_exemple/branches/om5_rad/sql/pgsql/om_tables.inc.php 2024-04-23 13:39:04 UTC (rev 4936)
@@ -26,4 +26,7 @@
"parametres->>'recherche' as recherche",
);
-
+$sousformulaire = array(
+ 'om_forms',
+ 'om_contraintes',
+);