# HG changeset patch
# User cavaliet
# Date 1308049702 -7200
# Node ID 056c19e37eabb49f7bf791be53d61e2bc6c3d3e1
# Parent e5f8cb1020c8e4fe1caff12cf962a3dc48cba183# Parent 6999575970267e7970c35d8b12d669fe75540528
fusionner
diff -r e5f8cb1020c8 -r 056c19e37eab web/hdabo/static/hdabo/js/hdabo.js
--- 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 : "
",
- 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("
");
+ 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("OK");
+ }
+ });
+ }
+ });
+
+ $.editable.addInputType('autocomplete', {
+ element : $.editable.types.text.element,
+ plugin : function(settings, original) {
+ $('input', this).autocomplete(settings.autocomplete);
+ }
+ });
+
+ $(".wikipediatag").editable(modify_tag_url, {
+ indicator : "
",
+ 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
diff -r e5f8cb1020c8 -r 056c19e37eab web/hdabo/templates/hdabo_base.html
--- 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 %}
-
-
-
-
Fiche(s) pour l'organisation {{ orga_name }} : {{nb_sheets}} fiche(s)
+ {% if valid != "2" %} + + {% endif %} +| + {% include "partial/one_sheet.html" %} + |
Afficher les fiches non validées pour les lieux suivants :
+| Nom | +Fiches non validées | +Fiches validées | +Toutes les fiches | +
|---|---|---|---|
| {{ item.organisation.name|default:"_" }} (lien) | ++ {% if item.nb_unval > 0 %} + {{item.nb_unval}} + {% else %}0{% endif %} | ++ {% if item.nb_val > 0 %} + {{item.nb_val}} + {% else %}0{% endif %} | ++ {% if item.nb_all > 0 %} + {{item.nb_all}} + {% else %}0{% endif %} | +
Afficher les fiches non validées pour les lieux suivants :
-| Nom | -Fiches non validées | -Fiches validées | -Toutes les fiches | -
|---|---|---|---|
| {{ item.organisation.name|default:"_" }} (lien) | -- {% if item.nb_unval > 0 %} - {{item.nb_unval}} - {% else %}0{% endif %} | -- {% if item.nb_val > 0 %} - {{item.nb_val}} - {% else %}0{% endif %} | -- {% if item.nb_all > 0 %} - {{item.nb_all}} - {% else %}0{% endif %} | -