diff --git a/apps/conference/admin.py b/apps/conference/admin.py index fbf64878..534f71ef 100644 --- a/apps/conference/admin.py +++ b/apps/conference/admin.py @@ -15,6 +15,7 @@ from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django.utils import translation from django.utils.translation import ugettext_lazy as _ +from django.views.decorators.csrf import csrf_exempt from modeltranslation.admin import TabbedTranslationAdmin from sorl.thumbnail import get_thumbnail @@ -348,6 +349,8 @@ class ConferenceListView(AdminListView): model = Conference +# FIXME: WTF? +@csrf_exempt def upload_conference_photo(request, conf_id): return upload_photo(request, conf_id, Conference) diff --git a/apps/functions/admin_views.py b/apps/functions/admin_views.py index a83aac44..9f4c8385 100644 --- a/apps/functions/admin_views.py +++ b/apps/functions/admin_views.py @@ -1,5 +1,7 @@ import json from django.views.generic import FormView +from django.views.decorators.csrf import csrf_exempt + from django.shortcuts import render_to_response, get_object_or_404, HttpResponse, Http404 from django.http import HttpResponseRedirect from django.conf import settings @@ -145,6 +147,9 @@ class AdminListView(FormView): return context + +# FIXME: WTF? +@csrf_exempt def upload_photo(request, id, Model): """ uploading photo to some instance of Model @@ -152,7 +157,7 @@ def upload_photo(request, id, Model): """ obj = get_object_or_404(Model, pk=id) - if request.POST: + if request.method == 'POST': response = {'success': False} form = PhotoForm(request.POST, request.FILES) if form.is_valid(): @@ -160,7 +165,7 @@ def upload_photo(request, id, Model): obj.upload_photo(photo) response['success'] = True else: - response.update({'errors':form.errors}) + response.update({'errors': form.errors}) return HttpResponse(json.dumps(response), content_type='application/json') else: diff --git a/apps/photologue/forms.py b/apps/photologue/forms.py index ce94d29e..e9201a20 100644 --- a/apps/photologue/forms.py +++ b/apps/photologue/forms.py @@ -48,10 +48,8 @@ class PhotoForm(forms.Form): if len(settings.LANGUAGES) in range(10): for lid, (code, name) in enumerate(settings.LANGUAGES): # uses enumerate for detect iteration number - # first iteration is a default lang so it required fields - required = True if lid == 0 else False self.fields['title_%s' % code] = forms.CharField(label=_(u'Описание'), required=False) - self.fields['caption_%s' % code] = forms.CharField(label=_(u'Заголовок'), required=required) + self.fields['caption_%s' % code] = forms.CharField(label=_(u'Заголовок'), required=False) def save(self, obj=None): data = self.cleaned_data diff --git a/apps/photologue/models.py b/apps/photologue/models.py index 9bd045a9..444a329d 100644 --- a/apps/photologue/models.py +++ b/apps/photologue/models.py @@ -695,7 +695,7 @@ class ImageModel(models.Model): class Photo(TranslatableModel, ImageModel): translations = TranslatedFields( caption=models.TextField(_('caption'), blank=True), - title=models.CharField(_('title'), max_length=200) + title=models.CharField(_('title'), max_length=200, blank=True) ) slug = models.SlugField(_('slug'), unique=True, diff --git a/proj/admin.py b/proj/admin.py index 9af9fe76..8aa44aac 100644 --- a/proj/admin.py +++ b/proj/admin.py @@ -11,6 +11,7 @@ from django.db.models.loading import get_model from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response from django.views.generic import DeleteView, TemplateView + from exposition.forms import StatisticForm, TimeTableForm from exposition.models import Exposition, Statistic, TimeTable, TmpTimeTable from file.forms import FileForm, FileModelForm, PhotoForm diff --git a/static/custom_js/main.js b/static/custom_js/main.js index 0aeec8e8..29559540 100644 --- a/static/custom_js/main.js +++ b/static/custom_js/main.js @@ -111,7 +111,6 @@ function postStat(data, textStatus){ */ } - $(document).ready(function(){ /* $('#id_created').datetimepicker({ diff --git a/static/jQuery-filer/css/jquery.filer-dragdropbox-theme.css b/static/jQuery-filer/css/jquery.filer-dragdropbox-theme.css new file mode 100755 index 00000000..d3bf6db8 --- /dev/null +++ b/static/jQuery-filer/css/jquery.filer-dragdropbox-theme.css @@ -0,0 +1,191 @@ +/*! + * CSS jQuery.filer + * Theme: DragDropBox + * Copyright (c) 2016 CreativeDream + * Version: 1.3 (14-Sep-2016) +*/ + +/*------------------------- + Input +-------------------------*/ +.jFiler-input-dragDrop { + display: block; + /*width: 343px;*/ + margin: 0 auto 25px auto; + padding: 25px; + color: #97A1A8; + background: #F9FBFE; + border: 2px dashed #C8CBCE; + text-align: center; + -webkit-transition: box-shadow 0.3s, + border-color 0.3s; + -moz-transition: box-shadow 0.3s, + border-color 0.3s; + transition: box-shadow 0.3s, + border-color 0.3s; +} + +.jFiler .jFiler-input-dragDrop.dragged { + border-color: #aaa; + box-shadow: inset 0 0 20px rgba(0,0,0,.08); +} + +.jFiler .jFiler-input-dragDrop.dragged * { + pointer-events: none; +} + +.jFiler .jFiler-input-dragDrop.dragged .jFiler-input-icon { + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.jFiler .jFiler-input-dragDrop.dragged .jFiler-input-text, +.jFiler .jFiler-input-dragDrop.dragged .jFiler-input-choose-btn { + filter: alpha(opacity=30); + opacity: 0.3; +} + +.jFiler-input-dragDrop .jFiler-input-icon { + font-size: 48px; + margin-top: -10px; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + transition: all 0.3s ease; +} + +.jFiler-input-text h3 { + margin: 0; + font-size: 18px; +} + +.jFiler-input-text span { + font-size: 12px; +} + +.jFiler-input-choose-btn { + display: inline-block; + padding: 8px 14px; + outline: none; + cursor: pointer; + text-decoration: none; + text-align: center; + white-space: nowrap; + font-size: 12px; + font-weight: bold; + color: #8d9496; + border-radius: 3px; + border: 1px solid #c6c6c6; + vertical-align: middle; + *background-color: #fff; + box-shadow: 0px 1px 5px rgba(0,0,0,0.05); + -webkit-transition: all 0.2s; + -moz-transition: all 0.2s; + transition: all 0.2s; +} + +.jFiler-input-choose-btn:hover, +.jFiler-input-choose-btn:active { + color: inherit; +} + +.jFiler-input-choose-btn:active { + background-color: #f5f5f5; +} + +/* gray */ +.jFiler-input-choose-btn.gray { + background-image: -webkit-gradient(linear,0 0,0 100%,from(#fcfcfc),to(#f5f5f5)); + background-image: -webkit-linear-gradient(top,#fcfcfc,#f5f5f5); + background-image: -o-linear-gradient(top,#fcfcfc,#f5f5f5); + background-image: linear-gradient(to bottom,#fcfcfc,#f5f5f5); + background-image: -moz-linear-gradient(top,#fcfcfc,#f5f5f5); +} + +.jFiler-input-choose-btn.gray:hover { + filter: alpha(opacity=87); + opacity: 0.87; +} + +.jFiler-input-choose-btn.gray:active { + background-color: #f5f5f5; + background-image: -webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#fcfcfc)); + background-image: -webkit-linear-gradient(top,#f5f5f5,#fcfcfc); + background-image: -o-linear-gradient(top,#f5f5f5,#fcfcfc); + background-image: linear-gradient(to bottom,#f5f5f5,#fcfcfc); + background-image: -moz-linear-gradient(top,#f5f5f5,#fcfcfc); +} + +/* blue */ +.jFiler-input-choose-btn.blue { + color: #48A0DC; + border: 1px solid #48A0DC; +} + +.jFiler-input-choose-btn.blue:hover { + background: #48A0DC; +} + +.jFiler-input-choose-btn.blue:active { + background: #48A0DC; +} + +/* green */ +.jFiler-input-choose-btn.green { + color: #27ae60; + border: 1px solid #27ae60; +} + +.jFiler-input-choose-btn.green:hover { + background: #27ae60; +} + +.jFiler-input-choose-btn.green:active { + background: #27ae60; +} + +/* red */ +.jFiler-input-choose-btn.red { + color: #ed5a5a; + border: 1px solid #ed5a5a; +} + +.jFiler-input-choose-btn.red:hover { + background: #ed5a5a; +} + +.jFiler-input-choose-btn.red:active { + background: #E05252; +} + +/* black */ +.jFiler-input-choose-btn.black { + color: #555; + border: 1px solid #555; +} + +.jFiler-input-choose-btn.black:hover { + background: #555; +} + +.jFiler-input-choose-btn.black:active { + background: #333; +} + +.jFiler-input-choose-btn.blue:hover, +.jFiler-input-choose-btn.green:hover, +.jFiler-input-choose-btn.red:hover, +.jFiler-input-choose-btn.black:hover { + border-color: transparent; + color: #fff; +} + +.jFiler-input-choose-btn.blue:active, +.jFiler-input-choose-btn.green:active, +.jFiler-input-choose-btn.red:active, +.jFiler-input-choose-btn.black:active { + border-color: transparent; + color: #fff; + filter: alpha(opacity=87); + opacity: 0.87; +} diff --git a/static/jQuery-filer/css/jquery.filer-icons/jquery-filer-preview.html b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer-preview.html new file mode 100755 index 00000000..5e9fa8af --- /dev/null +++ b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer-preview.html @@ -0,0 +1,924 @@ + + + + jquery-filer glyphs preview + + + + + + + + + +
+
+

jquery-filer contains 48 glyphs:

+ Toggle Preview Characters +
+ + +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ + + +
+ + diff --git a/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.css b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.css new file mode 100755 index 00000000..e64e034f --- /dev/null +++ b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.css @@ -0,0 +1,135 @@ +/* + Icon Font: jquery-filer +*/ + +@font-face { + font-family: "jquery-filer"; + src: url("./jquery-filer.eot"); + src: url("./jquery-filer.eot?#iefix") format("embedded-opentype"), + url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAABY8AA0AAAAAJGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAWIAAAABoAAAAcbgW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g5WYTm45mDjKoziE9XOuePt450H1s4harx2Dpvt4Mb581iB3ul1E6M9dt9PRLcT/Ygqq2QQs6TQU2y+q2Bo0g65E91XlNl/Daz3sbaY20ArLDHcbTP/Gom51X2x0XZOzDnhr71RifVyTMsLXG/lbiHdm0oleW3zxYeDXO7MOJHPs8Zb5V5NzQnluktpIp3uSXP/CyLCXdEAeNqNkc1qwkAUhc/4By1S2lVdztKCiZOAm2wFxV1X7lOdaCQkmkwQX0P6GKX7PkuhT9AH6LIncSh20WKGmfudMzd37jAAbvAKgdM3w7NlgS6+LDfQFneWm+iL2HILXfFiuY1b8W65g26jw0zRuqI61n9VLNDDh+UGrkXbchOP4t5yCz1xtNyGFG+WO/Q/MUYOjRCG6xISTzhwnaFEgph+SjVlTLCgLrkO6iGxpzZYkybImGfqmGPFShI+XCjGPjMMxxYBhhyRzY1+cl0UVC5dTf8BGOc6NHopnw5yViZxmMppmCzicjEYDOQ+Nms5yVIzyfKVlr6rZH9tzDYYDiO6UeW6ReSm2rDUBjv2rHnSAQ5PiXmPSmGzK3V+cKI40VRnG9b570oB51+FT7s+8xx4nBV5GLHgr5YDed4Apa8cz/GVN7q453ltFtzO6kdS9UluHasuMdd5EWepVMpzlVLy0srfppZ9qgAAeNpdzkdSw1AUBVG1CCbnZJLJOUj/fWwzxID2woQZ+2NnQIlmgianStKrvkVZtM/XZ9H9geL/E+3bkpIxxplgkg5TTDPDLHPMs8AiSyyzwiprrLPBJlt02WaHXfbYp8cBhxxxzAmnnHHOBZdccc0Nt9xxT0Xd+Xh/a1LT14EOdaRNa1SVhg50pM/68mtda9K+elcP9e//V7WX/J4e9UntJXvJ++R98j7cG+4Id4T7I+uDui/cF/bDftgP+2E/7If9sJ/tZ/vZfraf8zcFz3IYAAAAAAH//wACeNpjYGBgZACCM7aLzoPoC09YnsNoAFB9B7oAAA==), + url("./jquery-filer.woff") format("woff"), + url("./jquery-filer.ttf") format("truetype"), + url("./jquery-filer.svg#jquery-filer") format("svg"); + font-weight: normal; + font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: "jquery-filer"; + src: url("./jquery-filer.svg#jquery-filer") format("svg"); + } +} + +[data-icon]:before { content: attr(data-icon); } + +[data-icon]:before, +.icon-jfi-ban:before, +.icon-jfi-calendar:before, +.icon-jfi-check:before, +.icon-jfi-check-circle:before, +.icon-jfi-cloud-o:before, +.icon-jfi-cloud-up-o:before, +.icon-jfi-comment:before, +.icon-jfi-comment-o:before, +.icon-jfi-download-o:before, +.icon-jfi-exclamation:before, +.icon-jfi-exclamation-circle:before, +.icon-jfi-exclamation-triangle:before, +.icon-jfi-external-link:before, +.icon-jfi-eye:before, +.icon-jfi-file:before, +.icon-jfi-file-audio:before, +.icon-jfi-file-image:before, +.icon-jfi-file-o:before, +.icon-jfi-file-text:before, +.icon-jfi-file-video:before, +.icon-jfi-files-o:before, +.icon-jfi-folder:before, +.icon-jfi-heart:before, +.icon-jfi-heart-o:before, +.icon-jfi-history:before, +.icon-jfi-infinite:before, +.icon-jfi-info:before, +.icon-jfi-info-circle:before, +.icon-jfi-minus:before, +.icon-jfi-minus-circle:before, +.icon-jfi-paperclip:before, +.icon-jfi-pencil:before, +.icon-jfi-plus:before, +.icon-jfi-plus-circle:before, +.icon-jfi-power-off:before, +.icon-jfi-question:before, +.icon-jfi-question-circle:before, +.icon-jfi-reload:before, +.icon-jfi-settings:before, +.icon-jfi-sort:before, +.icon-jfi-times:before, +.icon-jfi-times-circle:before, +.icon-jfi-trash:before, +.icon-jfi-upload-o:before, +.icon-jfi-user:before, +.icon-jfi-view-grid:before, +.icon-jfi-view-list:before, +.icon-jfi-zip:before { + display: inline-block; + font-family: "jquery-filer"; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-decoration: inherit; + text-rendering: optimizeLegibility; + text-transform: none; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + font-smoothing: antialiased; +} + +.icon-jfi-ban:before { content: "\f328"; } +.icon-jfi-calendar:before { content: "\f30b"; } +.icon-jfi-check:before { content: "\f2f6"; } +.icon-jfi-check-circle:before { content: "\f30c"; } +.icon-jfi-cloud-o:before { content: "\f329"; } +.icon-jfi-cloud-up-o:before { content: "\f32a"; } +.icon-jfi-comment:before { content: "\f32b"; } +.icon-jfi-comment-o:before { content: "\f30d"; } +.icon-jfi-download-o:before { content: "\f32c"; } +.icon-jfi-exclamation:before { content: "\f32d"; } +.icon-jfi-exclamation-circle:before { content: "\f32e"; } +.icon-jfi-exclamation-triangle:before { content: "\f32f"; } +.icon-jfi-external-link:before { content: "\f330"; } +.icon-jfi-eye:before { content: "\f2f7"; } +.icon-jfi-file:before { content: "\f31f"; } +.icon-jfi-file-audio:before { content: "\f331"; } +.icon-jfi-file-image:before { content: "\f332"; } +.icon-jfi-file-o:before { content: "\f31d"; } +.icon-jfi-file-text:before { content: "\f333"; } +.icon-jfi-file-video:before { content: "\f334"; } +.icon-jfi-files-o:before { content: "\f335"; } +.icon-jfi-folder:before { content: "\f31e"; } +.icon-jfi-heart:before { content: "\f2f8"; } +.icon-jfi-heart-o:before { content: "\f336"; } +.icon-jfi-history:before { content: "\f337"; } +.icon-jfi-infinite:before { content: "\f2fb"; } +.icon-jfi-info:before { content: "\f338"; } +.icon-jfi-info-circle:before { content: "\f339"; } +.icon-jfi-minus:before { content: "\f33a"; } +.icon-jfi-minus-circle:before { content: "\f33b"; } +.icon-jfi-paperclip:before { content: "\f33c"; } +.icon-jfi-pencil:before { content: "\f2ff"; } +.icon-jfi-plus:before { content: "\f311"; } +.icon-jfi-plus-circle:before { content: "\f312"; } +.icon-jfi-power-off:before { content: "\f33d"; } +.icon-jfi-question:before { content: "\f33e"; } +.icon-jfi-question-circle:before { content: "\f33f"; } +.icon-jfi-reload:before { content: "\f300"; } +.icon-jfi-settings:before { content: "\f340"; } +.icon-jfi-sort:before { content: "\f303"; } +.icon-jfi-times:before { content: "\f316"; } +.icon-jfi-times-circle:before { content: "\f317"; } +.icon-jfi-trash:before { content: "\f318"; } +.icon-jfi-upload-o:before { content: "\f341"; } +.icon-jfi-user:before { content: "\f307"; } +.icon-jfi-view-grid:before { content: "\f342"; } +.icon-jfi-view-list:before { content: "\f343"; } +.icon-jfi-zip:before { content: "\f344"; } diff --git a/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.eot b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.eot new file mode 100755 index 00000000..74adf90f Binary files /dev/null and b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.eot differ diff --git a/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.svg b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.svg new file mode 100755 index 00000000..e6e93779 --- /dev/null +++ b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.svg @@ -0,0 +1,283 @@ + + + + + +Created by FontForge 20120731 at Tue Jan 20 14:13:11 2015 + By Iulian Galciuc,,, +Created by Iulian Galciuc,,, with FontForge 2.0 (http://fontforge.sf.net) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.ttf b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.ttf new file mode 100755 index 00000000..3140fce4 Binary files /dev/null and b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.ttf differ diff --git a/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.woff b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.woff new file mode 100755 index 00000000..0f4b5f78 Binary files /dev/null and b/static/jQuery-filer/css/jquery.filer-icons/jquery-filer.woff differ diff --git a/static/jQuery-filer/css/jquery.filer.css b/static/jQuery-filer/css/jquery.filer.css new file mode 100755 index 00000000..d155827b --- /dev/null +++ b/static/jQuery-filer/css/jquery.filer.css @@ -0,0 +1,421 @@ +/*! + * CSS jQuery.filer + * Copyright (c) 2016 CreativeDream + * Version: 1.3 (14-Sep-2016) +*/ +@import url('jquery.filer-icons/jquery-filer.css'); + +/*------------------------- + Basic configurations +-------------------------*/ +.jFiler * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.jFiler { + font-family: sans-serif; + font-size: 14px; + color: #494949; +} + +/* Helpers */ +.jFiler ul.list-inline li { + display: inline-block; + padding-right: 5px; + padding-left: 5px; +} + +.jFiler .pull-left { + float: left; +} + +.jFiler .pull-right { + float: right; +} + +/* File Icons */ +span.jFiler-icon-file { + position: relative; + display: block; + background: #e1e1e1 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMQAAAEACAYAAADsqNl9AAAD5klEQVR42u3azUqUURjA8bHAEpIK+9hlRBGC0QfVustI+oAo2nQJgYGFFEUhJF1NUVAXEC6iSyhIDCoX5js9Z5xpXmxsRjOdmfP7wfPqwtWZ589xhqlUN2Y5Zi5mJmYi5lzMgZhdFbpavEb32sxsURSfq5mqrPPv52MexYxZrb4NIusoOgoiDudb/JiMGbZSWQSRbRSdBPEqZtQqZRdEllFU2rxPuB8zYI2yDSK7KNYKYinmlvURRG5RVNa4GW5aHUHkGEWrIKasjSByjWJ1EC+tjCByjqKy6qPVI1ZGEDlHUb4h7loXQeQeRSOILzF7rIsgco+iEcS0VRGEKFaCSB+znrQqghDFShDvrYkgRNEM4pk1EYQomkFctiaCEEUziDPWRBCiaAYxYk0EIYpmEIPWRBCiqAeBIEQhCEGIQhBsWxA9E4UNEYQoBCEIUQiC7giiq6OwIYIQhSAEIQpB0H1BdF0UNkQQohCEIEQhCLo7iFoUMZ8EgSC6JAobIghRCEIQohAEvRXEtkRhQwQhCkEIQhSCoHeD2LIobIggRCEIQYhCEPRHEP81ChsiCFEIQhCiEAT9F8SmR2FDBCEKQQhCFIKgv4PYlChsiCD6bZ7/SxQ2RBCiEIQgRCEI8gpiQ1HYEEGIQhCCEIUgyDeIjqOwIYIQhSAEIQpBsBLEKVGsHYUNcUuIQhCCMK2jsB2CEEUpCtshClOKwmYIwpSisBn5BjEqgj+jsBluCVMaWyEKIQiCUhCXhCAI3BKC4K9RXBeEIHBbCALvKwTBRuO4IQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyEi1Wh10ClBrYXd6jDgKqAVxMD3OOgqoBXE+PSYcBdSCuJIeM44CakHMpseco4BKpSiKDymI5Zgxx0Hmt8N4TDX9kjx0JGQexONyEPMxw46FTGPYF7NQDiKZdDRkGsSDRgTlIL7HHHU8ZBbD8ZjFVkEkr2MGHBOZxLAj5m05gNVBJNOOipzeSLcLIn0Me9tx0ecx3KnvetsgkiVR0Ocx/Gy1+GsF0bgppr2noI9C2BnzpNXN0EkQDW9ijjlOejyGEzHv2i17J0EkP2KmYvY6WnoshP31/3QWO1n0ToNoWKhfOeOOmi4P4XTM06Iovq5nwdcbxG/pm4Hp67IxV2MuxByKGfJSsMWLPxRzOOZizLWYF7GbHze6178AQI59RSRyAJkAAAAASUVORK5CYII=') no-repeat; + background-size: cover; + width: 57px; + height: 74px; + line-height: 90px; + text-align: center; + margin: 0 auto; + color: #fff; + font-size: 14px; + font-weight: bold; + overflow: hidden; +} + +span.jFiler-icon-file i[class*="icon-jfi-"] { + font-size: 24px; +} + +span.jFiler-icon-file.f-image { + background-color: #e15955; +} + +span.jFiler-icon-file.f-video { + background-color: #4183d7; +} + +span.jFiler-icon-file.f-audio { + background-color: #5bab6e; +} + +/* Progress Bar */ +.jFiler-jProgressBar { + height: 8px; + background: #f1f1f1; + margin-top: 3px; + margin-bottom: 0; + overflow: hidden; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.jFiler-jProgressBar .bar { + float: left; + width: 0; + height: 100%; + font-size: 12px; + color: #ffffff; + text-align: center; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #50A1E9; + box-sizing: border-box; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-transition: width 0.3s ease; + -moz-transition: width 0.3s ease; + -o-transition: width 0.3s ease; + transition: width 0.3s ease; +} + +.jFiler-jProgressBar .bar.dark { + background-color: #555; +} + +.jFiler-jProgressBar .bar.blue { + background-color: #428bca; +} + +.jFiler-jProgressBar .bar.green { + background-color: #5cb85c; +} + +.jFiler-jProgressBar .bar.orange { + background-color: #f7a923; +} + +.jFiler-jProgressBar .bar.red { + background-color: #d9534f; +} + +/* Thumbs */ +.jFiler-row:after, +.jFiler-item:after { + display: table; + line-height: 0; + content: ""; + clear: both; +} + +.jFiler-items ul { + margin: 0; + padding: 0; + list-style: none; +} + +/*------------------------- + Default Theme +-------------------------*/ +.jFiler-theme-default .jFiler-input { + position: relative; + display: block; + width: 400px; + height: 35px; + margin: 0 0 15px 0; + background: #fefefe; + border: 1px solid #cecece; + font-size: 12px; + font-family: sans-serif; + color: #888; + border-radius: 4px; + cursor: pointer; + overflow: hidden; + -webkit-box-shadow: rgba(0,0,0,.25) 0 4px 5px -5px inset; + -moz-box-shadow: rgba(0,0,0,.25) 0 4px 5px -5px inset; + box-shadow: rgba(0,0,0,.25) 0 4px 5px -5px inset; +} + +.jFiler-theme-default .jFiler-input.focused { + outline: none; + -webkit-box-shadow: 0 0 7px rgba(0,0,0,0.1); + -moz-box-shadow: 0 0 7px rgba(0,0,0,0.1); + box-shadow: 0 0 7px rgba(0,0,0,0.1); +} + +.jFiler-theme-default .jFiler-input.dragged { + border: 1px dashed #aaaaaa; + background: #f9f9f9; +} + +.jFiler-theme-default .jFiler-inpu.draggedt:hover { + background: #FFF8D0; +} + +.jFiler-theme-default .jFiler-input.dragged * { + pointer-events: none; +} + +.jFiler-theme-default .jFiler-input.dragged .jFiler-input-caption { + width: 100%; + text-align: center; +} + +.jFiler-theme-default .jFiler-input.dragged .jFiler-input-button { + display: none; +} + +.jFiler-theme-default .jFiler-input-caption { + display: block; + float: left; + height: 100%; + padding-top: 8px; + padding-left: 10px; + text-overflow: ellipsis; + overflow: hidden; +} + +.jFiler-theme-default .jFiler-input-button { + display: block; + float: right; + height: 100%; + padding-top: 8px; + padding-left: 15px; + padding-right: 15px; + border-left: 1px solid #ccc; + color: #666666; + text-align: center; + background-color: #fefefe; + background-image: -webkit-gradient(linear,0 0,0 100%,from(#fefefe),to(#f1f1f1)); + background-image: -webkit-linear-gradient(top,#fefefe,#f1f1f1); + background-image: -o-linear-gradient(top,#fefefe,#f1f1f1); + background-image: linear-gradient(to bottom,#fefefe,#f1f1f1); + background-image: -moz-linear-gradient(top,#fefefe,#f1f1f1); + -webkit-transition: all .1s ease-out; + -moz-transition: all .1s ease-out; + -o-transition: all .1s ease-out; + transition: all .1s ease-out; +} + +.jFiler-theme-default .jFiler-input-button:hover { + -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.07); + -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.07); + box-shadow: inset 0 0 10px rgba(0,0,0,0.07); +} + +.jFiler-theme-default .jFiler-input-button:active { + background-image: -webkit-gradient(linear,0 0,0 100%,from(#f1f1f1),to(#fefefe)); + background-image: -webkit-linear-gradient(top,#f1f1f1,#fefefe); + background-image: -o-linear-gradient(top,#f1f1f1,#fefefe); + background-image: linear-gradient(to bottom,#f1f1f1,#fefefe); + background-image: -moz-linear-gradient(top,#f1f1f1,#fefefe); +} + +/*------------------------- + Thumbnails +-------------------------*/ +.jFiler-items-default .jFiler-items { + +} + +.jFiler-items-default .jFiler-item { + position: relative; + padding: 16px; + margin-bottom: 16px; + background: #f7f7f7; + color: #4d4d4c; +} + + +.jFiler-items-default .jFiler-item .jFiler-item-icon { + font-size: 32px; + color: #48A0DC; + + margin-right: 15px; + margin-top: -3px; +} + +.jFiler-items-default .jFiler-item .jFiler-item-title { + font-weight: bold; +} + +.jFiler-items-default .jFiler-item .jFiler-item-others { + font-size: 12px; + color: #777; + margin-left: -5px; + margin-right: -5px; +} + +.jFiler-items-default .jFiler-item .jFiler-item-others span { + padding-left: 5px; + padding-right: 5px; +} + +.jFiler-items-default .jFiler-item-assets { + position: absolute; + display: block; + right: 16px; + top: 50%; + margin-top: -10px; +} + +.jFiler-items-default .jFiler-item-assets a { + padding: 8px 9px 8px 12px; + cursor: pointer; + background: #fafafa; + color: #777; + border-radius: 4px; + border: 1px solid #e3e3e3 +} + +.jFiler-items-default .jFiler-item-assets .jFiler-item-trash-action:hover, +.jFiler-items-default .jFiler-item-assets .jFiler-item-trash-action:active { + color: #d9534f; +} + +.jFiler-items-default .jFiler-item-assets .jFiler-item-trash-action:active { + background: transparent; +} + +/* Thumbnails: Grid */ +.jFiler-items-grid .jFiler-item { + float: left; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container { + position: relative; + margin: 0 20px 30px 0; + padding: 10px; + border: 1px solid #e1e1e1; + border-radius: 3px; + background: #fff; + -webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.06); + -moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.06); + box-shadow: 0px 0px 3px rgba(0,0,0,0.06); +} + +.jFiler-items-grid .jFiler-item.not_loaded .jFiler-item-container{ + background-color: rgba(0,0,0,.05); +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-thumb { + display: block; + position: relative; + width: 190px; + height: 145px; + min-height: 115px; + border: 1px solid #e1e1e1; + overflow: hidden; + cursor: default; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-thumb .jFiler-item-thumb-image { + width: 100%; + height: 100%; + text-align: center; +} + +.jFiler-item .jFiler-item-container .jFiler-item-thumb img { + max-width: none; + max-height: 100%; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-thumb span.jFiler-icon-file { + margin-top: 32px; +} + +.jFiler-items-grid .jFiler-item-thumb-image.fi-loading { + background: url('data:image/gif;base64,R0lGODlhIwAjAMQAAP////f39+/v7+bm5t7e3tbW1s7OzsXFxb29vbW1ta2traWl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AABQOgFwIAIfkEBQQAHgAsAAAAAAEAAQAABQOgFwIAIfkECQQAHgAsAAAAACMAIwAABbWgJ45kaZ5oqq5s675wLM90baPBvS6MTgoKgqjxEBEihZuAsRAxHKJHJXk7NAwBB8RzsPRqBYFo4RgkFALKxMhAxAiKBdXtAXgah4Eis2nIBgcLCSgVGxMKNYAoD4MzAgI5KgQHCAhULQUKmgmRJgUaIhwWLwIEBQQDKQEKDxEQCXYxnSUBcjapKAIcHUg+JgkUHRx+YB6zIw4YEMc2QiMBzDB0HgbGvifR19rb3N3e3+Dh4ikhADs=') no-repeat center; + width: 100%; + height: 100%; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-thumb-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + color: #fff; + background: rgba(76, 76, 77, 0.8); + opacity: 0; + filter: alpha(opacity=0); + z-index: 10; + overflow-y: auto; + -webkit-transition: all 0.12s; + -moz-transition: all 0.12s; + transition: all 0.12s; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-thumb:hover .jFiler-item-thumb-overlay { + opacity: 1; + filter: aplpha(opacity(100)); +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-info { + display: table; + padding: 0 10px; + overflow: auto; + width: 100%; + height: 100%; + text-align: center; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-info .jFiler-item-title { + display: block; + font-weight: bold; + word-break: break-all; + line-height: 1; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-info .jFiler-item-others { + display: inline-block; + font-size: 10px; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-assets { + margin-top: 10px; + color: #999; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-assets .text-success { + color: #3C763D +} + +.jFiler-items-grid .jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-assets .text-error { + color: #A94442 +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-assets .jFiler-jProgressBar { + width: 120px; + margin-left: -5px; +} + +.jFiler-items-grid .jFiler-item .jFiler-item-container .jFiler-item-assets .jFiler-item-others { + font-size: 12px; +} + +.jFiler-items-grid .jFiler-item-trash-action:hover { + cursor: pointer; + color: #d9534f; +} diff --git a/static/jQuery-filer/js/init.js b/static/jQuery-filer/js/init.js new file mode 100644 index 00000000..f493c623 --- /dev/null +++ b/static/jQuery-filer/js/init.js @@ -0,0 +1,195 @@ +function init_filer($target) { + $target.find('.file_uploader').filer({ + limit: null, + maxSize: null, + extensions: null, + changeInput: '

Drag&Drop files here

or
Browse Files
', + showThumbs: true, + theme: "dragdropbox", + afterRender: function(l, p, o, s){ + s[0].name = s[0].name.replace('[]', '') + }, + templates: { + box: '', + item: '
  • \ +
    \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + {{fi-name}}\ + {{fi-size2}}\ +
    \ +
    \ +
    \ + {{fi-image}}\ +
    \ +
    \ +
      \ +
    • {{fi-progressBar}}
    • \ +
    \ +
      \ +
    • \ +
    \ +
    \ +
    \ +
    \ +
  • ', + itemAppend: '
  • \ +
    \ +
    \ + \ +
    \ +
    \ +
    \ +
    \ + {{fi-name}}\ + {{fi-size2}}\ +
    \ +
    \ +
    \ + {{fi-image}}\ +
    \ +
    \ +
      \ +
    • {{fi-icon}}
    • \ +
    \ +
      \ +
    • {{fi-remove}}
    • \ +
    \ +
    \ +
    \ +
    \ +
  • ', + progressBar: '
    ', + itemAppendToEnd: true, + canvasImage: true, + removeConfirmation: true, + _selectors: { + list: '.jFiler-items-list', + //item: '.jFiler-item', + progressBar: '.bar', + remove: '.jFiler-item-trash-action' + } + }, + dragDrop: { + dragEnter: null, + dragLeave: null, + drop: null, + dragContainer: null + }, + uploadFile: { + url: $target.data('upload-url'), + //data: null, + type: 'POST', + enctype: 'multipart/form-data', + synchron: true, + beforeSend: function() {}, + success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id){ + console.log(data); + console.log(itemEl); + console.log(listEl); + console.log(boxEl); + console.log(newInputEl); + console.log(inputEl); + console.log(id); + console.log('----------------------------'); + var parent = itemEl.find(".jFiler-jProgressBar").parent(); + + itemEl.find(".jFiler-jProgressBar").fadeOut("slow", function(){ + $("
    Success
    ").hide().appendTo(parent).fadeIn("slow"); + }); + }, + error: function(el){ + var parent = el.find(".jFiler-jProgressBar").parent(); + el.find(".jFiler-jProgressBar").fadeOut("slow", function(){ + $("
    Error
    ").hide().appendTo(parent).fadeIn("slow"); + }); + }, + statusCode: null, + onProgress: null, + onComplete: null + }, + files: [ + { + name: "appended_file.jpg", + size: 5453, + type: "image", + file: "http://127.0.0.1:8000/media/photologue/photos/cache/am_admin_thumbnail.jpg", // 188x143 crop="center" + url: "google.com.ua", + remove_url: '/remove-url/1/', + detail_link: '/detail_link/1/' + }, + { + name: "appended_file_2.jpg", + size: 9453, + type: "image", + file: "http://127.0.0.1:8000/media/photologue/photos/cache/am_admin_thumbnail.jpg", // 188x143 crop="center" + url: "/qwerty/qwerty/", + remove_url: '/remove-url/2/', + detail_link: '/detail_link/1/' + }, + { + name: "appended_file_2.jpg", + size: 9453, + type: "image", + file: "http://127.0.0.1:8000/media/photologue/photos/cache/am_admin_thumbnail.jpg", // 188x143 crop="center" + url: "/qwerty/qwerty/", + remove_url: '/remove-url/3/', + detail_link: '/detail_link/1/' + } + ], + addMore: false, + allowDuplicates: true, + clipBoardPaste: true, + excludeName: null, + beforeRender: null, + beforeShow: null, + beforeSelect: null, + onSelect: null, + afterShow: null, + onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){ + var filerKit = inputEl.prop("jFiler"), + file_name = filerKit.files_list[id].name; + + $.post('./php/ajax_remove_file.php', {file: file_name}); + }, + onEmpty: null, + options: null, + dialogs: { + alert: function(text) { + return alert(text); + }, + confirm: function (text, callback) { + confirm(text) ? callback() : null; + } + }, + captions: { + button: "Выберите файлы", + feedback: "Выберите файлы для загрузки", + feedback2: "выбранные файлы", + drop: "Перетяните файлы для загрузки", + removeConfirmation: "Вы уверены что хотите удалить этот файл?", + errors: { + filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.", + filesType: "Only Images are allowed to be uploaded.", + filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.", + filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB." + } + } + }); + +} + + +var $uploaders = $('.file_upload_container'); + +$uploaders.each(function (i, uploader) { + var $uploader = $(uploader), + fields = $uploader.data('fields').split('|'), // Массив названий полей для создания фото + languages = $uploader.data('languages').split('|'); // Массив языков, будет использоватся для генерации инпутов + + init_filer($uploader); +}); \ No newline at end of file diff --git a/static/jQuery-filer/js/jquery.filer.js b/static/jQuery-filer/js/jquery.filer.js new file mode 100755 index 00000000..331ce4a6 --- /dev/null +++ b/static/jQuery-filer/js/jquery.filer.js @@ -0,0 +1,1130 @@ +/*! + * jQuery.filer + * Copyright (c) 2016 CreativeDream + * Website: https://github.com/CreativeDream/jquery.filer + * Version: 1.3 (14-Sep-2016) + * Requires: jQuery v1.7.1 or later + */ +(function($) { + "use strict"; + $.fn.filer = function(q) { + return this.each(function(t, r) { + var s = $(r), + b = '.jFiler', + p = $(), + o = $(), + l = $(), + sl = [], + n_f = $.isFunction(q) ? q(s, $.fn.filer.defaults) : q, + n = n_f && $.isPlainObject(n_f) ? $.extend(true, {}, $.fn.filer.defaults, n_f) : $.fn.filer.defaults, + f = { + init: function() { + s.wrap('
    '); + f._set('props'); + s.prop("jFiler").boxEl = p = s.closest(b); + f._changeInput(); + }, + _bindInput: function() { + if (n.changeInput && o.length > 0) { + o.on("click", f._clickHandler); + } + s.on({ + "focus": function() { + o.addClass('focused'); + }, + "blur": function() { + o.removeClass('focused'); + }, + "change": f._onChange + }); + if (n.dragDrop) { + n.dragDrop.dragContainer.on("drag dragstart dragend dragover dragenter dragleave drop", function(e) { + e.preventDefault(); + e.stopPropagation(); + }); + n.dragDrop.dragContainer.on("drop", f._dragDrop.drop); + n.dragDrop.dragContainer.on("dragover", f._dragDrop.dragEnter); + n.dragDrop.dragContainer.on("dragleave", f._dragDrop.dragLeave); + } + if (n.uploadFile && n.clipBoardPaste) { + $(window) + .on("paste", f._clipboardPaste); + } + }, + _unbindInput: function(all) { + if (n.changeInput && o.length > 0) { + o.off("click", f._clickHandler); + } + + if (all) { + s.off("change", f._onChange); + if (n.dragDrop) { + n.dragDrop.dragContainer.off("drop", f._dragDrop.drop); + n.dragDrop.dragContainer.off("dragover", f._dragDrop.dragEnter); + n.dragDrop.dragContainer.off("dragleave", f._dragDrop.dragLeave); + } + if (n.uploadFile && n.clipBoardPaste) { + $(window) + .off("paste", f._clipboardPaste); + } + } + }, + _clickHandler: function() { + if (!n.uploadFile && n.addMore && s.val().length != 0) { + f._unbindInput(true); + var elem = $(''); + var attributes = s.prop("attributes"); + $.each(attributes, function() { + if (this.name == "required") return; + elem.attr(this.name, this.value); + }); + s.after(elem); + sl.push(elem); + s = elem; + f._bindInput(); + f._set('props'); + } + s.click() + }, + _applyAttrSettings: function() { + var d = ["name", "limit", "maxSize", "fileMaxSize", "extensions", "changeInput", "showThumbs", "appendTo", "theme", "addMore", "excludeName", "files", "uploadUrl", "uploadData", "options"]; + for (var k in d) { + var j = "data-jfiler-" + d[k]; + if (f._assets.hasAttr(j)) { + switch (d[k]) { + case "changeInput": + case "showThumbs": + case "addMore": + n[d[k]] = (["true", "false"].indexOf(s.attr(j)) > -1 ? s.attr(j) == "true" : s.attr(j)); + break; + case "extensions": + n[d[k]] = s.attr(j) + .replace(/ /g, '') + .split(","); + break; + case "uploadUrl": + if (n.uploadFile) n.uploadFile.url = s.attr(j); + break; + case "uploadData": + if (n.uploadFile) n.uploadFile.data = JSON.parse(s.attr(j)); + break; + case "files": + case "options": + n[d[k]] = JSON.parse(s.attr(j)); + break; + default: + n[d[k]] = s.attr(j); + } + s.removeAttr(j); + } + } + }, + _changeInput: function() { + f._applyAttrSettings(); + n.beforeRender != null && typeof n.beforeRender == "function" ? n.beforeRender(p, s) : null; + if (n.theme) { + p.addClass('jFiler-theme-' + n.theme); + } + if (s.get(0) + .tagName.toLowerCase() != "input" && s.get(0) + .type != "file") { + o = s; + s = $(""); + s.css({ + position: "absolute", + left: "-9999px", + top: "-9999px", + "z-index": "-9999" + }); + p.prepend(s); + f._isGn = s; + } else { + if (n.changeInput) { + switch (typeof n.changeInput) { + case "boolean": + o = $('
    ' + n.captions.feedback + '
    ' + n.captions.button + '
    "'); + break; + case "string": + case "object": + o = $(n.changeInput); + break; + case "function": + o = $(n.changeInput(p, s, n)); + break; + } + s.after(o); + s.css({ + position: "absolute", + left: "-9999px", + top: "-9999px", + "z-index": "-9999" + }); + } + } + s.prop("jFiler").newInputEl = o; + if (n.dragDrop) { + n.dragDrop.dragContainer = n.dragDrop.dragContainer ? $(n.dragDrop.dragContainer) : o; + } + if (!n.limit || (n.limit && n.limit >= 2)) { + s.attr("multiple", "multiple"); + s.attr("name") + .slice(-2) != "[]" ? s.attr("name", s.attr("name") + "[]") : null; + } + if (!s.attr("disabled") && !n.disabled) { + n.disabled = false; + f._bindInput(); + p.removeClass("jFiler-disabled"); + } else { + n.disabled = true; + f._unbindInput(true); + p.addClass("jFiler-disabled"); + } + if (n.files) { + f._append(false, { + files: n.files + }); + } + n.afterRender != null && typeof n.afterRender == "function" ? n.afterRender(l, p, o, s) : null; + }, + _clear: function() { + f.files = null; + s.prop("jFiler") + .files = null; + if (!n.uploadFile && !n.addMore) { + f._reset(); + } + f._set('feedback', (f._itFl && f._itFl.length > 0 ? f._itFl.length + ' ' + n.captions.feedback2 : n.captions.feedback)); + n.onEmpty != null && typeof n.onEmpty == "function" ? n.onEmpty(p, o, s) : null + }, + _reset: function(a) { + if (!a) { + if (!n.uploadFile && n.addMore) { + for (var i = 0; i < sl.length; i++) { + sl[i].remove(); + } + sl = []; + f._unbindInput(true); + if (f._isGn) { + s = f._isGn; + } else { + s = $(r); + } + f._bindInput(); + } + f._set('input', ''); + } + f._itFl = []; + f._itFc = null; + f._ajFc = 0; + f._set('props'); + s.prop("jFiler") + .files_list = f._itFl; + s.prop("jFiler") + .current_file = f._itFc; + f._itFr = []; + p.find("input[name^='jfiler-items-exclude-']:hidden") + .remove(); + l.fadeOut("fast", function() { + $(this) + .remove(); + }); + s.prop("jFiler").listEl = l = $(); + }, + _set: function(element, value) { + switch (element) { + case 'input': + s.val(value); + break; + case 'feedback': + if (o.length > 0) { + o.find('.jFiler-input-caption span') + .html(value); + } + break; + case 'props': + if (!s.prop("jFiler")) { + s.prop("jFiler", { + options: n, + listEl: l, + boxEl: p, + newInputEl: o, + inputEl: s, + files: f.files, + files_list: f._itFl, + current_file: f._itFc, + append: function(data) { + return f._append(false, { + files: [data] + }); + }, + enable: function() { + if (!n.disabled) + return; + n.disabled = false; + s.removeAttr("disabled"); + p.removeClass("jFiler-disabled"); + f._bindInput(); + }, + disable: function() { + if (n.disabled) + return; + n.disabled = true; + p.addClass("jFiler-disabled"); + f._unbindInput(true); + }, + remove: function(id) { + f._remove(null, { + binded: true, + data: { + id: id + } + }); + return true; + }, + reset: function() { + f._reset(); + f._clear(); + return true; + }, + retry: function(data) { + return f._retryUpload(data); + } + }) + } + } + }, + _filesCheck: function() { + var s = 0; + if (n.limit && f.files.length + f._itFl.length > n.limit) { + n.dialogs.alert(f._assets.textParse(n.captions.errors.filesLimit)); + return false + } + for (var t = 0; t < f.files.length; t++) { + var file = f.files[t], + x = file.name.split(".") + .pop() + .toLowerCase(), + m = { + name: file.name, + size: file.size, + size2: f._assets.bytesToSize(file.size), + type: file.type, + ext: x + }; + if (n.extensions != null && $.inArray(x, n.extensions) == -1 && $.inArray(m.type, n.extensions) == -1) { + n.dialogs.alert(f._assets.textParse(n.captions.errors.filesType, m)); + return false; + } + if ((n.maxSize != null && f.files[t].size > n.maxSize * 1048576) || (n.fileMaxSize != null && f.files[t].size > n.fileMaxSize * 1048576)) { + n.dialogs.alert(f._assets.textParse(n.captions.errors.filesSize, m)); + return false; + } + if (file.size == 4096 && file.type.length == 0) { + n.dialogs.alert(f._assets.textParse(n.captions.errors.folderUpload, m)); + return false; + } + if (n.onFileCheck != null && typeof n.onFileCheck == "function" ? n.onFileCheck(m, n, f._assets.textParse) === false : null) { + return false; + } + + if ((n.uploadFile || n.addMore) && !n.allowDuplicates) { + var m = f._itFl.filter(function(a, b) { + if (a.file.name == file.name && a.file.size == file.size && a.file.type == file.type && (file.lastModified ? a.file.lastModified == file.lastModified : true)) { + return true; + } + }); + if (m.length > 0) { + if (f.files.length == 1) { + return false; + } else { + file._pendRemove = true; + } + } + } + + s += f.files[t].size + } + if (n.maxSize != null && s >= Math.round(n.maxSize * 1048576)) { + n.dialogs.alert(f._assets.textParse(n.captions.errors.filesSizeAll)); + return false + } + return true; + }, + _thumbCreator: { + create: function(i) { + var file = f.files[i], + id = (f._itFc ? f._itFc.id : i), + name = file.name, + size = file.size, + url = file.file, + type = file.type ? file.type.split("/", 1) : "" + .toString() + .toLowerCase(), + ext = name.indexOf(".") != -1 ? name.split(".") + .pop() + .toLowerCase() : "", + progressBar = n.uploadFile ? '
    ' + n.templates.progressBar + '
    ' : '', + opts = { + id: id, + name: name, + size: size, + size2: f._assets.bytesToSize(size), + url: url, + type: type, + extension: ext, + icon: f._assets.getIcon(ext, type), + icon2: f._thumbCreator.generateIcon({ + type: type, + extension: ext + }), + image: '
    ', + progressBar: progressBar, + _appended: file._appended + }, + html = ""; + if (file.opts) { + opts = $.extend({}, file.opts, opts); + } + html = $(f._thumbCreator.renderContent(opts)) + .attr("data-jfiler-index", id); + html.get(0) + .jfiler_id = id; + f._thumbCreator.renderFile(file, html, opts); + if (file.forList) { + return html; + } + f._itFc.html = html; + html.hide()[n.templates.itemAppendToEnd ? "appendTo" : "prependTo"](l.find(n.templates._selectors.list)) + .show(); + if (!file._appended) { + f._onSelect(i); + } + }, + renderContent: function(opts) { + return f._assets.textParse((opts._appended ? n.templates.itemAppend : n.templates.item), opts); + }, + renderFile: function(file, html, opts) { + console.log(file); + console.log(html.find('.jFiler-item-trash-action').length); + console.log(opts); + console.log('-------------'); + if (file.remove_url){ + html.find('.jFiler-item-trash-action').attr('href', file.remove_url) + } + /* NOTE: добавил ссылку на подробный просмотр файла */ + if (file.detail_link){ + html + .find('.jFiler-item-thumb') + .attr('href', file.detail_link) + .css('cursor', 'pointer'); + } + /* NOTE: добавил ссылку на удаление файла */ + if (html.find('.jFiler-item-thumb-image') + .length == 0) { + return false; + } + if (file.file && opts.type == "image") { + var g = '', + m = html.find('.jFiler-item-thumb-image.fi-loading'); + $(g) + .error(function() { + g = f._thumbCreator.generateIcon(opts); + html.addClass('jFiler-no-thumbnail'); + m.removeClass('fi-loading') + .html(g); + }) + .load(function() { + m.removeClass('fi-loading') + .html(g); + }); + return true; + } + if (window.File && window.FileList && window.FileReader && opts.type == "image" && opts.size < 1e+7) { + console.log('renderFile third if'); + var y = new FileReader; + y.onload = function(e) { + var m = html.find('.jFiler-item-thumb-image.fi-loading'); + if (n.templates.canvasImage) { + var canvas = document.createElement('canvas'), + context = canvas.getContext('2d'), + img = new Image(); + + img.onload = function() { + var height = m.height(), + width = m.width(), + heightRatio = img.height / height, + widthRatio = img.width / width, + optimalRatio = heightRatio < widthRatio ? heightRatio : widthRatio, + optimalHeight = img.height / optimalRatio, + optimalWidth = img.width / optimalRatio, + steps = Math.ceil(Math.log(img.width / optimalWidth) / Math.log(2)); + + canvas.height = height; + canvas.width = width; + + if (img.width < canvas.width || img.height < canvas.height || steps <= 1) { + var x = img.width < canvas.width ? canvas.width / 2 - img.width / 2 : img.width > canvas.width ? -(img.width - canvas.width) / 2 : 0, + y = img.height < canvas.height ? canvas.height / 2 - img.height / 2 : 0 + context.drawImage(img, x, y, img.width, img.height); + } else { + var oc = document.createElement('canvas'), + octx = oc.getContext('2d'); + oc.width = img.width * 0.5; + oc.height = img.height * 0.5; + octx.fillStyle = "#fff"; + octx.fillRect(0, 0, oc.width, oc.height); + octx.drawImage(img, 0, 0, oc.width, oc.height); + octx.drawImage(oc, 0, 0, oc.width * 0.5, oc.height * 0.5); + + context.drawImage(oc, optimalWidth > canvas.width ? optimalWidth - canvas.width : 0, 0, oc.width * 0.5, oc.height * 0.5, 0, 0, optimalWidth, optimalHeight); + } + m.removeClass('fi-loading').html(''); + }; + img.onerror = function() { + html.addClass('jFiler-no-thumbnail'); + m.removeClass('fi-loading') + .html(f._thumbCreator.generateIcon(opts)); + }; + img.src = e.target.result; + } else { + m.removeClass('fi-loading').html(''); + } + }; + y.readAsDataURL(file); + } else { + console.log('renderFile else'); + var g = f._thumbCreator.generateIcon(opts), + m = html.find('.jFiler-item-thumb-image.fi-loading'); + html.addClass('jFiler-no-thumbnail'); + m.removeClass('fi-loading') + .html(g); + } + }, + generateIcon: function(obj) { + var m = new Array(3); + if (obj && obj.type && obj.type[0] && obj.extension) { + switch (obj.type[0]) { + case "image": + m[0] = "f-image"; + m[1] = "" + break; + case "video": + m[0] = "f-video"; + m[1] = "" + break; + case "audio": + m[0] = "f-audio"; + m[1] = "" + break; + default: + m[0] = "f-file f-file-ext-" + obj.extension; + m[1] = (obj.extension.length > 0 ? "." + obj.extension : ""); + m[2] = 1 + } + } else { + m[0] = "f-file"; + m[1] = (obj.extension && obj.extension.length > 0 ? "." + obj.extension : ""); + m[2] = 1 + } + var el = '' + m[1] + ''; + if (m[2] == 1) { + var c = f._assets.text2Color(obj.extension); + if (c) { + var j = $(el) + .appendTo("body"); + + j.css('background-color', f._assets.text2Color(obj.extension)); + el = j.prop('outerHTML'); + j.remove(); + } + } + return el; + }, + _box: function(params) { + if (n.beforeShow != null && typeof n.beforeShow == "function" ? !n.beforeShow(f.files, l, p, o, s) : false) { + return false + } + if (l.length < 1) { + if (n.appendTo) { + var appendTo = $(n.appendTo); + } else { + var appendTo = p; + } + appendTo.find('.jFiler-items') + .remove(); + l = $('
    '); + s.prop("jFiler").listEl = l; + l.append(f._assets.textParse(n.templates.box)) + .appendTo(appendTo); + l.on('click', n.templates._selectors.remove, function(e) { + e.preventDefault(); + var m = [params ? params.remove.event : e, params ? params.remove.el : $(this).closest(n.templates._selectors.item)], + c = function(a) { + f._remove(m[0], m[1]); + }; + if (n.templates.removeConfirmation) { + n.dialogs.confirm(n.captions.removeConfirmation, c); + } else { + c(); + } + }); + } + for (var i = 0; i < f.files.length; i++) { + if (!f.files[i]._appended) f.files[i]._choosed = true; + f._addToMemory(i); + f._thumbCreator.create(i); + } + } + }, + _upload: function(i) { + var c = f._itFl[i], + el = c.html, + formData = new FormData(); + formData.append(s.attr('name'), c.file, (c.file.name ? c.file.name : false)); + if (n.uploadFile.data != null && $.isPlainObject(typeof(n.uploadFile.data) == "function" ? n.uploadFile.data(c.file) : n.uploadFile.data)) { + for (var k in n.uploadFile.data) { + formData.append(k, n.uploadFile.data[k]) + } + } + + f._ajax.send(el, formData, c); + }, + _ajax: { + send: function(el, formData, c) { + c.ajax = $.ajax({ + url: n.uploadFile.url, + data: formData, + type: n.uploadFile.type, + enctype: n.uploadFile.enctype, + xhr: function() { + var myXhr = $.ajaxSettings.xhr(); + if (myXhr.upload) { + myXhr.upload.addEventListener("progress", function(e) { + f._ajax.progressHandling(e, el) + }, false) + } + return myXhr + }, + complete: function(jqXHR, textStatus) { + c.ajax = false; + f._ajFc++; + + if (n.uploadFile.synchron && c.id + 1 < f._itFl.length) { + f._upload(c.id + 1); + } + + if (f._ajFc >= f.files.length) { + f._ajFc = 0; + s.get(0).value = ""; + n.uploadFile.onComplete != null && typeof n.uploadFile.onComplete == "function" ? n.uploadFile.onComplete(l, p, o, s, jqXHR, textStatus) : null; + } + }, + beforeSend: function(jqXHR, settings) { + return n.uploadFile.beforeSend != null && typeof n.uploadFile.beforeSend == "function" ? n.uploadFile.beforeSend(el, l, p, o, s, c.id, jqXHR, settings) : true; + }, + success: function(data, textStatus, jqXHR) { + c.uploaded = true; + n.uploadFile.success != null && typeof n.uploadFile.success == "function" ? n.uploadFile.success(data, el, l, p, o, s, c.id, textStatus, jqXHR) : null + }, + error: function(jqXHR, textStatus, errorThrown) { + c.uploaded = false; + n.uploadFile.error != null && typeof n.uploadFile.error == "function" ? n.uploadFile.error(el, l, p, o, s, c.id, jqXHR, textStatus, errorThrown) : null + }, + statusCode: n.uploadFile.statusCode, + cache: false, + contentType: false, + processData: false + }); + return c.ajax; + }, + progressHandling: function(e, el) { + if (e.lengthComputable) { + var t = Math.round(e.loaded * 100 / e.total) + .toString(); + n.uploadFile.onProgress != null && typeof n.uploadFile.onProgress == "function" ? n.uploadFile.onProgress(t, el, l, p, o, s) : null; + el.find('.jFiler-jProgressBar') + .find(n.templates._selectors.progressBar) + .css("width", t + "%") + } + } + }, + _dragDrop: { + dragEnter: function(e) { + clearTimeout(f._dragDrop._drt); + n.dragDrop.dragContainer.addClass('dragged'); + f._set('feedback', n.captions.drop); + n.dragDrop.dragEnter != null && typeof n.dragDrop.dragEnter == "function" ? n.dragDrop.dragEnter(e, o, s, p) : null; + }, + dragLeave: function(e) { + clearTimeout(f._dragDrop._drt); + f._dragDrop._drt = setTimeout(function(e) { + if (!f._dragDrop._dragLeaveCheck(e)) { + f._dragDrop.dragLeave(e); + return false; + } + n.dragDrop.dragContainer.removeClass('dragged'); + f._set('feedback', n.captions.feedback); + n.dragDrop.dragLeave != null && typeof n.dragDrop.dragLeave == "function" ? n.dragDrop.dragLeave(e, o, s, p) : null; + }, 100, e); + }, + drop: function(e) { + clearTimeout(f._dragDrop._drt); + n.dragDrop.dragContainer.removeClass('dragged'); + f._set('feedback', n.captions.feedback); + if (e && e.originalEvent && e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files && e.originalEvent.dataTransfer.files.length > 0) { + f._onChange(e, e.originalEvent.dataTransfer.files); + } + n.dragDrop.drop != null && typeof n.dragDrop.drop == "function" ? n.dragDrop.drop(e.originalEvent.dataTransfer.files, e, o, s, p) : null; + }, + _dragLeaveCheck: function(e) { + var related = $(e.currentTarget), + insideEls = 0; + if (!related.is(o)) { + insideEls = o.find(related).length; + + if (insideEls > 0) { + debugger; + return false; + } + } + return true; + } + }, + _clipboardPaste: function(e, fromDrop) { + if (!fromDrop && (!e.originalEvent.clipboardData && !e.originalEvent.clipboardData.items)) { + return + } + if (fromDrop && (!e.originalEvent.dataTransfer && !e.originalEvent.dataTransfer.items)) { + return + } + if (f._clPsePre) { + return + } + var items = (fromDrop ? e.originalEvent.dataTransfer.items : e.originalEvent.clipboardData.items), + b64toBlob = function(b64Data, contentType, sliceSize) { + contentType = contentType || ''; + sliceSize = sliceSize || 512; + var byteCharacters = atob(b64Data); + var byteArrays = []; + for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) { + var slice = byteCharacters.slice(offset, offset + sliceSize); + var byteNumbers = new Array(slice.length); + for (var i = 0; i < slice.length; i++) { + byteNumbers[i] = slice.charCodeAt(i); + } + var byteArray = new Uint8Array(byteNumbers); + byteArrays.push(byteArray); + } + var blob = new Blob(byteArrays, { + type: contentType + }); + return blob; + }; + if (items) { + for (var i = 0; i < items.length; i++) { + if (items[i].type.indexOf("image") !== -1 || items[i].type.indexOf("text/uri-list") !== -1) { + if (fromDrop) { + try { + window.atob(e.originalEvent.dataTransfer.getData("text/uri-list") + .toString() + .split(',')[1]); + } catch (e) { + return; + } + } + var blob = (fromDrop ? b64toBlob(e.originalEvent.dataTransfer.getData("text/uri-list") + .toString() + .split(',')[1], "image/png") : items[i].getAsFile()); + blob.name = Math.random() + .toString(36) + .substring(5); + blob.name += blob.type.indexOf("/") != -1 ? "." + blob.type.split("/")[1].toString() + .toLowerCase() : ".png"; + f._onChange(e, [blob]); + f._clPsePre = setTimeout(function() { + delete f._clPsePre + }, 1000); + } + } + } + }, + _onSelect: function(i) { + if (n.uploadFile && !$.isEmptyObject(n.uploadFile)) { + if (!n.uploadFile.synchron || (n.uploadFile.synchron && $.grep(f._itFl, function(a) { + return a.ajax + }).length == 0)) { + f._upload(f._itFc.id) + } + } + if (f.files[i]._pendRemove) { + f._itFc.html.hide(); + f._remove(null, { + binded: true, + data: { + id: f._itFc.id + } + }); + } + n.onSelect != null && typeof n.onSelect == "function" ? n.onSelect(f.files[i], f._itFc.html, l, p, o, s) : null; + if (i + 1 >= f.files.length) { + n.afterShow != null && typeof n.afterShow == "function" ? n.afterShow(l, p, o, s) : null + } + }, + _onChange: function(e, d) { + if (!d) { + if (!s.get(0) + .files || typeof s.get(0) + .files == "undefined" || s.get(0) + .files.length == 0) { + if (!n.uploadFile && !n.addMore) { + f._set('input', ''); + f._clear(); + } + return false + } + f.files = s.get(0) + .files; + } else { + if (!d || d.length == 0) { + f._set('input', ''); + f._clear(); + return false + } + f.files = d; + } + if (!n.uploadFile && !n.addMore) { + f._reset(true); + } + s.prop("jFiler") + .files = f.files; + if (!f._filesCheck() || (n.beforeSelect != null && typeof n.beforeSelect == "function" ? !n.beforeSelect(f.files, l, p, o, s) : false)) { + f._set('input', ''); + f._clear(); + if (n.addMore && sl.length > 0) { + f._unbindInput(true); + sl[sl.length - 1].remove(); + sl.splice(sl.length - 1, 1); + s = sl.length > 0 ? sl[sl.length - 1] : $(r); + f._bindInput(); + } + return false + } + f._set('feedback', f.files.length + f._itFl.length + ' ' + n.captions.feedback2); + if (n.showThumbs) { + f._thumbCreator._box(); + } else { + for (var i = 0; i < f.files.length; i++) { + f.files[i]._choosed = true; + f._addToMemory(i); + f._onSelect(i); + } + } + }, + _append: function(e, data) { + var files = (!data ? false : data.files); + if (!files || files.length <= 0) { + return; + } + f.files = files; + s.prop("jFiler") + .files = f.files; + if (n.showThumbs) { + for (var i = 0; i < f.files.length; i++) { + f.files[i]._appended = true; + } + f._thumbCreator._box(); + } + }, + _getList: function(e, data) { + var files = (!data ? false : data.files); + if (!files || files.length <= 0) { + return; + } + f.files = files; + s.prop("jFiler") + .files = f.files; + if (n.showThumbs) { + var returnData = []; + for (var i = 0; i < f.files.length; i++) { + f.files[i].forList = true; + returnData.push(f._thumbCreator.create(i)); + } + if (data.callback) { + data.callback(returnData, l, p, o, s); + } + } + }, + _retryUpload: function(e, data) { + var id = parseInt(typeof data == "object" ? data.attr("data-jfiler-index") : data), + obj = f._itFl.filter(function(value, key) { + return value.id == id; + }); + if (obj.length > 0) { + if (n.uploadFile && !$.isEmptyObject(n.uploadFile) && !obj[0].uploaded) { + f._itFc = obj[0]; + s.prop("jFiler") + .current_file = f._itFc; + f._upload(id); + return true; + } + } else { + return false; + } + }, + _remove: function(e, el) { + if (el.binded) { + if (typeof(el.data.id) != "undefined") { + el = l.find(n.templates._selectors.item + "[data-jfiler-index='" + el.data.id + "']"); + if (el.length == 0) { + return false + } + } + if (el.data.el) { + el = el.data.el; + } + } + var excl_input = function(val) { + var input = p.find("input[name^='jfiler-items-exclude-']:hidden") + .first(); + + if (input.length == 0) { + input = $(''); + input.appendTo(p); + } + + if (val && $.isArray(val)) { + val = JSON.stringify(val); + input.val(val); + } + }, + callback = function(el, id) { + var item = f._itFl[id], + val = []; + + if (item.file._choosed || item.file._appended || item.uploaded) { + f._itFr.push(item); + + var m = f._itFl.filter(function(a) { + return a.file.name == item.file.name; + }); + + for (var i = 0; i < f._itFr.length; i++) { + if (n.addMore && f._itFr[i] == item && m.length > 0) { + f._itFr[i].remove_name = m.indexOf(item) + "://" + f._itFr[i].file.name; + } + val.push(f._itFr[i].remove_name ? f._itFr[i].remove_name : f._itFr[i].file.name); + } + } + excl_input(val); + f._itFl.splice(id, 1); + if (f._itFl.length < 1) { + f._reset(); + f._clear(); + } else { + f._set('feedback', f._itFl.length + ' ' + n.captions.feedback2); + } + el.fadeOut("fast", function() { + $(this) + .remove(); + }); + }; + + var attrId = el.get(0) + .jfiler_id || el.attr('data-jfiler-index'), + id = null; + + for (var key in f._itFl) { + if (key === 'length' || !f._itFl.hasOwnProperty(key)) continue; + if (f._itFl[key].id == attrId) { + id = key; + } + } + if (!f._itFl.hasOwnProperty(id)) { + return false + } + if (f._itFl[id].ajax) { + f._itFl[id].ajax.abort(); + callback(el, id); + return; + } + if (n.onRemove != null && typeof n.onRemove == "function" ? n.onRemove(el, f._itFl[id].file, id, l, p, o, s) !== false : true) { + callback(el, id); + } + }, + _addToMemory: function(i) { + f._itFl.push({ + id: f._itFl.length, + file: f.files[i], + html: $(), + ajax: false, + uploaded: false, + }); + if (n.addMore || f.files[i]._appended) f._itFl[f._itFl.length - 1].input = s; + f._itFc = f._itFl[f._itFl.length - 1]; + s.prop("jFiler") + .files_list = f._itFl; + s.prop("jFiler") + .current_file = f._itFc; + }, + _assets: { + bytesToSize: function(bytes) { + if (bytes == 0) return '0 Byte'; + var k = 1000; + var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + var i = Math.floor(Math.log(bytes) / Math.log(k)); + return (bytes / Math.pow(k, i)) + .toPrecision(3) + ' ' + sizes[i]; + }, + hasAttr: function(attr, el) { + var el = (!el ? s : el), + a = el.attr(attr); + if (!a || typeof a == "undefined") { + return false; + } else { + return true; + } + }, + getIcon: function(ext, type) { + var types = ["audio", "image", "text", "video"]; + if ($.inArray(type, types) > -1) { + return ''; + } + return ''; + }, + textParse: function(text, opts) { + opts = $.extend({}, { + limit: n.limit, + maxSize: n.maxSize, + fileMaxSize: n.fileMaxSize, + extensions: n.extensions ? n.extensions.join(',') : null, + }, (opts && $.isPlainObject(opts) ? opts : {}), n.options); + switch (typeof(text)) { + case "string": + return text.replace(/\{\{fi-(.*?)\}\}/g, function(match, a) { + a = a.replace(/ /g, ''); + if (a.match(/(.*?)\|limitTo\:(\d+)/)) { + return a.replace(/(.*?)\|limitTo\:(\d+)/, function(match, a, b) { + var a = (opts[a] ? opts[a] : ""), + str = a.substring(0, b); + str = (a.length > str.length ? str.substring(0, str.length - 3) + "..." : str); + return str; + }); + } else { + return (opts[a] ? opts[a] : ""); + } + }); + break; + case "function": + return text(opts); + break; + default: + return text; + } + }, + text2Color: function(str) { + if (!str || str.length == 0) { + return false + } + for (var i = 0, hash = 0; i < str.length; hash = str.charCodeAt(i++) + ((hash << 5) - hash)); + for (var i = 0, colour = "#"; i < 3; colour += ("00" + ((hash >> i++ * 2) & 0xFF) + .toString(16)) + .slice(-2)); + return colour; + } + }, + files: null, + _itFl: [], + _itFc: null, + _itFr: [], + _itPl: [], + _ajFc: 0 + } + + s.on("filer.append", function(e, data) { + f._append(e, data) + }).on("filer.remove", function(e, data) { + data.binded = true; + f._remove(e, data); + }).on("filer.reset", function(e) { + f._reset(); + f._clear(); + return true; + }).on("filer.generateList", function(e, data) { + return f._getList(e, data) + }).on("filer.retry", function(e, data) { + return f._retryUpload(e, data) + }); + + f.init(); + + return this; + }); + }; + $.fn.filer.defaults = { + limit: null, + maxSize: null, + fileMaxSize: null, + extensions: null, + changeInput: true, + showThumbs: false, + appendTo: null, + theme: 'default', + templates: { + box: '', + item: '
  • {{fi-icon}}
    {{fi-name | limitTo:30}}
    size: {{fi-size2}}type: {{fi-extension}}{{fi-progressBar}}
  • ', + itemAppend: '
  • {{fi-icon}}
    {{fi-name | limitTo:35}}
    size: {{fi-size2}}type: {{fi-extension}}
  • ', + progressBar: '
    ', + itemAppendToEnd: false, + removeConfirmation: true, + canvasImage: true, + _selectors: { + list: '.jFiler-items-list', + item: '.jFiler-item', + progressBar: '.bar', + remove: '.jFiler-item-trash-action' + } + }, + files: null, + uploadFile: null, + dragDrop: null, + addMore: false, + allowDuplicates: false, + clipBoardPaste: true, + excludeName: null, + beforeRender: null, + afterRender: null, + beforeShow: null, + beforeSelect: null, + onSelect: null, + onFileCheck: null, + afterShow: null, + onRemove: null, + onEmpty: null, + options: null, + dialogs: { + alert: function(text) { + return alert(text); + }, + confirm: function(text, callback) { + confirm(text) ? callback() : null; + } + }, + captions: { + button: "Choose Files", + feedback: "Choose files To Upload", + feedback2: "files were chosen", + drop: "Drop file here to Upload", + removeConfirmation: "Are you sure you want to remove this file?", + errors: { + filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.", + filesType: "Only Images are allowed to be uploaded.", + filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-fileMaxSize}} MB.", + filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB.", + folderUpload: "You are not allowed to upload folders." + } + } + } +})(jQuery); diff --git a/static/jQuery-filer/js/jquery.filer.min.js b/static/jQuery-filer/js/jquery.filer.min.js new file mode 100755 index 00000000..3054c6b6 --- /dev/null +++ b/static/jQuery-filer/js/jquery.filer.min.js @@ -0,0 +1,8 @@ +/*! + * jQuery.filer minified + * Copyright (c) 2016 CreativeDream + * Website: https://github.com/CreativeDream/jquery.filer + * Version: 1.3 (14-Sep-2016) + * Requires: jQuery v1.7.1 or later + */ +!function(a){"use strict";a.fn.filer=function(b){return this.each(function(c,d){var e=a(d),f=".jFiler",g=a(),h=a(),i=a(),j=[],k=a.isFunction(b)?b(e,a.fn.filer.defaults):b,l=k&&a.isPlainObject(k)?a.extend(!0,{},a.fn.filer.defaults,k):a.fn.filer.defaults,m={init:function(){e.wrap('
    '),m._set("props"),e.prop("jFiler").boxEl=g=e.closest(f),m._changeInput()},_bindInput:function(){l.changeInput&&h.length>0&&h.on("click",m._clickHandler),e.on({focus:function(){h.addClass("focused")},blur:function(){h.removeClass("focused")},change:m._onChange}),l.dragDrop&&(l.dragDrop.dragContainer.on("drag dragstart dragend dragover dragenter dragleave drop",function(a){a.preventDefault(),a.stopPropagation()}),l.dragDrop.dragContainer.on("drop",m._dragDrop.drop),l.dragDrop.dragContainer.on("dragover",m._dragDrop.dragEnter),l.dragDrop.dragContainer.on("dragleave",m._dragDrop.dragLeave)),l.uploadFile&&l.clipBoardPaste&&a(window).on("paste",m._clipboardPaste)},_unbindInput:function(b){l.changeInput&&h.length>0&&h.off("click",m._clickHandler),b&&(e.off("change",m._onChange),l.dragDrop&&(l.dragDrop.dragContainer.off("drop",m._dragDrop.drop),l.dragDrop.dragContainer.off("dragover",m._dragDrop.dragEnter),l.dragDrop.dragContainer.off("dragleave",m._dragDrop.dragLeave)),l.uploadFile&&l.clipBoardPaste&&a(window).off("paste",m._clipboardPaste))},_clickHandler:function(){if(!l.uploadFile&&l.addMore&&0!=e.val().length){m._unbindInput(!0);var b=a(''),c=e.prop("attributes");a.each(c,function(){"required"!=this.name&&b.attr(this.name,this.value)}),e.after(b),j.push(b),e=b,m._bindInput(),m._set("props")}e.click()},_applyAttrSettings:function(){var a=["name","limit","maxSize","fileMaxSize","extensions","changeInput","showThumbs","appendTo","theme","addMore","excludeName","files","uploadUrl","uploadData","options"];for(var b in a){var c="data-jfiler-"+a[b];if(m._assets.hasAttr(c)){switch(a[b]){case"changeInput":case"showThumbs":case"addMore":l[a[b]]=["true","false"].indexOf(e.attr(c))>-1?"true"==e.attr(c):e.attr(c);break;case"extensions":l[a[b]]=e.attr(c).replace(/ /g,"").split(",");break;case"uploadUrl":l.uploadFile&&(l.uploadFile.url=e.attr(c));break;case"uploadData":l.uploadFile&&(l.uploadFile.data=JSON.parse(e.attr(c)));break;case"files":case"options":l[a[b]]=JSON.parse(e.attr(c));break;default:l[a[b]]=e.attr(c)}e.removeAttr(c)}}},_changeInput:function(){if(m._applyAttrSettings(),null!=l.beforeRender&&"function"==typeof l.beforeRender?l.beforeRender(g,e):null,l.theme&&g.addClass("jFiler-theme-"+l.theme),"input"!=e.get(0).tagName.toLowerCase()&&"file"!=e.get(0).type)h=e,e=a(''),e.css({position:"absolute",left:"-9999px",top:"-9999px","z-index":"-9999"}),g.prepend(e),m._isGn=e;else if(l.changeInput){switch(typeof l.changeInput){case"boolean":h=a('
    '+l.captions.feedback+'
    '+l.captions.button+'
    "');break;case"string":case"object":h=a(l.changeInput);break;case"function":h=a(l.changeInput(g,e,l))}e.after(h),e.css({position:"absolute",left:"-9999px",top:"-9999px","z-index":"-9999"})}e.prop("jFiler").newInputEl=h,l.dragDrop&&(l.dragDrop.dragContainer=l.dragDrop.dragContainer?a(l.dragDrop.dragContainer):h),(!l.limit||l.limit&&l.limit>=2)&&(e.attr("multiple","multiple"),"[]"!=e.attr("name").slice(-2)?e.attr("name",e.attr("name")+"[]"):null),e.attr("disabled")||l.disabled?(l.disabled=!0,m._unbindInput(!0),g.addClass("jFiler-disabled")):(l.disabled=!1,m._bindInput(),g.removeClass("jFiler-disabled")),l.files&&m._append(!1,{files:l.files}),null!=l.afterRender&&"function"==typeof l.afterRender?l.afterRender(i,g,h,e):null},_clear:function(){m.files=null,e.prop("jFiler").files=null,l.uploadFile||l.addMore||m._reset(),m._set("feedback",m._itFl&&m._itFl.length>0?m._itFl.length+" "+l.captions.feedback2:l.captions.feedback),null!=l.onEmpty&&"function"==typeof l.onEmpty?l.onEmpty(g,h,e):null},_reset:function(b){if(!b){if(!l.uploadFile&&l.addMore){for(var c=0;c0&&h.find(".jFiler-input-caption span").html(b);break;case"props":e.prop("jFiler")||e.prop("jFiler",{options:l,listEl:i,boxEl:g,newInputEl:h,inputEl:e,files:m.files,files_list:m._itFl,current_file:m._itFc,append:function(a){return m._append(!1,{files:[a]})},enable:function(){l.disabled&&(l.disabled=!1,e.removeAttr("disabled"),g.removeClass("jFiler-disabled"),m._bindInput())},disable:function(){l.disabled||(l.disabled=!0,g.addClass("jFiler-disabled"),m._unbindInput(!0))},remove:function(a){return m._remove(null,{binded:!0,data:{id:a}}),!0},reset:function(){return m._reset(),m._clear(),!0},retry:function(a){return m._retryUpload(a)}})}},_filesCheck:function(){var b=0;if(l.limit&&m.files.length+m._itFl.length>l.limit)return l.dialogs.alert(m._assets.textParse(l.captions.errors.filesLimit)),!1;for(var c=0;c1048576*l.maxSize||null!=l.fileMaxSize&&m.files[c].size>1048576*l.fileMaxSize)return l.dialogs.alert(m._assets.textParse(l.captions.errors.filesSize,f)),!1;if(4096==d.size&&0==d.type.length)return l.dialogs.alert(m._assets.textParse(l.captions.errors.folderUpload,f)),!1;if(null!=l.onFileCheck&&"function"==typeof l.onFileCheck?l.onFileCheck(f,l,m._assets.textParse)===!1:null)return!1;if((l.uploadFile||l.addMore)&&!l.allowDuplicates){var f=m._itFl.filter(function(a,b){if(a.file.name==d.name&&a.file.size==d.size&&a.file.type==d.type&&(!d.lastModified||a.file.lastModified==d.lastModified))return!0});if(f.length>0){if(1==m.files.length)return!1;d._pendRemove=!0}}b+=m.files[c].size}return!(null!=l.maxSize&&b>=Math.round(1048576*l.maxSize))||(l.dialogs.alert(m._assets.textParse(l.captions.errors.filesSizeAll)),!1)},_thumbCreator:{create:function(b){var c=m.files[b],d=m._itFc?m._itFc.id:b,e=c.name,f=c.size,g=c.file,h=c.type?c.type.split("/",1):"".toString().toLowerCase(),j=e.indexOf(".")!=-1?e.split(".").pop().toLowerCase():"",k=l.uploadFile?'
    '+l.templates.progressBar+"
    ":"",n={id:d,name:e,size:f,size2:m._assets.bytesToSize(f),url:g,type:h,extension:j,icon:m._assets.getIcon(j,h),icon2:m._thumbCreator.generateIcon({type:h,extension:j}),image:'
    ',progressBar:k,_appended:c._appended},o="";return c.opts&&(n=a.extend({},c.opts,n)),o=a(m._thumbCreator.renderContent(n)).attr("data-jfiler-index",d),o.get(0).jfiler_id=d,m._thumbCreator.renderFile(c,o,n),c.forList?o:(m._itFc.html=o,o.hide()[l.templates.itemAppendToEnd?"appendTo":"prependTo"](i.find(l.templates._selectors.list)).show(),void(c._appended||m._onSelect(b)))},renderContent:function(a){return m._assets.textParse(a._appended?l.templates.itemAppend:l.templates.item,a)},renderFile:function(b,c,d){if(0==c.find(".jFiler-item-thumb-image").length)return!1;if(b.file&&"image"==d.type){var e='',f=c.find(".jFiler-item-thumb-image.fi-loading");return a(e).error(function(){e=m._thumbCreator.generateIcon(d),c.addClass("jFiler-no-thumbnail"),f.removeClass("fi-loading").html(e)}).load(function(){f.removeClass("fi-loading").html(e)}),!0}if(window.File&&window.FileList&&window.FileReader&&"image"==d.type&&d.size<1e7){var g=new FileReader;g.onload=function(a){var b=c.find(".jFiler-item-thumb-image.fi-loading");if(l.templates.canvasImage){var e=document.createElement("canvas"),f=e.getContext("2d"),g=new Image;g.onload=function(){var a=b.height(),c=b.width(),d=g.height/a,h=g.width/c,i=de.width?-(g.width-e.width)/2:0,n=g.heighte.width?k-e.width:0,0,.5*o.width,.5*o.height,0,0,k,j)}b.removeClass("fi-loading").html('')},g.onerror=function(){c.addClass("jFiler-no-thumbnail"),b.removeClass("fi-loading").html(m._thumbCreator.generateIcon(d))},g.src=a.target.result}else b.removeClass("fi-loading").html('')},g.readAsDataURL(b)}else{var e=m._thumbCreator.generateIcon(d),f=c.find(".jFiler-item-thumb-image.fi-loading");c.addClass("jFiler-no-thumbnail"),f.removeClass("fi-loading").html(e)}},generateIcon:function(b){var c=new Array(3);if(b&&b.type&&b.type[0]&&b.extension)switch(b.type[0]){case"image":c[0]="f-image",c[1]='';break;case"video":c[0]="f-video",c[1]='';break;case"audio":c[0]="f-audio",c[1]='';break;default:c[0]="f-file f-file-ext-"+b.extension,c[1]=b.extension.length>0?"."+b.extension:"",c[2]=1}else c[0]="f-file",c[1]=b.extension&&b.extension.length>0?"."+b.extension:"",c[2]=1;var d=''+c[1]+"";if(1==c[2]){var e=m._assets.text2Color(b.extension);if(e){var f=a(d).appendTo("body");f.css("background-color",m._assets.text2Color(b.extension)),d=f.prop("outerHTML"),f.remove()}}return d},_box:function(b){if(null!=l.beforeShow&&"function"==typeof l.beforeShow&&!l.beforeShow(m.files,i,g,h,e))return!1;if(i.length<1){if(l.appendTo)var c=a(l.appendTo);else var c=g;c.find(".jFiler-items").remove(),i=a('
    '),e.prop("jFiler").listEl=i,i.append(m._assets.textParse(l.templates.box)).appendTo(c),i.on("click",l.templates._selectors.remove,function(c){c.preventDefault();var d=[b?b.remove.event:c,b?b.remove.el:a(this).closest(l.templates._selectors.item)],e=function(a){m._remove(d[0],d[1])};l.templates.removeConfirmation?l.dialogs.confirm(l.captions.removeConfirmation,e):e()})}for(var d=0;d=m.files.length&&(m._ajFc=0,e.get(0).value="",null!=l.uploadFile.onComplete&&"function"==typeof l.uploadFile.onComplete?l.uploadFile.onComplete(i,g,h,e,a,b):null)},beforeSend:function(a,c){return null==l.uploadFile.beforeSend||"function"!=typeof l.uploadFile.beforeSend||l.uploadFile.beforeSend(b,i,g,h,e,d.id,a,c)},success:function(a,c,f){d.uploaded=!0,null!=l.uploadFile.success&&"function"==typeof l.uploadFile.success?l.uploadFile.success(a,b,i,g,h,e,d.id,c,f):null},error:function(a,c,f){d.uploaded=!1,null!=l.uploadFile.error&&"function"==typeof l.uploadFile.error?l.uploadFile.error(b,i,g,h,e,d.id,a,c,f):null},statusCode:l.uploadFile.statusCode,cache:!1,contentType:!1,processData:!1}),d.ajax},progressHandling:function(a,b){if(a.lengthComputable){var c=Math.round(100*a.loaded/a.total).toString();null!=l.uploadFile.onProgress&&"function"==typeof l.uploadFile.onProgress?l.uploadFile.onProgress(c,b,i,g,h,e):null,b.find(".jFiler-jProgressBar").find(l.templates._selectors.progressBar).css("width",c+"%")}}},_dragDrop:{dragEnter:function(a){clearTimeout(m._dragDrop._drt),l.dragDrop.dragContainer.addClass("dragged"),m._set("feedback",l.captions.drop),null!=l.dragDrop.dragEnter&&"function"==typeof l.dragDrop.dragEnter?l.dragDrop.dragEnter(a,h,e,g):null},dragLeave:function(a){clearTimeout(m._dragDrop._drt),m._dragDrop._drt=setTimeout(function(a){return m._dragDrop._dragLeaveCheck(a)?(l.dragDrop.dragContainer.removeClass("dragged"),m._set("feedback",l.captions.feedback),void(null!=l.dragDrop.dragLeave&&"function"==typeof l.dragDrop.dragLeave?l.dragDrop.dragLeave(a,h,e,g):null)):(m._dragDrop.dragLeave(a),!1)},100,a)},drop:function(a){clearTimeout(m._dragDrop._drt),l.dragDrop.dragContainer.removeClass("dragged"),m._set("feedback",l.captions.feedback),a&&a.originalEvent&&a.originalEvent.dataTransfer&&a.originalEvent.dataTransfer.files&&a.originalEvent.dataTransfer.files.length>0&&m._onChange(a,a.originalEvent.dataTransfer.files),null!=l.dragDrop.drop&&"function"==typeof l.dragDrop.drop?l.dragDrop.drop(a.originalEvent.dataTransfer.files,a,h,e,g):null},_dragLeaveCheck:function(b){var c=a(b.currentTarget),d=0;return!(!c.is(h)&&(d=h.find(c).length,d>0))}},_clipboardPaste:function(a,b){if((b||a.originalEvent.clipboardData||a.originalEvent.clipboardData.items)&&(!b||a.originalEvent.dataTransfer||a.originalEvent.dataTransfer.items)&&!m._clPsePre){var c=b?a.originalEvent.dataTransfer.items:a.originalEvent.clipboardData.items,d=function(a,b,c){b=b||"",c=c||512;for(var d=atob(a),e=[],f=0;f=m.files.length&&(null!=l.afterShow&&"function"==typeof l.afterShow?l.afterShow(i,g,h,e):null)},_onChange:function(b,c){if(c){if(!c||0==c.length)return m._set("input",""),m._clear(),!1;m.files=c}else{if(!e.get(0).files||"undefined"==typeof e.get(0).files||0==e.get(0).files.length)return l.uploadFile||l.addMore||(m._set("input",""),m._clear()),!1;m.files=e.get(0).files}if(l.uploadFile||l.addMore||m._reset(!0),e.prop("jFiler").files=m.files,!m._filesCheck()||null!=l.beforeSelect&&"function"==typeof l.beforeSelect&&!l.beforeSelect(m.files,i,g,h,e))return m._set("input",""),m._clear(),l.addMore&&j.length>0&&(m._unbindInput(!0),j[j.length-1].remove(),j.splice(j.length-1,1),e=j.length>0?j[j.length-1]:a(d),m._bindInput()),!1;if(m._set("feedback",m.files.length+m._itFl.length+" "+l.captions.feedback2),l.showThumbs)m._thumbCreator._box();else for(var f=0;f0&&(!l.uploadFile||a.isEmptyObject(l.uploadFile)||f[0].uploaded?void 0:(m._itFc=f[0],e.prop("jFiler").current_file=m._itFc,m._upload(d),!0))},_remove:function(b,d){if(d.binded){if("undefined"!=typeof d.data.id&&(d=i.find(l.templates._selectors.item+"[data-jfiler-index='"+d.data.id+"']"),0==d.length))return!1;d.data.el&&(d=d.data.el)}var f=function(b){var d=g.find("input[name^='jfiler-items-exclude-']:hidden").first();0==d.length&&(d=a(''),d.appendTo(g)),b&&a.isArray(b)&&(b=JSON.stringify(b),d.val(b))},j=function(b,c){var d=m._itFl[c],e=[];if(d.file._choosed||d.file._appended||d.uploaded){m._itFr.push(d);for(var g=m._itFl.filter(function(a){return a.file.name==d.file.name}),h=0;h0&&(m._itFr[h].remove_name=g.indexOf(d)+"://"+m._itFr[h].file.name),e.push(m._itFr[h].remove_name?m._itFr[h].remove_name:m._itFr[h].file.name)}f(e),m._itFl.splice(c,1),m._itFl.length<1?(m._reset(),m._clear()):m._set("feedback",m._itFl.length+" "+l.captions.feedback2),b.fadeOut("fast",function(){a(this).remove()})},k=d.get(0).jfiler_id||d.attr("data-jfiler-index"),n=null;for(var o in m._itFl)"length"!==o&&m._itFl.hasOwnProperty(o)&&m._itFl[o].id==k&&(n=o);return!!m._itFl.hasOwnProperty(n)&&(m._itFl[n].ajax?(m._itFl[n].ajax.abort(),void j(d,n)):void(null!=l.onRemove&&"function"==typeof l.onRemove&&l.onRemove(d,m._itFl[n].file,n,i,g,h,e)===!1||j(d,n)))},_addToMemory:function(b){m._itFl.push({id:m._itFl.length,file:m.files[b],html:a(),ajax:!1,uploaded:!1}),(l.addMore||m.files[b]._appended)&&(m._itFl[m._itFl.length-1].input=e),m._itFc=m._itFl[m._itFl.length-1],e.prop("jFiler").files_list=m._itFl,e.prop("jFiler").current_file=m._itFc},_assets:{bytesToSize:function(a){if(0==a)return"0 Byte";var b=1e3,c=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],d=Math.floor(Math.log(a)/Math.log(b));return(a/Math.pow(b,d)).toPrecision(3)+" "+c[d]},hasAttr:function(a,b){var b=b?b:e,c=b.attr(a);return!(!c||"undefined"==typeof c)},getIcon:function(b,c){var d=["audio","image","text","video"];return a.inArray(c,d)>-1?'':''},textParse:function(b,c){switch(c=a.extend({},{limit:l.limit,maxSize:l.maxSize,fileMaxSize:l.fileMaxSize,extensions:l.extensions?l.extensions.join(","):null},c&&a.isPlainObject(c)?c:{},l.options),typeof b){case"string":return b.replace(/\{\{fi-(.*?)\}\}/g,function(a,b){return b=b.replace(/ /g,""),b.match(/(.*?)\|limitTo\:(\d+)/)?b.replace(/(.*?)\|limitTo\:(\d+)/,function(a,b,d){var b=c[b]?c[b]:"",e=b.substring(0,d);return e=b.length>e.length?e.substring(0,e.length-3)+"...":e}):c[b]?c[b]:""});case"function":return b(c);default:return b}},text2Color:function(a){if(!a||0==a.length)return!1;for(var b=0,c=0;b>2*b++&255).toString(16)).slice(-2));return d}},files:null,_itFl:[],_itFc:null,_itFr:[],_itPl:[],_ajFc:0};return e.on("filer.append",function(a,b){m._append(a,b)}).on("filer.remove",function(a,b){b.binded=!0,m._remove(a,b)}).on("filer.reset",function(a){return m._reset(),m._clear(),!0}).on("filer.generateList",function(a,b){return m._getList(a,b)}).on("filer.retry",function(a,b){return m._retryUpload(a,b)}),m.init(),this})},a.fn.filer.defaults={limit:null,maxSize:null,fileMaxSize:null,extensions:null,changeInput:!0,showThumbs:!1,appendTo:null,theme:"default",templates:{box:'
      ',item:'
    • {{fi-icon}}
      {{fi-name | limitTo:30}}
      size: {{fi-size2}}type: {{fi-extension}}{{fi-progressBar}}
    • ',itemAppend:'
    • {{fi-icon}}
      {{fi-name | limitTo:35}}
      size: {{fi-size2}}type: {{fi-extension}}
    • ',progressBar:'
      ',itemAppendToEnd:!1,removeConfirmation:!0,canvasImage:!0,_selectors:{list:".jFiler-items-list",item:".jFiler-item",progressBar:".bar",remove:".jFiler-item-trash-action"}},files:null,uploadFile:null,dragDrop:null,addMore:!1,allowDuplicates:!1,clipBoardPaste:!0,excludeName:null,beforeRender:null,afterRender:null,beforeShow:null,beforeSelect:null,onSelect:null,onFileCheck:null,afterShow:null,onRemove:null,onEmpty:null,options:null,dialogs:{alert:function(a){return alert(a)},confirm:function(a,b){confirm(a)?b():null}},captions:{button:"Choose Files",feedback:"Choose files To Upload",feedback2:"files were chosen",drop:"Drop file here to Upload",removeConfirmation:"Are you sure you want to remove this file?",errors:{filesLimit:"Only {{fi-limit}} files are allowed to be uploaded.",filesType:"Only Images are allowed to be uploaded.",filesSize:"{{fi-name}} is too large! Please upload file up to {{fi-fileMaxSize}} MB.",filesSizeAll:"Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB.",folderUpload:"You are not allowed to upload folders."}}}}(jQuery); \ No newline at end of file diff --git a/templates/c_admin/forms/multilang.html b/templates/c_admin/forms/multilang.html index ced00c1d..34e256bc 100644 --- a/templates/c_admin/forms/multilang.html +++ b/templates/c_admin/forms/multilang.html @@ -1,4 +1,3 @@ -{% load widget_tweaks %} {% comment %} Usage: used for creating multilanguage tabs @@ -38,7 +37,7 @@ {% endif %} {# if field required label - bold #}
      - {% if f.field.required %}{{ f|attr:"required" }}{% else %}{{ f }}{% endif %} {# style for making content border #} + {{ f }} {{f.errors}}
      {% endifequal %} diff --git a/templates/c_admin/includes/photogallery.html b/templates/c_admin/includes/photogallery.html index bf8627ff..3e1d3fa3 100644 --- a/templates/c_admin/includes/photogallery.html +++ b/templates/c_admin/includes/photogallery.html @@ -1,34 +1,82 @@ +{% load static %}

      Фотогалерея

      +
      - {% if object %} - Фото - Просмотреть галерею

      - {% else %} -

      Фото можна добавлять только после введения основных даных

      - {% endif %} + {% if object %} + Фото + Просмотреть галерею

      + {% else %} +

      Фото можна добавлять только после введения основных даных

      + {% endif %} {% with photos=object.photogallery.photos.all %} - {% for photo in photos %} +
      + {% for photo in photos %} -
      - -
      - - {{ photo.title }} - -
      +
      + +
      + + {{ photo.title }} + +
      +
      + {% endfor %} +
      + {% endwith %} +{#
      #} +{# {% csrf_token %}#} +{#
      #} +{# #} +{#
      #} +{# {{ form.image }}#} +{# {{ form.image.errors }}#} +{#
      #} +{#
      #} -
      - {% endfor %} - {% endwith %} +{#
      #} +{# #} +{#
      {{ form.sort }}#} +{# {{ form.sort.errors }}#} +{#
      #} +{#
      #} + +{# {% with field='caption' form=form languages=languages %}#} +{# {% include 'c_admin/forms/multilang.html' %}#} +{# {% endwith %}#} +{##} +{# {% with field='title' form=form languages=languages %}#} +{# {% include 'c_admin/forms/multilang.html' %}#} +{# {% endwith %}#} +{##} +{#
      #} +{# #} +{#
      #} +{# #} + + + + + + +
      \ No newline at end of file