Objet : devel-adl
Archives de la liste
- From: svn AT agendadulibre.org
- To: devel AT agendadulibre.org
- Subject: [Devel] r282 - branches/dui
- Date: Sun, 8 Jul 2007 20:43:25 +0200 (CEST)
- List-archive: <http://lolut.utbm.info/pipermail/devel>
- List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>
Author: ldayot
Date: Sun Jul 8 20:43:21 2007
New Revision: 282
Log:
Desole, il y a encore plusieurs changements dans le meme commit.
Fonctionnenemnt sur un serveur n'ayant que UTF-8 et pas ISO8859-??.
Inclusion possible des fichiers includes/top.php et
includes/bottom.php en debut et fin de toutes les pages html s'ils
existent. Cela permet une integration facile sans modifier le code
initial, ca permet aussi de mettre a jour l'application sans devoir
refaire les modofications d'apparence.
Exemple sur http://agenda.jeudisepn.org
Ajout d'un style pour le formulaire de soumission d'evenement.
Unification des parties de formulaire pour les tags libres et de ceux
dans des categories.
Modified:
branches/dui/funcs.inc.php
Modified: branches/dui/funcs.inc.php
==============================================================================
--- branches/dui/funcs.inc.php (original)
+++ branches/dui/funcs.inc.php Sun Jul 8 20:43:21 2007
@@ -49,9 +49,12 @@
function calendar_setlocale()
{
if(setlocale(LC_TIME, "fr_FR") == false)
+ {
+ if(setlocale(LC_TIME, "fr_FR.UTF8") == false)
{
error ("Erreur locales");
}
+ }
}
function rss_feed_header ($href, $title)
@@ -81,18 +84,15 @@
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
- ?>
+?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $adl_title. " - ". $title; ?></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"/>
- <link rel="stylesheet" type="text/css" href="calendar.css"
title="Officielle" />
- <link rel="alternate stylesheet" type="text/css"
href="calendar2.css" title="Nouvelle" />
- <link rel="alternate stylesheet" type="text/css" href="air1.css"
title="Air1" />
- <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
+
<?php
rss_feed_header ("rss.php?region=all", $adl_short_title. ", ".
$adl_all_region);
@@ -102,14 +102,23 @@
rss_feed_header ("rss.php?region=" . $row->id, $adl_short_title. ", "
. $row->name);
}
- echo "\n</head>\n\n";
+ if (file_exists("includes/top.html"))
+ {
+ include("includes/top.html");
+ }
+ else
+ {
+ ?>
+ <link rel="stylesheet" type="text/css" href="calendar.css"
title="Officielle" />
+ <link rel="alternate stylesheet" type="text/css" href="calendar2.css"
title="Nouvelle" />
+ <link rel="alternate stylesheet" type="text/css" href="air1.css"
title="Air1" />
+ <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
+ <?php
+ echo "\n</head>\n\n";
- echo "<body>\n<div class=\"main\">\n";
-/* <div id="important">
- <p>Restez inform� en utilisant les <a href="rsslist.php">flux RSS</a> ou
les <a href="icallist.php">calendriers</a> !</p>
- <img src="lef-2007.png" width="100" style="float: right; margin-left:
10px; margin-right: 5px; margin-top: 5px; border: 0;"/>
- <p>Autour du 21 mars, f�tez le Libre avec <a
href="http://www.libre-en-fete.net">Libre en F�te</a> !</p>
-</div> */
+ echo "<body>\n";
+ }
+ echo "<div class=\"main\">\n";
echo "<h1><a href=\"index.php\">$adl_title</a></h1>\n";
echo "<p id=\"subtitle\"><em>$adl_subtitle</em></p>\n";
@@ -133,8 +142,16 @@
echo " - <a href=\"infos.php\">Informations</a>";
echo " - <a href=\"stats.php\">Statistiques</a>";
echo " - <a href=\"$adl_url_contact\">Contact</a></p>\n";
- echo "</div>\n</body>\n</html>\n";
+
+ if (file_exists("includes/bottom.html"))
+ {
+ include("includes/bottom.html");
+ }
+ else
+ {
+ echo "</div>\n</body>\n</html>\n";
+ }
}
function scramble_email ($email)
@@ -859,7 +876,7 @@
} // end if tiny_mce
?>
- <table>
+ <table class='form'>
<tr>
<td>
@@ -896,7 +913,7 @@
<td>
<b>D�crivez de la mani�re la plus compl�te possible votre
�v�nement.</b><br/>
<?php echo $adl_form_description_guide; ?>
- <textarea rows="25" cols="90" name="__event_description"><?php echo
$description;?></textarea><br/><br/>
+ <textarea rows="25" cols="70" name="__event_description"><?php echo
$description;?></textarea><br/><br/>
</td>
</tr>
@@ -988,7 +1005,7 @@
<?php
echo $adl_form_tags_guide;
- $oTags = selectWithoutCategoryTags($aTags, $fieldName="tags[0][]",
$multiple=true);
+ $oTags = selectCategoryTags($aTags, 0, $fieldName="tags[0]",
$multiple=true);
echo _("Dans les tags connus"). " : <br />". $oTags->HTML;
$tags = $oTags->tagsRest;
@@ -1060,7 +1077,7 @@
// output if HTML string select part of form
function selectTagsHTML($aTags)
{
- $oTags = selectWithoutCategoryTags($aTags, $fieldName="tags[tag]",
$multiple=false);
+ $oTags = selectCategoryTags($aTags, 0, $fieldName="tags[tag]",
$multiple=false);
$return = "<strong>". _("Tags"). "</strong> : {$oTags->HTML}<br />\n";
$aCategoryTags = selectWithCategoryTags($aTags);
foreach ($aCategoryTags->HTML as $category_id=>$aSelect)
@@ -1077,8 +1094,10 @@
{
global $db;
// TODO Select only tags used twice or more.
- // Or sort and class tags in alphabetical optgroup
- $ret = $db->query ("SELECT tags.name AS tag, tags_categories.id AS
category_id, tags_categories.name AS category, tags_categories.description as
description FROM tags LEFT JOIN tags_categories ON
tags_categories.id=category_id WHERE category_id>0 GROUP BY category_id,
tags.id ORDER BY tags_categories.name, tags.name");
+ // Select all categories
+ $ret = $db->query ("SELECT id, name, description ".
+ "FROM tags_categories ".
+ "ORDER BY tags_categories.name");
if ($ret == FALSE)
{
error ("Erreur lors de la recherche des tags");
@@ -1088,11 +1107,19 @@
$category_id=-1;
$return = array();
- $tagsSelect = array();
+ $tagsSelect = "";
while ($row = $db->fetchObject($ret))
{
- if ($category_id!=$row->category_id)
+ $oneline = selectCategoryTags($aTags, $row->id,
+ $fieldName="tags[{$row->id}]", $multiple=true);
+ $tagsSelect .= " ". $oneline->tagsSelect;
+
+ $return[$row->id]["categoryName"] = $row->name;
+ $return[$row->id]["categoryDescription"] = ($row->description!="" ?
$row->description : "");
+ $return[$row->id]["HTMLSelect"] = $oneline->HTML;
+
+/* if ($category_id!=$row->category_id)
{
if ($category_id!=-1)
{
@@ -1112,29 +1139,40 @@
($inArray = in_array($row->tag, $aTags) ? "selected='selected' " : "").
">{$row->tag}</option>\n";
if ($inArray) $tagsSelect[] = $row->tag;
+*/
} // end while
- if ($category_id!=-1)
+ /*if ($category_id!=-1)
{
$return[$category_id]["HTMLSelect"] .= "</select>";
$return[$category_id]["categoryDescription"] = ($description!="" ?
$description : "");
- }
+ }*/
$db->freeResult($ret);
$oTags->HTML = $return;
- $oTags->tagsSelect = implode(' ', $tagsSelect);
- $oTags->tagsRest = implode(' ', array_diff($aTags, $tagsSelect));
+ $oTags->tagsSelect = $tagsSelect; //implode(' ', $tagsSelect);
+ $oTags->tagsRest = implode(' ', array_diff($aTags, explode(' ',
$tagsSelect)));
+ //$oTags->tagsRest = $oneline->tagsRest;
+
return $oTags;
}
// Function to choose tags
// $aTags is an array (tag_name)
// output if HTML string select part of form
-function selectWithoutCategoryTags($aTags=array(), $fieldName="tags[0]",
$multiple=false)
+/*function selectWithoutCategoryTags($aTags=array(), $fieldName="tags[0]",
$multiple=false)
+{
+ return selectCategoryTags($aTags, $categoryId=0, $fieldName, $multiple);
+}*/
+
+// Function to choose tags
+// $aTags is an array (tag_name) of tags to be selected/checked
+// output if HTML string select/checkboxes part of form
+function selectCategoryTags($aTags=array(), $categoryId=0,
$fieldName="tags[0]", $multiple=false)
{
global $db;
// TODO Select only tags used twice or more.
// Or sort and class tags in alphabetical optgroup
- $ret = $db->query ("SELECT name, COUNT(event_id) AS n FROM tags LEF JOIN
tags_events ON tag_id=id WHERE category_id=0 GROUP BY id ORDER BY name");
+ $ret = $db->query ("SELECT name, COUNT(event_id) AS n FROM tags LEFT JOIN
tags_events ON tag_id=id WHERE category_id='$categoryId' GROUP BY id ORDER BY
name");
if ($ret == FALSE)
{
error ("Erreur lors de la recherche des tags");
@@ -1146,16 +1184,17 @@
$n=0;
$skeleton = "<label for='%1\$s'>%1\$s</label>". ($multiple ?
- "<input type=\"checkbox\" name=\"$fieldName\" %2\$s value=\"%1\$s\"
id=\"%1\$s\" /><label> / " :
+ "<input type=\"checkbox\" name=\"{$fieldName}[]\" %2\$s value=\"%1\$s\"
id=\"%1\$s\" /><label> / " :
"<option value=\"%1\$s\" %2\$s />%1\$s</option>");
$return = ($multiple ? "" : "<select
name='{$fieldName}'>\n<option></option>\n");
while ($row = $db->fetchObject($ret))
{
- // only tags used twice or more
+ // is this tag in $aTags = checked/selected
$inArray = in_array($row->name, $aTags);
- if ($row->n>1)
+ // only tags used twice or more
+ if ($categoryId>0 || $row->n>1)
{
$return .= sprintf($skeleton, $row->name, ($inArray ? ($multiple ?
"checked='checked'" : "selected='selected'") : ""));
if ($inArray) $tagsSelect[] = $row->name;
- [Devel] r282 - branches/dui, svn, 08/07/2007
Archives gérées par MHonArc 2.6.16.