| author | veltr |
| Mon, 09 Sep 2013 17:23:38 +0200 | |
| changeset 104 | e61d5a5d970e |
| parent 103 | da385c0872a6 |
| child 105 | d9434a9d7130 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jocondelab/migrations/0008_auto__add_nb_notices_on_countries.py Mon Sep 09 17:23:38 2013 +0200 @@ -0,0 +1,284 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Country.nb_notices' + db.add_column(u'jocondelab_country', 'nb_notices', + self.gf('django.db.models.fields.IntegerField')(default=0, db_index=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Country.nb_notices' + db.delete_column(u'jocondelab_country', 'nb_notices') + + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'core.autrnoticeterm': { + 'Meta': {'object_name': 'AutrNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.domnnoticeterm': { + 'Meta': {'object_name': 'DomnNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.ecolnoticeterm': { + 'Meta': {'object_name': 'EcolNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.epoqnoticeterm': { + 'Meta': {'object_name': 'EpoqNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.lieuxnoticeterm': { + 'Meta': {'object_name': 'LieuxNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.notice': { + 'Meta': {'object_name': 'Notice'}, + 'adpt': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'appl': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'aptn': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'attr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'autr': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'autr_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'autr+'", 'symmetrical': 'False', 'through': "orm['core.AutrNoticeTerm']", 'to': "orm['core.Term']"}), + 'bibl': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'comm': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'contact': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'coor': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'copy': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'dacq': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'data': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'dation': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'ddpt': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'decv': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'deno': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'depo': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'desc': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'desy': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'dims': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'dmaj': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'dmis': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'domn': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'domn_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'domn+'", 'symmetrical': 'False', 'through': "orm['core.DomnNoticeTerm']", 'to': "orm['core.Term']"}), + 'drep': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'ecol': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'ecol_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'ecol+'", 'symmetrical': 'False', 'through': "orm['core.EcolNoticeTerm']", 'to': "orm['core.Term']"}), + 'epoq': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'epoq_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'epoq+'", 'symmetrical': 'False', 'through': "orm['core.EpoqNoticeTerm']", 'to': "orm['core.Term']"}), + 'etat': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'expo': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'gene': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'geohi': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'hist': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'insc': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'inv': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'labo': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'lieux': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'lieux_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'lieux+'", 'symmetrical': 'False', 'through': "orm['core.LieuxNoticeTerm']", 'to': "orm['core.Term']"}), + 'loca': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'loca2': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'mill': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'milu': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'mosa': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'msgcom': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'museo': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'nsda': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'onom': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'paut': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'pdat': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'pdec': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'peoc': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'peri': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}), + 'peri_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'peri+'", 'symmetrical': 'False', 'through': "orm['core.PeriNoticeTerm']", 'to': "orm['core.Term']"}), + 'peru': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'phot': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'pins': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'plieux': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'prep': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'puti': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'reda': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'ref': ('django.db.models.fields.CharField', [], {'max_length': '20', 'unique': 'True', 'null': 'True', 'blank': 'True'}), + 'refim': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'repr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'repr_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'repr+'", 'symmetrical': 'False', 'through': "orm['core.ReprNoticeTerm']", 'to': "orm['core.Term']"}), + 'srep': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'srep_terms': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'srep+'", 'symmetrical': 'False', 'through': "orm['core.SrepNoticeTerm']", 'to': "orm['core.Term']"}), + 'stat': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'tech': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'tico': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'titr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'util': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'video': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'www': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}) + }, + 'core.noticeterm': { + 'Meta': {'object_name': 'NoticeTerm'}, + 'graph': ('django.db.models.fields.URLField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'notice': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Notice']"}), + 'term': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Term']"}) + }, + 'core.perinoticeterm': { + 'Meta': {'object_name': 'PeriNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.reprnoticeterm': { + 'Meta': {'object_name': 'ReprNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.srepnoticeterm': { + 'Meta': {'object_name': 'SrepNoticeTerm', '_ormbases': ['core.NoticeTerm']}, + u'noticeterm_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['core.NoticeTerm']", 'unique': 'True', 'primary_key': 'True'}) + }, + 'core.term': { + 'Meta': {'object_name': 'Term'}, + 'alternative_wikipedia_pageid': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'alternative_wikipedia_url': ('django.db.models.fields.URLField', [], {'db_index': 'True', 'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'dbpedia_uri': ('django.db.models.fields.URLField', [], {'db_index': 'True', 'max_length': '2048', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), + 'lang': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), + u'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + u'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'link_semantic_level': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), + 'nb_notice': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + 'normalized_label': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), + 'notices': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'terms+'", 'symmetrical': 'False', 'through': "orm['core.NoticeTerm']", 'to': "orm['core.Notice']"}), + 'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['core.Term']"}), + u'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'thesaurus': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Thesaurus']"}), + u'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'uri': ('django.db.models.fields.URLField', [], {'db_index': 'True', 'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'url_status': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), + 'validated': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'validation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'validator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.User']", 'null': 'True', 'blank': 'True'}), + 'wikipedia_edition': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'wikipedia_pageid': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'wikipedia_revision_id': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'wikipedia_url': ('django.db.models.fields.URLField', [], {'db_index': 'True', 'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'wp_alternative_label': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '1024', 'null': 'True', 'blank': 'True'}), + 'wp_label': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '1024', 'null': 'True', 'blank': 'True'}) + }, + 'core.thesaurus': { + 'Meta': {'ordering': "['label']", 'object_name': 'Thesaurus'}, + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'}), + 'uri': ('django.db.models.fields.URLField', [], {'db_index': 'True', 'max_length': '2048', 'null': 'True', 'blank': 'True'}) + }, + 'core.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'en'", 'max_length': '2'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'jocondelab.contributedfields': { + 'Meta': {'object_name': 'ContributedFields'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'dbpedia_uri': ('django.db.models.fields.URLField', [], {'max_length': '2048', 'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'term': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dbpedia_fields'", 'to': "orm['jocondelab.ContributedTerm']"}), + 'thumbnail': ('django.db.models.fields.URLField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + }, + 'jocondelab.contributedterm': { + 'Meta': {'object_name': 'ContributedTerm'}, + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'dbpedia_language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'dbpedia_uri': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '2048', 'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'jocondelab.contribution': { + 'Meta': {'object_name': 'Contribution'}, + 'contribution_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'notice': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Notice']"}), + 'term': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'contributions'", 'to': "orm['jocondelab.ContributedTerm']"}), + 'thesaurus': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['core.Thesaurus']"}) + }, + 'jocondelab.country': { + 'Meta': {'object_name': 'Country'}, + 'dbpedia_uri': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '2048', 'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iso_code_2': ('django.db.models.fields.CharField', [], {'max_length': '2', 'db_index': 'True'}), + 'iso_code_3': ('django.db.models.fields.CharField', [], {'max_length': '3', 'db_index': 'True'}), + 'nb_notices': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}) + }, + 'jocondelab.dbpediafields': { + 'Meta': {'object_name': 'DbpediaFields'}, + 'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'dbpedia_uri': ('django.db.models.fields.URLField', [], {'max_length': '2048', 'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'label': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), + 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'term': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dbpedia_fields'", 'to': "orm['core.Term']"}), + 'thumbnail': ('django.db.models.fields.URLField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}) + }, + 'jocondelab.dbpediageo': { + 'Meta': {'object_name': 'DbpediaGeo'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'latitude': ('django.db.models.fields.FloatField', [], {'db_index': 'True'}), + 'longitude': ('django.db.models.fields.FloatField', [], {'db_index': 'True'}), + 'term': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'geo'", 'unique': 'True', 'to': "orm['core.Term']"}) + }, + 'jocondelab.dbpediayears': { + 'Meta': {'object_name': 'DbpediaYears'}, + 'end_year': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'start_year': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'term': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'years'", 'unique': 'True', 'to': "orm['core.Term']"}) + }, + 'jocondelab.termlinks': { + 'Meta': {'object_name': 'TermLinks'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'termlinks_objects'", 'to': "orm['core.Term']"}), + 'subject': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'termlinks_subjects'", 'to': "orm['core.Term']"}) + } + } + + complete_apps = ['jocondelab'] \ No newline at end of file
--- a/src/jocondelab/static/jocondelab/css/front-common.css Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/static/jocondelab/css/front-common.css Mon Sep 09 17:23:38 2013 +0200 @@ -129,6 +129,10 @@ margin: 40px auto 20px; text-align: right; } +input { + font-family: 'OpenSans' !important; +} + /* END GLOBAL BLOCKS */ /* HEADER > TITLE */ @@ -167,11 +171,17 @@ position: absolute; top: 32px; right: 0; max-width: 35%; text-align: right; } +.search-input, .search-form .tagit { + border-radius: 8px; box-shadow: 1px 1px 1px #666666 inset; border: none; + background: url(../img/search-icon.png) right center no-repeat #ffffff; +} + +.header-search-input, .header-search-form .tagit { + margin: 0 auto; width: 260px; max-width: 90%; font-size: 14px; z-index: 1; +} + .header-search-input { - margin: 0 auto; width: 260px; max-width: 90%; line-height: 28px; height: 28px; - font-size: 16px; font-family: 'OpenSans'; padding: 0 9px; z-index: 1; - border-radius: 9px; box-shadow: 2px 2px 4px #333333 inset; border: none; - background: url(../img/search-icon.png) right center no-repeat #ffffff; + line-height: 28px; height: 28px; padding: 0 9px; } .header-search-input::-moz-placeholder { @@ -182,6 +192,10 @@ font-size: .8em; font-style: italic; } +.search-form .tagit { + height: 2em; padding: 0.2em 0.5em; +} + /* HEADER > MENUS */ .top-menus { @@ -239,24 +253,24 @@ /* DBPEDIA OVERLAY */ .dbpedia-overlay { - position: absolute; width: 400px; background: #ffffff; border: 1px solid #999999; box-shadow: 5px 5px 10px rgba(0,0,0,.5); + position: absolute; width: 280px; background: #ffffff; border: 1px solid #999999; box-shadow: 5px 5px 10px rgba(0,0,0,.5); display: none; z-index: 8; } .dbpedia-overlay h2 { - font-size: 16px; font-weight: 700; margin: 10px; + font-size: 14px; font-weight: 700; margin: 10px; } .dbpedia-abstract { - font-size: 12px; margin: 0 10px 10px; + font-size: 11px; margin: 0 10px 10px; } .dbpedia-source { - color: #0063DC; font-size: 11px; margin: 0 10px 10px; clear: both; + color: #0063DC; font-size: 10px; margin: 0 10px 10px; clear: both; } .dbpedia-overlay img { - max-width: 200px; max-height: 180px; float: left; margin: 10px 10px 2px; + max-width: 160px; max-height: 150px; float: left; margin: 10px 10px 2px; } /* RESULTS LIST */ @@ -328,14 +342,4 @@ .notice-term:hover { background: #ffffff; -} - -.big-search-form { - text-align: center; margin: 20px 0; -} - -.big-search-input { - margin: 0 auto; width: 80%; line-height: 32px; height: 32px; font-size: 16px; font-family: 'OpenSans'; padding: 0 9px; - border-radius: 9px; box-shadow: 2px 2px 4px #333333 inset; - background: url(../img/search-icon.png) right center no-repeat #ffffff; border: none; } \ No newline at end of file
--- a/src/jocondelab/static/jocondelab/css/front-search.css Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/static/jocondelab/css/front-search.css Mon Sep 09 17:23:38 2013 +0200 @@ -10,4 +10,16 @@ .term-frequency { font-size: .8em; -} \ No newline at end of file +} + +.big-search-form { + text-align: center; margin: 20px 0; +} + +.big-search-input, .big-search-form .tagit { + margin: 0 auto; width: 80%; font-size: 15px; +} + +.big-search-input { + line-height: 32px; height: 32px; padding: 0 9px; +}
--- a/src/jocondelab/static/jocondelab/js/front-common.js Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/static/jocondelab/js/front-common.js Mon Sep 09 17:23:38 2013 +0200 @@ -1,5 +1,30 @@ $(function() { + /* SEARCH TAG-IT */ + + var $searchInput = $(".search-input"), + originalValue = $searchInput.val(); + + function submitIfChanged(e, ui) { + var val = $searchInput.val(); + if (!ui.duringInitialization && val && val !== originalValue) { + $(".search-form").submit(); + } + } + + $searchInput.tagit({ + autocomplete: { + source: urls.ajax_terms, + focus: function(e, ui) { + showDbpediaBox(ui.item.dbpedia_uri); + setDbpediaBoxAnchor({type: "dom", selector: $(e.target).autocomplete("widget"), positioning: "side"}); + } + }, + allowSpaces: true, + afterTagAdded : submitIfChanged, + afterTagRemoved: submitIfChanged + }); + /* DBPEDIA OVERLAY */ var lang = $("html").attr("lang"), @@ -17,35 +42,62 @@ $overlay = $(".dbpedia-overlay"), hovering = null, dontclose = false, - $refdiv = null, + anchor = null, $win = $(window), dbpediaCache = {}, $overlayImg = $overlay.find("img"), $h2 = $overlay.find("h2"), $abstract = $overlay.find(".dbpedia-abstract"), $source = $overlay.find(".dbpedia-source a"); - - window.moveDbpediaBoxToCoords = function(x, y, ymargin, alwaysbelow) { - var ovw = $overlay.outerWidth(), - ovh = $overlay.outerHeight(), - showAbove = (y + ymargin + ovh) > ($win.height() + $win.scrollTop()) && !alwaysbelow; - $overlay.css({ - top: showAbove ? (y - ovh - ymargin) : (y + ymargin), - left: Math.max(5, Math.min($win.width() - ovw - 5, x - (ovw / 2))) - }); - } - function moveDbpediaBoxToRefDiv() { - if (hovering && $refdiv) { - var refoff = $refdiv.offset(), - refw = $refdiv.outerWidth(), - refh = $refdiv.outerHeight(), - refx = refoff.left, - refy = refoff.top; - window.moveDbpediaBoxToCoords(refx + (refw / 2), refy + (refh / 2), refh / 2); + window.setDbpediaBoxAnchor = function(a) { + anchor = a || null; + if (anchor) { + recentreDbpediaBox(); } } + window.recentreDbpediaBox = function() { + if (!anchor) { return; } + var ovw = $overlay.outerWidth(), + ovh = $overlay.outerHeight(); + switch (anchor.type) { + case "dom": + var $refdiv = anchor.selector, + refoff = $refdiv.offset(), + refw = $refdiv.outerWidth(), + refh = $refdiv.outerHeight(), + refx = refoff.left, + refy = refoff.top, + refbox = { left: refx, right: refx + refw, top: refy, bottom: refy + refh }; + break; + case "callback": + var refbox = anchor.callback() + break; + } + if (!refbox) { return; } + if (!refbox.right) { refbox.right = refbox.left; } + if (!refbox.bottom) { refbox.bottom = refbox.top; } + refbox.hcentre = (refbox.left + refbox.right) / 2; + switch (anchor.positioning) { + case "side": + var showLeft = (refbox.right + ovw) > $win.width(); + css = { left: showLeft ? (refbox.left - ovw) : (refbox.right), top: refbox.top }; + break; + case "bottom": + css = { left: refbox.hcentre - ovw / 2, top: refbox.bottom }; + break; + case "vertical": + default: + var showAbove = (refbox.bottom + ovh) > ($win.height() + $win.scrollTop()); + css = { left: refbox.hcentre - ovw / 2, top: showAbove ? refbox.top - ovh : refbox.bottom }; + } + if (css) { + css.left = Math.max(5, Math.min($win.width() - ovw - 5, css.left)); + $overlay.css(css); + } + } + window.showDbpediaBox = function(dbpediaUri, cancelClose) { if (!dbpediaUri) { return; @@ -73,7 +125,7 @@ $h2.text((uriData.l && uriData.lr) ? (uriData.l + " → " + uriData.lr) : label); $abstract.text((uriData.a || uriData.ar || "").replace(/^(.{240,260})\s.+$/,'$1…').substr(0,261)); $source.attr("href", wkUrl); - moveDbpediaBoxToRefDiv(); + recentreDbpediaBox(); } function getUriData(dbpediaUri) { @@ -108,8 +160,8 @@ setTimeout(function() { if (!hovering) { $overlay.hide(); + window.setDbpediaBoxAnchor(); deferredRemovePopin(); - $refdiv = null; } }, 0); } @@ -118,8 +170,9 @@ var $sel = $(selector); $sel.off("mouseenter mouseleave"); $sel.mouseenter(function(e) { - $refdiv = $(this); - var dbpediaUri = $refdiv.attr("data-dbpedia-uri") || defaultUri; + var $this = $(this); + setDbpediaBoxAnchor({ selector: $this, type: "dom", positioning: "vertical" }); + var dbpediaUri = $this.attr("data-dbpedia-uri") || defaultUri; if (!dbpediaUri || dbpediaUri === "None") { return; } @@ -247,8 +300,8 @@ $win.resize(function() { adaptGrid(); - moveDbpediaBoxToRefDiv(); - }).scroll(moveDbpediaBoxToRefDiv); + recentreDbpediaBox(); + }).scroll(recentreDbpediaBox); $(".language-label").click(function() { $(this).siblings(".language-button").click(); @@ -258,6 +311,6 @@ $(".language-list").toggle(); }); */ - $overlayImg.load(moveDbpediaBoxToRefDiv); + $overlayImg.load(recentreDbpediaBox); });
--- a/src/jocondelab/static/jocondelab/js/front-geo.js Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/static/jocondelab/js/front-geo.js Mon Sep 09 17:23:38 2013 +0200 @@ -15,7 +15,7 @@ var coordCache = [], coordIdCache = [], defaultIcon = new L.Icon.Default(), - orangeIcon = new L.Icon.Default({iconUrl: urls.static_url + "jocondelab/lib/images/marker-orange.png"}), + orangeIcon = new L.Icon.Default({iconUrl: urls.orange_marker }), country_uris = _(countries).pluck("dbpedia_uri"), itemCount = 12, scaleBase = Math.log(countries[0].nb_notices), @@ -94,6 +94,7 @@ return; } window.showDbpediaBox(feature.dbpedia_uri, (feature === stickyFeature)); + window.setDbpediaBoxAnchor({type: "callback", callback: moveCurrentFeature, positioning: "bottom"}); throttledMove(); } @@ -120,17 +121,19 @@ return; } var p = map.latLngToContainerPoint(c), - mo = $map.offset(); - window.moveDbpediaBoxToCoords(p.x + mo.left, p.y + mo.top, 0, true); + mo = $map.offset(), + y = p.y + mo.top; + return ({ top: y - (fb ? 0 : 30), left: p.x + mo.left, bottom: y }); } - var throttledMove = _.throttle(moveCurrentFeature,200); + var throttledMove = _.throttle(window.recentreDbpediaBox,200); function hideDbpedia(force) { if (!stickyFeature) { currentFeature = null; } if (!stickyFeature || force) { + window.setDbpediaBoxAnchor(); window.hideDbpediaBox(); } }
--- a/src/jocondelab/static/jocondelab/js/front-notice.js Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/static/jocondelab/js/front-notice.js Mon Sep 09 17:23:38 2013 +0200 @@ -100,7 +100,7 @@ if (typeof dbpCache[label] === "undefined") { dbpCache[label] = null; $.ajax({ - url: wikipedia_urls.fr.dbpedia_sparql_url, + url: urls.wikipedia.fr.dbpedia_sparql_url, data: { query: frSparqlTpl( { label: label, lang: lang } ), format: "application/sparql-results+json" @@ -111,10 +111,10 @@ //console.log("Data found in french DbPedia", data.results.bindings[0]); onBindingsLoaded(data, { dbpedia_language: "fr" }); } else { - if (lang !== "fr" && wikipedia_urls[lang]) { - var wk_url = wikipedia_urls[lang].page_url + '/' + encodeURIComponent(label.replace(/ /g,'_')); + if (lang !== "fr" && urls.wikipedia[lang]) { + var wk_url = urls.wikipedia[lang].page_url + '/' + encodeURIComponent(label.replace(/ /g,'_')); $.ajax({ - url: wikipedia_urls[lang].dbpedia_sparql_url, + url: urls.wikipedia[lang].dbpedia_sparql_url, data: { query: otherSparqlTpl({ wikipedia_url: wk_url }), format: "application/sparql-results+json" @@ -234,7 +234,7 @@ if (termdata.dbpedia_uri) { bindDbpediaBox($newItem.find("term-link"), termdata.dbpedia_uri); $.ajax({ - url: contribute_url, + url: urls.ajax_contribute, dataType: "json", type: "POST", data: {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jocondelab/static/jocondelab/lib/jquery.tagit.css Mon Sep 09 17:23:38 2013 +0200 @@ -0,0 +1,67 @@ +ul.tagit { + padding: 1px 5px; + overflow: auto; + margin-left: inherit; /* usually we don't want the regular ul margins. */ + margin-right: inherit; +} +ul.tagit li { + display: block; + float: left; + margin: 2px 5px 2px 0; +} +ul.tagit li.tagit-choice { + position: relative; + line-height: inherit; +} + +ul.tagit li.tagit-choice-read-only { + padding: .2em .5em .2em .5em; +} + +ul.tagit li.tagit-choice-editable { + padding: .2em 18px .2em .5em; +} + +ul.tagit li.tagit-new { + padding: .25em 4px .25em 0; +} + +ul.tagit li.tagit-choice a.tagit-label { + cursor: pointer; + text-decoration: none; +} +ul.tagit li.tagit-choice .tagit-close { + cursor: pointer; + position: absolute; + right: .1em; + top: 50%; + margin-top: -8px; + line-height: 17px; +} + +/* used for some custom themes that don't need image icons */ +ul.tagit li.tagit-choice .tagit-close .text-icon { + display: none; +} + +ul.tagit li.tagit-choice input { + display: block; + float: left; + margin: 2px 5px 2px 0; +} +ul.tagit input[type="text"] { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + + border: none; + margin: 0; + padding: 0; + width: inherit; + background-color: inherit; + outline: none; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/jocondelab/static/jocondelab/lib/tag-it.min.js Mon Sep 09 17:23:38 2013 +0200 @@ -0,0 +1,16 @@ +(function(b){b.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var a= +this;this.element.is("input")?(this.tagList=b("<ul></ul>").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.css("display","none")):this.tagList=this.element.find("ul, ol").andSelf().last();this.tagInput=b('<input type="text" />').addClass("ui-widget-content");this.options.readOnly&&this.tagInput.attr("disabled","disabled");this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex);this.options.placeholderText&&this.tagInput.attr("placeholder", +this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(a,c){var d=a.term.toLowerCase(),e=b.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(e=this._subtractArray(e,this.assignedTags()));c(e)});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(){a._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=0)); +b.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=b.proxy(this.options.autocomplete.source,this));b.isFunction(this.options.tagSource)&&(this.options.tagSource=b.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(b('<li class="tagit-new"></li>').append(this.tagInput)).click(function(c){var d=b(c.target);d.hasClass("tagit-label")?(d=d.closest(".tagit-choice"),d.hasClass("removed")||a._trigger("onTagClicked", +c,{tag:d,tagLabel:a.tagLabel(d)})):a.tagInput.focus()});var d=!1;if(this.options.singleField)if(this.options.singleFieldNode){var c=b(this.options.singleFieldNode),e=c.val().split(this.options.singleFieldDelimiter);c.val("");b.each(e,function(b,c){a.createTag(c,null,!0);d=!0})}else this.options.singleFieldNode=b('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);d||this.tagList.children("li").each(function(){b(this).hasClass("tagit-new")|| +(a.createTag(b(this).text(),b(this).attr("class"),!0),b(this).remove())});this.tagInput.keydown(function(c){if(c.which==b.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var d=a._lastTag();!a.options.removeConfirmation||d.hasClass("remove")?a.removeTag(d):a.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");if(c.which===b.ui.keyCode.COMMA||c.which===b.ui.keyCode.ENTER||c.which==b.ui.keyCode.TAB&& +""!==a.tagInput.val()||c.which==b.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=b.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==b.trim(a.tagInput.val()).charAt(0)&&'"'==b.trim(a.tagInput.val()).charAt(b.trim(a.tagInput.val()).length-1)&&0!==b.trim(a.tagInput.val()).length-1))c.which===b.ui.keyCode.ENTER&&""===a.tagInput.val()||c.preventDefault(),a.tagInput.data("autocomplete-open")||a.createTag(a._cleanedInput())}).blur(function(){a.tagInput.data("autocomplete-open")||a.createTag(a._cleanedInput())}); +if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source)c={select:function(b,c){a.createTag(c.item.value);return!1}},b.extend(c,this.options.autocomplete),c.source=this.options.tagSource||c.source,this.tagInput.autocomplete(c).bind("autocompleteopen",function(){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose",function(){a.tagInput.data("autocomplete-open",!1)})},_cleanedInput:function(){return b.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))}, +_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var a=this,d=[];this.options.singleField?(d=b(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter),""===d[0]&&(d=[])):this._tags().each(function(){d.push(a.tagLabel(this))});return d},_updateSingleTagsField:function(a){b(this.options.singleFieldNode).val(a.join(this.options.singleFieldDelimiter)).trigger("change")}, +_subtractArray:function(a,d){for(var c=[],e=0;e<a.length;e++)-1==b.inArray(a[e],d)&&c.push(a[e]);return c},tagLabel:function(a){return this.options.singleField?b(a).find(".tagit-label:first").text():b(a).find("input:first").val()},_showAutocomplete:function(){this.tagInput.autocomplete("search","")},_findTagByLabel:function(a){var d=this,c=null;this._tags().each(function(){if(d._formatStr(a)==d._formatStr(d.tagLabel(this)))return c=b(this),!1});return c},_isNew:function(a){return!this._findTagByLabel(a)}, +_formatStr:function(a){return this.options.caseSensitive?a:b.trim(a.toLowerCase())},_effectExists:function(a){return Boolean(b.effects&&(b.effects[a]||b.effects.effect&&b.effects.effect[a]))},createTag:function(a,d,c){var e=this;a=b.trim(a);this.options.preprocessTag&&(a=this.options.preprocessTag(a));if(""===a)return!1;if(!this.options.allowDuplicates&&!this._isNew(a))return a=this._findTagByLabel(a),!1!==this._trigger("onTagExists",null,{existingTag:a,duringInitialization:c})&&this._effectExists("highlight")&& +a.effect("highlight"),!1;if(this.options.tagLimit&&this._tags().length>=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:c}),!1;var g=b(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(a),f=b("<li></li>").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(d).append(g);this.options.readOnly?f.addClass("tagit-choice-read-only"):(f.addClass("tagit-choice-editable"),d=b("<span></span>").addClass("ui-icon ui-icon-close"), +d=b('<a><span class="text-icon">\u00d7</span></a>').addClass("tagit-close").append(d).click(function(){e.removeTag(f)}),f.append(d));this.options.singleField||(g=g.html(),f.append('<input type="hidden" style="display:none;" value="'+g+'" name="'+this.options.fieldName+'" />'));!1!==this._trigger("beforeTagAdded",null,{tag:f,tagLabel:this.tagLabel(f),duringInitialization:c})&&(this.options.singleField&&(g=this.assignedTags(),g.push(a),this._updateSingleTagsField(g)),this._trigger("onTagAdded",null, +f),this.tagInput.val(""),this.tagInput.parent().before(f),this._trigger("afterTagAdded",null,{tag:f,tagLabel:this.tagLabel(f),duringInitialization:c}),this.options.showAutocompleteOnFocus&&!c&&setTimeout(function(){e._showAutocomplete()},0))},removeTag:function(a,d){d="undefined"===typeof d?this.options.animate:d;a=b(a);this._trigger("onTagRemoved",null,a);if(!1!==this._trigger("beforeTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})){if(this.options.singleField){var c=this.assignedTags(),e=this.tagLabel(a), +c=b.grep(c,function(a){return a!=e});this._updateSingleTagsField(c)}if(d){a.addClass("removed");var c=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],g=this;c.push(function(){a.remove();g._trigger("afterTagRemoved",null,{tag:a,tagLabel:g.tagLabel(a)})});a.fadeOut("fast").hide.apply(a,c).dequeue()}else a.remove(),this._trigger("afterTagRemoved",null,{tag:a,tagLabel:this.tagLabel(a)})}},removeTagByLabel:function(a,b){var c=this._findTagByLabel(a);if(!c)throw"No such tag exists with the name '"+ +a+"'";this.removeTag(c,b)},removeAll:function(){var a=this;this._tags().each(function(b,c){a.removeTag(c,!1)})}})})(jQuery);
--- a/src/jocondelab/templates/jocondelab/front_base.html Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/front_base.html Mon Sep 09 17:23:38 2013 +0200 @@ -12,10 +12,12 @@ <script type="text/javascript" src="{{STATIC_URL}}jocondelab/lib/underscore-min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}jocondelab/lib/jquery.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}jocondelab/lib/jquery-ui.min.js"></script> + <script type="text/javascript" src="{{STATIC_URL}}jocondelab/lib/tag-it.min.js"></script> {% endblock %} {% block css_import %} <link rel="stylesheet" href="{{STATIC_URL}}jocondelab/css/smoothness/jquery-ui-1.10.3.custom.min.css" type="text/css"/> + <link rel="stylesheet" href="{{STATIC_URL}}jocondelab/lib/jquery.tagit.css" type="text/css"/> {% endblock %} {% block css_declaration %} @@ -23,6 +25,9 @@ {% endblock %} {% block js_declaration %} + <script type="text/javascript"> + var urls = { ajax_terms: "{% url 'ajax_terms' %}" }; + </script> <script type="text/javascript" src="{{STATIC_URL}}jocondelab/js/front-common.js"></script> {% endblock %} @@ -67,8 +72,8 @@ </div> </div> {% block header_search %} - <form class="header-search-form" action="{% url 'front_search' %}"> - <input class="header-search-input" type="search" name="q" placeholder="{% trans 'Search in contents' %}" /> + <form class="header-search-form search-form" action="{% url 'front_search' %}"> + <input class="header-search-input search-input" type="search" name="q" placeholder="{% trans 'Search in contents' %}" /> </form> {% endblock %} {% endblock %}
--- a/src/jocondelab/templates/jocondelab/front_geo.html Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/front_geo.html Mon Sep 09 17:23:38 2013 +0200 @@ -15,13 +15,11 @@ {% block js_declaration %} {{block.super}} <script type="text/javascript"> - var urls = { - static_url: "{{STATIC_URL}}", - ajax_geo_coords: "{% url 'ajax_geo_coords' %}", - ajax_geo_search: "{% url 'ajax_geo_search' %}", - ajax_contents: "{% url 'ajax_contents' %}", - countries_geo_json: "{{STATIC_URL}}jocondelab/lib/countries.geo.json" - }; + urls.orange_marker = "{{STATIC_URL}}jocondelab/lib/images/marker-orange.png"; + urls.ajax_geo_coords = "{% url 'ajax_geo_coords' %}"; + urls.ajax_geo_search = "{% url 'ajax_geo_search' %}"; + urls.ajax_contents = "{% url 'ajax_contents' %}"; + urls.countries_geo_json = "{{STATIC_URL}}jocondelab/lib/countries.geo.json"; var countries = {{countries|safe}}; </script> <script type="text/javascript" src="{{STATIC_URL}}jocondelab/js/front-geo.js"></script>
--- a/src/jocondelab/templates/jocondelab/front_notice.html Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/front_notice.html Mon Sep 09 17:23:38 2013 +0200 @@ -10,10 +10,10 @@ {% block js_declaration %} {{block.super}} <script type="text/javascript"> - var wikipedia_urls = {{wikipedia_urls|safe}}, - contribute_url = "{% url 'ajax_contribute' %}", - notice_id = "{{object.id}}", + var notice_id = "{{object.id}}", csrf_token = "{{csrf_token}}"; + urls.ajax_contribute = "{% url 'ajax_contribute' %}"; + urls.wikipedia = {{wikipedia_urls|safe}}; </script> <script type="text/javascript" src="{{STATIC_URL}}jocondelab/js/front-notice.js"></script> {% endblock %}
--- a/src/jocondelab/templates/jocondelab/front_search.html Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/front_search.html Mon Sep 09 17:23:38 2013 +0200 @@ -20,10 +20,11 @@ {% block main %} - <form class="big-search-form"> - <input class="big-search-input" type="search" name="q" value="{{searchterm}}" /> + <form class="big-search-form search-form"> + <input class="big-search-input search-input" type="search" name="q" value="{{searchterm}}" /> </form> + {% if not searchterm %} <ul class="term-cloud"> {% for word in words %} <li style="font-size: {{word.font_size|unlocalize}}em"> @@ -31,6 +32,7 @@ </li> {% endfor %} </ul> + {% endif %} {% include 'jocondelab/partial/notice_list.html' %}
--- a/src/jocondelab/templates/jocondelab/front_timeline.html Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/front_timeline.html Mon Sep 09 17:23:38 2013 +0200 @@ -10,11 +10,8 @@ {% block js_declaration %} {{block.super}} <script type="text/javascript"> - var urls = { - static_url: "{{STATIC_URL}}", - ajax_years: "{% url 'ajax_years' %}", - ajax_contents: "{% url 'ajax_contents' %}" - } + urls.ajax_years = "{% url 'ajax_years' %}"; + urls.ajax_contents = "{% url 'ajax_contents' %}"; </script> <script type="text/javascript" src="{{STATIC_URL}}jocondelab/js/front-timeline.js"></script> {% endblock %}
--- a/src/jocondelab/urls.py Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/urls.py Mon Sep 09 17:23:38 2013 +0200 @@ -36,6 +36,7 @@ url(r'^geo/$', GeoView.as_view(), name='front_geo'), url(r'^timeline/$', TemplateView.as_view(template_name="jocondelab/front_timeline.html"), name='front_timeline'), url(r'^notice/(?P<pk>\d+)/$', NoticeView.as_view(), name='front_notice'), + url(r'^ajax/terms/$', 'jocondelab.views.ajax.terms', name='ajax_terms'), url(r'^ajax/years/$', 'jocondelab.views.ajax.years', name='ajax_years'), url(r'^ajax/geocoords/$', 'jocondelab.views.ajax.geo_coords', name='ajax_geo_coords'), url(r'^ajax/geosearch/$', 'jocondelab.views.ajax.geo_search', name='ajax_geo_search'),
--- a/src/jocondelab/views/ajax.py Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/views/ajax.py Mon Sep 09 17:23:38 2013 +0200 @@ -14,6 +14,15 @@ from django.conf import settings from jocondelab.views.front_office import get_notices +def terms(request): + + lang = request.GET.get('lang', request.LANGUAGE_CODE)[:2] + q = request.GET.get('term', None) + count = request.GET.get('count', 20) + qs = DbpediaFields.objects.filter(language_code=lang,label__istartswith=q).values('dbpedia_uri','label').distinct().order_by('label')[:count] + res = [{"dbpedia_uri": r['dbpedia_uri'], "label": r['label']} for r in qs] + return HttpResponse(content=json.dumps(res), mimetype='application/json') + def years(request): lang = request.GET.get('lang', request.LANGUAGE_CODE)[:2]
--- a/src/jocondelab/views/front_office.py Fri Sep 06 17:51:50 2013 +0200 +++ b/src/jocondelab/views/front_office.py Mon Sep 09 17:23:38 2013 +0200 @@ -52,26 +52,16 @@ context = {} lang = request.GET.get('lang',request.LANGUAGE_CODE)[:2] querystr = request.GET.get('q', "") - search_in_title = request.GET.get('search_in_title', True) - search_in_translations = request.GET.get('search_in_translations', True) show_tagcloud = request.GET.get('show_tagcloud', True) - queryterms = [s.strip(" ") for s in re.split("[,;]",querystr) if s.strip(" ")] if (search_in_title or search_in_translations) else None + queryterms = [s.strip(" ") for s in re.split("[,;]",querystr) if s.strip(" ")] npp = 48 if queryterms else 24 - if queryterms and search_in_translations and search_in_title: - mainq = Q() - if search_in_translations: - transq = Q() - for term in queryterms: - transq = transq | Q(label__icontains=term) - ts = DbpediaFields.objects.filter(language_code=lang).filter(transq).values('term_id') - mainq = mainq | Q(noticeterm__term__in=ts) -# mainq = mainq | Q(noticeterm__term__dbpedia_fields__language_code=lang,noticeterm__term__dbpedia_fields__label__icontains=term) - if search_in_title: - for term in queryterms: - mainq = mainq | Q(titr__icontains=term) - qs = Notice.objects.filter(Q(image=True) & mainq).distinct() + if queryterms: + qs = Notice.objects.filter(image=True) + for term in queryterms: + fs = DbpediaFields.objects.filter(label=term, language_code=lang).values('term_id').distinct() + qs = qs.filter(noticeterm__term__in=fs) nbnotices = qs.count() ns = qs[:npp] else: @@ -85,7 +75,7 @@ context["searchterm"] = querystr wpp = 50 - if show_tagcloud: + if show_tagcloud and not queryterms: ts = Term.objects.filter(dbpedia_fields__language_code=lang).order_by('-nb_notice')[:wpp] words = [{ "uri": t.dbpedia_uri,