From 6dbc83af32ca1bded29101903d98d8656113801e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 1 Aug 2013 15:26:38 +0200 Subject: [PATCH] jqModal-Dialoge durch jQuery-UI-Dialoge ersetzen --- SL/ClientJS.pm | 21 +++++- SL/Form.pm | 4 +- SL/Template/Plugin/L.pm | 11 --- css/kivitendo/jqModal.css | 37 ---------- css/lx-office-erp/jqModal.css | 39 ----------- doc/online/.dummy | 0 doc/online/de/add_project.pod | 16 ----- js/autocomplete_part.js | 5 +- js/client_js.js | 4 +- js/common.js | 25 ------- js/jqModal/jqModal.js | 68 ------------------- js/locale/de.js | 3 + locale/de/all | 2 +- scripts/locales.pl | 4 +- templates/webpages/admin/edit_client.html | 11 +-- .../webpages/admin/test_db_connection.html | 4 +- templates/webpages/common/help_overlay.html | 11 --- .../webpages/part/part_picker_search.html | 3 +- .../presenter/record/grouped_record_list.html | 13 ++-- templates/webpages/project/form.html | 1 - .../webpages/record_links/add_filter.html | 14 ++-- 21 files changed, 54 insertions(+), 242 deletions(-) delete mode 100644 css/kivitendo/jqModal.css delete mode 100644 css/lx-office-erp/jqModal.css delete mode 100644 doc/online/.dummy delete mode 100644 doc/online/de/add_project.pod delete mode 100644 js/jqModal/jqModal.js delete mode 100644 templates/webpages/common/help_overlay.html diff --git a/SL/ClientJS.pm b/SL/ClientJS.pm index 7d1bb383a..ada199efa 100644 --- a/SL/ClientJS.pm +++ b/SL/ClientJS.pm @@ -75,10 +75,10 @@ my %supported_methods = ( off => 3, one => 3, - # ## jqModal plugin ## + # ## jQuery UI dialog plugin ## pattern: $().dialog('') # Closing and removing the popup - jqmClose => 1, # $().jqmClose() + 'dialog:close' => 1, # ## jstree plugin ## pattern: $.jstree._reference($()).() @@ -185,6 +185,12 @@ sub jstree { return $self; } +sub dialog { + my ($self) = @_; + $self->{_prefix} = 'dialog:'; + return $self; +} + sub flash { my ($self, $type, @messages) = @_; @@ -262,6 +268,9 @@ Now some Perl code: $js->jstree->rename_node('#tb-' . $text_block->id, $text_block->title) ->jstree->select_node('#tb-' . $text_block->id); + # Close a popup opened by kivi.popup_dialog(): + $js->dialog->close('#jqueryui_popup_dialog'); + # Finally render the JSON response: $self->render($js); @@ -324,6 +333,14 @@ to the following: $controller->render(\$self->to_json, { type => 'json' }); +=item C + +Tells C<$self> that the next action is to be called on a jQuery UI +dialog instance, e.g. one opened by C. For +example: + + $js->dialog->close('#jqueryui_popup_dialog'); + =item C Tells C<$self> that the next action is to be called on a jstree diff --git a/SL/Form.pm b/SL/Form.pm index 2d1dce5c0..dbb9337b3 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -467,11 +467,11 @@ sub header { main menu list_accounts jquery.autocomplete jquery.multiselect2side ui-lightness/jquery-ui - jquery-ui.custom jqModal + jquery-ui.custom ); $layout->use_javascript("$_.js") for (qw( - jquery jquery-ui jquery.cookie jqModal jquery.checkall jquery.download + jquery jquery-ui jquery.cookie jquery.checkall jquery.download common part_selection switchmenuframe autocomplete_part ), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}"); diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index c072d08e1..ef534ce04 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -434,17 +434,6 @@ JAVASCRIPT return $code; } -sub online_help_tag { - my ($self, $tag, %params) = _hashify(2, @_); - my $cc = $::myconfig{countrycode}; - my $file = "doc/online/$cc/$tag.html"; - my $text = $params{text} || $::locale->text('Help'); - - die 'malformed help tag' unless $tag =~ /^[a-zA-Z0-9_]+$/; - return unless -f $file; - return $self->html_tag('a', $text, href => $file, class => 'jqModal') -} - sub dump { my $self = shift; return '
' . Data::Dumper::Dumper(@_) . '
'; diff --git a/css/kivitendo/jqModal.css b/css/kivitendo/jqModal.css deleted file mode 100644 index 7c8c92fd2..000000000 --- a/css/kivitendo/jqModal.css +++ /dev/null @@ -1,37 +0,0 @@ -/* the overlayed element */ -.jqModal_overlay { - position: fixed; - top: 50%; - margin-top: -250px; - height: 500px; - - left: 50%; - margin-left: -400px; - width: 800px; - - background-color: #fff; - border: 1px solid #333; - - /* CSS3 styling for latest browsers */ - box-shadow: 0 0 90px 5px #000; - -moz-box-shadow: 0 0 90px 5px #000; - -webkit-box-shadow: 0 0 90px #000; - - padding: 10px; -} - -.jqModal_overlay .overlay_content { - width: 790px; - height: 490px; - overflow: auto; -} - -.jqModal_overlay .close { - background-image: url(../../image/dialog-close.png); - position: absolute; - right: -16px; - top: -16px; - cursor: pointer; - height: 32px; - width: 32px; -} diff --git a/css/lx-office-erp/jqModal.css b/css/lx-office-erp/jqModal.css deleted file mode 100644 index 90f9594b9..000000000 --- a/css/lx-office-erp/jqModal.css +++ /dev/null @@ -1,39 +0,0 @@ -/* the overlayed element */ -.jqModal_overlay { - position: fixed; - top: 50%; - margin-top: -250px; - height: 500px; - - left: 50%; - margin-left: -400px; - width: 800px; - - background-image: url("../../image/fade.png"); - background-repeat: repeat-x; - background-color: #fff; - border: 1px solid #333; - - /* CSS3 styling for latest browsers */ - box-shadow: 0 0 90px 5px #000; - -moz-box-shadow: 0 0 90px 5px #000; - -webkit-box-shadow: 0 0 90px #000; - - padding: 10px; -} - -.jqModal_overlay .overlay_content { - width: 790px; - height: 490px; - overflow: auto; -} - -.jqModal_overlay .close { - background-image: url(../../image/dialog-close.png); - position: absolute; - right: -16px; - top: -16px; - cursor: pointer; - height: 32px; - width: 32px; -} diff --git a/doc/online/.dummy b/doc/online/.dummy deleted file mode 100644 index e69de29bb..000000000 diff --git a/doc/online/de/add_project.pod b/doc/online/de/add_project.pod deleted file mode 100644 index 9a5169760..000000000 --- a/doc/online/de/add_project.pod +++ /dev/null @@ -1,16 +0,0 @@ -=head1 Projekte erfassen - -Projekte sind in kivitendo nur organisatorische Einheiten. Wenn Sie Projekte -erfassen, können Sie C Projekte zuweisen, und Auswertungen hinterher -nach den Projekten filtern. Projekte haben ansonsten keine weitere Funktion. - -=head1 Tips - -=over 4 - -=item * - -Projektnamen können in den Rechnungstemplates ausgedruckt werden, siehe -L. - -=back diff --git a/js/autocomplete_part.js b/js/autocomplete_part.js index b89751e3b..04af286b2 100644 --- a/js/autocomplete_part.js +++ b/js/autocomplete_part.js @@ -29,12 +29,13 @@ namespace('kivi', function(k){ var timer; function open_dialog () { - open_jqm_window({ + k.popup_dialog({ url: 'controller.pl?action=Part/part_picker_search', data: $.extend({ real_id: real_id, }, ajax_data($dummy.val())), id: 'part_selection', + dialog: { title: k.t8('Part picker') } }); window.clearTimeout(timer); return true; @@ -98,7 +99,7 @@ namespace('kivi', function(k){ } function close_popup() { - $('#part_selection').jqmClose() + $('#part_selection').dialog('close'); }; $dummy.autocomplete({ diff --git a/js/client_js.js b/js/client_js.js index e5fdcb578..35d5e6959 100644 --- a/js/client_js.js +++ b/js/client_js.js @@ -91,10 +91,10 @@ ns.eval_json_result = function(data) { else if (action[0] == 'off') $(action[1]).off(action[2], kivi.get_function_by_name(action[3])); else if (action[0] == 'one') $(action[1]).one(action[2], kivi.get_function_by_name(action[3])); - // ## jqModal plugin ## + // ## jQuery UI dialog plugin ## // Closing and removing the popup - else if (action[0] == 'jqmClose') $(action[1]).jqmClose(); + else if (action[0] == 'dialog:close') $(action[1]).dialog('close'); // ## jstree plugin ## diff --git a/js/common.js b/js/common.js index 904448d35..2bc91078c 100644 --- a/js/common.js +++ b/js/common.js @@ -160,31 +160,6 @@ function focus_by_name(name){ return false; } -function open_jqm_window(params) { - params = params || { }; - var id = params.id ? params.id : 'jqm_popup_dialog'; - - $('#' + id).remove(); - var div = $('
').hide().appendTo('body'); - var close = $('
').appendTo(div); - var content = $('
').appendTo(div); - - div.jqm({ modal: true }); - div.jqmShow(); - $(close).click(function() { - div.jqmClose(); - }); - - $.ajax({ - url: params.url, - data: params.data, - type: params.type, - success: function(new_html) { $(content).html(new_html); } - }); - - return true; -} - $(document).ready(function () { // initialize all jQuery UI tab elements: $(".tabwidget").each(function(idx, element) { diff --git a/js/jqModal/jqModal.js b/js/jqModal/jqModal.js deleted file mode 100644 index db1dd9e7c..000000000 --- a/js/jqModal/jqModal.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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: 0, -overlayClass: 'jqmOverlay', -closeClass: 'jqmClose', -trigger: '.jqModal', -ajax: '@href', -ajaxText: '...', -target: '#help_content', -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)});}; -$.fn.jqmClose=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t);this.remove();});}; - -$.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(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));f(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();f(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=[],F=false, -i=$('').css({opacity:0}), -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); diff --git a/js/locale/de.js b/js/locale/de.js index 883ac6b60..c5a0d26be 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -1,6 +1,9 @@ namespace("kivi").setupLocale({ +"Add linked record":"Verknüpften Beleg hinzufügen", "Are you sure?":"Sind Sie sicher?", +"Database Connection Test":"Test der Datenbankverbindung", "Map":"Karte", +"Part picker":"Artikelauswahl", "The description is missing.":"Die Beschreibung fehlt.", "The name is missing.":"Der Name fehlt.", "The name must only consist of letters, numbers and underscores and start with a letter.":"Der Name darf nur aus Buchstaben (keine Umlaute), Ziffern und Unterstrichen bestehen und muss mit einem Buchstaben beginnen.", diff --git a/locale/de/all b/locale/de/all index aa2889d44..ba78f2306 100755 --- a/locale/de/all +++ b/locale/de/all @@ -164,6 +164,7 @@ $self->{texts} = { 'Add bank account' => 'Bankkonto erfassen', 'Add custom variable' => 'Benutzerdefinierte Variable erfassen', 'Add link: select records to link with' => 'Verknüpfungen hinzufügen: zu verknüpfende Belege auswählen', + 'Add linked record' => 'Verknüpften Beleg hinzufügen', 'Add links' => 'Verknüpfungen hinzufügen', 'Add new currency' => 'Neue Währung hinzufügen', 'Add new custom variable' => 'Neue benutzerdefinierte Variable erfassen', @@ -1007,7 +1008,6 @@ $self->{texts} = { 'Hardcopy' => 'Seite drucken', 'Has serial number' => 'Hat eine Serienummer', 'Heading' => 'Überschrift', - 'Help' => 'Hilfe', 'Help Template Variables' => 'Hilfe zu Dokumenten-Variablen', 'Help on column names' => 'Hilfe zu Spaltennamen', 'Here' => 'Hier', diff --git a/scripts/locales.pl b/scripts/locales.pl index ed085487f..714953194 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -43,7 +43,7 @@ our $missing = {}; our @lost = (); my %ignore_unused_templates = ( - map { $_ => 1 } qw(common/help_overlay.html ct/testpage.html generic/autocomplete.html oe/periodic_invoices_email.txt part/testpage.html t/render.html t/render.js) + map { $_ => 1 } qw(ct/testpage.html generic/autocomplete.html oe/periodic_invoices_email.txt part/testpage.html t/render.html t/render.js) ); my (%referenced_html_files, %locale, %htmllocale, %alllocales, %cached, %submit, %jslocale); @@ -633,7 +633,7 @@ sub scan_javascript_file { while( my $line = readline($fh) ) { while( $line =~ m/ - kivi.t8 + \bk(?:ivi)?.t8 \s* \( \s* diff --git a/templates/webpages/admin/edit_client.html b/templates/webpages/admin/edit_client.html index cd9983fcf..2d3fe552f 100644 --- a/templates/webpages/admin/edit_client.html +++ b/templates/webpages/admin/edit_client.html @@ -123,11 +123,12 @@ } function test_database_connectivity() { - open_jqm_window({ - url: 'controller.pl?action=Admin/test_database_connectivity', - data: $(".contains_dbsettings").serialize(), - type: 'POST', - id: 'test_db_connection_window' + kivi.popup_dialog({ + url: 'controller.pl?action=Admin/test_database_connectivity', + data: $(".contains_dbsettings").serialize(), + type: 'POST', + id: 'test_db_connection_window', + dialog: { title: kivi.t8('Database Connection Test') } }); return true; } diff --git a/templates/webpages/admin/test_db_connection.html b/templates/webpages/admin/test_db_connection.html index 4f1271d61..4c7101097 100644 --- a/templates/webpages/admin/test_db_connection.html +++ b/templates/webpages/admin/test_db_connection.html @@ -1,6 +1,4 @@ [%- USE HTML %][%- USE LxERP -%][%- USE L -%] -
[% HTML.escape(title) %]
- [%- IF ok %]

[% LxERP.t8('The connection was established successfully.') %]

@@ -17,5 +15,5 @@ [%- END %] diff --git a/templates/webpages/common/help_overlay.html b/templates/webpages/common/help_overlay.html deleted file mode 100644 index a192a88aa..000000000 --- a/templates/webpages/common/help_overlay.html +++ /dev/null @@ -1,11 +0,0 @@ -[%- USE T8 %] - -
- [% -
- [% 'Please wait...' | $T8 %] - [% 'loading' | $T8 %] -
-
diff --git a/templates/webpages/part/part_picker_search.html b/templates/webpages/part/part_picker_search.html index 318c95e10..3bb59b4ec 100644 --- a/templates/webpages/part/part_picker_search.html +++ b/templates/webpages/part/part_picker_search.html @@ -3,10 +3,9 @@ [%- USE LxERP %] [%- USE T8 %] -

[% 'Part picker' | $T8 %]

-[% L.input_tag('part_picker_filter', SELF.filter.all_substr__ilike, class='part_picker_filter') %] +[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', SELF.filter.all_substr__ilike, class='part_picker_filter') %] [% L.hidden_tag('part_picker_real_id', FORM.real_id) %]
diff --git a/templates/webpages/presenter/record/grouped_record_list.html b/templates/webpages/presenter/record/grouped_record_list.html index 9602388cf..9d8a7d7a8 100644 --- a/templates/webpages/presenter/record/grouped_record_list.html +++ b/templates/webpages/presenter/record/grouped_record_list.html @@ -18,12 +18,13 @@