Index: umc/python/join/de.po =================================================================== --- umc/python/join/de.po (revision 3530) +++ umc/python/join/de.po (working copy) @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: univention-management-console-module-join\n" "Report-Msgid-Bugs-To: packages@univention.de\n" -"POT-Creation-Date: 2011-09-20 12:07+0200\n" +"POT-Creation-Date: 2011-10-04 17:21+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -13,11 +13,11 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: umc/python/join/__init__.py:213 +#: umc/python/join/__init__.py:214 msgid "Another join operation is in progress" msgstr "Es wird gerade eine andere Join Operation ausgeführt" -#: umc/python/join/__init__.py:408 +#: umc/python/join/__init__.py:403 #, python-format msgid "Removing temp file: %s" msgstr "Lösche temporäre Datei: " @@ -26,15 +26,15 @@ msgid "due" msgstr "fällig" -#: umc/python/join/__init__.py:353 +#: umc/python/join/__init__.py:351 msgid "never run" msgstr "noch nie ausgeführt" -#: umc/python/join/__init__.py:336 +#: umc/python/join/__init__.py:335 msgid "not installed" msgstr "nicht installiert" -#: umc/python/join/__init__.py:326 umc/python/join/__init__.py:355 +#: umc/python/join/__init__.py:326 umc/python/join/__init__.py:352 msgid "run" msgstr "ausführen" Index: umc/python/join/__init__.py =================================================================== --- umc/python/join/__init__.py (revision 3530) +++ umc/python/join/__init__.py (working copy) @@ -51,8 +51,9 @@ class Instance(umcm.Base): def init(self): MODULE.warn("Initializing 'join' module with LANG = '%s'" % self.locale) - global _ - _ = umc.Translation('univention-management-console-module-join',self.locale).translate +# should not be needed anymore? +# global _ +# _ = umc.Translation('univention-management-console-module-join',self.locale).translate # some constants self._instdir = '/usr/lib/univention-install' # where to find *.inst files @@ -322,19 +323,16 @@ next # ... ignore this entry files[fname]['last'] = version if files[fname]['last'] < files[fname]['current']: - files[fname]['icon'] = 'join-run' files[fname]['action'] = _('run') files[fname]['status'] = _('due') else: files[fname]['status'] = _('successful') - files[fname]['icon'] = 'join-success' files[fname]['action'] = '' else: MODULE.warn(" Script '%s' has no package" % fname) e = {} e['script'] = fname e['status'] = _('not installed') - e['icon'] = 'join-error' e['last'] = version files[fname] = e except Exception,ex: @@ -351,15 +349,12 @@ entry['last'] = '--' if 'current' in entry: entry['status'] = _('never run') - entry['icon'] = 'join-run' entry['action'] = _('run') # to avoid double expressions in the JS code, checking for # definedness and non-emptiness of strings: We set all empty # properties to the empty string. if not 'action' in entry: entry['action'] = '' - if not 'icon' in entry: - entry['icon'] = '' # Return only entries that have a 'current' property. if 'current' in entry: result.append(entry) Index: umc/js/de.po =================================================================== --- umc/js/de.po (revision 3530) +++ umc/js/de.po (working copy) @@ -1,10 +1,9 @@ # This file is auto-generated by the dh-umc tools and should not be edited! -#, fuzzy msgid "" msgstr "" "Project-Id-Version: univention-management-console-module-join\n" "Report-Msgid-Bugs-To: packages@univention.de\n" -"POT-Creation-Date: 2011-08-30 18:03+0200\n" +"POT-Creation-Date: 2011-10-04 18:06+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -13,92 +12,104 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: umc/js/join.js:396 -#, fuzzy, python-format +#: umc/js/join.js:427 +#, python-format msgid "%d join scripts are currently running" msgstr "Momentan werden %d Skripte ausgeführt." -#: umc/js/join.js:357 +#: umc/js/join.js:376 #, python-format -msgid "%d scripts are due to be run" +msgid "%d scripts are due to be run." msgstr "Insgesamt können %d Skripte ausgeführt werden." -#: umc/js/join.js:348 +#: umc/js/join.js:367 #, python-format msgid "%d scripts selected" msgstr "%d Skripte ausgewählt" -#: umc/js/join.js:597 +#: umc/js/join.js:611 msgid "... loading log ..." msgstr "... Protokoll wird geladen ..." -#: umc/js/join.js:347 +#: umc/js/join.js:366 msgid "1 script selected" msgstr "1 Skript ausgewählt" -#: umc/js/join.js:479 -msgid "Action" -msgstr "Aktion" - -#: umc/js/join.js:404 umc/js/join.js:696 +#: umc/js/join.js:436 umc/js/join.js:708 msgid "Can't start join: " msgstr "Kann Join-Prozess nicht starten: " -#: umc/js/join.js:428 -#, fuzzy +#: umc/js/join.js:460 msgid "Current status" msgstr "Aktueller Status" -#: umc/js/join.js:455 +#: umc/js/join.js:507 msgid "Current version" msgstr "Aktuelle Version" -#: umc/js/join.js:258 +#: umc/js/join.js:267 msgid "" "Currently some join scripts are running. You may watch the log file until " "they are finished." msgstr "" +"Momentan werden Join-Skripte abgearbeitet. Sie können den Fortschritt im Log-" +"File verfolgen, bis der Vorgang abgeschlossen ist." -#: umc/js/join.js:720 +#: umc/js/join.js:732 msgid "DC Hostname" msgstr "Name des Domaincontroller-Computers" -#: umc/js/join.js:161 umc/js/join.js:164 +#: umc/js/join.js:479 +msgid "Execute" +msgstr "Ausführen" + +#: umc/js/join.js:480 +msgid "Execute this join script" +msgstr "Diesen Join-Skript ausführen" + +#: umc/js/join.js:166 msgid "Join Protocol" msgstr "Protokoll aller Join-Skripte" -#: umc/js/join.js:421 +#: umc/js/join.js:453 msgid "Join status" msgstr "Join-Status" -#: umc/js/join.js:363 +#: umc/js/join.js:388 msgid "Join status ok, nothing to do." msgstr "" "Domänenbeitritt ist komplett; es sind keine Skripte übrig, die ausgeführt " "werden müßten." -#: umc/js/join.js:462 +#: umc/js/join.js:514 msgid "Last version" msgstr "Letzte Version" -#: umc/js/join.js:456 +#: umc/js/join.js:508 msgid "Latest script version ready for execution" msgstr "Neuester Skript, der ausgeführt werden kann" -#: umc/js/join.js:463 +#: umc/js/join.js:515 msgid "Latest script version that was executed successfully" msgstr "Letzter Skript, der erfolgreich ausgeführt wurde" -#: umc/js/join.js:734 +#: umc/js/join.js:423 +msgid "One join script is currently running" +msgstr "Ein Skript wird momentan ausgeführt." + +#: umc/js/join.js:379 +msgid "One script is due to be run." +msgstr "Ein Skript steht zur Ausführung an." + +#: umc/js/join.js:746 msgid "Password" msgstr "Passwort" -#: umc/js/join.js:735 +#: umc/js/join.js:747 msgid "Password of the Domain Administrator" msgstr "Passwort des Domänen-Administrators" -#: umc/js/join.js:714 -#, fuzzy +#: umc/js/join.js:726 msgid "" "Please enter the required information below and click the 'Start Join' " "button. This will join your system into the domain." @@ -107,40 +118,35 @@ "auf den Knopf 'Domänenbeitritt starten'. Dies gliedert Ihr System in die " "Domäne ein." -#: umc/js/join.js:480 -msgid "Run this script if it's due or never run" -msgstr "" - -#: umc/js/join.js:448 +#: umc/js/join.js:500 msgid "Script (package)" msgstr "Skript (Paket)" -#: umc/js/join.js:449 +#: umc/js/join.js:501 msgid "Script name (the same as the package it belongs to)" msgstr "Skriptname (benannt nach dem Paket, zu dem er gehört)" -#: umc/js/join.js:683 +#: umc/js/join.js:694 msgid "Start Join" msgstr "Domänenbeitritt starten" -#: umc/js/join.js:470 +#: umc/js/join.js:522 msgid "State" msgstr "Status" -#: umc/js/join.js:471 +#: umc/js/join.js:523 msgid "Status of this package" msgstr "Status dieses Paketes" -#: umc/js/join.js:721 +#: umc/js/join.js:733 msgid "The hostname of the DC Master of the domain" msgstr "Der Computername des Master-Domaincontrollers der Domäne" -#: umc/js/join.js:728 -#, fuzzy +#: umc/js/join.js:740 msgid "The username of the Domain Administrator" -msgstr "Passwort des Domänen-Administrators" +msgstr "Nutzername des Domänen-Administrators" -#: umc/js/join.js:422 +#: umc/js/join.js:454 msgid "" "This page shows the status of all available join scripts on this system, " "along with all join-related actions (run selected or all join scripts, or " @@ -149,44 +155,39 @@ "Diese Seite zeigt den Status aller verfügbaren Join-Skripte auf diesem " "System, zusammen mit allen Aktionen, die ausgeführt werden können." -#: umc/js/join.js:116 +#: umc/js/join.js:117 msgid "This system has not been joined yet." msgstr "Dieses System ist der Domäne noch nicht beigetreten." -#: umc/js/join.js:108 +#: umc/js/join.js:109 #, python-format msgid "This system joined on %s" msgstr "Dieses System ist der Domäne am %s beigetreten." -#: umc/js/join.js:727 +#: umc/js/join.js:739 msgid "Username" msgstr "Nutzername" -#: umc/js/join.js:617 +#: umc/js/join.js:631 msgid "hide log" msgstr "Protokoll ausblenden" -#: umc/js/join.js:169 -#, fuzzy +#: umc/js/join.js:170 msgid "last {logcount} lines" msgstr "letzte {logcount} Zeilen" -#: umc/js/join.js:358 +#: umc/js/join.js:383 msgid "run all" msgstr "Alle Skripte ausführen" -#: umc/js/join.js:350 +#: umc/js/join.js:369 msgid "run selected scripts" msgstr "Ausgewählte Skripte ausführen" -#: umc/js/join.js:624 -#, fuzzy +#: umc/js/join.js:638 msgid "show all" msgstr "Gesamtes Protokoll zeigen" -#: umc/js/join.js:609 +#: umc/js/join.js:623 msgid "show log" msgstr "Protokoll einblenden" - -#~ msgid "Run this script" -#~ msgstr "Diesen Skript ausführen" Index: umc/js/join.js =================================================================== --- umc/js/join.js (revision 3530) +++ umc/js/join.js (working copy) @@ -13,8 +13,9 @@ dojo.require("umc.widgets.ContainerForm"); dojo.require("umc.widgets.Grid"); dojo.require("umc.widgets.TabbedModule"); +dojo.require("umc.widgets.StandbyMixin"); +dojo.require("umc.modules._join.Form"); dojo.require("dojox.string.sprintf"); -dojo.require("dojox.layout.TableContainer"); // Inheriting from umc.widgets.TabbedModule so any pages being added // will become tabs automatically. @@ -22,7 +23,7 @@ _page: null, // umc.widgets.Page _content: null, // umc.widgets.ExpandingTitlePane - _split: null, // dijit.layout.BorderContainer +// _split: null, // dijit.layout.BorderContainer _grid: null, // umc.widgets.Grid _infotext: null, @@ -60,7 +61,7 @@ _switch_log_display: function(code) { if (code == 'hide') { - this._split.removeChild(this._logview); + this._content.removeChild(this._logview); this._bottom.addChild(this._b_show); this._bottom.removeChild(this._b_hide); this._bottom.removeChild(this._b_full); @@ -86,7 +87,7 @@ this._refresh_log(true); this._bottom.addChild(this._b_hide); this._bottom.addChild(this._b_full); - this._split.addChild(this._logview); + this._content.addChild(this._logview); this._logview.addChild(this._logtext); } @@ -106,19 +107,23 @@ { // show grid with join status, else.... this._infotext.set('content',this._("This system joined on %s",result)); - this._split.removeChild(this._joinpane); - this._split.addChild(this._grid); + this._content.removeChild(this._joinpane); + this._content.addChild(this._grid); this._reload_grid(); // force grid reload } else { // show affordance to join, nothing more. this._infotext.set('content',this._("This system has not been joined yet.")); - this._split.removeChild(this._grid); - this._split.addChild(this._joinpane); + this._content.removeChild(this._grid); + this._content.addChild(this._joinpane); } } - })); + }), + dojo.hitch(this, function(result) { + console.error("check_join_status ERROR " + result.message); + }) + ); }, // Asynchronously invokes reload of the log lines display. Before fetching real data, @@ -160,10 +165,6 @@ }).then(dojo.hitch(this,function(result) { var txt = dojox.string.sprintf("%s
\n",this._("Join Protocol")); - // this is for debugging so we can see the refresh - //var txt = dojox.string.sprintf("%s [%d]
\n",this._("Join Protocol"),this._proto_gen); - //this._proto_gen++; - if (this._logcount) { var tmp = this._("last {logcount} lines"); @@ -188,7 +189,9 @@ // Establish refresh every second. We keep the last instance of our 'Deferred' // as an instance member this._refresh_job, thus avoiding to have more than one // refresh running at any time. - if (! this._refresh_job) + // + // Added here: if this._refresh_time is set to zero we stop the timer. + if ((! this._refresh_job) && (this._refresh_time)) { var deferred = new dojo.Deferred(); this._refresh_job = deferred; @@ -239,27 +242,43 @@ this.moduleStore.query({ scope: 'running' }).then(dojo.hitch(this, function(result) { - if (result != this._job_running) + try { - this._job_running = result; - this._check_join_status(); // switch between join form and script grid - this._reload_grid(); // redo the status query for the grid, effectively triggering - // _check_grid_status() on 'fetchComplete' - } - // for first display: if none of the two widgets (script grid or join form) - // is displayed AND we run into a running job we have to do two things: - // (1) show a header text that explains the situation - // (2) switch log display on. - if (this._job_running) - { - var txt = this._infotext.get('content'); - if (txt == '') + if (result != this._job_running) { - this._infotext.set('content',this._("Currently some join scripts are running. You may watch the log file until they are finished.")); - this._switch_log_display('show'); + this._job_running = result; + if (! result) + { + this._joinform.standby(false); + } + this._check_join_status(); // switch between join form and script grid + this._reload_grid(); // redo the status query for the grid, effectively triggering + // _check_grid_status() on 'fetchComplete' } + // for first display: if none of the two widgets (script grid or join form) + // is displayed AND we run into a running job we have to do two things: + // (1) show a header text that explains the situation + // (2) switch log display on. + if (this._job_running) + { + var txt = this._infotext.get('content'); + if (txt == '') + { + this._infotext.set('content',this._("Currently some join scripts are running. You may watch the log file until they are finished.")); + this._switch_log_display('show'); + } + } } - })); + catch(error) + { + console.error('job_polling_loop ERROR: ' + error.message); + } + }), + dojo.hitch(this, function(result) { + this._joinform.standby(false); + this._grid.standby(false); + }) + ); // We should have exactly one such job. If one is underway, we don't // step on its feet. Otherwise, we start a new one. @@ -354,7 +373,13 @@ { if (runnable) { - this._footers[0].set('content',this._('%d scripts are due to be run',runnable)); + var due = this._('%d scripts are due to be run.',runnable); + if (runnable == 1) + { + due = this._("One script is due to be run."); + } + this._footers[0].set('content',due); + this._multi_action.set('label',this._('run all')); this._footers[1].addChild(this._multi_action); } @@ -393,7 +418,14 @@ { this._job_running = true; - this._footers[0].set('content',this._('%d join scripts are currently running',list.length)); + if (list.length == 1) + { + this._footers[0].set('content',this._("One join script is currently running")); + } + else + { + this._footers[0].set('content',this._('%d join scripts are currently running',list.length)); + } this._footers[1].removeChild(this._multi_action); this.umcpCommand('join/run',{scripts: list}).then(dojo.hitch(this, function(data) { @@ -432,37 +464,57 @@ // Trying to give the user a chance to resize the grid <-> logview ratio. // Even a simple BorderContainer is able to do that: just give some of its // children a 'splitter: true' property. - this._split = new dijit.layout.BorderContainer({ - }); - this._content.addChild(this._split); +// this._split = new dijit.layout.BorderContainer({ +// }); +// this._content.addChild(this._split); this._grid = new umc.widgets.Grid({ region: 'center', moduleStore: this.moduleStore, //query: {scope: 'scripts'}, - actions: {}, + actions: + [ + { + name: 'run', + label: this._( 'Execute' ), + description: this._( 'Execute this join script' ), + isContextAction: true, + isStandardAction: true, + canExecute: dojo.hitch(this, function(values) { + // Knowledge is in the Python module! + return (values['action'] == 'run'); + }), + callback: dojo.hitch(this, function(id) { + if (dojo.isArray(id)) + { + id = id[0]; + } + this._run_scripts([id]); + }) + } + ], columns: [ { name: 'script', label: this._("Script (package)"), description: this._("Script name (the same as the package it belongs to)"), - editable: false, - width: '40%' + editable: false +// width: '50%' }, { name: 'current', label: this._("Current version"), description: this._("Latest script version ready for execution"), editable: false, - width: '14%' + width: 'adjust' }, { name: 'last', label: this._("Last version"), description: this._("Latest script version that was executed successfully"), editable: false, - width: '14%' + width: 'adjust' }, // Status column. Currently only text. { @@ -471,44 +523,6 @@ description: this._("Status of this package"), editable: false, width: '12%' - // iconField: 'icon' // deactivated (for now) - }, - // Action field - { - name: 'action', - label: this._("Action"), - description: this._("Run this script if it's due or never run"), - sortable: false, - editable: false, - width: '10%', - // We turn the value of the field into an action button that will - // invoke the script named by the 'script' field of this row - formatter: dojo.hitch(this, function(key, rowIndex) { - // key = the value of the field, in our case empty or 'run' - // rowIndex = needed to retrieve the script name - try - { - if (key != '') - { - var tmp = this._grid.getRowValues(rowIndex); - var script = tmp.script; - return new umc.widgets.Button({ - label: key, - // FIXME style this button by a reasonable CSS class or such. - style: 'border:outset 1px;background-color:#A0A0A0;margin:0px;padding:0px;', - //'class': 'umcSubmitButton', // doesn't work, unfortunately. - onClick: dojo.hitch(this, function() { - this._run_scripts([script]); - }) - }); - } - return ''; - } - catch(err) - { - return ''; - } - }) } ] }); @@ -655,11 +669,11 @@ scrollable: false, style: 'border:none;' }); - this._split.addChild(info); + this._content.addChild(info); this._infotext = new umc.widgets.Text({ style: 'border:none;margin:.2em;', - content: '', + content: '' }); info.addChild(this._infotext); @@ -668,73 +682,74 @@ // password and for starting the join process. This form is prepared here and stored // into the this._joinpane variable. The _check_join_status() method will decide // which view is to show. - this._joinpane = new dojox.layout.TableContainer({ + this._joinpane = new umc.widgets.ContainerWidget({ region: 'center', - cols: 1, - style: 'width:50%;', - showLabels: false + scrollable: true }); - this._joinform = new umc.widgets.Form({ - scrollable: true, - buttons: - [ - { - type: 'submit', - label: this._("Start Join"), - onClick: dojo.hitch(this, function() { - //this._joinform.standby(true); - this._switch_log_display('show'); - this.umcpCommand('join/join',{ - host: this._joinform._widgets['host'].value, - user: this._joinform._widgets['user'].value, - pass: this._joinform._widgets['pass'].value - }).then(dojo.hitch(this, function(data) { - var result = dojo.getObject('result', false, data); - if (result != '') - { - // Note result is already localized - umc.dialog.alert(this._("Can't start join: ") + result); - this._check_join_status(); // sets meaningful messages - } - else - { - // Job is started. Now wait for its completion. - this._job_polling_loop(true); - } - })); - }) - } - ], - widgets: - [ - { - type: 'Text', - name: 'text', - style: 'margin-top:1em;margin-bottom:1em;', - content: this._("Please enter the required information below and click the 'Start Join' button. This will join your system into the domain.") - }, - { - type: 'TextBox', - name: 'host', - value: '', - label: this._('DC Hostname'), - description: this._('The hostname of the DC Master of the domain') - }, - { - type: 'TextBox', - name: 'user', - value: 'Administrator', - label: this._('Username'), - description: this._('The username of the Domain Administrator') - }, - { - type: 'PasswordBox', - name: 'pass', - value: '', - label: this._( 'Password' ), - description: this._( 'Password of the Domain Administrator' ) - } - ] + var buttons = + [ + { + type: 'submit', + 'default': true, + label: this._("Start Join"), + onClick: dojo.hitch(this, function() { + this._joinform.standby(true); + this._switch_log_display('show'); + this.umcpCommand('join/join',{ + host: this._joinform._widgets['host'].value, + user: this._joinform._widgets['user'].value, + pass: this._joinform._widgets['pass'].value + }).then(dojo.hitch(this, function(data) { + var result = dojo.getObject('result', false, data); + if (result != '') + { + this._joinform.standby(false); + // Note result is already localized + umc.dialog.alert(this._("Can't start join: ") + result); + this._check_join_status(); // sets meaningful messages + } + else + { + // Job is started. Now wait for its completion. + this._job_polling_loop(true); + } + })); + }) + } + ]; + var widgets = + [ + { + type: 'Text', + name: 'text', + style: 'margin-top:1em;margin-bottom:1em;', + content: this._("Please enter the required information below and click the 'Start Join' button. This will join your system into the domain.") + }, + { + type: 'TextBox', + name: 'host', + value: '', + label: this._('DC Hostname'), + description: this._('The hostname of the DC Master of the domain') + }, + { + type: 'TextBox', + name: 'user', + value: 'Administrator', + label: this._('Username'), + description: this._('The username of the Domain Administrator') + }, + { + type: 'PasswordBox', + name: 'pass', + value: '', + label: this._( 'Password' ), + description: this._( 'Password of the Domain Administrator' ) + } + ]; + this._joinform = new umc.modules._join.Form({ + buttons: buttons, + widgets: widgets }); this._joinpane.addChild(this._joinform); @@ -745,6 +760,11 @@ this._job_polling_loop(true); this._page.startup(); // start event loop and data gathering + }, + + uninitialize: function() { - } + this.inherited(arguments); + this._refresh_time = 0; + });