From 3f63181ec3dc3bff8d030e086293e6eaa385b198 Mon Sep 17 00:00:00 2001 From: franzz Date: Sat, 6 Sep 2014 00:12:03 +0200 Subject: [PATCH] add link to tables in error messages --- inc/databap.php | 26 ++++++++++++++------------ inc/toolbox.php | 6 +++--- jquery/databap.js | 4 ++-- style/screen.css | 26 +++++++++++++------------- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/inc/databap.php b/inc/databap.php index 8e223b4..1f09a12 100644 --- a/inc/databap.php +++ b/inc/databap.php @@ -950,11 +950,10 @@ class Databap extends PhpObject //New table info $sTitle = mb_strtolower($bCreation?trim($sTitle):$asPrevTableInfo['title']); $sDescription = mb_strtolower(trim($sDescription)); - $sRightTableLink = 'table '.self::getTableFormat($sTitle).''; //Check for existing table with the same name - if($bCreation && $this->checkValue(self::TABL_TABLE, array('title'=>$sTitle))) $sDesc = 'Une documentation existe déjà pour la '.$sRightTableLink; - elseif(!$bCreation && $iPrevTableId!=$this->getUpToDateId(self::TABL_TABLE, $sTitle)) $sDesc = 'Une version plus récente de cette documentation existe : '.$sRightTableLink; + if($bCreation && $this->checkValue(self::TABL_TABLE, array('title'=>$sTitle))) $sDesc = ToolBox::findReplaceLinks('Une documentation existe déjà pour la table '.self::getTableFormat($sTitle)); + elseif(!$bCreation && $iPrevTableId!=$this->getUpToDateId(self::TABL_TABLE, $sTitle)) $sDesc = ToolBox::findReplaceLinks('Une version plus récente de la table '.self::getTableFormat($sTitle).' existe'); elseif(!$bSimul) { //Load table into database @@ -999,8 +998,8 @@ class Databap extends PhpObject $asTable['company'] = $asUser['company']; //Out of date warning - $sRightTableLink = 'table '.self::getTableFormat($asTable['title']).''; - $asTable['warning'] = ($bReadById && $iTableId!=$this->getUpToDateId(self::TABL_TABLE, $iTableId))?'Il existe une documentation plus à jour pour la '.$sRightTableLink:''; + $sRightTableLink = ToolBox::findReplaceLinks('Il existe une documentation plus à jour pour la table '.self::getTableFormat($asTable['title'])); + $asTable['warning'] = ($bReadById && $iTableId!=$this->getUpToDateId(self::TABL_TABLE, $iTableId))?$sRightTableLink:''; } else $sDesc = self::NOT_FOUND; @@ -1151,14 +1150,17 @@ class Databap extends PhpObject private function getTableInfo($iTableId, $bFormatting=true) { $asTable = $this->oMySql->selectRow(self::TABL_TABLE, $iTableId); - $asTable['timestamp'] = strtotime($asTable['led']); - if($bFormatting) + if(!empty($asTable)) { - $asTable['system'] = self::getTableFormat($asTable['system']); - $asTable['title'] = self::getTableFormat($asTable['title']); - $asTable['description'] = self::getDescriptionFormat($asTable['description']); - $asTable['led'] = self::getDateFormat($asTable['led']); - $asTable['formatted_keywords'] = str_replace("\n", '
', ToolBox::findReplaceLinks($asTable['keywords'])); + $asTable['timestamp'] = strtotime($asTable['led']); + if($bFormatting) + { + $asTable['system'] = self::getTableFormat($asTable['system']); + $asTable['title'] = self::getTableFormat($asTable['title']); + $asTable['description'] = self::getDescriptionFormat($asTable['description']); + $asTable['led'] = self::getDateFormat($asTable['led']); + $asTable['formatted_keywords'] = str_replace("\n", '
', ToolBox::findReplaceLinks($asTable['keywords'])); + } } return $asTable; } diff --git a/inc/toolbox.php b/inc/toolbox.php index fb8f2cd..c1c27da 100644 --- a/inc/toolbox.php +++ b/inc/toolbox.php @@ -276,8 +276,8 @@ class ToolBox //Phase 3: Rebuild link $asPatterns = array(); - $sPreChar = '(^|\ |\*|\')'; - $sPostChar = '(\ |\.|\:|$)'; + $sPreChar = '(^|\ |\*|\'|\()'; + $sPostChar = '(\ |\.|\:|\)|$)'; foreach($asReplacements as $sHash=>$sPage) { if(mb_strlen($sHash)>1) @@ -288,7 +288,7 @@ class ToolBox $asPatterns['`'.$sPreChar.$sHash.'\ ([\d]+)'.$sPostChar.'`mui'] = '$1'.$sTitle.'$2$3'; //Type + phrase - if($sPage=='table') $asPatterns['`'.$sPreChar.'(?i)'.$sHash.'(?-i)\ ([_A-Z0-9]+)'.$sPostChar.'`mu'] = '$1'.$sTitle.' $2$3'; + if($sPage=='table') $asPatterns['`'.$sPreChar.'(?i)'.$sHash.'(?-i)\ ([_A-Z0-9\*\/]+)'.$sPostChar.'`mu'] = '$1'.$sTitle.' $2$3'; } } $sText = preg_replace(array_keys($asPatterns), array_values($asPatterns), $sText); diff --git a/jquery/databap.js b/jquery/databap.js index 178d92e..a2b8301 100644 --- a/jquery/databap.js +++ b/jquery/databap.js @@ -840,14 +840,14 @@ function Databap() this.addMsgBefore = function(msg, msgClass, elem) { - var $msg = $('

', {'class':msgClass}).append($('', {'class':'fa fa-inline'})).append(msg); + var $msg = $('

', {'class':msgClass}).append($('', {'class':'fa fa-inline fa-c-'+msgClass})).append(msg); $msg.hide().insertBefore(elem).slideDown('fast', function(){databap.updateScrollBar('bottom');}).delay(5000).slideUp('fast', function(){$(this).remove();databap.updateScrollBar();}); }; this.feedback = function(sClass, sMsg) { $('', {'class':'feedback '+sClass}) - .append($('', {'class':'fa fa-inline'})) + .append($('', {'class':'fa fa-inline fa-c-'+sClass})) .append(self.addPunctuation(sMsg)) .appendTo('#title_feedback') .slideDown('fast') diff --git a/style/screen.css b/style/screen.css index 2084bcd..f05f89a 100644 --- a/style/screen.css +++ b/style/screen.css @@ -652,20 +652,31 @@ vertical-align 0% -5% -10% -15% -20% -25% -30% content: "\f191"; } +.fa-c-success:before, .fa-c-ok:before, .available .fa:before { + content: "\f00c"; +} + .fa-c-warning { color:#EFAB00; } -.fa-c-warning:before, .warning .fa:before { +.fa-c-warning:before { content: "\f071"; } .fa-c-error { color:red; } -.fa-c-error:before, .error .fa:before { +.fa-c-error:before { content: "\f071"; } +.fa-c-ko { + color:red; +} +.fa-c-ko:before, .unavailable .fa:before { + content: "\f00d"; +} + .fa-c-search:before { content: "\f002"; } @@ -674,17 +685,6 @@ vertical-align 0% -5% -10% -15% -20% -25% -30% content: /*"\f087"*/"\f015"; } -.fa-c-ok:before, .available .fa:before, .success .fa:before { - content: "\f00c"; -} - -.fa-c-ko { - color:red; -} -.fa-c-ko:before, .unavailable .fa:before { - content: "\f00d"; -} - .fa-c-loading:before { content: "\f110"; }