django-codenerix-extensions 4.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codenerix_extensions/__init__.py +6 -0
- codenerix_extensions/files/__init__.py +0 -0
- codenerix_extensions/files/models.py +92 -0
- codenerix_extensions/files/views.py +55 -0
- codenerix_extensions/helpers.py +131 -0
- codenerix_extensions/lib/__init__.py +0 -0
- codenerix_extensions/lib/cryptography.py +66 -0
- codenerix_extensions/locale/en/LC_MESSAGES/django.po +85 -0
- codenerix_extensions/locale/es/LC_MESSAGES/django.mo +0 -0
- codenerix_extensions/locale/es/LC_MESSAGES/django.po +86 -0
- codenerix_extensions/static/codenerix_extensions/js/codenerix_extensions.js +49 -0
- codenerix_extensions/static/codenerix_extensions/js/cryptography.js +101 -0
- codenerix_extensions/static/codenerix_extensions/js/websocket.js +248 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/aes.js +207 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/cipher-core.js +857 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/core.js +706 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/enc-base64.js +103 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/enc-utf16.js +129 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/evpkdf.js +112 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/format-hex.js +46 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/hmac.js +125 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/lib-typedarrays.js +56 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/md5.js +248 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/mode-cfb.js +58 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/mode-ctr-gladman.js +96 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/mode-ctr.js +38 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/mode-ecb.js +20 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/mode-ofb.js +34 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/pad-ansix923.js +29 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/pad-iso10126.js +24 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/pad-iso97971.js +20 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/pad-nopadding.js +10 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/pad-zeropadding.js +25 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/pbkdf2.js +125 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/rabbit-legacy.js +170 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/rabbit.js +172 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/rc4.js +119 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/ripemd160.js +247 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/sha1.js +130 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/sha224.js +60 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/sha256.js +179 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/sha3.js +303 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/sha384.js +63 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/sha512.js +303 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/tripledes.js +750 -0
- codenerix_extensions/static/codenerix_extensions/lib/crypto-js/x64-core.js +284 -0
- codenerix_extensions/static/codenerix_extensions/lib/reconnecting-websocket/reconnecting-websocket.js +365 -0
- codenerix_extensions/static/codenerix_extensions/lib/reconnecting-websocket/reconnecting-websocket.min.js +1 -0
- codenerix_extensions/validators.py +222 -0
- codenerix_extensions/views.py +126 -0
- django_codenerix_extensions-4.0.5.dist-info/METADATA +101 -0
- django_codenerix_extensions-4.0.5.dist-info/RECORD +54 -0
- django_codenerix_extensions-4.0.5.dist-info/WHEEL +4 -0
- django_codenerix_extensions-4.0.5.dist-info/licenses/LICENSE +201 -0
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# django-codenerix-extensions
|
|
4
|
+
#
|
|
5
|
+
# Codenerix GNU
|
|
6
|
+
#
|
|
7
|
+
# Project URL : http://www.codenerix.com
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
|
|
21
|
+
from django.utils.translation import gettext_lazy as _
|
|
22
|
+
from django.db import models
|
|
23
|
+
|
|
24
|
+
from codenerix.lib.helpers import upload_path
|
|
25
|
+
from codenerix.fields import FileAngularField, ImageAngularField
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# ##################################
|
|
29
|
+
# #### Documentos e imagenes #######
|
|
30
|
+
# ##################################
|
|
31
|
+
class GenDocumentFile(models.Model): # META: Abstract class
|
|
32
|
+
doc_path = FileAngularField(
|
|
33
|
+
_("Doc Path"),
|
|
34
|
+
upload_to=upload_path,
|
|
35
|
+
max_length=200,
|
|
36
|
+
blank=False,
|
|
37
|
+
null=False,
|
|
38
|
+
)
|
|
39
|
+
name_file = models.CharField(
|
|
40
|
+
_("Name"), max_length=254, blank=False, null=False
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
class Meta:
|
|
44
|
+
abstract = True
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class GenDocumentFileNull(models.Model): # META: Abstract class
|
|
48
|
+
doc_path = FileAngularField(
|
|
49
|
+
_("Doc Path"),
|
|
50
|
+
upload_to=upload_path,
|
|
51
|
+
max_length=200,
|
|
52
|
+
blank=True,
|
|
53
|
+
null=True,
|
|
54
|
+
)
|
|
55
|
+
name_file = models.CharField(
|
|
56
|
+
_("Name"), max_length=254, blank=True, null=True
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
class Meta:
|
|
60
|
+
abstract = True
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class GenImageFile(models.Model): # META: Abstract class
|
|
64
|
+
image = ImageAngularField(
|
|
65
|
+
_("Image"),
|
|
66
|
+
upload_to=upload_path,
|
|
67
|
+
max_length=200,
|
|
68
|
+
blank=False,
|
|
69
|
+
null=False,
|
|
70
|
+
)
|
|
71
|
+
name_file = models.CharField(
|
|
72
|
+
_("Name"), max_length=254, blank=True, null=True
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
class Meta:
|
|
76
|
+
abstract = True
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class GenImageFileNull(models.Model): # META: Abstract class
|
|
80
|
+
image = ImageAngularField(
|
|
81
|
+
_("Image"),
|
|
82
|
+
upload_to=upload_path,
|
|
83
|
+
max_length=200,
|
|
84
|
+
blank=True,
|
|
85
|
+
null=True,
|
|
86
|
+
)
|
|
87
|
+
name_file = models.CharField(
|
|
88
|
+
_("Name"), max_length=254, blank=True, null=True
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
class Meta:
|
|
92
|
+
abstract = True
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# django-codenerix-extensions
|
|
4
|
+
#
|
|
5
|
+
# Codenerix GNU
|
|
6
|
+
#
|
|
7
|
+
# Project URL : http://www.codenerix.com
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
|
|
21
|
+
import json
|
|
22
|
+
from django.views.generic import View
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class DocumentFileView(View):
|
|
26
|
+
def form_valid(self, form, forms=None):
|
|
27
|
+
body_json = json.loads(self.request.body.decode('utf-8'))
|
|
28
|
+
if 'doc_path' in body_json and 'filename' in body_json['doc_path']:
|
|
29
|
+
name_file = body_json['doc_path']['filename']
|
|
30
|
+
self.request.name_file = name_file
|
|
31
|
+
form.instance.name_file = name_file
|
|
32
|
+
if forms:
|
|
33
|
+
return super(DocumentFileView, self).form_valid(form, forms)
|
|
34
|
+
else:
|
|
35
|
+
return super(DocumentFileView, self).form_valid(form)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ImageFileView(View):
|
|
39
|
+
def form_valid(self, form, forms=None):
|
|
40
|
+
body_json = json.loads(self.request.body.decode('utf-8'))
|
|
41
|
+
if 'image' in body_json and 'filename' in body_json['image']:
|
|
42
|
+
name_file = body_json['image']['filename']
|
|
43
|
+
self.request.name_file = name_file
|
|
44
|
+
form.instance.name_file = name_file
|
|
45
|
+
else:
|
|
46
|
+
# compatibility with multiforms
|
|
47
|
+
field_image = "{}_image".format(str(self.form_class).split('.')[-1].replace("'", '').replace('>', ''))
|
|
48
|
+
if field_image in body_json and 'filename' in body_json[field_image]:
|
|
49
|
+
name_file = body_json[field_image]['filename']
|
|
50
|
+
self.request.name_file = name_file
|
|
51
|
+
form.instance.name_file = name_file
|
|
52
|
+
if forms:
|
|
53
|
+
return super(ImageFileView, self).form_valid(form, forms)
|
|
54
|
+
else:
|
|
55
|
+
return super(ImageFileView, self).form_valid(form)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# django-codenerix-extensions
|
|
4
|
+
#
|
|
5
|
+
# Codenerix GNU
|
|
6
|
+
#
|
|
7
|
+
# Project URL : http://www.codenerix.com
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
|
|
21
|
+
import bz2
|
|
22
|
+
from bz2 import BZ2File
|
|
23
|
+
from decimal import Decimal, ROUND_HALF_UP
|
|
24
|
+
|
|
25
|
+
from django.utils.translation import get_language
|
|
26
|
+
from django.conf import settings
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_external_model(class_object):
|
|
30
|
+
"""
|
|
31
|
+
Given a class (class_object), it locates the related model (throught the codenerix abstract class)
|
|
32
|
+
"""
|
|
33
|
+
class_abstract = class_object.CodenerixMeta.abstract
|
|
34
|
+
if class_abstract is not None:
|
|
35
|
+
for class_related in class_object._meta.related_objects:
|
|
36
|
+
if issubclass(class_related.related_model, class_abstract):
|
|
37
|
+
return class_related.related_model
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_external_method(class_object, method_name, *args, **kwargs):
|
|
42
|
+
"""
|
|
43
|
+
Given a class (class_object), a name for a method (method_name) and its arguments,
|
|
44
|
+
it searchs for the method in the related model (throught the codenerix abstract class) and
|
|
45
|
+
it executes that method or return None if no method is found.
|
|
46
|
+
"""
|
|
47
|
+
related_model = get_external_model(class_object)
|
|
48
|
+
if related_model is not None:
|
|
49
|
+
f = getattr(related_model, method_name, None)
|
|
50
|
+
if f:
|
|
51
|
+
instance = related_model()
|
|
52
|
+
return f(instance, *args, **kwargs)
|
|
53
|
+
else:
|
|
54
|
+
return None
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def DynamicLanguageForm(modelName, modelConection, exclude=None, nameForm=None):
|
|
59
|
+
listForm = []
|
|
60
|
+
for lang in settings.LANGUAGES:
|
|
61
|
+
lang_code = lang[0].upper()
|
|
62
|
+
name = str(modelName) + "FormText" if nameForm is None else nameForm
|
|
63
|
+
excludes = "["
|
|
64
|
+
if exclude:
|
|
65
|
+
for e in exclude:
|
|
66
|
+
excludes += e + ", "
|
|
67
|
+
excludes += "]"
|
|
68
|
+
|
|
69
|
+
string = "class {}{}(GenModelForm):\n".format(name, lang_code)
|
|
70
|
+
string += " class Meta:\n"
|
|
71
|
+
string += " model={}{}\n".format(modelConection, lang_code)
|
|
72
|
+
string += " exclude = {}\n".format(excludes)
|
|
73
|
+
listForm.append(string)
|
|
74
|
+
|
|
75
|
+
return listForm
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def get_language_database():
|
|
79
|
+
'''
|
|
80
|
+
Return the language to be used to search the database contents
|
|
81
|
+
'''
|
|
82
|
+
lang = None
|
|
83
|
+
language = get_language()
|
|
84
|
+
if language:
|
|
85
|
+
for x in settings.LANGUAGES_DATABASES:
|
|
86
|
+
if x.upper() == language.upper():
|
|
87
|
+
lang = language
|
|
88
|
+
break
|
|
89
|
+
|
|
90
|
+
if lang is None:
|
|
91
|
+
lang = settings.LANGUAGES_DATABASES[0]
|
|
92
|
+
return lang.lower()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class FileBZ2(object):
|
|
96
|
+
def __init__(self, filename, mode):
|
|
97
|
+
self.file = None
|
|
98
|
+
if 'r' in mode:
|
|
99
|
+
self.mode = 'r'
|
|
100
|
+
elif 'w' in mode:
|
|
101
|
+
self.mode = 'w'
|
|
102
|
+
raise Exception('This method is not developed')
|
|
103
|
+
else:
|
|
104
|
+
raise Exception('Mode must contain "r" for decompressing or "w" for compressing')
|
|
105
|
+
|
|
106
|
+
self.binary = 'b' in mode
|
|
107
|
+
self.filename = filename
|
|
108
|
+
|
|
109
|
+
def __enter__(self):
|
|
110
|
+
try:
|
|
111
|
+
mode = self.mode
|
|
112
|
+
if self.binary:
|
|
113
|
+
mode += 't'
|
|
114
|
+
self.file = bz2.open(self.filename, mode)
|
|
115
|
+
except AttributeError:
|
|
116
|
+
mode = self.mode
|
|
117
|
+
if self.binary:
|
|
118
|
+
mode += 'U'
|
|
119
|
+
self.file = BZ2File(self.filename, mode)
|
|
120
|
+
return self.file
|
|
121
|
+
|
|
122
|
+
def __exit__(self, type, value, traceback):
|
|
123
|
+
if self.file:
|
|
124
|
+
self.file.close()
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def round_decimal(number, currency_decimal_places=2, round_type=ROUND_HALF_UP):
|
|
128
|
+
# Round Decimal variable
|
|
129
|
+
number = Decimal(number)
|
|
130
|
+
number_decimal = str(10**(-currency_decimal_places))
|
|
131
|
+
return number.quantize(Decimal(number_decimal), rounding=round_type)
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# django-codenerix-extensions
|
|
4
|
+
#
|
|
5
|
+
# Codenerix GNU
|
|
6
|
+
#
|
|
7
|
+
# Project URL : http://www.codenerix.com
|
|
8
|
+
#
|
|
9
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
# you may not use this file except in compliance with the License.
|
|
11
|
+
# You may obtain a copy of the License at
|
|
12
|
+
#
|
|
13
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
#
|
|
15
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
# See the License for the specific language governing permissions and
|
|
19
|
+
# limitations under the License.
|
|
20
|
+
#
|
|
21
|
+
# This library is intended for encrypting as CODENERIX's Cryptography Libraries work, the basis
|
|
22
|
+
# for the library to work are, the KEY is always a SHA256 from your real KEY, the IV vector
|
|
23
|
+
# should be generated automatically on encryption time by the library and must be inserted
|
|
24
|
+
# at the beginning of the encrypted string (which shoul be padded with PKCS7). The full
|
|
25
|
+
# string IV+ENCRYPTED is encoded to Base64. For decrypting the process is the opossite, the
|
|
26
|
+
# raw string is decoded from Base64, the first 16 bytes are taken as the IV and the rest as
|
|
27
|
+
# the encrypted string, the key is hashed with SHA256 and then the encrypted string is decrypted
|
|
28
|
+
# using the IV and the hashed key.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
import base64
|
|
32
|
+
import hashlib
|
|
33
|
+
|
|
34
|
+
from Crypto import Random
|
|
35
|
+
from Crypto.Cipher import AES
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class AESCipher(object):
|
|
39
|
+
"""
|
|
40
|
+
Adapted solution from: https://stackoverflow.com/a/21928790/1481040
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
def __init__(self):
|
|
44
|
+
self.bs = 32
|
|
45
|
+
|
|
46
|
+
def encrypt(self, raw, key, iv=None):
|
|
47
|
+
raw = self._pad(raw)
|
|
48
|
+
if iv is None:
|
|
49
|
+
iv = Random.new().read(AES.block_size)
|
|
50
|
+
hashkey = hashlib.sha256(key.encode()).digest()
|
|
51
|
+
cipher = AES.new(hashkey, AES.MODE_CBC, iv)
|
|
52
|
+
return base64.b64encode(iv + cipher.encrypt(raw))
|
|
53
|
+
|
|
54
|
+
def decrypt(self, enc, key):
|
|
55
|
+
enc = base64.b64decode(enc)
|
|
56
|
+
iv = enc[:AES.block_size]
|
|
57
|
+
hashkey = hashlib.sha256(key.encode()).digest()
|
|
58
|
+
cipher = AES.new(hashkey, AES.MODE_CBC, iv)
|
|
59
|
+
return self._unpad(cipher.decrypt(enc[AES.block_size:])).decode('utf-8')
|
|
60
|
+
|
|
61
|
+
def _pad(self, s):
|
|
62
|
+
return s + (self.bs - len(s) % self.bs) * chr(self.bs - len(s) % self.bs)
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def _unpad(s):
|
|
66
|
+
return s[:-ord(s[len(s)-1:])]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
#, fuzzy
|
|
7
|
+
msgid ""
|
|
8
|
+
msgstr ""
|
|
9
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"POT-Creation-Date: 2023-07-20 10:56+0200\n"
|
|
12
|
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
15
|
+
"Language: \n"
|
|
16
|
+
"MIME-Version: 1.0\n"
|
|
17
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
|
|
20
|
+
#: codenerix_extensions/files/models.py:33
|
|
21
|
+
#: codenerix_extensions/files/models.py:49
|
|
22
|
+
msgid "Doc Path"
|
|
23
|
+
msgstr ""
|
|
24
|
+
|
|
25
|
+
#: codenerix_extensions/files/models.py:40
|
|
26
|
+
#: codenerix_extensions/files/models.py:56
|
|
27
|
+
#: codenerix_extensions/files/models.py:72
|
|
28
|
+
#: codenerix_extensions/files/models.py:88
|
|
29
|
+
msgid "Name"
|
|
30
|
+
msgstr ""
|
|
31
|
+
|
|
32
|
+
#: codenerix_extensions/files/models.py:65
|
|
33
|
+
#: codenerix_extensions/files/models.py:81
|
|
34
|
+
msgid "Image"
|
|
35
|
+
msgstr ""
|
|
36
|
+
|
|
37
|
+
#: codenerix_extensions/validators.py:128
|
|
38
|
+
#, python-format
|
|
39
|
+
msgid "NIF %(cid)s is misspelled"
|
|
40
|
+
msgstr ""
|
|
41
|
+
|
|
42
|
+
#: codenerix_extensions/validators.py:130
|
|
43
|
+
#, python-format
|
|
44
|
+
msgid "CIF %(cid)s is misspelled"
|
|
45
|
+
msgstr ""
|
|
46
|
+
|
|
47
|
+
#: codenerix_extensions/validators.py:132
|
|
48
|
+
#, python-format
|
|
49
|
+
msgid "NIE %(cid)s is misspelled"
|
|
50
|
+
msgstr ""
|
|
51
|
+
|
|
52
|
+
#: codenerix_extensions/validators.py:134
|
|
53
|
+
#, python-format
|
|
54
|
+
msgid "CID %(cid)s is too long"
|
|
55
|
+
msgstr ""
|
|
56
|
+
|
|
57
|
+
#: codenerix_extensions/validators.py:136
|
|
58
|
+
#, python-format
|
|
59
|
+
msgid "CID %(cid)s has a wrong format"
|
|
60
|
+
msgstr ""
|
|
61
|
+
|
|
62
|
+
#: codenerix_extensions/validators.py:138
|
|
63
|
+
#: codenerix_extensions/validators.py:148
|
|
64
|
+
#: codenerix_extensions/validators.py:153
|
|
65
|
+
#: codenerix_extensions/validators.py:158
|
|
66
|
+
#, python-format
|
|
67
|
+
msgid "CID %(cid)s is incorrect"
|
|
68
|
+
msgstr ""
|
|
69
|
+
|
|
70
|
+
#: codenerix_extensions/validators.py:141
|
|
71
|
+
#, python-format
|
|
72
|
+
msgid "%(cid)s is incorrect"
|
|
73
|
+
msgstr ""
|
|
74
|
+
|
|
75
|
+
#: codenerix_extensions/validators.py:146
|
|
76
|
+
msgid "NIFs are not allowed in this field"
|
|
77
|
+
msgstr ""
|
|
78
|
+
|
|
79
|
+
#: codenerix_extensions/validators.py:151
|
|
80
|
+
msgid "CIFs are not allowed in this field"
|
|
81
|
+
msgstr ""
|
|
82
|
+
|
|
83
|
+
#: codenerix_extensions/validators.py:156
|
|
84
|
+
msgid "NIEs are not allowed in this field"
|
|
85
|
+
msgstr ""
|
|
Binary file
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
#, fuzzy
|
|
7
|
+
msgid ""
|
|
8
|
+
msgstr ""
|
|
9
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"POT-Creation-Date: 2023-07-20 10:56+0200\n"
|
|
12
|
+
"PO-Revision-Date: 2017-11-22 17:11-0015\n"
|
|
13
|
+
"Last-Translator: b'nombe apellidos <soleronline@gmail.com>'\n"
|
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
15
|
+
"Language: \n"
|
|
16
|
+
"MIME-Version: 1.0\n"
|
|
17
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
"X-Translated-Using: django-rosetta 0.7.13\n"
|
|
20
|
+
|
|
21
|
+
#: codenerix_extensions/files/models.py:33
|
|
22
|
+
#: codenerix_extensions/files/models.py:49
|
|
23
|
+
msgid "Doc Path"
|
|
24
|
+
msgstr "Ruta del documento"
|
|
25
|
+
|
|
26
|
+
#: codenerix_extensions/files/models.py:40
|
|
27
|
+
#: codenerix_extensions/files/models.py:56
|
|
28
|
+
#: codenerix_extensions/files/models.py:72
|
|
29
|
+
#: codenerix_extensions/files/models.py:88
|
|
30
|
+
msgid "Name"
|
|
31
|
+
msgstr "Nombre"
|
|
32
|
+
|
|
33
|
+
#: codenerix_extensions/files/models.py:65
|
|
34
|
+
#: codenerix_extensions/files/models.py:81
|
|
35
|
+
msgid "Image"
|
|
36
|
+
msgstr "Imagen"
|
|
37
|
+
|
|
38
|
+
#: codenerix_extensions/validators.py:128
|
|
39
|
+
#, python-format
|
|
40
|
+
msgid "NIF %(cid)s is misspelled"
|
|
41
|
+
msgstr "El NIF %(cid)s está mal escrito"
|
|
42
|
+
|
|
43
|
+
#: codenerix_extensions/validators.py:130
|
|
44
|
+
#, python-format
|
|
45
|
+
msgid "CIF %(cid)s is misspelled"
|
|
46
|
+
msgstr "El CIF %(cid)s está mal escrito"
|
|
47
|
+
|
|
48
|
+
#: codenerix_extensions/validators.py:132
|
|
49
|
+
#, python-format
|
|
50
|
+
msgid "NIE %(cid)s is misspelled"
|
|
51
|
+
msgstr "El NIE %(cid)s está mal escrito"
|
|
52
|
+
|
|
53
|
+
#: codenerix_extensions/validators.py:134
|
|
54
|
+
#, python-format
|
|
55
|
+
msgid "CID %(cid)s is too long"
|
|
56
|
+
msgstr "El CID %(cid)s es demasiado largo"
|
|
57
|
+
|
|
58
|
+
#: codenerix_extensions/validators.py:136
|
|
59
|
+
#, python-format
|
|
60
|
+
msgid "CID %(cid)s has a wrong format"
|
|
61
|
+
msgstr "El CID %(cid)s tiene un formato incorrecto"
|
|
62
|
+
|
|
63
|
+
#: codenerix_extensions/validators.py:138
|
|
64
|
+
#: codenerix_extensions/validators.py:148
|
|
65
|
+
#: codenerix_extensions/validators.py:153
|
|
66
|
+
#: codenerix_extensions/validators.py:158
|
|
67
|
+
#, python-format
|
|
68
|
+
msgid "CID %(cid)s is incorrect"
|
|
69
|
+
msgstr "El CID %(cid)s es incorrecto"
|
|
70
|
+
|
|
71
|
+
#: codenerix_extensions/validators.py:141
|
|
72
|
+
#, python-format
|
|
73
|
+
msgid "%(cid)s is incorrect"
|
|
74
|
+
msgstr "%(cid)s incorrecto"
|
|
75
|
+
|
|
76
|
+
#: codenerix_extensions/validators.py:146
|
|
77
|
+
msgid "NIFs are not allowed in this field"
|
|
78
|
+
msgstr "Los NIF no están permitidos en este campo"
|
|
79
|
+
|
|
80
|
+
#: codenerix_extensions/validators.py:151
|
|
81
|
+
msgid "CIFs are not allowed in this field"
|
|
82
|
+
msgstr "Los CIF no están permitidos en este campo"
|
|
83
|
+
|
|
84
|
+
#: codenerix_extensions/validators.py:156
|
|
85
|
+
msgid "NIEs are not allowed in this field"
|
|
86
|
+
msgstr "Los NIE no están permitidos en este campo"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* django-codenerix-extensions
|
|
4
|
+
*
|
|
5
|
+
* Codenerix GNU
|
|
6
|
+
*
|
|
7
|
+
* Project URL : http://www.codenerix.com
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
function codenerix_extensions(scope, $timeout){
|
|
23
|
+
/*
|
|
24
|
+
* copy the content between fields of the same form
|
|
25
|
+
*/
|
|
26
|
+
scope.refresh_lang_field_memory=Array();
|
|
27
|
+
scope.refresh_lang_field = function(field_name, model_name, languages){
|
|
28
|
+
var basefield = model_name+languages[0]+"_"+field_name;
|
|
29
|
+
var otherlangs = languages.slice(1);
|
|
30
|
+
if (scope.refresh_lang_field_memory[basefield] == undefined){
|
|
31
|
+
scope.refresh_lang_field_memory[basefield] = "";
|
|
32
|
+
}
|
|
33
|
+
angular.forEach(otherlangs, function (lang, key) {
|
|
34
|
+
var newfield = model_name+lang+'_'+field_name;
|
|
35
|
+
if (scope[scope.form_name][newfield] != undefined){
|
|
36
|
+
var value = scope[scope.form_name][newfield].$viewValue;
|
|
37
|
+
if (value == undefined || value==scope.refresh_lang_field_memory[basefield]) {
|
|
38
|
+
if (scope[scope.form_name] != undefined && scope[scope.form_name][basefield] != undefined){
|
|
39
|
+
$timeout(function () {
|
|
40
|
+
scope[scope.form_name][newfield].$setViewValue(scope[scope.form_name][basefield].$viewValue);
|
|
41
|
+
scope[scope.form_name][newfield].$render();
|
|
42
|
+
}, 500);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
scope.refresh_lang_field_memory[basefield]=scope[scope.form_name][basefield].$viewValue;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* django-codenerix-extensions
|
|
4
|
+
*
|
|
5
|
+
* Codenerix GNU
|
|
6
|
+
*
|
|
7
|
+
* Project URL : http://www.codenerix.com
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*
|
|
21
|
+
* This library is intended for encrypting as CODENERIX Cryptography's Libraries work, the basis
|
|
22
|
+
* for the library to work are, the KEY is always a SHA256 from your real KEY, the IV vector
|
|
23
|
+
* should be generated automatically on encryption time by the library and must be inserted
|
|
24
|
+
* at the beginning of the encrypted string (which shoul be padded with PKCS7). The full
|
|
25
|
+
* string IV+ENCRYPTED is encoded to Base64. For decrypting the process is the opossite, the
|
|
26
|
+
* raw string is decoded from Base64, the first 16 bytes are taken as the IV and the rest as
|
|
27
|
+
* the encrypted string, the key is hashed with SHA256 and then the encrypted string is decrypted
|
|
28
|
+
* using the IV and the hashed key.
|
|
29
|
+
*
|
|
30
|
+
* This library is working thanks to crypto-js from Jakub Zapletal ( https://github.com/jakubzapletal )
|
|
31
|
+
*
|
|
32
|
+
* You must include the next crypto-js files to let cryptography work as excepcted:
|
|
33
|
+
* <script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/core.js"></script>
|
|
34
|
+
* <script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/sha256.js"></script>
|
|
35
|
+
* <script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/enc-base64.js"></script>
|
|
36
|
+
* <script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/cipher-core.js"></script>
|
|
37
|
+
* <script type="text/javascript" src="/static/codenerix_extensions/lib/crypto-js/aes.js"></script>
|
|
38
|
+
*
|
|
39
|
+
* // Some examples
|
|
40
|
+
* var raw = "1234567890123456";
|
|
41
|
+
* var key = "1234567890123456";
|
|
42
|
+
* var raw2 = "eFu34cdc2j30avHkYRIIfoH0JpD2VgkuMIkULxKxvuqwEPt26h33KHzqmnEIPbaX";
|
|
43
|
+
* var key2 = "123456789012345b";
|
|
44
|
+
* var raw3 = "hOxLY8VLpi989zsRJZycBZgij2iPM/jYkdq51m3yFy+n/gMGL5Z5YjxcUhitJ81tEcKnz55cTenBaTG0uUcZfqhjQne42LaVWykItm1J/aA=";
|
|
45
|
+
* var key3 = "La magia ocurre cuando sale el sol";
|
|
46
|
+
* var raw4 = "When the moon comes to the sky, your eyes shine!";
|
|
47
|
+
* var key4 = "No matter what you do, the sierpinski cube is beautifull!"
|
|
48
|
+
*
|
|
49
|
+
* var enc = encrypt(raw, key, "1234567890123456"); console.log(typeof(enc), enc); // Giving an specific IV vector
|
|
50
|
+
* var dec = encrypt(raw, key); console.log(typeof(dec), dec); // Using automatic IV vector generator
|
|
51
|
+
* var dec = decrypt(raw2, key2); console.log(typeof(dec), dec); // Decrypting
|
|
52
|
+
* var dec = decrypt(raw3, key3); console.log(typeof(dec), dec); // Decrypting
|
|
53
|
+
* var enc = encrypt(raw4, key4); console.log(typeof(enc), enc); // Encrypting
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
function encrypt(raw, key, iv) {
|
|
57
|
+
// Create the hash from the key
|
|
58
|
+
var hashkey = CryptoJS.SHA256(key);
|
|
59
|
+
|
|
60
|
+
// The initialization vector (must be 16 bytes)
|
|
61
|
+
if (typeof(iv) == "undefined") {
|
|
62
|
+
var iv = CryptoJS.lib.WordArray.random(16);
|
|
63
|
+
} else {
|
|
64
|
+
console.warn("You are using an external IV, this is not the way the library is inteded to work, BE CAREFULL this is only for debugging purpose!");
|
|
65
|
+
var iv = CryptoJS.enc.Utf8.parse(iv);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Encrypt
|
|
69
|
+
var enc = CryptoJS.AES.encrypt(raw, hashkey, { iv: iv });
|
|
70
|
+
|
|
71
|
+
// Put the result together with the IV
|
|
72
|
+
var mix = iv.concat(enc.ciphertext);
|
|
73
|
+
|
|
74
|
+
// Convert to Base 64
|
|
75
|
+
var b64enc = mix.toString(CryptoJS.enc.Base64)
|
|
76
|
+
|
|
77
|
+
// We are done
|
|
78
|
+
return b64enc;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function decrypt(data, key) {
|
|
82
|
+
// Create the hash from the key
|
|
83
|
+
var hashkey = CryptoJS.SHA256(key);
|
|
84
|
+
|
|
85
|
+
// Convert to Base 64
|
|
86
|
+
var full = CryptoJS.enc.Base64.parse(data);
|
|
87
|
+
|
|
88
|
+
// Put the result together with the IV
|
|
89
|
+
var iv = CryptoJS.enc.Hex.parse(full.toString(CryptoJS.enc.Hex).slice(0,16*2));
|
|
90
|
+
var raw = CryptoJS.enc.Hex.parse(full.toString(CryptoJS.enc.Hex).slice(16*2));
|
|
91
|
+
|
|
92
|
+
// Encrypt
|
|
93
|
+
var todec = CryptoJS.lib.CipherParams.create({ciphertext: raw});
|
|
94
|
+
var dec = CryptoJS.AES.decrypt(todec, hashkey, { iv: iv });
|
|
95
|
+
|
|
96
|
+
// Get the string
|
|
97
|
+
var str = dec.toString(CryptoJS.enc.Utf8);
|
|
98
|
+
|
|
99
|
+
// We are done
|
|
100
|
+
return str;
|
|
101
|
+
}
|