cvs: doc-editor /install doc-editor.sql firstRun.php /js main.js /js/locale fr.js /php ExtJsController.php class.php /themes style.css
/themes/img block-bottom.gif block-top.gif

From: Date: Thu, 16 Apr 2009 17:41:14 +0000
Subject: cvs: doc-editor /install doc-editor.sql firstRun.php /js main.js /js/locale fr.js /php ExtJsController.php class.php /themes style.css
/themes/img block-bottom.gif block-top.gif
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3753@lists.php.net to get a copy of this message
yannick Thu Apr 16 17:41:14 2009 UTC Modified files: /doc-editor/install doc-editor.sql firstRun.php /doc-editor/js/locale fr.js /doc-editor/js main.js /doc-editor/php class.php ExtJsController.php /doc-editor/themes/img block-bottom.gif block-top.gif /doc-editor/themes style.css Log: # DB : Add project table into DB in order to store the last update date/time and to prepare the next step (add pear project) # DB : Add project field to all table witch need one (except users table) # Add last update Date/time under "Connected as" in the main tab # Check si an update is in progress before start a new one # Update fr i18n Warning : you need to update your DB table after this commit

http://cvs.php.net/viewvc.cgi/doc-editor/install/doc-editor.sql?r1=1.3&r2=1.4&diff_format=u Index: doc-editor/install/doc-editor.sql diff -u doc-editor/install/doc-editor.sql:1.3 doc-editor/install/doc-editor.sql:1.4 --- doc-editor/install/doc-editor.sql:1.3 Mon Mar 30 21:42:17 2009 +++ doc-editor/install/doc-editor.sql Thu Apr 16 17:41:14 2009 @@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS `commitMessage` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `text` text NOT NULL, `userID` int(10) unsigned NOT NULL, KEY `id` (`id`) @@ -26,6 +27,7 @@ CREATE TABLE IF NOT EXISTS `dirs` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `parentDir` int(11) NOT NULL, `name` varchar(255) NOT NULL, KEY `id` (`id`) @@ -39,6 +41,7 @@ CREATE TABLE IF NOT EXISTS `errorfiles` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `lang` varchar(10) NOT NULL, `path` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, @@ -57,6 +60,7 @@ CREATE TABLE IF NOT EXISTS `files` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `lang` varchar(10) NOT NULL, `xmlid` varchar(255) DEFAULT NULL, `dir` int(11) unsigned NOT NULL, @@ -91,6 +95,7 @@ CREATE TABLE IF NOT EXISTS `pendingCommit` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `lang` varchar(10) NOT NULL, `path` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, @@ -111,6 +116,7 @@ CREATE TABLE IF NOT EXISTS `pendingPatch` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `lang` varchar(10) NOT NULL, `path` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, @@ -124,11 +130,26 @@ -- -------------------------------------------------------- -- +-- Structure of table `project` +-- + +CREATE TABLE IF NOT EXISTS `project` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `lastupdate` datetime NOT NULL, + `by` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- -- Structure of table `translators` -- CREATE TABLE IF NOT EXISTS `translators` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `project` varchar(255) NOT NULL, `lang` varchar(255) NOT NULL, `nick` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, http://cvs.php.net/viewvc.cgi/doc-editor/install/firstRun.php?r1=1.1&r2=1.2&diff_format=u Index: doc-editor/install/firstRun.php diff -u doc-editor/install/firstRun.php:1.1 doc-editor/install/firstRun.php:1.2 --- doc-editor/install/firstRun.php:1.1 Sun Mar 29 21:09:23 2009 +++ doc-editor/install/firstRun.php Thu Apr 16 17:41:14 2009 @@ -44,6 +44,10 @@ // Parse translators $phpDoc->rev_parse_translation(); +// We update the last update date/time into DB +$phpDoc->set_last_update(); + + if ($isCLI) { echo "\n\nInstallation completed!\n"; } else { http://cvs.php.net/viewvc.cgi/doc-editor/js/locale/fr.js?r1=1.2&r2=1.3&diff_format=u Index: doc-editor/js/locale/fr.js diff -u doc-editor/js/locale/fr.js:1.2 doc-editor/js/locale/fr.js:1.3 --- doc-editor/js/locale/fr.js:1.2 Wed Apr 15 14:59:59 2009 +++ doc-editor/js/locale/fr.js Thu Apr 16 17:41:14 2009 @@ -106,6 +106,15 @@ i18n["Expand"] = "Déplier ce dossier"; i18n["Open the same file in <b>{0}</b>"] = "Ouvrir le même fichier en <b>{0}</b>"; i18n["Repository"] = "Dépôt Cvs"; +i18n["Last data update: <em id=\"lastUpdateTime\">{0}</em>"] = "Dernière mise à jour : <em id=\"lastUpdateTime\">{0}</em>"; +i18n["update in progress..."] = "Mise en jour en cours..."; +i18n["Verify if there is an update in progress. Please, wait..."] = "Vérification de l\'état de la mise à jour. Merci de patienter..."; +i18n["There is currently an update in progress.<br/>You can\'t perform an update now."] = "Il y a actuellement une mise à jour en cours.<br/>Vous ne pouvez pas l\'effectuer maintenant"; +i18n[""] = ""; +i18n[""] = ""; +i18n[""] = ""; + + // Main Menu i18n["Main Menu"] = "Menu principal"; http://cvs.php.net/viewvc.cgi/doc-editor/js/main.js?r1=1.31&r2=1.32&diff_format=u Index: doc-editor/js/main.js diff -u doc-editor/js/main.js:1.31 doc-editor/js/main.js:1.32 --- doc-editor/js/main.js:1.31 Wed Apr 15 14:59:59 2009 +++ doc-editor/js/main.js Thu Apr 16 17:41:14 2009 @@ -925,19 +925,6 @@ }] }); win.show(); - /* - var o, i; - - o = Ext.util.JSON.decode(action.responseText); - this.filePendingOpen = []; - - for (i = 0; i < o.files.length; i = i + 1) { - this.filePendingOpen[i] = ['en' + path, o.files[i].name]; - } - - // Start the first - this.openFile(this.filePendingOpen[0][0], this.filePendingOpen[0][1]); - */ } }); @@ -2389,6 +2376,9 @@ // Desable the close button for this win win.tools.close.setVisible(false); + // Set 'in progress' + Ext.getDom('lastUpdateTime').innerHTML = _('update in progress...'); + // Start Step 1 RefreshStep1(this); @@ -2397,7 +2387,37 @@ }); } - win.show(btn); + + // We test if there is an update in progress or not + Ext.getBody().mask('<img src="themes/img/loading.gif" style="vertical-align: middle;" /> '+_('Verify if there is an update in progress. Please, wait...')); + + Ext.Ajax.request({ + url: './php/controller.php', + params: { + task: 'get-last-update' + }, + success: function(r){ + + // Remove wait msg + Ext.getBody().unmask(); + + var o = Ext.util.JSON.decode(r.responseText); + + if( o.lastupdate === 'in_progress' ) { + Ext.MessageBox.show({ + title: _('Status'), + msg: _('There is currently an update in progress.<br/>You can\'t perform an update now.'), + buttons: Ext.MessageBox.OK, + icon: Ext.MessageBox.INFO + }); + } else { + win.show(btn); + } + + + } + }); + }, // Winupdate WinCheckBuild: function(){ @@ -3110,8 +3130,20 @@ }, success: function(r){ - if (r.responseText !== 'pong') { + var o = Ext.util.JSON.decode(r.responseText); + if (o.ping !== 'pong') { window.location.href = './'; + } else { + + if( o.lastupdate === 'in_progress' ) { + Ext.getDom('lastUpdateTime').innerHTML = _('update in progress...'); + } else { + var dt = Date.parseDate(o.lastupdate, "Y-m-d H:i:s"); + + // We update the lastupdate date/time + Ext.getDom('lastUpdateTime').innerHTML = dt.format('Y-m-d, H:i'); + } + } }, failure: function(){ @@ -3119,10 +3151,10 @@ } }); - this.TaskPing.delay(30000); + this.TaskPing.delay(3000); }, this); - this.TaskPing.delay(30000); // start after 1 minute. + this.TaskPing.delay(3000); // start after 1 minute. // Grid : Files in Error gridFilesError = new Ext.grid.GridPanel({ store: this.storeFilesError, @@ -6066,7 +6098,7 @@ width: 140, sortable: true, dataIndex: 'pubDate', - renderer: Ext.util.Format.dateRenderer('Y/m/d, H:i') + renderer: Ext.util.Format.dateRenderer('d/m/Y, H:i') }], autoScroll: true, height: 400, @@ -6925,6 +6957,8 @@ '<div class="res-block-inner">' + '<h3>'+ String.format(_('Connected as <em>{0}</em>'), this.userLogin) + + '<br/><br/>'+ + String.format(_('Last data update: <em id="lastUpdateTime">{0}</em>'), '-') + '</h3>' + '</div>' + '</div>' http://cvs.php.net/viewvc.cgi/doc-editor/php/class.php?r1=1.30&r2=1.31&diff_format=u Index: doc-editor/php/class.php diff -u doc-editor/php/class.php:1.30 doc-editor/php/class.php:1.31 --- doc-editor/php/class.php:1.30 Wed Apr 15 15:51:07 2009 +++ doc-editor/php/class.php Thu Apr 16 17:41:14 2009 @@ -4078,4 +4078,50 @@ return $node; } // get_Check_Doc_Files + /** + * Get the last update datetime + * @return The last update datetime or "in_progress" if the update is in progress + */ + function get_last_update() + { + // Test is there is an update in progress + $lock_update = new LockFile('lock_update_repository'); + $lock_apply = new LockFile('lock_apply_tools'); + + if( $lock_update->isLocked() || $lock_apply->isLocked() ) { return array('lastupdate'=>'in_progress', 'by'=>'-'); } + else { + + $s = 'SELECT lastupdate, `by` FROM `project` WHERE `name`="php"'; + $r = $this->db->query($s); + $a = $r->fetch_assoc(); + + return $a; + + } + + + } // get_last_update + + /** + * Set the last update datetime into DB + * @return Nothing + */ + function set_last_update() + { + + $s = 'SELECT lastupdate, `by` FROM `project` WHERE `name`="php"'; + $r = $this->db->query($s); + $nb = $r->num_rows; + + if( $nb == 0 ) { + $s = 'INSERT INTO `project` (`name`, `lastupdate`, `by`) VALUES (\'php\', now(), \''.( ( isset($this->cvsLogin ) ) ? $this->cvsLogin : '-' ).'\')'; + } else { + $s = 'UPDATE `project` SET `lastupdate`=now(), `by`=\''.( ( isset($this->cvsLogin ) ) ? $this->cvsLogin : '-' ).'\' WHERE `name`=\'php\''; + } + $r = $this->db->query($s); + + return; + + } // get_last_update + } // End of class http://cvs.php.net/viewvc.cgi/doc-editor/php/ExtJsController.php?r1=1.10&r2=1.11&diff_format=u Index: doc-editor/php/ExtJsController.php diff -u doc-editor/php/ExtJsController.php:1.10 doc-editor/php/ExtJsController.php:1.11 --- doc-editor/php/ExtJsController.php:1.10 Wed Apr 15 09:55:29 2009 +++ doc-editor/php/ExtJsController.php Thu Apr 16 17:41:14 2009 @@ -162,6 +162,9 @@ // Parse translators $this->phpDoc->rev_parse_translation(); + // Set lastUpdate date/time + $this->phpDoc->set_last_update(); + // Check errors in files // $tool = new ToolsError($_SESSION['lang']); // $tool->run('/'); @@ -219,7 +222,13 @@ */ public function ping() { - return !isset($_SESSION['userID']) ? 'false' : 'pong'; + $this->phpDoc->isLogged(); + $r = $this->phpDoc->get_last_update(); + + $response = !isset($_SESSION['userID']) ? 'false' : 'pong'; + + return $this->getResponse(array('ping' => $response, 'lastupdate' => $r['lastupdate'], 'by' => $r['by'])); + } //NEW @@ -849,4 +858,12 @@ return ''; } + public function get_last_update() { + + $this->phpDoc->isLogged(); + $r = $this->phpDoc->get_last_update(); + + return $this->getResponse(array('success' => true, 'lastupdate' => $r['lastupdate'])); + } + } \ No newline at end of file http://cvs.php.net/viewvc.cgi/doc-editor/themes/img/block-bottom.gif?r1=1.1&r2=1.2&diff_format=u Index: doc-editor/themes/img/block-bottom.gif http://cvs.php.net/viewvc.cgi/doc-editor/themes/img/block-top.gif?r1=1.1&r2=1.2&diff_format=u Index: doc-editor/themes/img/block-top.gif http://cvs.php.net/viewvc.cgi/doc-editor/themes/style.css?r1=1.8&r2=1.9&diff_format=u Index: doc-editor/themes/style.css diff -u doc-editor/themes/style.css:1.8 doc-editor/themes/style.css:1.9 --- doc-editor/themes/style.css:1.8 Wed Apr 15 14:59:59 2009 +++ doc-editor/themes/style.css Thu Apr 16 17:41:14 2009 @@ -414,7 +414,7 @@ background: transparent url(../themes/img/block-top.gif) no-repeat scroll 0 0; margin-bottom: 15px; padding-top: 5px; - width: 210px; + width: 280px; } .res-block-inner { background: transparent url(../themes/img/block-bottom.gif) no-repeat scroll left bottom; padding: 3px 11px;
« previous php.doc.cvs (#3753) next »