[SPIP Zone] r4017 - in /_plugins_branche_stable_/_spip_1_9_0_/Forms: ./ action/ base/ exec/ img_pack/ inc/ lang/

Author: cedric@yterium.com
Date: Sat Jul 15 17:42:59 2006
New Revision: 4017

Log:
la version stable pour 1.9 vu que la version de dev necessitera la 1.9.1

Added:
    _plugins_branche_stable_/_spip_1_9_0_/Forms/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/action/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/action/forms_exporte_reponse_article.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/base/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/base/forms.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/exec/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/exec/forms_edit.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/exec/forms_reponses.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/exec/forms_telecharger.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/exec/forms_tous.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/forms_boutons.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/forms_filtres.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/forms_fonctions.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/forms_options.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/forms_style.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/img_pack/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/img_pack/form-24.gif (with props)
    _plugins_branche_stable_/_spip_1_9_0_/Forms/img_pack/form-24.png (with props)
    _plugins_branche_stable_/_spip_1_9_0_/Forms/img_pack/wrapper.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/inc/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/inc/forms.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_ar.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_bg.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_ca.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_cpf.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_da.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_de.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_en.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_eo.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_es.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_fa.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_fr.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_gl.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_hu.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_it.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_lb.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_nl.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_auv.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_gsc.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_lms.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_lnc.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_ni.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_prv.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_oc_va.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_pl.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_pt.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_pt_br.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_vi.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lang/forms_zh.php3
    _plugins_branche_stable_/_spip_1_9_0_/Forms/lisez-moi.txt
    _plugins_branche_stable_/_spip_1_9_0_/Forms/plugin.xml
    _plugins_branche_stable_/_spip_1_9_0_/Forms/sondage.html
    _plugins_branche_stable_/_spip_1_9_0_/Forms/spip_ecard.html
    _plugins_branche_stable_/_spip_1_9_0_/Forms/spip_ecard.php
    _plugins_branche_stable_/_spip_1_9_0_/Forms/spip_forms.css
    _plugins_branche_stable_/_spip_1_9_0_/Forms/valide_sondage.html

Added: _plugins_branche_stable_/_spip_1_9_0_/Forms/action/forms_exporte_reponse_article.php

--- _plugins_branche_stable_/_spip_1_9_0_/Forms/action/forms_exporte_reponse_article.php (added)
+++ _plugins_branche_stable_/_spip_1_9_0_/Forms/action/forms_exporte_reponse_article.php Sat Jul 15 17:42:59 2006
@@ -0,0 +1,103 @@
+<?php
+
+function action_forms_exporte_reponse_article(){
+ $id_reponse = _request('arg');
+ $hash = _request('hash');
+ $id_auteur = _request('id_auteur');
+ $redirect = _request('redirect');
+ if ($redirect==NULL) $redirect="";
+
+ if (verifier_action_auteur("forms_exporte_reponse_article-$id_reponse",$hash,$id_auteur)==TRUE){
+ // preparer l'article
+ $id_article = 0;
+ $res = spip_query("SELECT * FROM spip_reponses AS r LEFT JOIN spip_forms AS f ON f.id_form = r.id_form WHERE r.id_reponse=".spip_abstract_quote($id_reponse));
+ if ($row=spip_fetch_array($res)){
+ $id_form = $row['id_form'];
+ $titre = _L("Reponse $id_reponse");
+ $soustitre = _L($row['titre']);
+ $date = $row['date'];
+
+ $structure = unserialize($row['structure']);
+ foreach ($structure as $index => $t) {
+ $code = $t['code'];
+ $type = $t['type'];
+ $type_ext = $t['type_ext'];
+ $types[$id_form][$code] = $type;
+ $trans[$id_form][$code] = array();
+
+ if ($type == 'select' || $type == 'multiple') {
+ $trans[$id_form][$code] = $t['type_ext'];
+ }
+ else if ($type == 'mot') {
+ $id_groupe = intval($t['type_ext']['id_groupe']);
+ $query_mot = "SELECT id_mot, titre FROM spip_mots WHERE id_groupe=$id_groupe";
+ $result_mot = spip_query($query_mot);
+ while ($row = spip_fetch_array($result_mot)) {
+ $id_mot = $row['id_mot'];
+ $titre = $row['titre'];
+ $trans[$id_form][$code][$id_mot] = $titre;
+ }
+ }
+ }
+ // Lire les valeurs entrees
+ $query2 = "SELECT * FROM spip_reponses_champs WHERE id_reponse=".spip_abstract_quote($id_reponse);
+ $result2 = spip_query($query2);
+ $valeurs = array();
+ while ($row2 = spip_fetch_array($result2)) {
+ $champ = $row2['champ'];
+ if ($types[$id_form][$champ] == 'fichier') {
+ $valeurs[$champ][] = $row2['valeur'];
+ }
+ else if (isset($trans[$id_form][$champ][$row2['valeur']]))
+ $valeurs[$champ][] = $trans[$id_form][$champ][$row2['valeur']];
+ else
+ $valeurs[$champ][] = $row2['valeur'];
+ }
+
+ $texte = "";
+ foreach ($structure as $index => $t) {
+ $nom = $t['nom'];
+ $code = $t['code'];
+ $type = $t['type'];
+ if (!$v = $valeurs[$code]){
+ switch ($type){
+ case 'textestatique': $texte .= "\n{{{$nom}}}\n\n"; break;
+ case 'separateur': $texte .= "\n{{{{$nom}}}}\n\n"; break;
+ }
+ }
+ else {
+ $n = count($v);
+ if ($n > 1) {
+ $s = "\n-* " . join("\n-* ", $v);
+ }
+ else $s = join('', $v);
+
+ switch ($type){
+ case 'texte': $texte .= "\n{{{$nom}}}\n_ $s\n"; break;
+ case 'url': $texte .= "_ {{{$nom}}} : [$s -> $s]\n"; break;
+ case 'email': $texte .= "_ {{{$nom}}} : [$s -> mailto:$s]\n"; break;
+ default:
+ $texte .= "_ {{{$nom}}} : $s\n"; break;
+ }
+ }
+ }
+
+ // creer un article
+ include_spip('base/abstract_sql');
+ $id_article = spip_abstract_insert("spip_articles",
+ "(titre,soustitre,texte,date,statut)",
+ "(".spip_abstract_quote($titre).",".spip_abstract_quote($soustitre).",".spip_abstract_quote($texte).",".spip_abstract_quote($date).",'prepa')");
+
+ if ($id_article!=0){
+ spip_query("UPDATE spip_reponses SET id_article_export=$id_article WHERE id_reponse=".spip_abstract_quote($id_reponse));
+ }
+ }
+ if ($id_article!=0)
+ redirige_par_entete(generer_url_ecrire('articles_edit',"id_article=$id_article",true));
+ else
+ redirige_par_entete($redirect);
+ }
+ else
+ redirige_par_entete($redirect);
+}
+?>
\ No newline at end of file

Added: _plugins_branche_stable_/_spip_1_9_0_/Forms/base/forms.php

--- _plugins_branche_stable_/_spip_1_9_0_/Forms/base/forms.php (added)
+++ _plugins_branche_stable_/_spip_1_9_0_/Forms/base/forms.php Sat Jul 15 17:42:59 2006
@@ -0,0 +1,126 @@
+<?php
+/*
+ * forms
+ * version plug-in de spip_form
+ *
+ * Auteur :
+ * Antoine Pitrou
+ * adaptation en 182e puis plugin par cedric.morin@yterium.com
+ * © 2005,2006 - Distribue sous licence GNU/GPL
+ *
+ */
+//
+// Formulaires : inc_serialbase
+//
+
+$spip_forms = array(
+ "id_form" => "bigint(21) NOT NULL",
+ "titre" => "varchar(255) NOT NULL",
+ "descriptif" => "text",
+ "sondage" => "varchar(255) NOT NULL",
+ "structure" => "text",
+ "email" => "text",
+ "champconfirm" => "varchar(255) NOT NULL",
+ "texte" => "text",
+ "maj" => "TIMESTAMP");
+
+$spip_forms_key = array(
+ "PRIMARY KEY" => "id_form");
+
+$spip_reponses = array(
+ "id_reponse" => "bigint(21) NOT NULL",
+ "id_form" => "bigint(21) NOT NULL",
+ "date" => "DATETIME NOT NULL",
+ "ip" => "VARCHAR(255) NOT NULL",
+ "id_auteur" => "bigint(21) NOT NULL",
+ "id_article_export" => "bigint(21) NOT NULL",
+ "statut" => "VARCHAR(255) NOT NULL",
+ "cookie" => "VARCHAR(255) NOT NULL",
+ "maj" => "TIMESTAMP");
+
+$spip_reponses_key = array(
+ "PRIMARY KEY" => "id_reponse",
+ "KEY id_form" => "id_form, date",
+ "KEY date" => "date",
+ "KEY cookie" => "cookie",
+ "KEY id_auteur" => "id_auteur",
+ "KEY statut" => "statut, id_form");
+
+global $tables_principales;
+$tables_principales['spip_forms'] = array(
+ 'field' => &$spip_forms,
+ 'key' => &$spip_forms_key);
+
+$tables_principales['spip_reponses'] = array(
+ 'field' => &$spip_reponses,
+ 'key' => &$spip_reponses_key);
+
+/*
+function boucle_FORMS($id_boucle, &$boucles) {
+$boucle = &$boucles[$id_boucle];
+$id_table = $boucle -> id_table;

[... 3907 lines stripped ...]