fusionner
authorcavaliet
Tue, 14 Jun 2011 13:08:22 +0200
changeset 27 056c19e37eab
parent 25 e5f8cb1020c8 (current diff)
parent 26 699957597026 (diff)
child 28 2cc86e8db2ec
fusionner
web/hdabo/static/hdabo/js/hdabo.js
web/hdabo/templates/partial/organisation_list.html
web/hdabo/urls.py
web/hdabo/views.py
--- a/web/hdabo/static/hdabo/js/hdabo.js	Tue Jun 14 12:56:48 2011 +0200
+++ b/web/hdabo/static/hdabo/js/hdabo.js	Tue Jun 14 13:08:22 2011 +0200
@@ -1,190 +1,232 @@
-// -*- coding: utf-8 -*-
-function init_tags_events()
-{
-    // Up and down management for tag table lines
-    $(".up,.down").click(function(){
-        tag_up_down(this);
-    });
-    // Remove tag for a datasheet's list
-    $(".remove_tag_from_list").click(function(){
-        if(confirm("Confirmez-vous la suppression du tag \"" + $(this).attr('alt') + "\" de la liste courante ?")){
-            remove_tag_from_list(this);
-        }
-    });
-    //activate_wp_cb
-    $(".activate_wp_cb").click(function(e){
-        new_checked = $(this).is(':checked');
-        if(new_checked){
-            question = "Confirmez-vous l'activation du lien Wikipédia pour le tag \"" + $(this).attr('alt') + "\" ?";
-        } else {
-            question = "Confirmez-vous la désactivation du lien Wikipédia pour le tag \"" + $(this).attr('alt') + "\" ?";
-        }
-        if(confirm(question)){
-            validate_wp_link(this);
-        }
-        else{
-            // Since the click event is dispatched after the checked changed, we change the checked changed if confirm is false.
-            e.preventDefault(); // unvalidates user's click
-            $(this).attr('checked', !new_checked);
-        }
-    });
-    
-    $(".reset_wp_info").click(function(e){
-        if(confirm("Confirmez vous le réytablissement du label original de ce tag ?")){
-            reset_wp_info(this);
-        }
-    });
-    
-        
-    $(".wikipediatag").editable(modify_tag_url, { 
-    	indicator : "<img src='"+static_url+"hdabo/img/indicator.gif'>",
-    	type      : "autocomplete",
-    	tooltip   : "Cliquer pour éditer...",
-    	onblur    : "submit",
-    	submitdata: {csrfmiddlewaretoken:global_csrf_token, datasheet_id:$('#datasheet_id').val()},
-    	callback  : function(value, settings) {
-            $('#tag_table_container').html(value);
-            init_tags_events();
-    	},
-    	autocomplete : {
-			source: function( request, response ) {
-				$.ajax({
-					url: "http://fr.wikipedia.org/w/api.php",
-					dataType: "jsonp",
-					data: {
-						action: "opensearch",
-						limit: "20",
-						namespace: "0",
-						format: "json",
-						search: request.term
-					},
-					success: function( data ) {
-						response( $.map( data[1], function( item ) {
-							return {
-								label: item,
-								value: item
-							}
-						}));
-					}
-				});
-			},
-			minLength: 2,
-			open: function() {
-				$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
-			},
-			close: function() {
-				$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
-			}    		
-    	}
-    });
-}
-
-function validate_wp_link(cb)
-{
-    var url = validate_wp_link_url;
-    var id_tag = $(cb).attr('id');
-    new_checked = $(cb).is(':checked');
-    $.ajax({
-        url: url,
-        type: 'POST',
-        data: {csrfmiddlewaretoken:global_csrf_token,
-               datasheet_id:$('#datasheet_id').val(),
-               tag_id:id_tag,
-               activated:new_checked
-               },
-        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
-        //dataType: 'json',
-        success: function(msg, textStatus, XMLHttpRequest) {
-            $('#tag_table_container').html(msg);
-            init_tags_events();
-        }
-    });
-}
-
-function remove_tag_from_list(btn)
-{
-    var url = remove_tag_from_list_url;
-    var id_tag = $(btn).attr('id');
-    $.ajax({
-        url: url,
-        type: 'POST',
-        data: {csrfmiddlewaretoken:global_csrf_token,
-               datasheet_id:$('#datasheet_id').val(),
-               tag_id:id_tag
-               },
-        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
-        //dataType: 'json',
-        success: function(msg, textStatus, XMLHttpRequest) {
-            $('#tag_table_container').html(msg);
-            init_tags_events();
-        }
-    });
-}
-
-function remove_tag_from_list(btn)
-{
-    var url = remove_tag_from_list_url;
-    var id_tag = $(btn).attr('id');
-    $.ajax({
-        url: url,
-        type: 'POST',
-        data: {csrfmiddlewaretoken:global_csrf_token, 
-               datasheet_id:$('#datasheet_id').val(),
-               tag_id:id_tag
-               },
-        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
-        //dataType: 'json',
-        success: function(msg, textStatus, XMLHttpRequest) {
-            $('#tag_table_container').html(msg);
-            init_tags_events();
-        }
-    });
-}
-
-function tag_up_down(arrow)
-{
-    if ($(arrow).is(".up")) {
-        mv = "u";
-    } else {
-        mv = "d";
-    }
-    var url = tag_up_down_url;
-    var id_tag = $(arrow).attr('id');
-    // This indicates the position (from 0) of the tag in the list. NB : it is different from the TagSheet.order in the database.
-    var pos_tag = $(arrow).attr('pos');
-    $.ajax({
-        url: url,
-        type: 'POST',
-        data: {csrfmiddlewaretoken:global_csrf_token, 
-               datasheet_id:$('#datasheet_id').val(),
-               tag_id:id_tag,
-               move:mv,
-               tag_pos:pos_tag
-               },
-        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
-        //dataType: 'json',
-        success: function(msg, textStatus, XMLHttpRequest) {
-            $('#tag_table_container').html(msg);
-            init_tags_events();
-        }
-    });
-}
-
-function reset_wp_info(cell)
-{
-	var tag_id = $(cell).html()
-	
-	$.ajax({
-		url: reset_wp_info_url,
-		type: 'POST',
-		data: {
-			csrfmiddlewaretoken:global_csrf_token, 
-            datasheet_id:$('#datasheet_id').val(),
-            tag_id:tag_id
-        },
-        success: function(msg, textStatus, XMLHttpRequest) {
-            $('#tag_table_container').html(msg);
-            init_tags_events();
-        }
-	});
+// -*- coding: utf-8 -*-
+function init_tags_events()
+{
+    // Up and down management for tag table lines
+    $(".up,.down").click(function(){
+        tag_up_down(this);
+    });
+    // Remove tag for a datasheet's list
+    $(".remove_tag_from_list").click(function(){
+        if(confirm("Confirmez-vous la suppression du tag \"" + $(this).attr('alt') + "\" de la liste courante ?")){
+            remove_tag_from_list(this);
+        }
+    });
+    //activate_wp_cb
+    $(".activate_wp_cb").click(function(e){
+        new_checked = $(this).is(':checked');
+        if(new_checked){
+            question = "Confirmez-vous l'activation du lien Wikipédia pour le tag \"" + $(this).attr('alt') + "\" ?";
+        } else {
+            question = "Confirmez-vous la désactivation du lien Wikipédia pour le tag \"" + $(this).attr('alt') + "\" ?";
+        }
+        if(confirm(question)){
+            validate_wp_link(this);
+        }
+        else{
+            // Since the click event is dispatched after the checked changed, we change the checked changed if confirm is false.
+            e.preventDefault(); // unvalidates user's click
+            $(this).attr('checked', !new_checked);
+        }
+    });
+    
+    $("#wp_search").autocomplete({
+        source: function( request, response ) {
+            $.ajax({
+                url: "http://fr.wikipedia.org/w/api.php",
+                dataType: "jsonp",
+                data: {
+                    action: "opensearch",
+                    limit: "20",
+                    namespace: "0",
+                    format: "json",
+                    search: request.term
+                },
+                success: function( data ) {
+                    response( $.map( data[1], function( item ) {
+                        return {
+                            label: item,
+                            value: item
+                        }
+                    }));
+                }
+            });
+        },
+        minLength: 2,
+        open: function() {
+            $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
+        },
+        close: function() {
+            $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
+            $("#ok_search").show();
+        }
+    });
+    
+    $("#ok_search").click(function(){
+        if($("#wp_search").val()!=""){
+            $("#ok_search").html("<img src='"+static_url+"hdabo/img/indicator.gif'>");
+            var url = add_tag_url;
+            $.ajax({
+                url: url,
+                type: 'POST',
+                data: {csrfmiddlewaretoken:global_csrf_token,
+                       datasheet_id:$('#datasheet_id').val(),
+                       value:$("#wp_search").val()
+                       },
+                // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
+                //dataType: 'json',
+                success: function(msg, textStatus, XMLHttpRequest) {
+                    $('#tag_table_container').html(msg);
+                    init_tags_events();
+                    // And scroll to the bottom
+                    $("html").animate({ scrollTop: $(document).height() }, 500);
+                },
+                complete: function(){
+                    // We empty the input and hide the ok button
+                    $("#wp_search").val("");
+                    $("#ok_search").hide();
+                    $("#ok_search").html("<b>OK</b>");
+                }
+            });
+        }
+    });
+    
+    $.editable.addInputType('autocomplete', {
+    	element : $.editable.types.text.element,
+    	plugin : function(settings, original) {
+    		$('input', this).autocomplete(settings.autocomplete);
+    	}
+    });
+    
+    $(".wikipediatag").editable(modify_tag_url, { 
+    	indicator : "<img src='"+static_url+"hdabo/img/indicator.gif'>",
+    	type      : "autocomplete",
+    	tooltip   : "Cliquer pour éditer...",
+    	onblur    : "submit",
+    	submitdata: {csrfmiddlewaretoken:global_csrf_token, datasheet_id:$('#datasheet_id').val()},
+    	callback  : function(value, settings) {
+            $('#tag_table_container').html(value);
+            init_tags_events();
+    	},
+    	autocomplete : {
+			source: function( request, response ) {
+				$.ajax({
+					url: "http://fr.wikipedia.org/w/api.php",
+					dataType: "jsonp",
+					data: {
+						action: "opensearch",
+						limit: "20",
+						namespace: "0",
+						format: "json",
+						search: request.term
+					},
+					success: function( data ) {
+						response( $.map( data[1], function( item ) {
+							return {
+								label: item,
+								value: item
+							}
+						}));
+					}
+				});
+			},
+			minLength: 2,
+			open: function() {
+				$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
+			},
+			close: function() {
+				$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
+			}    		
+    	}
+    });
+}
+
+function validate_wp_link(cb)
+{
+    var url = validate_wp_link_url;
+    var id_tag = $(cb).attr('id');
+    new_checked = $(cb).is(':checked');
+    $.ajax({
+        url: url,
+        type: 'POST',
+        data: {csrfmiddlewaretoken:global_csrf_token,
+               datasheet_id:$('#datasheet_id').val(),
+               tag_id:id_tag,
+               activated:new_checked
+               },
+        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
+        //dataType: 'json',
+        success: function(msg, textStatus, XMLHttpRequest) {
+            $('#tag_table_container').html(msg);
+            init_tags_events();
+        }
+    });
+}
+
+function remove_tag_from_list(btn)
+{
+    var url = remove_tag_from_list_url;
+    var id_tag = $(btn).attr('id');
+    $.ajax({
+        url: url,
+        type: 'POST',
+        data: {csrfmiddlewaretoken:global_csrf_token,
+               datasheet_id:$('#datasheet_id').val(),
+               tag_id:id_tag
+               },
+        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
+        //dataType: 'json',
+        success: function(msg, textStatus, XMLHttpRequest) {
+            $('#tag_table_container').html(msg);
+            init_tags_events();
+        }
+    });
+}
+
+function remove_tag_from_list(btn)
+{
+    var url = remove_tag_from_list_url;
+    var id_tag = $(btn).attr('id');
+    $.ajax({
+        url: url,
+        type: 'POST',
+        data: {csrfmiddlewaretoken:global_csrf_token, 
+               datasheet_id:$('#datasheet_id').val(),
+               tag_id:id_tag
+               },
+        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
+        //dataType: 'json',
+        success: function(msg, textStatus, XMLHttpRequest) {
+            $('#tag_table_container').html(msg);
+            init_tags_events();
+        }
+    });
+}
+
+function tag_up_down(arrow)
+{
+    if ($(arrow).is(".up")) {
+        mv = "u";
+    } else {
+        mv = "d";
+    }
+    var url = tag_up_down_url;
+    var id_tag = $(arrow).attr('id');
+    // This indicates the position (from 0) of the tag in the list. NB : it is different from the TagSheet.order in the database.
+    var pos_tag = $(arrow).attr('pos');
+    $.ajax({
+        url: url,
+        type: 'POST',
+        data: {csrfmiddlewaretoken:global_csrf_token, 
+               datasheet_id:$('#datasheet_id').val(),
+               tag_id:id_tag,
+               move:mv,
+               tag_pos:pos_tag
+               },
+        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
+        //dataType: 'json',
+        success: function(msg, textStatus, XMLHttpRequest) {
+            $('#tag_table_container').html(msg);
+            init_tags_events();
+        }
+    });
 }
\ No newline at end of file
--- a/web/hdabo/templates/hdabo_base.html	Tue Jun 14 12:56:48 2011 +0200
+++ b/web/hdabo/templates/hdabo_base.html	Tue Jun 14 13:08:22 2011 +0200
@@ -1,79 +1,80 @@
-{% load i18n %}
-{% comment %}{% load logintag %}{% endcomment %}
-{% comment %}{% load navigation %}{% endcomment %}
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}">
-<head>
-{% block head %}
-	<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
-    <meta http-equiv="content-language" content="{{LANGUAGE_CODE}}" />
-    <link rel="SHORTCUT ICON" href="{{STATIC_URL}}hdabo/img/favicon.ico" />
-    <title>{% block title %}HDA-BO{% endblock %}</title>
-    {% block js_import %}
-    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.min.js"></script>
-    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.nyroModal.min.js"></script>
-    <!--[if IE 6]>
-    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.nyroModal-ie6.min.js"></script>
-    <![endif]-->
-    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.qtip.min.js"></script>
-    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.validate.js" ></script>
-    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/hdabo.js"></script>
-    {% endblock %}
-    
-    {% block css_declaration %}
-    <style type="text/css">
-		.rounded {
-			behavior:url("{{STATIC_URL}}hdabo/css/border-radius.htc");
-		}
-	</style>
-	{% endblock %}
-    
-    {% block css_import %}
-    
-    <link rel="stylesheet" href="{{STATIC_URL}}hdabo/css/style.css" type="text/css"/>
-    <link rel="stylesheet" href="{{STATIC_URL}}hdabo/css/nyroModal.css" type="text/css"/>
-    {% endblock %}
-    
-    {% block js_declaration %}
-    {% endblock %}
-    
-{% endblock %}
-</head>
-<body>
-{% block body %}
-<div class="container">
-<div id="header">      
-    {% block header %}
-    <div id="header_left">
-    	<p><a href="{% url hdabo.views.home %}">HDA<span class="hda_blue">BO</span></a></p>
-    </div>
-    {% endblock %}
-</div>
-<div id="content" class="span-24 last">
-    <div id="toolbar">
-    {% block toolbar %}
-    <p><a href="{% url hdabo.views.home %}">home</a></p>
-    {% endblock %}
-    </div>
-    <div id="inner_content">
-    {% block content %}
-    {% endblock %}
-    </div>      
-</div>
-<div id="footer" class="span-24 last">
-    {% block footer %}
-    <div class="footer_img">
-    <a href="http://www.iri.centrepompidou.fr" target="_blank"><img src="{{STATIC_URL}}hdabo/img/logo_IRI_footer.png" alt="Logo IRI" /></a>
-    </div>
-    <div style="float: right; text-align: right;" class="small" id="copyright_version">
-        <div>©2011 <a style="text-decoration: none; color: #4F5155;" href="http://www.iri.centrepompidou.fr" target="_blank">IRI</a></div>
-        <div id="versionwrapper"><span class="version" id="version">{{VERSION}}</span></div>
-    </div>
-    {% endblock %}
-</div>
-</div>
-{% endblock %}
-</body>
-</html>
+{% load i18n %}
+{% comment %}{% load logintag %}{% endcomment %}
+{% comment %}{% load navigation %}{% endcomment %}
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}">
+<head>
+{% block head %}
+	<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
+    <meta http-equiv="content-language" content="{{LANGUAGE_CODE}}" />
+    <link rel="SHORTCUT ICON" href="{{STATIC_URL}}hdabo/img/favicon.ico" />
+    <title>{% block title %}HDA-BO{% endblock %}</title>
+    {% block js_import %}
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/hdabo.js"></script>
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.min.js"></script>
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.nyroModal.min.js"></script>
+    <!--[if IE 6]>
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.nyroModal-ie6.min.js"></script>
+    <![endif]-->
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.qtip.min.js"></script>
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.validate.js" ></script>
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.textchange.min.js" ></script>
+    {% endblock %}
+    
+    {% block css_declaration %}
+    <style type="text/css">
+		.rounded {
+			behavior:url("{{STATIC_URL}}hdabo/css/border-radius.htc");
+		}
+	</style>
+	{% endblock %}
+    
+    {% block css_import %}
+    
+    <link rel="stylesheet" href="{{STATIC_URL}}hdabo/css/style.css" type="text/css"/>
+    <link rel="stylesheet" href="{{STATIC_URL}}hdabo/css/nyroModal.css" type="text/css"/>
+    {% endblock %}
+    
+    {% block js_declaration %}
+    {% endblock %}
+    
+{% endblock %}
+</head>
+<body>
+{% block body %}
+<div class="container">
+<div id="header">      
+    {% block header %}
+    <div id="header_left">
+    	<p><a href="{% url hdabo.views.home %}">HDA<span class="hda_blue">BO</span></a></p>
+    </div>
+    {% endblock %}
+</div>
+<div id="content" class="span-24 last">
+    <div id="toolbar">
+    {% block toolbar %}
+    <p><a href="{% url hdabo.views.home %}">home</a></p>
+    {% endblock %}
+    </div>
+    <div id="inner_content">
+    {% block content %}
+    {% endblock %}
+    </div>      
+</div>
+<div id="footer" class="span-24 last">
+    {% block footer %}
+    <div class="footer_img">
+    <a href="http://www.iri.centrepompidou.fr" target="_blank"><img src="{{STATIC_URL}}hdabo/img/logo_IRI_footer.png" alt="Logo IRI" /></a>
+    </div>
+    <div style="float: right; text-align: right;" class="small" id="copyright_version">
+        <div>©2011 <a style="text-decoration: none; color: #4F5155;" href="http://www.iri.centrepompidou.fr" target="_blank">IRI</a></div>
+        <div id="versionwrapper"><span class="version" id="version">{{VERSION}}</span></div>
+    </div>
+    {% endblock %}
+</div>
+</div>
+{% endblock %}
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdabo/templates/list_for_orga.html	Tue Jun 14 13:08:22 2011 +0200
@@ -0,0 +1,78 @@
+{% extends "hdabo_base.html" %}
+    {% block title %}HDA - BO : Fiches pour {{ orga_name }}{% endblock %}
+
+    {% block js_import %}
+    {{block.super}}
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery-ui.min.js"></script>
+    <script type="text/javascript" src="{{STATIC_URL}}hdabo/js/jquery.jeditable.js"></script>
+    {% endblock %}
+    
+    {% block js_declaration %}
+    {{block.super}}
+    {% if valid != "2" %}
+    <script type="text/javascript">
+    
+    var global_csrf_token = "{{ csrf_token }}";
+    var static_url = "{{STATIC_URL}}";
+    var tag_up_down_url = "{% url hdabo.views.tag_up_down %}";
+    var remove_tag_from_list_url = "{% url hdabo.views.remove_tag_from_list %}";
+    var validate_wp_link_url = "{% url hdabo.views.validate_wp_link %}";
+    var modify_tag_url = "{% url hdabo.views.modify_tag %}";
+    var add_tag_url = "{% url hdabo.views.add_tag %}";
+    
+    $(document).ready(function(){
+        init_tags_events();
+    });
+    </script>
+    {% endif %}
+    {% endblock %}
+
+    {% block css_import %}
+    {{block.super}}
+    <link rel="stylesheet" href="{{STATIC_URL}}hdabo/css/smoothness/jquery-ui-1.8.13.custom.css" type="text/css"/>
+    {% endblock %}
+
+    {% block css_declaration %}
+    {{block.super}}
+    <style type="text/css">
+    .ui-autocomplete {
+        max-height: 100px;
+        overflow-y: auto;
+        /* prevent horizontal scrollbar */
+        overflow-x: hidden;
+        /* add padding to account for vertical scrollbar */
+        padding-right: 20px;
+    }
+    </style>
+    {% endblock %}
+    
+    
+    {% block content %}
+    {{block.super}}
+    <p>Fiche(s) pour l'organisation <b>{{ orga_name }}</b> : {{nb_sheets}} fiche(s)</p>
+    {% if valid != "2" %}
+    <div id="count_nav_top">
+        <p><a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=0 %}">&lt;&lt;</a>&nbsp;&nbsp;
+           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=prev_index %}">&lt;</a>&nbsp;&nbsp;
+           {{displayed_index}}/{{nb_sheets}}&nbsp;&nbsp;
+           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=next_index %}">&gt;</a>&nbsp;&nbsp;
+           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=last_index %}">&gt;&gt;</a></p>
+    </div>
+    {% endif %}
+    <table>
+    {% for ds in datasheets %}
+    <tr class="imageline {% cycle 'hdaboevenline' 'hdabooddline' %}"><td>
+    {% include "partial/one_sheet.html" %}
+    </td></tr>
+    {% endfor %}
+    </table>
+    {% if valid != "2" %}
+    <div id="count_nav_bottom">
+        <p><a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=0 %}">&lt;&lt;</a>&nbsp;&nbsp;
+           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=prev_index %}">&lt;</a>&nbsp;&nbsp;
+           {{displayed_index}}/{{nb_sheets}}&nbsp;&nbsp;
+           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=next_index %}">&gt;</a>&nbsp;&nbsp;
+           <a href="{% url hdabo.views.list_for_orga orga_id=orga_id, valid=valid, start_index=last_index %}">&gt;&gt;</a></p>
+    </div>
+    {% endif %}
+    {% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdabo/templates/organisation_list.html	Tue Jun 14 13:08:22 2011 +0200
@@ -0,0 +1,32 @@
+{% extends "hdabo_base.html" %}
+    {% block title %}HDA-BO : Liste des organisations{% endblock %}
+    
+    {% block content %}
+    {{block.super}}
+    <p>Afficher les fiches non validées pour les lieux suivants :</p>
+    <table>
+    <tr>
+        <th class="contenttitle">Nom</th>
+        <th class="contenttitle">Fiches non validées</th>
+        <th class="contenttitle">Fiches validées</th>
+        <th class="contenttitle">Toutes les fiches</th>
+    </tr>
+    {% for item in organisations %}
+    <tr class="imageline {% cycle 'hdabooddline' 'hdaboevenline'%}">
+        <td class="contenttitle">{{ item.organisation.name|default:"_" }} (<a href="{{item.organisation.website}}" target="_blank">lien</a>)</td>
+        <td class="contenttitle">
+        {% if item.nb_unval > 0 %}
+        <a class="contenttitlelink" href="{% url hdabo.views.list_for_orga orga_id=item.organisation.id valid=0 %}">{{item.nb_unval}}</a>
+        {% else %}0{% endif %}</td>
+        <td class="contenttitle">
+        {% if item.nb_val > 0 %}
+        <a class="contenttitlelink" href="{% url hdabo.views.list_for_orga orga_id=item.organisation.id valid=1 %}">{{item.nb_val}}</a>
+        {% else %}0{% endif %}</td>
+        <td class="contenttitle">
+        {% if item.nb_all > 0 %}
+        <a class="contenttitlelink" href="{% url hdabo.views.list_for_orga orga_id=item.organisation.id valid=2 %}">{{item.nb_all}}</a>
+        {% else %}0{% endif %}</td>
+    </tr>
+    {% endfor %}
+    </table>
+    {% endblock %}
--- a/web/hdabo/templates/partial/one_sheet.html	Tue Jun 14 12:56:48 2011 +0200
+++ b/web/hdabo/templates/partial/one_sheet.html	Tue Jun 14 13:08:22 2011 +0200
@@ -25,6 +25,11 @@
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; par : <input type="text" name="validator" value="{{ds.validated}}"/>
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; le {{ds.validation_date}}
         {% endif %}
+        {% if valid != "2" %}
+        <span style="float:right;">Ajouter un tag : <input type="text" name="wp_search" id="wp_search" />
+        <span id="ok_search" style='display:none' /><b>OK</b></span>
+        </span>
+        {% endif %}
         </p>
         {% csrf_token %}
         <input type="hidden" name="datasheet_id" value="{{ds.id}}" id="datasheet_id" />
--- a/web/hdabo/templates/partial/organisation_list.html	Tue Jun 14 12:56:48 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-{% extends "hdabo_base.html" %}
-    {% block title %}HDA-BO : Liste des organisations{% endblock %}
-    
-    {% block content %}
-    {{block.super}}
-    <p>Afficher les fiches non validées pour les lieux suivants :</p>
-    <table>
-    <tr>
-        <th class="contenttitle">Nom</th>
-        <th class="contenttitle">Fiches non validées</th>
-        <th class="contenttitle">Fiches validées</th>
-        <th class="contenttitle">Toutes les fiches</th>
-    </tr>
-    {% for item in organisations %}
-    <tr class="imageline {% cycle 'hdabooddline' 'hdaboevenline'%}">
-        <td class="contenttitle">{{ item.organisation.name|default:"_" }} (<a href="{{item.organisation.website}}" target="_blank">lien</a>)</td>
-        <td class="contenttitle">
-        {% if item.nb_unval > 0 %}
-        <a class="contenttitlelink" href="{% url hdabo.views.list_for_orga orga_id=item.organisation.id valid=0 %}">{{item.nb_unval}}</a>
-        {% else %}0{% endif %}</td>
-        <td class="contenttitle">
-        {% if item.nb_val > 0 %}
-        <a class="contenttitlelink" href="{% url hdabo.views.list_for_orga orga_id=item.organisation.id valid=1 %}">{{item.nb_val}}</a>
-        {% else %}0{% endif %}</td>
-        <td class="contenttitle">
-        {% if item.nb_all > 0 %}
-        <a class="contenttitlelink" href="{% url hdabo.views.list_for_orga orga_id=item.organisation.id valid=2 %}">{{item.nb_all}}</a>
-        {% else %}0{% endif %}</td>
-    </tr>
-    {% endfor %}
-    </table>
-    {% endblock %}
--- a/web/hdabo/urls.py	Tue Jun 14 12:56:48 2011 +0200
+++ b/web/hdabo/urls.py	Tue Jun 14 13:08:22 2011 +0200
@@ -25,4 +25,5 @@
     url(r'^validatelink$', 'hdabo.views.validate_wp_link'),
     url(r'^modifytag$', 'hdabo.views.modify_tag'),
     url(r'^resetwpinfo$', 'hdabo.views.reset_wikipedia_info'),
+    url(r'^addtag$', 'hdabo.views.add_tag'),
 )
--- a/web/hdabo/views.py	Tue Jun 14 12:56:48 2011 +0200
+++ b/web/hdabo/views.py	Tue Jun 14 13:08:22 2011 +0200
@@ -1,201 +1,201 @@
-from django.conf import settings
-from django.contrib.auth.decorators import login_required #@UnusedImport
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-from hdabo.management.commands.querywikipedia import process_tag
-from hdabo.wp_utils import normalize_tag, query_wikipedia_title
-from models import Organisation, Datasheet, TaggedSheet, Tag
-from wikitools import wiki
-
-
-#@login_required
-def home(request):
-    
-    # Get all organisations
-    orgas = Organisation.objects.all()
-    # Count all validated, unvalidated sheets for each organisation
-    org_list = []
-    for orga in orgas :
-        all_datasheets = Datasheet.objects.filter(organisation=orga)
-        nb_all = len(all_datasheets)
-        nb_val = len(all_datasheets.filter(validated=True))
-        nb_unval = len(all_datasheets.filter(validated=False))
-        org_list.append({'organisation':orga, 'nb_all':nb_all, 'nb_val':nb_val, 'nb_unval':nb_unval})
-    
-    
-    return render_to_response("partial/organisation_list.html",
-                              {'organisations':org_list},
-                              context_instance=RequestContext(request))
-
-
-#@login_required
-def list_for_orga(request, orga_id=None, valid=None, start_index=None):
-    
-    orga = Organisation.objects.get(id=orga_id)
-    orga_name = orga.name
-    
-    if start_index :
-        try:
-            start_index = int(start_index)
-        except :
-            start_index = 0
-    else :
-        start_index = 0
-    
-    # If valid = 0, we search unvalidated sheets
-    # If valid = 1, we search validated sheets
-    # If valid = 2, we search AND DISPLAY all sheets
-    if valid == "1" :
-        # We count all the validated sheets
-        datasheets = Datasheet.objects.filter(organisation=orga).filter(validated=True)
-        nb_sheets = len(datasheets)
-        # And select the current one
-        datasheets = [datasheets[start_index]]
-    elif valid != "2":
-        # We count all the validated sheets
-        datasheets = Datasheet.objects.filter(organisation=orga).filter(validated=False)
-        nb_sheets = len(datasheets)
-        # And select the current one
-        datasheets = [datasheets[start_index]]
-    else :
-        datasheets = Datasheet.objects.filter(organisation=orga)
-        nb_sheets = len(datasheets)
-    
-    # We get the ORDERED tags if we display one sheet (case valid = 0 and 1)
-    ordered_tags = None
-    if valid != "2" :
-        ordered_tags = TaggedSheet.objects.filter(datasheet=datasheets[0]).order_by('order')
-    
-    displayed_index = start_index + 1;
-    prev_index = max(start_index - 1, 0);
-    next_index = min(nb_sheets - 1, start_index + 1);
-    last_index = max(nb_sheets - 1, 0);
-    
-    return render_to_response("partial/list_for_orga.html",
-                              {'datasheets':datasheets, 'orga_name':orga_name,
-                               'nb_sheets':nb_sheets, 'orga_id':orga_id, 'ordered_tags':ordered_tags,
-                               'prev_index':prev_index, 'next_index':next_index, 'last_index':last_index,
-                               'start_index':start_index, 'displayed_index':displayed_index, 'valid':valid},
-                              context_instance=RequestContext(request))
-
-#@login_required
-def tag_up_down(request):
-    ds_id = request.POST["datasheet_id"]
-    #tag_id = request.POST["tag_id"]
-    # tag_pos indicates the position (from 0) of the tag in the list. NB : it is different from the TagSheet.order in the database.
-    tag_pos = int(request.POST["tag_pos"])
-    # move can be "u" or "d", for up and down
-    move = request.POST["move"]
-    # First we get the datasheet's TaggedSheets
-    ordered_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0]).order_by('order')
-    # We get the current TaggedSheet and its's order
-    #ts = ordered_tags.filter(tag=Tag.objects.filter(id=tag_id))[0]
-    ts = ordered_tags[tag_pos]
-    tag_order = ts.order
-    # We get the other TaggedSheet that will be moved
-    if move == "u" :
-        other_ts = ordered_tags[tag_pos - 1]
-    elif move == "d" :
-        other_ts = ordered_tags[tag_pos + 1]
-    else :
-        other_ts = None
-    # We switch the orders
-    if other_ts :
-        ts.order = other_ts.order
-        other_ts.order = tag_order
-        ts.save()
-        other_ts.save()
-    
-    return get_tag_table(request=request, ds_id=ds_id, valid=0)
-
-
-#@login_required
-def get_tag_table(request=None, ds_id=None, valid=None):
-    
-    ordered_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0]).order_by('order')
-    
-    return render_to_response("partial/tag_table.html",
-                              {'ordered_tags':ordered_tags, 'valid':valid},
-                              context_instance=RequestContext(request))
-
-
-#@login_required
-def remove_tag_from_list(request=None):
-    
-    ds_id = request.POST["datasheet_id"]
-    tag_id = request.POST["tag_id"]
-    # First we get the datasheet's TaggedSheets
-    ds_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0])
-    # We get the current TaggedSheet and we delete it
-    ts = ds_tags.filter(tag=Tag.objects.filter(id=tag_id))[0]
-    ts.delete()
-    
-    return get_tag_table(request=request, ds_id=ds_id, valid=0)
-
-
-#@login_required
-def validate_wp_link(request=None):
-    
-    ds_id = request.POST["datasheet_id"]
-    tag_id = request.POST["tag_id"]
-    if request.POST["activated"] != "false" :
-        wp_activ = True
-    else :
-        wp_activ = False
-    # First we get the tag object
-    tag = Tag.objects.filter(id=tag_id)[0]
-    tag.wikipedia_activated = wp_activ
-    tag.save()
-    
-    return get_tag_table(request=request, ds_id=ds_id, valid=0)
-
-#@login_required
-def modify_tag(request):
-    
-    tag_id = request.POST["id"]
-    tag_label = request.POST["value"]
-    ds_id = request.POST["datasheet_id"]
-        
-    tag = Tag.objects.get(id=tag_id)
-    
-    if tag.label != tag_label:
-
-
-        tag.label = tag_label
-        
-        site = wiki.Wiki(settings.WIKIPEDIA_API_URL) #@UndefinedVariable
-        new_label, status, url, pageid, response = query_wikipedia_title(site, tag_label) #@UnusedVariable                    
-
-        if status is not None:
-            tag.url_status = status
-        if url is not None:
-            tag.wikipedia_url = url
-            tag.wikipedia_activated = True
-        else:
-            tag.wikipedia_url = None
-            tag.wikipedia_activated = False
-            
-        if pageid is not None:
-            tag.wikipedia_pageid = pageid
-        else:
-            tag.wikipedia_pageid = None
-            
-        tag.save()
-    
-    return get_tag_table(request=request, ds_id=ds_id, valid=0)
-
-
-#@login_required
-def reset_wikipedia_info(request):
-    
-    tag_id = request.POST["tag_id"]    
-    ds_id = request.POST["datasheet_id"]
-    
-    tag = Tag.objects.get(id=tag_id)
-    site = wiki.Wiki(settings.WIKIPEDIA_API_URL) #@UndefinedVariable
-    
-    tag.label = normalize_tag(tag.original_label)
-    
-    process_tag(site, tag, 0)
-    
-    return get_tag_table(request=request, ds_id=ds_id, valid=0)
+from django.conf import settings
+from django.contrib.auth.decorators import login_required #@UnusedImport
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+from hdabo.management.commands.querywikipedia import process_tag
+from hdabo.wp_utils import normalize_tag, query_wikipedia_title
+from models import Organisation, Datasheet, TaggedSheet, Tag
+from wikitools import wiki
+
+
+#@login_required
+def home(request):
+    
+    # Get all organisations
+    orgas = Organisation.objects.all()
+    # Count all validated, unvalidated sheets for each organisation
+    org_list = []
+    for orga in orgas :
+        all_datasheets = Datasheet.objects.filter(organisation=orga)
+        nb_all = len(all_datasheets)
+        nb_val = len(all_datasheets.filter(validated=True))
+        nb_unval = len(all_datasheets.filter(validated=False))
+        org_list.append({'organisation':orga, 'nb_all':nb_all, 'nb_val':nb_val, 'nb_unval':nb_unval})
+    
+    
+    return render_to_response("partial/organisation_list.html",
+                              {'organisations':org_list},
+                              context_instance=RequestContext(request))
+
+
+#@login_required
+def list_for_orga(request, orga_id=None, valid=None, start_index=None):
+    
+    orga = Organisation.objects.get(id=orga_id)
+    orga_name = orga.name
+    
+    if start_index :
+        try:
+            start_index = int(start_index)
+        except :
+            start_index = 0
+    else :
+        start_index = 0
+    
+    # If valid = 0, we search unvalidated sheets
+    # If valid = 1, we search validated sheets
+    # If valid = 2, we search AND DISPLAY all sheets
+    if valid == "1" :
+        # We count all the validated sheets
+        datasheets = Datasheet.objects.filter(organisation=orga).filter(validated=True)
+        nb_sheets = len(datasheets)
+        # And select the current one
+        datasheets = [datasheets[start_index]]
+    elif valid != "2":
+        # We count all the validated sheets
+        datasheets = Datasheet.objects.filter(organisation=orga).filter(validated=False)
+        nb_sheets = len(datasheets)
+        # And select the current one
+        datasheets = [datasheets[start_index]]
+    else :
+        datasheets = Datasheet.objects.filter(organisation=orga)
+        nb_sheets = len(datasheets)
+    
+    # We get the ORDERED tags if we display one sheet (case valid = 0 and 1)
+    ordered_tags = None
+    if valid != "2" :
+        ordered_tags = TaggedSheet.objects.filter(datasheet=datasheets[0]).order_by('order')
+    
+    displayed_index = start_index + 1;
+    prev_index = max(start_index - 1, 0);
+    next_index = min(nb_sheets - 1, start_index + 1);
+    last_index = max(nb_sheets - 1, 0);
+    
+    return render_to_response("partial/list_for_orga.html",
+                              {'datasheets':datasheets, 'orga_name':orga_name,
+                               'nb_sheets':nb_sheets, 'orga_id':orga_id, 'ordered_tags':ordered_tags,
+                               'prev_index':prev_index, 'next_index':next_index, 'last_index':last_index,
+                               'start_index':start_index, 'displayed_index':displayed_index, 'valid':valid},
+                              context_instance=RequestContext(request))
+
+#@login_required
+def tag_up_down(request):
+    ds_id = request.POST["datasheet_id"]
+    #tag_id = request.POST["tag_id"]
+    # tag_pos indicates the position (from 0) of the tag in the list. NB : it is different from the TagSheet.order in the database.
+    tag_pos = int(request.POST["tag_pos"])
+    # move can be "u" or "d", for up and down
+    move = request.POST["move"]
+    # First we get the datasheet's TaggedSheets
+    ordered_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0]).order_by('order')
+    # We get the current TaggedSheet and its's order
+    #ts = ordered_tags.filter(tag=Tag.objects.filter(id=tag_id))[0]
+    ts = ordered_tags[tag_pos]
+    tag_order = ts.order
+    # We get the other TaggedSheet that will be moved
+    if move == "u" :
+        other_ts = ordered_tags[tag_pos - 1]
+    elif move == "d" :
+        other_ts = ordered_tags[tag_pos + 1]
+    else :
+        other_ts = None
+    # We switch the orders
+    if other_ts :
+        ts.order = other_ts.order
+        other_ts.order = tag_order
+        ts.save()
+        other_ts.save()
+    
+    return get_tag_table(request=request, ds_id=ds_id, valid=0)
+
+
+#@login_required
+def get_tag_table(request=None, ds_id=None, valid=None):
+    
+    ordered_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0]).order_by('order')
+    
+    return render_to_response("partial/tag_table.html",
+                              {'ordered_tags':ordered_tags, 'valid':valid},
+                              context_instance=RequestContext(request))
+
+
+#@login_required
+def remove_tag_from_list(request=None):
+    
+    ds_id = request.POST["datasheet_id"]
+    tag_id = request.POST["tag_id"]
+    # First we get the datasheet's TaggedSheets
+    ds_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0])
+    # We get the current TaggedSheet and we delete it
+    ts = ds_tags.filter(tag=Tag.objects.filter(id=tag_id))[0]
+    ts.delete()
+    
+    return get_tag_table(request=request, ds_id=ds_id, valid=0)
+
+
+#@login_required
+def validate_wp_link(request=None):
+    
+    ds_id = request.POST["datasheet_id"]
+    tag_id = request.POST["tag_id"]
+    if request.POST["activated"] != "false" :
+        wp_activ = True
+    else :
+        wp_activ = False
+    # First we get the tag object
+    tag = Tag.objects.filter(id=tag_id)[0]
+    tag.wikipedia_activated = wp_activ
+    tag.save()
+    
+    return get_tag_table(request=request, ds_id=ds_id, valid=0)
+
+#@login_required
+def modify_tag(request):
+    
+    tag_id = request.POST["id"]
+    tag_label = request.POST["value"]
+    ds_id = request.POST["datasheet_id"]
+        
+    tag = Tag.objects.get(id=tag_id)
+    
+    if tag.label != tag_label:
+
+
+        tag.label = tag_label
+        
+        site = wiki.Wiki(settings.WIKIPEDIA_API_URL) #@UndefinedVariable
+        new_label, status, url, pageid, response = query_wikipedia_title(site, tag_label) #@UnusedVariable                    
+
+        if status is not None:
+            tag.url_status = status
+        if url is not None:
+            tag.wikipedia_url = url
+            tag.wikipedia_activated = True
+        else:
+            tag.wikipedia_url = None
+            tag.wikipedia_activated = False
+            
+        if pageid is not None:
+            tag.wikipedia_pageid = pageid
+        else:
+            tag.wikipedia_pageid = None
+            
+        tag.save()
+    
+    return get_tag_table(request=request, ds_id=ds_id, valid=0)
+
+
+#@login_required
+def reset_wikipedia_info(request):
+    
+    tag_id = request.POST["tag_id"]    
+    ds_id = request.POST["datasheet_id"]
+    
+    tag = Tag.objects.get(id=tag_id)
+    site = wiki.Wiki(settings.WIKIPEDIA_API_URL) #@UndefinedVariable
+    
+    tag.label = normalize_tag(tag.original_label)
+    
+    process_tag(site, tag, 0)
+    
+    return get_tag_table(request=request, ds_id=ds_id, valid=0)