Pflichtenhefte: vor Tabwechseln mit Datenverlust nachfragen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 31 Jul 2013 15:34:43 +0000 (17:34 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:09:09 +0000 (13:09 +0200)
js/locale/de.js
js/requirement_spec.js
locale/de/all
templates/webpages/requirement_spec/show.html

index 012cc8f..3183187 100644 (file)
@@ -5,6 +5,8 @@ namespace("kivi").setupLocale({
 "Add sub function block":"Unterfunktionsblock hinzufügen",
 "Add text block":"Textblock erfassen",
 "Are you sure?":"Sind Sie sicher?",
+"Basic settings actions":"Aktionen zu Grundeinstellungen",
+"Cancel":"Abbrechen",
 "Copy":"Kopieren",
 "Copy requirement spec":"Pflichtenheft kopieren",
 "Copy template":"Vorlage kopieren",
@@ -27,6 +29,7 @@ namespace("kivi").setupLocale({
 "Edit text block":"Textblock bearbeiten",
 "Enter longdescription":"Langtext eingeben",
 "Function block actions":"Funktionsblockaktionen",
+"If you switch to a different tab without saving you will lose the data you've entered in the current tab.":"Wenn Sie auf einen anderen Tab wechseln, ohne vorher zu speichern, so gehen die im aktuellen Tab eingegebenen Daten verloren.",
 "Map":"Karte",
 "Orders/Quotations actions":"",
 "Part picker":"Artikelauswahl",
index 5c4967f..0946655 100644 (file)
@@ -491,6 +491,36 @@ ns.revert_to_versioned_copy_ajax_call = function(key, opt) {
   return true;
 };
 
+// -------------------------------------------------------------------------
+// ------------------------------- tab widget ------------------------------
+// -------------------------------------------------------------------------
+var content_div_ids_for_tab_headers = {
+    'tab-header-function-block':     'function-blocks-tab'
+  , 'tab-header-basic-settings':     'ui-tabs-1'
+  , 'tab-header-time-cost-estimate': 'ui-tabs-2'
+  , 'tab-header-versions':           'ui-tabs-3'
+  , 'tab-header-quotations-orders':  'ui-tabs-4'
+};
+
+ns.tabs_before_activate = function(event, ui) {
+  if (!ui.oldTab)
+    return true;
+
+  var content_div_id = content_div_ids_for_tab_headers[ $(ui.oldTab).attr('id') ];
+  if (!content_div_id || (content_div_id == 'function-blocks-tab'))
+    return true;
+
+  var inputs = $('#' + content_div_id).find('input,select,textarea').filter('[type!=hidden]');
+  if (!inputs.size() || confirm(kivi.t8("If you switch to a different tab without saving you will lose the data you've entered in the current tab.")))
+    return true;
+
+  var new_focus = $(inputs).filter(':focusable')[0];
+  if (new_focus)
+    $(new_focus).focus();
+
+  return false;
+};
+
 // -------------------------------------------------------------------------
 // ----------------------------- context menus -----------------------------
 // -------------------------------------------------------------------------
index 3500c61..db1d7cf 100755 (executable)
@@ -316,6 +316,7 @@ $self->{texts} = {
   'Basic Settings for the Requirement Spec' => 'Grundeinstellungen des Pflichtenheftes',
   'Basic Settings for the Requirement Spec Template' => 'Grundeinstellungen der Pflichtenheftvorlage',
   'Basic settings'              => 'Grundeinstellungen',
+  'Basic settings actions'      => 'Aktionen zu Grundeinstellungen',
   'Batch Printing'              => 'Druck',
   'Bcc'                         => 'Bcc',
   'Bcc E-mail'                  => 'BCC (E-Mail)',
@@ -1181,6 +1182,7 @@ $self->{texts} = {
   'If you lock the system normal users won\'t be able to log in.' => 'Wenn Sie das System sperren, so werden sich normale Benutzer nicht mehr anmelden können.',
   'If you see this message, you most likely just setup your LX-Office and haven\'t added any entry types. If this is the case, the option is accessible for administrators in the System menu.' => 'Wenn Sie diese Meldung sehen haben Sie wahrscheinlich ein frisches LX-Office Setup und noch keine Buchungsgruppen eingerichtet. Ein Administrator kann dies im Systemmen&uuml; erledigen.',
   'If you select a base unit then you also have to enter a factor.' => 'Wenn Sie eine Basiseinheit auswählen, dann müssen Sie auch einen Faktor eingeben.',
+  'If you switch to a different tab without saving you will lose the data you\'ve entered in the current tab.' => 'Wenn Sie auf einen anderen Tab wechseln, ohne vorher zu speichern, so gehen die im aktuellen Tab eingegebenen Daten verloren.',
   'If you want to change any of these parameters then press the "Back" button, edit the file "config/kivitendo.conf" and login into the admin module again.' => 'Wenn Sie einen der Parameter ändern wollen, so drücken Sie auf den "Zurück"-Button, bearbeiten Sie die Datei "config/kivitendo.conf", und melden Sie sich erneut im Administrationsbereich an.',
   'If you want to delete such a dataset you have to edit the client(s) that are using the dataset in question and have them use another dataset.' => 'Wenn Sie eine solche Datenbank löschen möchten, dann müssen Sie zuerst den/die Mandanten auf eine andere Datenbank umstellen, die die zu löschende Datenbank benutzen.',
   'If you want to set up the authentication database yourself then log in to the administration panel. kivitendo will then create the database and tables for you.' => 'Wenn Sie die Authentifizierungs-Datenbank selber einrichten wollen, so melden Sie sich im Administrationsbereich an. kivitendo wird dann die Datenbank und die erforderlichen Tabellen für Sie anlegen.',
index 38711c1..f01c0b2 100644 (file)
@@ -6,14 +6,14 @@
 
 [%- L.hidden_tag('requirement_spec_id', SELF.requirement_spec.id, 'data-is-template'=(SELF.requirement_spec.is_template ? 1 : 0)) -%]
 
-<div class="tabwidget">
+<div id="requirement_spec_tabs" class="tabwidget">
  <ul>
-  <li><a href="#function-blocks-tab">[%- LxERP.t8("Content") %]</a></li>
-  <li><a href="controller.pl?action=RequirementSpec/ajax_show_basic_settings&id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Basic settings") %]</a></li>
-  <li><a href="controller.pl?action=RequirementSpec/ajax_show_time_and_cost_estimate&id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Time and cost estimate") %]</a></li>
+  <li id="tab-header-function-block"><a href="#function-blocks-tab">[%- LxERP.t8("Content") %]</a></li>
+  <li id="tab-header-basic-settings"><a href="controller.pl?action=RequirementSpec/ajax_show_basic_settings&id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Basic settings") %]</a></li>
+  <li id="tab-header-time-cost-estimate"><a href="controller.pl?action=RequirementSpec/ajax_show_time_and_cost_estimate&id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Time and cost estimate") %]</a></li>
   [%- UNLESS SELF.requirement_spec.is_template %]
-   <li><a href="controller.pl?action=RequirementSpecVersion/list&requirement_spec_id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Versions") %]</a></li>
-   <li><a href="[% SELF.url_for(controller='RequirementSpecOrder', action='list', requirement_spec_id=SELF.requirement_spec.id) %]">[%- LxERP.t8("Quotations and orders") %]</a></li>
+   <li id="tab-header-versions"><a href="controller.pl?action=RequirementSpecVersion/list&requirement_spec_id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Versions") %]</a></li>
+   <li id="tab-header-quotations-orders"><a href="[% SELF.url_for(controller='RequirementSpecOrder', action='list', requirement_spec_id=SELF.requirement_spec.id) %]">[%- LxERP.t8("Quotations and orders") %]</a></li>
   [%- END %]
  </ul>
 
@@ -112,6 +112,7 @@ $(function() {
 [% END %]
 
   kivi.requirement_spec.create_context_menus([% SELF.requirement_spec.is_template ? 'true' : 'false' %]);
+  $('#requirement_spec_tabs').on("tabsbeforeactivate", kivi.requirement_spec.tabs_before_activate);
 });
 
   -->