diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/fixtures/initial_data-fr.json | 3 | ||||
| -rw-r--r-- | ishtar_common/fixtures/initial_importtypes-fr.json | 311 | ||||
| -rw-r--r-- | ishtar_common/static/gentium/GentiumPlus-I.ttf | bin | 0 -> 1818280 bytes | |||
| -rw-r--r-- | ishtar_common/static/gentium/GentiumPlus-R.ttf | bin | 0 -> 1918536 bytes | |||
| -rw-r--r-- | ishtar_common/static/gentium/OFL.txt | 94 | ||||
| -rw-r--r-- | ishtar_common/static/gentium/README.txt | 88 | ||||
| -rw-r--r-- | ishtar_common/static/media/style_basic.css | 35 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet_organization_pdf.html | 4 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet_person_pdf.html | 4 | ||||
| -rw-r--r-- | ishtar_common/views.py | 39 | 
10 files changed, 497 insertions, 81 deletions
| diff --git a/ishtar_common/fixtures/initial_data-fr.json b/ishtar_common/fixtures/initial_data-fr.json index d9026cf49..4045094d9 100644 --- a/ishtar_common/fixtures/initial_data-fr.json +++ b/ishtar_common/fixtures/initial_data-fr.json @@ -839,6 +839,9 @@              ],              [                  "Documents op\u00e9ration : lecture" +            ], +            [ +                "Contenants : lecture"              ]          ]      } diff --git a/ishtar_common/fixtures/initial_importtypes-fr.json b/ishtar_common/fixtures/initial_importtypes-fr.json index 4386b6de7..438a023e0 100644 --- a/ishtar_common/fixtures/initial_importtypes-fr.json +++ b/ishtar_common/fixtures/initial_importtypes-fr.json @@ -119,6 +119,13 @@      }  },  { +    "model": "ishtar_common.importermodel", +    "fields": { +        "name": "Relation entre Op\u00e9ration", +        "klass": "archaeological_operations.models.RecordRelations" +    } +}, +{      "model": "ishtar_common.importertype",      "fields": {          "name": "MCC - Op\u00e9rations", @@ -129,6 +136,7 @@          ],          "is_template": true,          "unicity_keys": "code_patriarche", +        "available": true,          "users": [],          "created_models": []      } @@ -144,6 +152,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": []      } @@ -159,6 +168,7 @@          ],          "is_template": true,          "unicity_keys": "", +        "available": true,          "users": [],          "created_models": []      } @@ -174,6 +184,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": []      } @@ -189,6 +200,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": []      } @@ -204,6 +216,7 @@          ],          "is_template": true,          "unicity_keys": "code_patriarche", +        "available": true,          "users": [],          "created_models": [              [ @@ -229,6 +242,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": [              [ @@ -251,6 +265,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": []      } @@ -266,6 +281,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": []      } @@ -281,6 +297,7 @@          ],          "is_template": true,          "unicity_keys": "", +        "available": true,          "users": [],          "created_models": [              [ @@ -300,6 +317,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": [              [ @@ -325,6 +343,7 @@          ],          "is_template": true,          "unicity_keys": "external_id", +        "available": true,          "users": [],          "created_models": [              [ @@ -343,6 +362,26 @@      }  },  { +    "model": "ishtar_common.importertype", +    "fields": { +        "name": "Ishtar - Relations entre op\u00e9rations", +        "slug": "ishtar-operations-relations", +        "description": null, +        "associated_models": [ +            "archaeological_operations.models.RecordRelations" +        ], +        "is_template": true, +        "unicity_keys": null, +        "available": true, +        "users": [], +        "created_models": [ +            [ +                "archaeological_operations.models.RecordRelations" +            ] +        ] +    } +}, +{      "model": "ishtar_common.regexp",      "fields": {          "name": "Num\u00e9ro INSEE", @@ -2595,11 +2634,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 25, +        "col_number": 26,          "description": "Marquage visible sur le mobilier. Exemple : \"id1234 la Roche aux F\u00e9es\", \"MTX-45\", etc.\r\nCeci reproduit d'ordinaire un marquage r\u00e9alis\u00e9 par un arch\u00e9ologue. Il ne s'agit pas ici de reproduire une \u00e9pigraphie ou tout autre inscription arch\u00e9ologique (graffito, d\u00e9dicaces, defixio, etc.) , mais vous pouvez l'utiliser pour cela si vous n'avez pas \u00e0 utiliser de marquage arch\u00e9ologique.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2609,11 +2648,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 26, +        "col_number": 27,          "description": "Commentaire g\u00e9n\u00e9ral libre. Exemple : \"habillage en nid d'abeille, poli g\u00e9n\u00e9ralis\u00e9, encoche emmanchement lat\u00e9ral ouvert sur la face sup\u00e9rieure\", \"1 bord + bec tubulaire\", \"fibule de Langton Down\", etc.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2623,11 +2662,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 27, +        "col_number": 28,          "description": "Commentaire g\u00e9n\u00e9ral sur les datations, si besoin. Exemple : \"plut\u00f4t fin IIe s. ou d\u00e9but IIIe s.\", \"Datation \u00e0 pr\u00e9ciser avant publication\", \" Datation rapide faite par M. Dupont\", etc.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2637,11 +2676,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 28, +        "col_number": 29,          "description": "Valeur estim\u00e9e (\u20ac), sous la forme d'un nombre d\u00e9cimal. Exemple : \"4500\", \"0.2\", etc.\r\nUtile essentiellement pour les probl\u00e8mes de partage, vente, assurance etc.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2651,11 +2690,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 29, +        "col_number": 30,          "description": "Nom exact du fichier image, sous la forme XXXXX.jpg.\r\nAttention au respect strict des caract\u00e8res et majuscules lors d'un import de ce type, \".JPG\" ou \"*.jpg\", etc.\r\nExemple : \"P1030831.JPG\", \"IMG_6485.JPG\", \"fibule.jpg\", etc.\r\nLors de l'import il faut ajouter ces images sous la forme d'un fichier zip (joint au csv import\u00e9) pour que les images soient automatiquement int\u00e9gr\u00e9es.\r\n",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2665,7 +2704,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 30, +        "col_number": 31,          "description": "Chronologies associ\u00e9es (plusieurs possibles s\u00e9par\u00e9es par &). Exemple : \"Gallo-romain & M\u00e9di\u00e9val\", \"GR&MED\", \"M\u00e9solithique final & M\u00e9so moyen & Epipal\", etc.",          "regexp_pre_filter": null,          "required": false, @@ -2679,11 +2718,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 31, +        "col_number": 32,          "description": "Coordonn\u00e9e X pour cet objet.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2693,11 +2732,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 32, +        "col_number": 33,          "description": "Coordonn\u00e9e Y pour cet objet.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2707,11 +2746,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 33, +        "col_number": 34,          "description": "Coordonn\u00e9e Z pour cet objet (altitude NGF ou arbitraire).",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2721,11 +2760,11 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 34, +        "col_number": 35,          "description": "Code permettant de qualifier le mode de projection des donn\u00e9es (SRS /EPSG). Exemple : \"2154\" pour le Lambert 93.",          "regexp_pre_filter": null,          "required": false, -        "export_field_name": null +        "export_field_name": ""      }  },  { @@ -2791,7 +2830,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 36, +        "col_number": 37,          "description": "Identifiant textuel du d\u00e9p\u00f4t. Cet identifiant doit correspondre \u00e0 un d\u00e9p\u00f4t existant en base de donn\u00e9es.",          "regexp_pre_filter": null,          "required": false, @@ -2805,7 +2844,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 37, +        "col_number": 38,          "description": "",          "regexp_pre_filter": null,          "required": false, @@ -2819,7 +2858,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 38, +        "col_number": 39,          "description": "Champ n\u00e9cessaire si vous indiquez une caisse",          "regexp_pre_filter": null,          "required": false, @@ -3169,7 +3208,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 35, +        "col_number": 36,          "description": "Date au format JJ/MM/AAAA ou AAAA-MM-JJ. Par exemple : 2017-07-31 ou 31/07/2017.",          "regexp_pre_filter": null,          "required": false, @@ -3183,7 +3222,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 39, +        "col_number": 40,          "description": "Localisation dans le d\u00e9p\u00f4t : r\u00e9f\u00e9rence de la premi\u00e8re localisation. Par exemple si la premi\u00e8re localisation du d\u00e9p\u00f4t concern\u00e9 est \u00ab b\u00e2timent \u00bb mettre : \u00ab A \u00bb pour b\u00e2timent A.",          "regexp_pre_filter": null,          "required": false, @@ -3197,7 +3236,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 40, +        "col_number": 41,          "description": "Localisation dans le d\u00e9p\u00f4t : r\u00e9f\u00e9rence de la seconde localisation.",          "regexp_pre_filter": null,          "required": false, @@ -3211,7 +3250,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 41, +        "col_number": 42,          "description": "Localisation dans le d\u00e9p\u00f4t : r\u00e9f\u00e9rence de la troisi\u00e8me localisation.",          "regexp_pre_filter": null,          "required": false, @@ -3225,7 +3264,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 42, +        "col_number": 43,          "description": "Localisation dans le d\u00e9p\u00f4t : r\u00e9f\u00e9rence de la quatri\u00e8me localisation.",          "regexp_pre_filter": null,          "required": false, @@ -3239,7 +3278,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 43, +        "col_number": 44,          "description": "Localisation dans le d\u00e9p\u00f4t : r\u00e9f\u00e9rence de la cinqui\u00e8me localisation.",          "regexp_pre_filter": null,          "required": false, @@ -3253,7 +3292,7 @@          "importer_type": [              "ishtar-finds"          ], -        "col_number": 44, +        "col_number": 45,          "description": "Localisation dans le d\u00e9p\u00f4t : r\u00e9f\u00e9rence de la sixi\u00e8me localisation. ",          "regexp_pre_filter": null,          "required": false, @@ -3261,6 +3300,62 @@      }  },  { +    "model": "ishtar_common.importercolumn", +    "fields": { +        "label": "NMI", +        "importer_type": [ +            "ishtar-finds" +        ], +        "col_number": 25, +        "description": "Nombre minimum d'individu(s) li\u00e9(s) \u00e0 cet enregistrement (entier). Exemple : \"12\".", +        "regexp_pre_filter": null, +        "required": false, +        "export_field_name": "" +    } +}, +{ +    "model": "ishtar_common.importercolumn", +    "fields": { +        "label": "Op\u00e9ration (identifiant externe) - membre de gauche", +        "importer_type": [ +            "ishtar-operations-relations" +        ], +        "col_number": 1, +        "description": "", +        "regexp_pre_filter": null, +        "required": true, +        "export_field_name": null +    } +}, +{ +    "model": "ishtar_common.importercolumn", +    "fields": { +        "label": "Type de relation entre op\u00e9ration", +        "importer_type": [ +            "ishtar-operations-relations" +        ], +        "col_number": 2, +        "description": "", +        "regexp_pre_filter": null, +        "required": true, +        "export_field_name": null +    } +}, +{ +    "model": "ishtar_common.importercolumn", +    "fields": { +        "label": "Op\u00e9ration (identifiant externe) - membre de droite", +        "importer_type": [ +            "ishtar-operations-relations" +        ], +        "col_number": 3, +        "description": "", +        "regexp_pre_filter": null, +        "required": true, +        "export_field_name": null +    } +}, +{      "model": "ishtar_common.formatertype",      "fields": {          "formater_type": "IntegerFormater", @@ -3669,6 +3764,38 @@      }  },  { +    "model": "ishtar_common.formatertype", +    "fields": { +        "formater_type": "TypeFormater", +        "options": "archaeological_operations.models.RelationType", +        "many_split": null +    } +}, +{ +    "model": "ishtar_common.formatertype", +    "fields": { +        "formater_type": "TypeFormater", +        "options": "archaeological_finds.models.AlterationType", +        "many_split": "&" +    } +}, +{ +    "model": "ishtar_common.formatertype", +    "fields": { +        "formater_type": "TypeFormater", +        "options": "archaeological_finds.models.AlterationCauseType", +        "many_split": "&" +    } +}, +{ +    "model": "ishtar_common.formatertype", +    "fields": { +        "formater_type": "TypeFormater", +        "options": "archaeological_finds.models.TreatmentEmergencyType", +        "many_split": null +    } +}, +{      "model": "ishtar_common.importerduplicatefield",      "fields": {          "column": [ @@ -4154,7 +4281,7 @@      "fields": {          "column": [              "ishtar-finds", -            36 +            37          ],          "field_name": "container__location__external_id",          "force_new": false, @@ -4167,7 +4294,7 @@      "fields": {          "column": [              "ishtar-finds", -            36 +            37          ],          "field_name": "container__external_id",          "force_new": false, @@ -4180,7 +4307,7 @@      "fields": {          "column": [              "ishtar-finds", -            37 +            38          ],          "field_name": "container__external_id",          "force_new": false, @@ -7466,7 +7593,7 @@      "fields": {          "column": [              "ishtar-finds", -            25 +            26          ],          "target": "mark",          "regexp_filter": null, @@ -7486,7 +7613,7 @@      "fields": {          "column": [              "ishtar-finds", -            26 +            27          ],          "target": "comment",          "regexp_filter": null, @@ -7506,7 +7633,7 @@      "fields": {          "column": [              "ishtar-finds", -            27 +            28          ],          "target": "dating_comment",          "regexp_filter": null, @@ -7526,7 +7653,7 @@      "fields": {          "column": [              "ishtar-finds", -            28 +            29          ],          "target": "estimated_value",          "regexp_filter": null, @@ -7546,7 +7673,7 @@      "fields": {          "column": [              "ishtar-finds", -            29 +            30          ],          "target": "image",          "regexp_filter": null, @@ -7566,7 +7693,7 @@      "fields": {          "column": [              "ishtar-finds", -            30 +            31          ],          "target": "datings__period",          "regexp_filter": null, @@ -7606,7 +7733,7 @@      "fields": {          "column": [              "ishtar-finds", -            31 +            32          ],          "target": "base_finds__x",          "regexp_filter": null, @@ -7626,7 +7753,7 @@      "fields": {          "column": [              "ishtar-finds", -            32 +            33          ],          "target": "base_finds__y",          "regexp_filter": null, @@ -7646,7 +7773,7 @@      "fields": {          "column": [              "ishtar-finds", -            33 +            34          ],          "target": "base_finds__z",          "regexp_filter": null, @@ -7666,7 +7793,7 @@      "fields": {          "column": [              "ishtar-finds", -            34 +            35          ],          "target": "base_finds__spatial_reference_system",          "regexp_filter": null, @@ -7766,7 +7893,7 @@      "fields": {          "column": [              "ishtar-finds", -            36 +            37          ],          "target": "container__responsible__external_id",          "regexp_filter": null, @@ -7786,7 +7913,7 @@      "fields": {          "column": [              "ishtar-finds", -            37 +            38          ],          "target": "container__reference",          "regexp_filter": null, @@ -7806,7 +7933,7 @@      "fields": {          "column": [              "ishtar-finds", -            38 +            39          ],          "target": "container__container_type",          "regexp_filter": null, @@ -8326,7 +8453,7 @@      "fields": {          "column": [              "ishtar-finds", -            35 +            36          ],          "target": "base_finds__discovery_date",          "regexp_filter": null, @@ -8346,7 +8473,7 @@      "fields": {          "column": [              "ishtar-finds", -            39 +            40          ],          "target": "set_localisation_1",          "regexp_filter": null, @@ -8366,7 +8493,7 @@      "fields": {          "column": [              "ishtar-finds", -            40 +            41          ],          "target": "set_localisation_2",          "regexp_filter": null, @@ -8386,7 +8513,7 @@      "fields": {          "column": [              "ishtar-finds", -            41 +            42          ],          "target": "set_localisation_3",          "regexp_filter": null, @@ -8406,7 +8533,7 @@      "fields": {          "column": [              "ishtar-finds", -            42 +            43          ],          "target": "set_localisation_4",          "regexp_filter": null, @@ -8426,7 +8553,7 @@      "fields": {          "column": [              "ishtar-finds", -            43 +            44          ],          "target": "set_localisation_5",          "regexp_filter": null, @@ -8446,7 +8573,7 @@      "fields": {          "column": [              "ishtar-finds", -            44 +            45          ],          "target": "set_localisation_6",          "regexp_filter": null, @@ -8460,5 +8587,85 @@          "concat_str": "",          "comment": ""      } +}, +{ +    "model": "ishtar_common.importtarget", +    "fields": { +        "column": [ +            "ishtar-finds", +            25 +        ], +        "target": "min_number_of_individuals", +        "regexp_filter": null, +        "formater_type": [ +            "IntegerFormater", +            "", +            "" +        ], +        "force_new": false, +        "concat": false, +        "concat_str": "", +        "comment": "" +    } +}, +{ +    "model": "ishtar_common.importtarget", +    "fields": { +        "column": [ +            "ishtar-operations-relations", +            1 +        ], +        "target": "left_record__external_id", +        "regexp_filter": null, +        "formater_type": [ +            "UnicodeFormater", +            "", +            "" +        ], +        "force_new": false, +        "concat": false, +        "concat_str": null, +        "comment": "" +    } +}, +{ +    "model": "ishtar_common.importtarget", +    "fields": { +        "column": [ +            "ishtar-operations-relations", +            2 +        ], +        "target": "relation_type", +        "regexp_filter": null, +        "formater_type": [ +            "TypeFormater", +            "archaeological_operations.models.RelationType", +            null +        ], +        "force_new": false, +        "concat": false, +        "concat_str": null, +        "comment": "" +    } +}, +{ +    "model": "ishtar_common.importtarget", +    "fields": { +        "column": [ +            "ishtar-operations-relations", +            3 +        ], +        "target": "right_record__external_id", +        "regexp_filter": null, +        "formater_type": [ +            "UnicodeFormater", +            "", +            "" +        ], +        "force_new": false, +        "concat": false, +        "concat_str": null, +        "comment": "" +    }  }  ] diff --git a/ishtar_common/static/gentium/GentiumPlus-I.ttf b/ishtar_common/static/gentium/GentiumPlus-I.ttfBinary files differ new file mode 100644 index 000000000..7bc1b3d8b --- /dev/null +++ b/ishtar_common/static/gentium/GentiumPlus-I.ttf diff --git a/ishtar_common/static/gentium/GentiumPlus-R.ttf b/ishtar_common/static/gentium/GentiumPlus-R.ttfBinary files differ new file mode 100644 index 000000000..c1194dd35 --- /dev/null +++ b/ishtar_common/static/gentium/GentiumPlus-R.ttf diff --git a/ishtar_common/static/gentium/OFL.txt b/ishtar_common/static/gentium/OFL.txt new file mode 100644 index 000000000..4f7540787 --- /dev/null +++ b/ishtar_common/static/gentium/OFL.txt @@ -0,0 +1,94 @@ +Copyright (c) 2003-2014 SIL International (http://www.sil.org/),
 +with Reserved Font Names "Gentium" and "SIL".
 +
 +This Font Software is licensed under the SIL Open Font License, Version 1.1.
 +This license is copied below, and is also available with a FAQ at:
 +http://scripts.sil.org/OFL
 +
 +
 +-----------------------------------------------------------
 +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
 +-----------------------------------------------------------
 +
 +PREAMBLE
 +The goals of the Open Font License (OFL) are to stimulate worldwide
 +development of collaborative font projects, to support the font creation
 +efforts of academic and linguistic communities, and to provide a free and
 +open framework in which fonts may be shared and improved in partnership
 +with others.
 +
 +The OFL allows the licensed fonts to be used, studied, modified and
 +redistributed freely as long as they are not sold by themselves. The
 +fonts, including any derivative works, can be bundled, embedded, 
 +redistributed and/or sold with any software provided that any reserved
 +names are not used by derivative works. The fonts and derivatives,
 +however, cannot be released under any other type of license. The
 +requirement for fonts to remain under this license does not apply
 +to any document created using the fonts or their derivatives.
 +
 +DEFINITIONS
 +"Font Software" refers to the set of files released by the Copyright
 +Holder(s) under this license and clearly marked as such. This may
 +include source files, build scripts and documentation.
 +
 +"Reserved Font Name" refers to any names specified as such after the
 +copyright statement(s).
 +
 +"Original Version" refers to the collection of Font Software components as
 +distributed by the Copyright Holder(s).
 +
 +"Modified Version" refers to any derivative made by adding to, deleting,
 +or substituting -- in part or in whole -- any of the components of the
 +Original Version, by changing formats or by porting the Font Software to a
 +new environment.
 +
 +"Author" refers to any designer, engineer, programmer, technical
 +writer or other person who contributed to the Font Software.
 +
 +PERMISSION & CONDITIONS
 +Permission is hereby granted, free of charge, to any person obtaining
 +a copy of the Font Software, to use, study, copy, merge, embed, modify,
 +redistribute, and sell modified and unmodified copies of the Font
 +Software, subject to the following conditions:
 +
 +1) Neither the Font Software nor any of its individual components,
 +in Original or Modified Versions, may be sold by itself.
 +
 +2) Original or Modified Versions of the Font Software may be bundled,
 +redistributed and/or sold with any software, provided that each copy
 +contains the above copyright notice and this license. These can be
 +included either as stand-alone text files, human-readable headers or
 +in the appropriate machine-readable metadata fields within text or
 +binary files as long as those fields can be easily viewed by the user.
 +
 +3) No Modified Version of the Font Software may use the Reserved Font
 +Name(s) unless explicit written permission is granted by the corresponding
 +Copyright Holder. This restriction only applies to the primary font name as
 +presented to the users.
 +
 +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
 +Software shall not be used to promote, endorse or advertise any
 +Modified Version, except to acknowledge the contribution(s) of the
 +Copyright Holder(s) and the Author(s) or with their explicit written
 +permission.
 +
 +5) The Font Software, modified or unmodified, in part or in whole,
 +must be distributed entirely under this license, and must not be
 +distributed under any other license. The requirement for fonts to
 +remain under this license does not apply to any document created
 +using the Font Software.
 +
 +TERMINATION
 +This license becomes null and void if any of the above conditions are
 +not met.
 +
 +DISCLAIMER
 +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
 +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
 +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
 +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
 +OTHER DEALINGS IN THE FONT SOFTWARE.
 diff --git a/ishtar_common/static/gentium/README.txt b/ishtar_common/static/gentium/README.txt new file mode 100644 index 000000000..bc17a8cb7 --- /dev/null +++ b/ishtar_common/static/gentium/README.txt @@ -0,0 +1,88 @@ +README 
 +Gentium Plus
 +========================
 +
 +Thank you for your interest in the Gentium Plus fonts.
 +We hope you find them useful!
 +
 +Gentium Plus supports a wide range of Latin, Greek and Cyrillic 
 +characters. Documentation for the fonts is available on Gentium website
 +(http://scripts.sil.org/Gentium), including details on what ranges are
 +supported. 
 +
 +Gentium Plus is released under the SIL Open Font License.
 +
 +See the OFL and OFL-FAQ for details of the SIL Open Font License.
 +See the FONTLOG for information on this and previous releases.
 +See the GENTIUM-FAQ for answers to common questions about the Gentium fonts
 +See the website (http://scripts.sil.org/Gentium) for further documentation.
 +See the SIL Unicode Roman FAQ (http://scripts.sil.org/ComplexRomanFontFAQ)
 +for frequently asked questions and their answers regarding SIL's Roman fonts.
 +
 +
 +TIPS
 +====
 +
 +As this font is distributed at no cost, we are unable to provide a 
 +commercial level of personal technical support. The font has, however, 
 +been through some testing on various platforms to be sure it works in most
 +situations. In particular, it has been tested and shown to work on Windows
 +XP, Windows Vista and Windows 7. Graphite capabilities have been tested 
 +on Graphite-supported platforms.
 +
 +If you do find a problem, please do report it to fonts@sil.org.
 +We can't guarantee any direct response, but will try to fix reported bugs in
 +future versions. Make sure you read through the 
 +SIL Unicode Roman FAQ (http://scripts.sil.org/ComplexRomanFontFAQ).
 +
 +Many problems can be solved, or at least explained, through an understanding
 +of the encoding and use of the fonts. Here are some basic hints:
 +
 +Encoding: 
 +The fonts are encoded according to Unicode, so your application must support
 +Unicode text in order to access letters other than the standard alphabet.
 +Most Windows applications provide basic Unicode support. You will, however,
 +need some way of entering Unicode text into your document.
 +
 +Keyboarding:
 +This font does not include any keyboarding helps or utilities. It uses the
 +built-in keyboards of the operating system. You will need to install the
 +appropriate keyboard and input method for the characters of the language you
 +wish to use. If you want to enter characters that are not supported by any
 +system keyboard, the Keyman program (www.tavultesoft.com) can be helpful
 +on Windows systems. Also available for Windows is MSKLC 
 +(http://www.microsoft.com/globaldev/tools/msklc.mspx). 
 +For Linux systems such as Ubuntu, KMFL (http://kmfl.sourceforge.net/)
 +is available. Ukelele (http://scripts.sil.org/ukelele) is available for
 +Mac OS X versions 10.2 and later.
 +
 +For other platforms, KMFL (http://kmfl.sourceforge.net/), 
 +XKB (http://www.x.org/wiki/XKB) or Ukelele (http://scripts.sil.org/ukelele) 
 +can be helpful.
 +
 +If you want to enter characters that are not supported by any system
 +keyboard, and to access the full Unicode range, we suggest you use
 +gucharmap, kcharselect on Ubuntu or similar software.
 +
 +Another method of entering some symbols is provided by a few applications such
 +as Adobe InDesign or OpenOffice.org. They can display a glyph palette or input
 +dialog that shows all the glyphs (symbols) in a font and allow you to enter
 +them by clicking on the glyph you want.
 +
 +Rendering:
 +This font is designed to work with Graphite or Opentype advanced font 
 +technologies. To take advantage of the advanced typographic 
 +capabilities of this font, you must be using applications that provide an
 +adequate level of support for Graphite or OpenType. See "Applications
 +that provide an adequate level of support for SIL Unicode Roman fonts" 
 +(http://scripts.sil.org/Complex_AdLvSup).
 +
 +
 +CONTACT
 +========
 +For more information please visit the Gentium page on SIL International's
 +Computers and Writing systems website:
 +http://scripts.sil.org/Gentium
 +
 +Support through the website: http://scripts.sil.org/Support
 +
 diff --git a/ishtar_common/static/media/style_basic.css b/ishtar_common/static/media/style_basic.css index 1d92928dc..d0f5bbe4a 100644 --- a/ishtar_common/static/media/style_basic.css +++ b/ishtar_common/static/media/style_basic.css @@ -1,7 +1,8 @@  @page {    size: a4 portrait; -  margin: 2.5cm 1cm 2.5cm 1cm; +  margin: 2cm 1cm 2.5cm 1cm;    background-image: url("images/ishtar-bg.jpg"); +  background-repeat: no-repeat;    @frame footer {      -pdf-frame-content: pdffooter;      bottom: 1cm; @@ -16,6 +17,9 @@      margin-right: 1cm;      height: 1.5cm;    } +  @bottom-center { +      content: counter(page) "/" counter(pages); +  }  }  label{ @@ -36,6 +40,13 @@ caption, h3{      font-size:1.5em;  } +a img { +    display: block; +    margin-left: auto; +    margin-right: auto; +    padding:0.5em; +} +  th{      text-align:center;      border-bottom:2px solid #922; @@ -72,10 +83,21 @@ td{      display:none;  } +caption, hr, .tool-left, .tool-right, .display_details, .display_details_inline{ +    display: None; +    color: transparent; +    background-color: transparent; +    border-color: transparent; +} +  p{      margin:0.2em;  } +td{ +    background-color: #ddd; +} +  #pdffooter, #pdfheader{      text-align:center;  } @@ -84,8 +106,15 @@ p{      font-weight:bold;      width:100%;      border-bottom:1px solid #922; +    position: fixed; +    top: -0.5cm;  } -.display_details, .display_details_inline{ -    display: none; +.window-refs{ +    text-align:center; +    padding:0; +    margin:0; +    font-size: 0.9em; +    width:100%; +    display:block;  } diff --git a/ishtar_common/templates/ishtar/sheet_organization_pdf.html b/ishtar_common/templates/ishtar/sheet_organization_pdf.html index 887c7ccb2..2276aa4d1 100644 --- a/ishtar_common/templates/ishtar/sheet_organization_pdf.html +++ b/ishtar_common/templates/ishtar/sheet_organization_pdf.html @@ -1,6 +1,5 @@  {% extends "ishtar/sheet_organization.html" %}  {% block header %} -<link rel="stylesheet" href="{{STATIC_URL}}/media/style_basic.css?ver={{VERSION}}" />  {% endblock %}  {% block main_head %}  {{ block.super }} @@ -10,9 +9,6 @@ Ishtar – {{APP_NAME}} – {{item}}  {% endblock %}  {%block head_sheet%}{%endblock%}  {%block main_foot%} -<div id="pdffooter"> -– <pdf:pagenumber/> – -</div>  </body>  </html>  {%endblock%} diff --git a/ishtar_common/templates/ishtar/sheet_person_pdf.html b/ishtar_common/templates/ishtar/sheet_person_pdf.html index 199892d2f..9dd9e4c50 100644 --- a/ishtar_common/templates/ishtar/sheet_person_pdf.html +++ b/ishtar_common/templates/ishtar/sheet_person_pdf.html @@ -1,6 +1,5 @@  {% extends "ishtar/sheet_person.html" %}  {% block header %} -<link rel="stylesheet" href="{{STATIC_URL}}/media/style_basic.css?ver={{VERSION}}" />  {% endblock %}  {% block main_head %}  {{ block.super }} @@ -10,9 +9,6 @@ Ishtar – {{APP_NAME}} – {{item}}  {% endblock %}  {%block head_sheet%}{%endblock%}  {%block main_foot%} -<div id="pdffooter"> -– <pdf:pagenumber/> – -</div>  </body>  </html>  {%endblock%} diff --git a/ishtar_common/views.py b/ishtar_common/views.py index b8350c62a..8d475aff5 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1,6 +1,6 @@  #!/usr/bin/env python  # -*- coding: utf-8 -*- -# Copyright (C) 2010-2016  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2017  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet>  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU Affero General Public License as @@ -21,13 +21,7 @@ from tidylib import tidy_document as tidy  from copy import copy, deepcopy  import csv -import cStringIO as StringIO  import datetime - -import reportlab -reportlab.Version = "2.2"  # stupid hack for an old library... -import ho.pisa as pisa -  import json  import logging  from markdown import markdown @@ -35,6 +29,8 @@ import optparse  import re  from tempfile import NamedTemporaryFile  import unicodedata +from weasyprint import HTML, CSS +from weasyprint.fonts import FontConfiguration  from extra_views import ModelFormSetView @@ -42,6 +38,7 @@ from django.conf import settings  from django.contrib.auth import logout  from django.contrib.auth.decorators import login_required  from django.contrib.postgres.search import SearchQuery +from django.contrib.staticfiles.templatetags.staticfiles import static  from django.core.exceptions import ObjectDoesNotExist  from django.core.urlresolvers import reverse, NoReverseMatch  from django.db.models import Q, ImageField @@ -1333,19 +1330,25 @@ def show_item(model, name, extra_dct=None):          elif doc_type == 'pdf':              tpl = loader.get_template('ishtar/sheet_%s_pdf.html' % name)              context_instance['output'] = 'PDF' -            content = tpl.render(context_instance, request) -            result = StringIO.StringIO() -            html = content.encode('utf-8') -            html = html.replace("<table", "<pdf:nextpage/><table repeat='1'") -            pdf = pisa.pisaDocument(StringIO.StringIO(html), result, -                                    encoding='utf-8') -            response = HttpResponse(result.getvalue(), -                                    content_type='application/pdf') +            html = tpl.render(context_instance, request) +            font_config = FontConfiguration() +            css = CSS(string=''' +            @font-face { +                font-family: Gentium; +                src: url(%s); +            } +            body{ +                font-family: Gentium +            } +            ''' % (static("gentium/GentiumPlus-R.ttf"))) +            css2 = CSS(filename=settings.STATIC_ROOT + '/media/style_basic.css') +            pdf = HTML(string=html, base_url=request.build_absolute_uri() +                       ).write_pdf(stylesheets=[css, css2], +                                   font_config=font_config) +            response = HttpResponse(pdf, content_type='application/pdf')              response['Content-Disposition'] = 'attachment; filename=%s.pdf' % \                                                filename -            if not pdf.err: -                return response -            return HttpResponse(content, content_type="application/xhtml") +            return response          else:              tpl = loader.get_template('ishtar/sheet_%s_window.html' % name)              content = tpl.render(context_instance, request) | 
