From 970685936cdd7b70e3efa2f2506f66198049b16d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Thu, 10 Sep 2009 16:56:48 +0200 Subject: [PATCH] * Plugin jQuery.modal * UI do wycinania kawalkow tekstu z edytora XML jako oddzielne utwory. refs #98. * zmiana formularza "Merge" refs #96. --- apps/explorer/forms.py | 6 + apps/explorer/views.py | 39 ++- project/static/css/jquery.modal.css | 28 ++ project/static/css/master.css | 21 +- project/static/js/editor.js | 228 ++++---------- project/static/js/editor.ui.js | 297 ++++++++++++++++++ project/static/js/jquery.modal.js | 69 ++++ project/templates/explorer/editor.html | 37 ++- .../templates/explorer/panels/dceditor.html | 4 +- project/templates/explorer/split.html | 27 ++ project/templates/explorer/split_success.html | 3 + project/urls.py | 4 + 12 files changed, 589 insertions(+), 174 deletions(-) create mode 100755 project/static/css/jquery.modal.css create mode 100755 project/static/js/editor.ui.js create mode 100755 project/static/js/jquery.modal.js create mode 100755 project/templates/explorer/split.html create mode 100755 project/templates/explorer/split_success.html diff --git a/apps/explorer/forms.py b/apps/explorer/forms.py index e453f1fd..9541cb02 100644 --- a/apps/explorer/forms.py +++ b/apps/explorer/forms.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from django import forms from lxml import etree @@ -71,6 +72,11 @@ class ImageFoldersForm(forms.Form): super(ImageFoldersForm, self).__init__(*args, **kwargs) self.fields['folders'].choices = [('', '-- Wybierz folder z obrazkami --')] + [(fn, fn) for fn in models.get_image_folders()] +class SplitForm(forms.Form): + partname = forms.RegexField(regex='[0-9\w-]+', \ + label='Part name', help_text='Example: rozdział-2') + autoxml = forms.BooleanField(required=False, initial=False, label=u"Generate DublinCore") + class DublinCoreForm(forms.Form): about = forms.URLField(verify_exists=False) author = PersonField() diff --git a/apps/explorer/views.py b/apps/explorer/views.py index 7f99b662..2930d989 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -424,7 +424,9 @@ class panel_view(object): 'fileid': path, 'exception_type': type(e).__name__, 'exception': e, 'panel_name': panel.display_name}) - +## +## Editor "commands" and "dialogs" +## @login_required @with_repo def print_html(request, path, repo): @@ -439,6 +441,41 @@ def print_xml(request, path, repo): user_branch = file_branch(path, request.user) return HttpResponse( repo.get_file(path, user_branch), mimetype="text/plain; charset=utf-8") +@login_required # WARNING: we don't wont a login form inside a window +@with_repo +def split_text(request, path, repo): + user_branch = file_branch(path, request.user) + valid = False + + if request.method == "POST": + sform = forms.SplitForm(request.POST, prefix='splitform') + dcform = forms.SplitForm(request.POST, prefix='dcform') + + print "validating sform" + if sform.is_valid(): + valid = True + if sform.cleaned_data['autoxml']: + print "validating dcform" + valid = dcform.is_valid() + + print "valid is ", valid + if valid: + uri = path + '$' + sform.cleaned_data['partname'] + # do something + return HttpResponseRedirect( reverse('split-success',\ + kwargs={'path': path})+'?child='+uri) + else: + sform = forms.SplitForm(prefix='splitform') + dcform = forms.DublinCoreForm(prefix='dcform') + + return direct_to_template(request, 'explorer/split.html', extra_context={ + 'splitform': sform, 'dcform': dcform, 'fileid': path} ) + +def split_success(request, path): + return direct_to_template(request, 'explorer/split_success.html',\ + extra_context={'fileid': path, 'cfileid': request.GET['child']} ) + + # ================= # = Utility views = # ================= diff --git a/project/static/css/jquery.modal.css b/project/static/css/jquery.modal.css new file mode 100755 index 00000000..4717ad45 --- /dev/null +++ b/project/static/css/jquery.modal.css @@ -0,0 +1,28 @@ +/* jqModal base Styling courtesy of; + Brice Burgess */ + +/* The Window's CSS z-index value is respected (takes priority). If none is supplied, + the Window's z-index value will be set to 3000 by default (via jqModal.js). */ + +.jqmWindow { + display: none; + + position: absolute; + top: 40px; + left: 25%; + bottom: auto; + height: auto; + width: auto; + + max-width: 80%; + max-height: 80%; + + overflow: auto; + + background-color: #EEE; + color: #333; + border: 1px solid black; + padding: 1em; +} + +.jqmOverlay { background-color: #000; } diff --git a/project/static/css/master.css b/project/static/css/master.css index 33a9f684..de799891 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -190,7 +190,6 @@ label { height: 26px; } - .panel-toolbar .toolbar-button-groups-container .panel-toolbar-extra button { /* this is uber specific */ font-size: 12px; @@ -323,3 +322,23 @@ div.isection p { background-color: yellow; border-color: yellow; } + +/* Commit dialog */ +#commit-dialog-error-empty-message { + color: red; + display: none; + font-weight: bold; +} + +text#commit-dialog-message { + width: 80%; + margin: auto; +} + +#split-dialog .container-box form { + margin: 0.2em 1em; +} + +#split-dialog .container-box fieldset { + margin: 0.5em; +} \ No newline at end of file diff --git a/project/static/js/editor.js b/project/static/js/editor.js index ac34ac5a..36dfcf27 100644 --- a/project/static/js/editor.js +++ b/project/static/js/editor.js @@ -6,7 +6,6 @@ function Hotkey(code) { this.character = String.fromCharCode(code & 0xff) } - Hotkey.prototype.toString = function() { mods = [] if(this.has_alt) mods.push('Alt') @@ -22,7 +21,7 @@ function Panel(panelWrap) { self.wrap = panelWrap; self.contentDiv = $('.panel-content', panelWrap); self.instanceId = Math.ceil(Math.random() * 1000000000); - $.log('new panel - wrap: ', self.wrap); + // $.log('new panel - wrap: ', self.wrap); $(document).bind('panel:unload.' + self.instanceId, function(event, data) { @@ -46,7 +45,7 @@ Panel.prototype.callHook = function() { var noHookAction = args.splice(0,1)[0] var result = false; - $.log('calling hook: ', hookName, 'with args: ', args); + // $.log('calling hook: ', hookName, 'with args: ', args); if(this.hooks && this.hooks[hookName]) result = this.hooks[hookName].apply(this, args); else if (noHookAction instanceof Function) @@ -55,7 +54,7 @@ Panel.prototype.callHook = function() { } Panel.prototype.load = function (url) { - $.log('preparing xhr load: ', this.wrap); + // $.log('preparing xhr load: ', this.wrap); $(document).trigger('panel:unload', this); var self = this; self.current_url = url; @@ -80,10 +79,8 @@ Panel.prototype.load = function (url) { } Panel.prototype.unload = function(event, data) { - $.log('got unload signal', this, ' target: ', data); - - if( data == this ) { - $.log('unloading', this); + // $.log('got unload signal', this, ' target: ', data); + if( data == this ) { $(this.contentDiv).html(''); // disconnect the toolbar @@ -108,7 +105,7 @@ Panel.prototype.refresh = function(event, data) { } Panel.prototype.otherPanelChanged = function(other) { - $.log('panel ', other, ' changed.'); + $.log('Panel ', this, ' is aware that ', other, ' changed.'); if(!this.callHook('dirty')) $('.change-notification', this.wrap).fadeIn(); } @@ -138,7 +135,7 @@ Panel.prototype.connectToolbar = function() // check if there is a one var toolbar = $("div.toolbar", this.contentDiv); - $.log('Connecting toolbar', toolbar); + // $.log('Connecting toolbar', toolbar); if(toolbar.length == 0) return; // move the extra @@ -188,9 +185,9 @@ Panel.prototype.connectToolbar = function() try { var params = $.evalJSON(button.attr('ui:action-params')); } catch(object) { - $.log('JSON exception in ', button, ': ', object); - button.attr('disabled', 'disabled'); - return; + $.log('JSON exception in ', button, ': ', object); + button.attr('disabled', 'disabled'); + return; } var callback = function() { @@ -203,7 +200,7 @@ Panel.prototype.connectToolbar = function() // connect hotkey if(hk) { self.hotkeys[hk.code] = callback; - $.log('hotkey', hk); + // $.log('hotkey', hk); } // tooltip @@ -263,60 +260,6 @@ function Editor() this.scriplets = {}; } -Editor.prototype.setupUI = function() { - // set up the UI visually and attach callbacks - var self = this; - - self.rootDiv.makeHorizPanel({}); // TODO: this probably doesn't belong into jQuery - // self.rootDiv.css('top', ($('#header').outerHeight() ) + 'px'); - - $('#panels > *.panel-wrap').each(function() { - var panelWrap = $(this); - $.log('wrap: ', panelWrap); - var panel = new Panel(panelWrap); - panelWrap.data('ctrl', panel); // attach controllers to wraps - panel.load($('.panel-toolbar select', panelWrap).val()); - - $('.panel-toolbar select', panelWrap).change(function() { - var url = $(this).val(); - panelWrap.data('ctrl').load(url); - self.savePanelOptions(); - }); - - $('.panel-toolbar button.refresh-button', panelWrap).click( - function() { - panel.refresh(); - } ); - }); - - $(document).bind('panel:contentChanged', function() { - self.onContentChanged.apply(self, arguments) - }); - - $('#toolbar-button-save').click( function (event, data) { - self.saveToBranch(); - } ); - - $('#toolbar-button-update').click( function (event, data) { - if (self.updateUserBranch()) { - // commit/update can be called only after proper, save - // this means all panels are clean, and will get refreshed - // do this only, when there are any changes to local branch - self.refreshPanels(); - } - } ); - - $('#toolbar-button-commit').click( function (event, data) { - self.sendPullRequest(); - event.preventDefault(); - event.stopPropagation(); - return false; - } ); - self.rootDiv.bind('stopResize', function() { - self.savePanelOptions() - }); -} - Editor.prototype.loadConfig = function() { // Load options from cookie var defaultOptions = { @@ -478,20 +421,6 @@ Editor.prototype.onContentChanged = function(event, data) { }, 300000 ); }; -Editor.prototype.refreshPanels = function() { - var self = this; - - self.allPanels().each(function() { - var panel = $(this).data('ctrl'); - $.log('Refreshing: ', this, panel); - if ( panel.changed() ) - panel.unmarkChanged(); - else - panel.refresh(); - }); -}; - - Editor.prototype.updateUserBranch = function() { if( $('.panel-wrap.changed').length != 0) alert("There are unsaved changes - can't update."); @@ -499,108 +428,81 @@ Editor.prototype.updateUserBranch = function() { var self = this; $.ajax({ url: $('#toolbar-button-update').attr('ui:ajax-action'), - dataType: 'json', - success: function(data, textStatus) { - switch(data.result) { - case 'done': - self.showPopup('generic-yes', 'Plik uaktualniony.'); - self.refreshPanels() - break; - case 'nothing-to-do': - self.showPopup('generic-info', 'Brak zmian do uaktualnienia.'); - break; - default: - self.showPopup('generic-error', data.errors && data.errors[0]); - } - }, - error: function(rq, tstat, err) { - self.showPopup('generic-error', 'Błąd serwera: ' + err); - }, - type: 'POST', - data: {} + dataType: 'json', + success: function(data, textStatus) { + switch(data.result) { + case 'done': + self.showPopup('generic-yes', 'Plik uaktualniony.'); + self.refreshPanels() + break; + case 'nothing-to-do': + self.showPopup('generic-info', 'Brak zmian do uaktualnienia.'); + break; + default: + self.showPopup('generic-error', data.errors && data.errors[0]); + } + }, + error: function(rq, tstat, err) { + self.showPopup('generic-error', 'Błąd serwera: ' + err); + }, + type: 'POST', + data: {} }); } -Editor.prototype.sendPullRequest = function () { +Editor.prototype.sendMergeRequest = function (message) { if( $('.panel-wrap.changed').length != 0) alert("There are unsaved changes - can't commit."); var self = this; - - /* this.showPopup('not-implemented'); */ - - $.log('URL !: ', $('#toolbar-commit-form').attr('action')); + $.log('URL !: ', $('#commit-dialog form').attr('action')); $.ajax({ - url: $('#toolbar-commit-form').attr('action'), - dataType: 'json', - success: function(data, textStatus) { - switch(data.result) { - case 'done': - self.showPopup('generic-yes', 'Łączenie zmian powiodło się.'); - - if(data.localmodified) - self.refreshPanels() + url: $('#commit-dialog form').attr('action'), + dataType: 'json', + success: function(data, textStatus) { + switch(data.result) { + case 'done': + self.showPopup('generic-yes', 'Łączenie zmian powiodło się.'); + + if(data.localmodified) + self.refreshPanels() - break; - case 'nothing-to-do': - self.showPopup('generic-info', 'Brak zmian do połaczenia.'); - break; - default: - self.showPopup('generic-error', data.errors && data.errors[0]); - } - }, - error: function(rq, tstat, err) { - self.showPopup('generic-error', 'Błąd serwera: ' + err); - }, - type: 'POST', - data: {'message': $('#toolbar-commit-message').val() } + break; + case 'nothing-to-do': + self.showPopup('generic-info', 'Brak zmian do połaczenia.'); + break; + default: + self.showPopup('generic-error', data.errors && data.errors[0]); + } + }, + error: function(rq, tstat, err) { + self.showPopup('generic-error', 'Błąd serwera: ' + err); + }, + type: 'POST', + data: { + 'message': message + } }); } -Editor.prototype.showPopup = function(name, text, timeout) +Editor.prototype.postSplitRequest = function(s, f) { - timeout = timeout || 4000; - var self = this; - self.popupQueue.push( [name, text, timeout] ) - - if( self.popupQueue.length > 1) - return; - - var box = $('#message-box > #' + name); - $('*.data', box).html(text || ''); - box.fadeIn(100); - - if(timeout > 0) - setTimeout( $.fbind(self, self.advancePopupQueue), timeout); + $.ajax({ + url: $('#split-dialog form').attr('action'), + dataType: 'html', + success: s, + error: f, + type: 'POST', + data: $('#split-dialog form').serialize() + }); }; -Editor.prototype.advancePopupQueue = function() { - var self = this; - var elem = this.popupQueue.shift(); - if(elem) { - var box = $('#message-box > #' + elem[0]); - - box.fadeOut(100, function() - { - $('*.data', box).html(''); - - if( self.popupQueue.length > 0) { - var ibox = $('#message-box > #' + self.popupQueue[0][0]); - $('*.data', ibox).html(self.popupQueue[0][1] || ''); - ibox.fadeIn(100); - if(self.popupQueue[0][2] > 0) - setTimeout( $.fbind(self, self.advancePopupQueue), self.popupQueue[0][2]); - } - }); - } -}; Editor.prototype.allPanels = function() { return $('#' + this.rootDiv.attr('id') +' > *.panel-wrap', this.rootDiv.parent()); } - Editor.prototype.registerScriptlet = function(scriptlet_id, scriptlet_func) { // I briefly assume, that it's verified not to break the world on SS diff --git a/project/static/js/editor.ui.js b/project/static/js/editor.ui.js new file mode 100755 index 00000000..b27daace --- /dev/null +++ b/project/static/js/editor.ui.js @@ -0,0 +1,297 @@ +/* + * UI related Editor methods + */ +Editor.prototype.setupUI = function() { + // set up the UI visually and attach callbacks + var self = this; + + var resize_start = function(event, mydata) { + $(document).bind('mousemove', mydata, resize_changed). + bind('mouseup', mydata, resize_stop); + + $('.panel-overlay', mydata.root).css('display', 'block'); + return false; + } + var resize_changed = function(event) { + var old_width = parseInt(event.data.overlay.css('width')); + var delta = event.pageX + event.data.hotspot_x - old_width; + event.data.overlay.css({ + 'width': old_width + delta + }); + + if(event.data.overlay.next) { + var left = parseInt(event.data.overlay.next.css('left')); + event.data.overlay.next.css('left', left+delta); + } + + return false; + }; + + var resize_stop = function(event) { + $(document).unbind('mousemove', resize_changed).unbind('mouseup', resize_stop); + // $('.panel-content', event.data.root).css('display', 'block'); + var overlays = $('.panel-content-overlay', event.data.root); + $('.panel-content-overlay', event.data.root).each(function(i) { + if( $(this).data('panel').hasClass('last-panel') ) + $(this).data('panel').css({ + 'left': $(this).css('left'), + 'right': $(this).css('right') + }); + else + $(this).data('panel').css({ + 'left': $(this).css('left'), + 'width': $(this).css('width') + }); + }); + $('.panel-overlay', event.data.root).css('display', 'none'); + $(event.data.root).trigger('stopResize'); + }; + + /* + * Prepare panels (overlays & stuff) + */ + /* create an overlay */ + var panel_root = self.rootDiv; + var overlay_root = $("
"); + panel_root.append(overlay_root); + + var prev = null; + + $('*.panel-wrap', panel_root).each( function() + { + var panel = $(this); + var handle = $('.panel-slider', panel); + var overlay = $("
 
"); + overlay_root.append(overlay); + overlay.data('panel', panel); + overlay.data('next', null); + + if (prev) prev.next = overlay; + + if( panel.hasClass('last-panel') ) + { + overlay.css({ + 'left': panel.css('left'), + 'right': panel.css('right') + }); + } + else { + overlay.css({ + 'left': panel.css('left'), + 'width': panel.css('width') + }); + // $.log('Has handle: ' + panel.attr('id')); + overlay.append(handle.clone()); + /* attach the trigger */ + handle.mousedown(function(event) { + var touch_data = { + root: panel_root, + overlay: overlay, + hotspot_x: event.pageX - handle.position().left + }; + + $(this).trigger('hpanel:panel-resize-start', touch_data); + return false; + }); + $('.panel-content', panel).css('right', + (handle.outerWidth() || 10) + 'px'); + $('.panel-content-overlay', panel).css('right', + (handle.outerWidth() || 10) + 'px'); + }; + + prev = overlay; + }); + + panel_root.bind('hpanel:panel-resize-start', resize_start); + self.rootDiv.bind('stopResize', function() { + self.savePanelOptions() + }); + + /* + * Connect panel actions + */ + $('#panels > *.panel-wrap').each(function() { + var panelWrap = $(this); + // $.log('wrap: ', panelWrap); + var panel = new Panel(panelWrap); + panelWrap.data('ctrl', panel); // attach controllers to wraps + panel.load($('.panel-toolbar select', panelWrap).val()); + + $('.panel-toolbar select', panelWrap).change(function() { + var url = $(this).val(); + panelWrap.data('ctrl').load(url); + self.savePanelOptions(); + }); + + $('.panel-toolbar button.refresh-button', panelWrap).click( + function() { + panel.refresh(); + } ); + }); + + $(document).bind('panel:contentChanged', function() { + self.onContentChanged.apply(self, arguments) + }); + + /* + * Connect various buttons + */ + + $('#toolbar-button-save').click( function (event, data) { + self.saveToBranch(); + } ); + + $('#toolbar-button-update').click( function (event, data) { + if (self.updateUserBranch()) { + // commit/update can be called only after proper, save + // this means all panels are clean, and will get refreshed + // do this only, when there are any changes to local branch + self.refreshPanels(); + } + } ); + + /* COMMIT DIALOG */ + $('#commit-dialog'). + jqm({ + modal: true, + trigger: '#toolbar-button-commit' + }); + + $('#commit-dialog-cancel-button').click(function() { + $('#commit-dialog-error-empty-message').hide(); + $('#commit-dialog').jqmHide(); + }); + + $('#commit-dialog-save-button').click( function (event, data) + { + if( $('#commit-dialog-message').val().match(/^\s*$/)) { + $('#commit-dialog-error-empty-message').fadeIn(); + } + else { + $('#commit-dialog-error-empty-message').hide(); + $('#commit-dialog').jqmHide(); + self.sendMergeRequest($('#commit-dialog-message').val() ); + } + + return false; + }); + + /* SPLIT DIALOG */ + $('#split-dialog').jqm({ + modal: true, + onShow: $.fbind(self, self.loadSplitDialog) + }). + jqmAddClose('button.dialog-close-button'); + +// $('#split-dialog'). +} + +Editor.prototype.loadSplitDialog = function(hash) +{ + var self = this; + + $("div.loading-box", hash.w).show(); + $("div.fatal-error-box", hash.w).hide(); + $('div.container-box', hash.w).hide(); + hash.w.show(); + + function onFailure(rq, tstat, err) { + $('div.container-box', hash.w).html(''); + $("div.loading-box", hash.w).hide(); + $("div.fatal-error-box", hash.w).show(); + hash.t.failure(); + }; + + function onSuccess(data, status) { + // put the form into the window + $('div.container-box', hash.w).html(data); + $("div.loading-box", hash.w).hide(); + $('form input[name=splittext]', hash.w).val(hash.t.selection); + $('form input[name=fulltext]', hash.w).val(hash.t.fulltext); + $('div.container-box', hash.w).show(); + + // connect buttons + $('#split-dialog-button-accept').click(function() { + self.postSplitRequest(onSuccess, onFailure); + return false; + }); + + $('#split-dialog-button-close').click(function() { + hash.w.jqmHide(); + $('div.container-box', hash.w).html(''); + hash.t.failure(); + }); + + $('#split-dialog-button-dismiss').click(function() { + hash.w.jqmHide(); + $('div.container-box', hash.w).html(''); + }); + }; + + $.ajax({ + url: 'split', + dataType: 'html', + success: onSuccess, + error: onFailure, + type: 'GET', + data: {} + }); +} + +/* Refreshing routine */ +Editor.prototype.refreshPanels = function() { + var self = this; + + self.allPanels().each(function() { + var panel = $(this).data('ctrl'); + $.log('Refreshing: ', this, panel); + if ( panel.changed() ) + panel.unmarkChanged(); + else + panel.refresh(); + }); +}; + + +/* + * Pop-up messages + */ +Editor.prototype.showPopup = function(name, text, timeout) +{ + timeout = timeout || 4000; + var self = this; + self.popupQueue.push( [name, text, timeout] ) + + if( self.popupQueue.length > 1) + return; + + var box = $('#message-box > #' + name); + $('*.data', box).html(text || ''); + box.fadeIn(100); + + if(timeout > 0) + setTimeout( $.fbind(self, self.advancePopupQueue), timeout); +}; + +Editor.prototype.advancePopupQueue = function() { + var self = this; + var elem = this.popupQueue.shift(); + if(elem) { + var box = $('#message-box > #' + elem[0]); + + box.fadeOut(100, function() + { + $('*.data', box).html(''); + + if( self.popupQueue.length > 0) { + var ibox = $('#message-box > #' + self.popupQueue[0][0]); + $('*.data', ibox).html(self.popupQueue[0][1] || ''); + ibox.fadeIn(100); + if(self.popupQueue[0][2] > 0) + setTimeout( $.fbind(self, self.advancePopupQueue), self.popupQueue[0][2]); + } + }); + } +}; + + diff --git a/project/static/js/jquery.modal.js b/project/static/js/jquery.modal.js new file mode 100755 index 00000000..3aac816e --- /dev/null +++ b/project/static/js/jquery.modal.js @@ -0,0 +1,69 @@ +/* + * jqModal - Minimalist Modaling with jQuery + * (http://dev.iceburg.net/jquery/jqModal/) + * + * Copyright (c) 2007,2008 Brice Burgess + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * $Version: 03/01/2009 +r14 + */ +(function($) { +$.fn.jqm=function(o){ +var p={ +overlay: 50, +overlayClass: 'jqmOverlay', +closeClass: 'jqmClose', +trigger: '.jqModal', +ajax: F, +ajaxText: '', +target: F, +modal: F, +toTop: F, +onShow: F, +onHide: F, +onLoad: F +}; +return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s; +H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s}; +if(p.trigger)$(this).jqmAddTrigger(p.trigger); +});}; + +$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');}; +$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');}; +$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});}; +$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});}; + +$.jqm = { +hash:{}, +open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('
').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z); + if(c.modal) {if(!A[0])L('bind');A.push(s);} + else if(c.overlay > 0)h.w.jqmAddClose(o); + else o=F; + + h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F; + if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}} + + if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u; + r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});} + else if(cc)h.w.jqmAddClose($(cc,h.w)); + + if(c.toTop&&h.o)h.w.before('').insertAfter(h.o); + (c.onShow)?c.onShow(h):h.w.show();e(h);return F; +}, +close:function(s){var h=H[s];if(!h.a)return F;h.a=F; + if(A[0]){A.pop();if(!A[0])L('unbind');} + if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove(); + if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F; +}, +params:{}}; +var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false, +i=$('').css({opacity:0}), +e=function(h){if(ie6)if(h.o)h.o.html('

').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);}, +f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}}, +L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);}, +m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;}, +hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() { + if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});}; +})(jQuery); \ No newline at end of file diff --git a/project/templates/explorer/editor.html b/project/templates/explorer/editor.html index 891366b7..2263f02e 100644 --- a/project/templates/explorer/editor.html +++ b/project/templates/explorer/editor.html @@ -2,15 +2,17 @@ {% block extrahead %} + - + - - + + + {% endblock extrahead %} {% block extrabody %} @@ -30,10 +32,8 @@ {% block header-toolbar %} -

- - -
+ + @@ -79,4 +79,27 @@ {% endfor %} +
+
+ + +

Wiadomość nie może być pusta.

+

+ + +

+
+
+ +
+
+ + +
{% endblock maincontent %} diff --git a/project/templates/explorer/panels/dceditor.html b/project/templates/explorer/panels/dceditor.html index a09f9bef..fd613695 100644 --- a/project/templates/explorer/panels/dceditor.html +++ b/project/templates/explorer/panels/dceditor.html @@ -1,7 +1,7 @@
-
+ {{ form.as_p }} - +