il manquait un bout au dernier commit :/
authorx2000habouzit <x2000habouzit>
Thu, 19 Feb 2004 19:39:40 +0000 (19:39 +0000)
committerx2000habouzit <x2000habouzit>
Thu, 19 Feb 2004 19:39:40 +0000 (19:39 +0000)
etat_migration
include/auto.prepend.inc.php
include/xorg.page.inc.php
include/xorg.table-editor.inc.php [new file with mode: 0644]
templates/table-editor.tpl [new file with mode: 0644]

index b08dfd1..91b6bfd 100644 (file)
@@ -2,13 +2,13 @@
 
 ,---------------------.
 | NB Etats :          |
-|     -> rien de fait |
+| ;   -> rien de fait |
 | x   -> à tester     |
 | xx  -> en templates |
 | xxx -> anonyme      |
-| !!! -> postponned   |
+| ;!  -> postponned   |
 | --- -> supprimée    |
-| @@@ -> non modifiée |
+| xx! -> non modifiée |
 `---------------------'
 
 # PS pour trier : V<down><down>...<down>:!sort<enter>
 ------+-------------------------------------------+----------------
 Etat  | Ancien nom                                                               | Nouveau nom
 ------+-[ admin ]---------------------------------+----------------
-         | admin/admin_faqs.php                                          | 
-         | admin/admin_trombino.php                              | 
-         | admin/comptesPOP.php                                          | 
-         | admin/correction_adr.php                              | 
-         | admin/envoidirect.php                                         | 
-         | admin/evenements.php                                          | 
-         | admin/homonymes.php                                           | 
-         | admin/ins_confirmees.php                              | 
-         | admin/pg.php                                                          | 
-         | admin/utilisateurs.php                                        | 
+;        | admin/admin_faqs.php                                          | 
+;        | admin/admin_trombino.php                              | 
+;        | admin/comptesPOP.php                                          | 
+;        | admin/correction_adr.php                              | 
+;        | admin/envoidirect.php                                         | 
+;        | admin/evenements.php                                          | 
+;        | admin/homonymes.php                                           | 
+;        | admin/ins_confirmees.php                              | 
+;        | admin/pg.php                                                          | 
+;        | admin/utilisateurs.php                                        | 
 ------+-[ marketing ]-----------------------------+----------------
-         | admin/marketing.php                                           | marketing/
-         | admin/marketing_promo.php                             | marketing/
-         | admin/marketing_volontaire.php                        | marketing/
-         | admin/relance.php                                             | marketing/ 
-         | admin/utilisateurs_identification.php         | marketing/
-         | admin/utilisateurs_marketing.php              | marketing/
-         | marketing.php                                                         | marketing/index
+;        | admin/marketing.php                                           | marketing/
+;        | admin/marketing_promo.php                             | marketing/
+;        | admin/marketing_volontaire.php                        | marketing/
+;        | admin/relance.php                                             | marketing/ 
+;        | admin/utilisateurs_identification.php         | marketing/
+;        | admin/utilisateurs_marketing.php              | marketing/
+;        | marketing.php                                                         | marketing/index
 ------+-[ docs ]----------------------------------+----------------
-         | docs/FROM.php                                                         | docs/from.php
-         | en-cours.php                                                          | docs/en-cours.php
-         | info-groupesx.php                                             | docs/info-groupesx.php
-         | plan.php                                                              | ? docs/plan.php
-         | services.php                                                          | docs/services.php
+;        | docs/FROM.php                                                         | docs/from.php
+;        | en-cours.php                                                          | docs/en-cours.php
+;        | info-groupesx.php                                             | docs/info-groupesx.php
+;        | plan.php                                                              | ? docs/plan.php
+;        | services.php                                                          | docs/services.php
 ------+-[ stats ]---------------------------------+----------------
-         | parselogD.php                                                         | stats/...
-         | parselogN.php                                                         | stats/...
-         | parselogR.php                                                         | stats/...
-         | stats.php                                                             | stats/index.php
+;        | parselogD.php                                                         | stats/...
+;        | parselogN.php                                                         | stats/...
+;        | parselogR.php                                                         | stats/...
+;        | stats.php                                                             | stats/index.php
 ------+-[ listes ]--------------------------------+----------------
-         | listes/creation.php                                           | 
-         | listes/gere_listes.php                                        | 
-         | listes/gere_msg.php                                           | 
-         | listes/index.php                                              | 
-         | listes/liste.php                                              | 
-         | listes/mailtoins.inc.php                              | 
-         | listes/trombiliste.php                                        | 
+;        | listes/creation.php                                           | 
+;        | listes/gere_listes.php                                        | 
+;        | listes/gere_msg.php                                           | 
+;        | listes/index.php                                              | 
+;        | listes/liste.php                                              | 
+;        | listes/mailtoins.inc.php                              | 
+;        | listes/trombiliste.php                                        | 
 ------+-[ paiement ]------------------------------+----------------
-         | paiement/cyberpaiement.inc.php                        | 
-         | paiement/cyberpaiement_retour.php             | 
-         | paiement/index.php                                            | 
+;        | paiement/cyberpaiement.inc.php                        | 
+;        | paiement/cyberpaiement_retour.php             | 
+;        | paiement/index.php                                            | 
 ------+-[ sondages ]------------------------------+----------------
-         | sondage/accueil.php                                           | 
-         | sondage/bloc.php                                              | 
-         | sondage/droits.php                                            | 
-         | sondage/exemples.php                                          | 
-         | sondage/modifie.php                                           | 
-         | sondage/question.php                                          | 
-         | sondage/questionnaire.php                             | 
-         | sondage/reponse.php                                           | 
-         | sondage/resultats.php                                         | 
-         | sondage/titre.php                                             | 
-         | sondage/validation.php                                        | 
+;        | admin/gerer_sondages.php                              |
+;        | sondage/accueil.php                                           | 
+;        | sondage/bloc.php                                              | 
+;        | sondage/droits.php                                            | 
+;        | sondage/exemples.php                                          | 
+;        | sondage/modifie.php                                           | 
+;        | sondage/question.php                                          | 
+;        | sondage/questionnaire.php                             | 
+;        | sondage/reponse.php                                           | 
+;        | sondage/resultats.php                                         | 
+;        | sondage/titre.php                                             | 
+;        | sondage/validation.php                                        | 
 ------+-[ emails ... ]----------------------------+----------------
-         | routage-mail.php                                              | 
+;        | routage-mail.php                                              | 
 ------+-[ inscription + mdp ]---------------------+----------------
-         | inscrire.php                                                          | 
-         | maj.php                                                                       | 
-         | recovery.php                                                          | 
-         | step4.php                                                             | 
-         | tmpPWD.php                                                            | 
+;        | inscrire.php                                                          | 
+;        | maj.php                                                                       | 
+;        | recovery.php                                                          | 
+;        | step4.php                                                             | 
+;        | tmpPWD.php                                                            | 
 ------+-[ bordel ]--------------------------------+----------------
-         | domaine.php                                                           | 
-         | emploi.php                                                            | 
-         | emploi_public.php                                             | 
-         | evenements.php                                                        | 
-         | index.coupure.php                                             | 
-         | mescontacts_pdf.php                                           | 
-         | pg.confirm.php                                                        | 
-         | pg.php                                                                        | 
-         | profil.php                                                            | 
-         | profil2.php                                                           | 
-         | recherche.php                                                         | 
-         | trombino.php                                                          | 
-         | trombipromo.php                                                       | 
-         | x.php                                                                         | 
+;        | domaine.php                                                           | 
+;        | emploi.php                                                            | 
+;        | emploi_public.php                                             | 
+;        | evenements.php                                                        | 
+;        | index.coupure.php                                             | 
+;        | mescontacts_pdf.php                                           | 
+;        | pg.confirm.php                                                        | 
+;        | pg.php                                                                        | 
+;        | profil.php                                                            | 
+;        | profil2.php                                                           | 
+;        | recherche.php                                                         | 
+;        | trombino.php                                                          | 
+;        | trombipromo.php                                                       | 
+;        | x.php                                                                         | 
 ------+-[ admin ]---------------------------------+----------------
-!!!      | admin/gerer_applis.php                                        | \
-!!!      | admin/gerer_auth-groupex.php                          |  |
-!!!      | admin/gerer_binets.php                                        |  |
-!!!      | admin/gerer_coupure.php                                       |  |
-!!!      | admin/gerer_groupesx.php                              |   > utiliser les classes Diogènes, j'ai pas diogènes hors ligne :/
-!!!      | admin/gerer_listes.php                                        |  |
-!!!      | admin/gerer_paiement.php                              |  |
-!!!      | admin/gerer_skins.php                                         |  |---> mef la table a changé
-!!!      | admin/gerer_sondages.php                              | /
-!!!      | admin/logger.php                                              | \
-!!!      | admin/logger_actions.php                              |  \ Utiliser les classes de Jeremy, donc pour plus tard
-!!!      | admin/logger_events.php                                       |  /
-!!!      | admin/logger_user.php                                         | /
+;!       | admin/logger.php                                              | \
+;!       | admin/logger_actions.php                              |  \ Utiliser les classes de Jeremy, donc pour plus tard
+;!       | admin/logger_events.php                                       |  /
+;!       | admin/logger_user.php                                         | /
 ------+-[ news ]----------------------------------+----------------
-!!!      | news/abonnements.php                                          | \
-!!!      | news/article.php                                              |  |
-!!!      | news/attachment.php                                           |  |
-!!!      | news/config.news.inc.php                              |  |
-!!!      | news/faq_admin.php                                            |   \ s'en débarasser ?
-!!!      | news/index.php                                                        |   /
-!!!      | news/newsportal.php                                           |  |
-!!!      | news/offreemploi.php                                          |  |
-!!!      | news/post.php                                                         |  |
-!!!      | news/thread.php                                                       | /
-!!!      | confbanana.php                                                        | -> dépend de banana, à passer plus tard ...
+;!       | news/abonnements.php                                          | \
+;!       | news/article.php                                              |  |
+;!       | news/attachment.php                                           |  |
+;!       | news/config.news.inc.php                              |  |
+;!       | news/faq_admin.php                                            |   \ s'en débarasser ?
+;!       | news/index.php                                                        |   /
+;!       | news/newsportal.php                                           |  |
+;!       | news/offreemploi.php                                          |  |
+;!       | news/post.php                                                         |  |
+;!       | news/thread.php                                                       | /
+;!       | confbanana.php                                                        | -> dépend de banana, à passer plus tard ...
 ------+-[ trackers ]------------------------------+----------------
-         | trackers/tracker_show.php                             | -
-         | trackers/tracker_show_rq.php                          | -
-         | trackers/index.php                                            | -
-         | trackers/tracker_admin.php                            | -
+;        | trackers/tracker_show.php                             | -
+;        | trackers/tracker_show_rq.php                          | -
+;        | trackers/index.php                                            | -
+;        | trackers/tracker_admin.php                            | -
 ------+-------------------------------------------+----------------
-@@@      | groupex/donne-chall.php                                       | -
-@@@      | groupex/export-econfiance.php                         | -
-@@@      | redirect/error.php                                            | -
-@@@      | redirect/redirect.php                                         | -
 x        | epouse.php                                                            | -
 x        | parselog.php                                                          | stats/...
 xx       | AccesPermanentOff.php                                         | cookie_off.php
@@ -139,6 +127,14 @@ xx   | admin/ax-xorg.php                                             | -
 xx       | admin/deces_promo.php                                         | -
 xx       | admin/FormatePrenomNOM2.php                           | scripts/
 xx       | admin/FormatePrenomNOM.php                            | scripts/
+xx       | admin/gerer_applis.php                                        | -
+xx       | admin/gerer_auth-groupex.php                          |
+xx       | admin/gerer_binets.php                                        |
+xx       | admin/gerer_coupure.php                                       |
+xx       | admin/gerer_groupesx.php                              |
+xx       | admin/gerer_listes.php                                        |
+xx       | admin/gerer_paiement.php                              |
+xx       | admin/gerer_skins.php                                         |
 xx       | admin/graph_promo.php                                         | stats/graph_promo.php
 xx       | admin/index.php                                                       | -
 xx       | admin/newsletter_archi.php                            | -
@@ -178,6 +174,8 @@ xx    | ethique.php                                                           | docs/ethique.php
 xx       | exit.php                                                              | -
 xx       | faq.php                                                                       | docs/faq.php
 xx       | getphoto.php                                                          | -
+xx!      | groupex/donne-chall.php                                       | -
+xx!      | groupex/export-econfiance.php                         | -
 xx       | groupex.php                                                           | groupex/index.php 
 xx       | index.php                                                             | -
 xx       | login.php                                                             | -
@@ -188,6 +186,8 @@ xx    | newsletter.php                                                        | -
 xx       | newsletter_req.php                                            | -
 xx       | pattecassee.php                                                       | -
 xx       | preferences.php                                                       | -
+xx!      | redirect/error.php                                            | -
+xx!      | redirect/redirect.php                                         | -
 xx       | rss.php                                                                       | -
 xx       | secu.php                                                              | docs/secu.php
 xx       | sendmail.php                                                          | -
index 17599bc..47c3470 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+
+ini_set('include_path', '/home/x2000habouzit/dev/diogenes/lib/:'.ini_get('include_path'));
 require("config.xorg.inc.php") ;
 setlocale(LC_TIME, "fr_FR");
 require("xorg.common.inc.php");
@@ -37,4 +39,11 @@ function new_admin_page($tpl_name, $popup=false, $tpl_head="") {
     _new_page(SKINNED, $tpl_name, $tpl_head, AUTH_MDP, $popup, true);
 }
 
+function new_admin_table_editor($table,$idfield) {
+    global $editor;
+    new_admin_page('table-editor.tpl');
+    require('xorg.table-editor.inc.php');
+    $editor = new XOrgAdminTableEditor($table,$idfield);
+}
+
 ?>
index b96e1b1..ecb14a7 100644 (file)
@@ -59,7 +59,7 @@ class XorgPage extends DiogenesCorePage {
         $this->doAuth();
     }
 
-    function display($append_to_id="") {
+    function run($append_to_id="") {
         global $baseurl, $site_dev;
         if($this->_page_type == NO_SKIN)
             parent::display($this->_tpl);
diff --git a/include/xorg.table-editor.inc.php b/include/xorg.table-editor.inc.php
new file mode 100644 (file)
index 0000000..9a02ebb
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+require_once('diogenes.table-editor.inc.php');
+
+class XOrgAdminTableEditor extends DiogenesTableEditor {
+    function XOrgTableEditor($table,$idfield) {
+        $this->DiogenesTableEditor($table,$idfield);
+    }
+
+    function assign($var_name, $contenu) {
+        global $page;
+        $page->assign($var_name, $contenu);
+    }
+    
+    function run() {
+        global $page;
+        parent::run($page, 'table-editor.tpl', false);
+        $page->run();
+    }
+}
+
+?>
diff --git a/templates/table-editor.tpl b/templates/table-editor.tpl
new file mode 100644 (file)
index 0000000..46d3921
--- /dev/null
@@ -0,0 +1,126 @@
+{dynamic}
+
+<div class="rubrique">
+    {$title}
+</div>
+
+{if !$doedit}
+
+{literal}
+<script language="javascript" type="text/javascript">
+  <!--
+  function del( myid ) {
+    if (confirm ("You are about to delete this entry. Do you want to proceed?")) {
+      document.operations.action.value = "del";
+      document.operations.{/literal}{$prefix}{literal}id.value = myid;
+      document.operations.submit();
+      return true;
+    }
+  }
+  function edit( myid ) {
+    document.operations.action.value = "edit";
+    document.operations.{/literal}{$prefix}{literal}id.value = myid;
+    document.operations.submit();
+    return true;
+  }
+  // -->
+</script>
+{/literal}
+
+<form method="post" action="{$smarty.server.PHP_SELF}" name="operations">
+<input type="hidden" name="action" value="" />
+<input type="hidden" name="{$prefix}id" value="" />
+</form>
+
+<table class="bicol">
+<tr>
+  <th>id</th>
+  {foreach from=$vars item=myval}
+  {if $myval.sum}<th>{$myval.desc}</th>{/if}
+  {/foreach}
+  <th>action</th>
+</tr>
+<tr class="impair">
+  <td colspan="{$ncols}"><strong>nouvelle entrée</strong></td>
+  <td class="action">
+    <a href="javascript:edit('');">create</a>
+  </td>
+</tr>
+{foreach from=$rows item=myrow}{assign var="myarr" value=$myrow[2]}
+<tr class="{cycle values="pair,impair"}">
+  <td>{$myrow[1]}</td>
+{foreach from=$vars key=mykey item=myval}
+{if $myval.sum}
+  <td>
+  {if $myval.type=="timestamp"}
+  <small>{$myarr.$mykey|date_format:"%Y-%m-%d %H:%M:%S"}</small>
+  {else}
+  {$myarr.$mykey}
+  {/if}
+  </td>
+{/if}
+{/foreach}
+  <td class="action">
+    <a href="javascript:edit('{$myrow[1]}');">edit</a>
+    <a href="javascript:del('{$myrow[1]}');">delete</a>
+{foreach from=$myrow[3] item=myaction}
+    {a lnk=$myaction}
+{/foreach}
+  </td>
+</tr>
+{/foreach}
+
+</table>
+
+{else}
+
+<form method="post" action="{$smarty.server.PHP_SELF}">
+<input type="hidden" name="action" value="update">
+{if $id!=''}
+<input type="hidden" name="{$prefix}id" value="{$id}">
+{/if}
+<table class="bicol">
+<tr class="impair">
+  <th colspan="2">
+  {if $id!=''}modification de l'entrée {$id}
+  {else}nouvelle entrée{/if}
+  </th>
+</tr>
+{foreach from=$vars key=mykey item=myval}
+{if $mykey != $idfield}
+<tr class="{cycle values="pair,impair"}">
+  <td>
+    <strong>{$myval.desc}</strong>
+    {if $myval.type=="password"}<br /><em>(blank=no change)</em>{/if}
+  </td>
+  <td>
+{if $myval.type=="textarea"}
+    <textarea name="{$prefix}{$mykey}" rows="10" cols="70">{$myval.value|escape}</textarea>
+{elseif $myval.type=="set"}
+    {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.value}
+{elseif $myval.type=="timestamp"}
+    <input type="text" name="{$prefix}{$mykey}" value="{$myval.value|date_format:"%Y-%m-%d %H:%M:%S"}" />
+{elseif $myval.type=="password"}
+    <input type="password" name="{$prefix}{$mykey}" size="40" />
+{else}
+    <input type="{$myval.type}" name="{$prefix}{$mykey}" size="40" value="{$myval.value|escape}" />
+{/if}
+  </td>
+</tr>
+{/if}
+{/foreach}
+</table>
+
+<p class="center">
+  <input type="submit" value="enregistrer" />
+</p>
+
+</form>
+
+<p>
+  <a href="{$smarty.server.PHP_SELF}">back</a>
+</p>
+
+{/if}
+
+{/dynamic}