add link to tables in error messages
This commit is contained in:
@@ -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 = '<a href="'.$this->getInternalLink('table', $sTitle).'" target="_blank">table '.self::getTableFormat($sTitle).'</a>';
|
||||
|
||||
//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 = '<a href="'.$this->getInternalLink('table', $asTable['title']).'" target="_blank">table '.self::getTableFormat($asTable['title']).'</a>';
|
||||
$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", '<br />', 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", '<br />', ToolBox::findReplaceLinks($asTable['keywords']));
|
||||
}
|
||||
}
|
||||
return $asTable;
|
||||
}
|
||||
|
||||
@@ -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<a href="#'.$sPage.'-$2" target="_blank" class="internal_link round"><i class="fa fa-inline fa-c-'.$sPage.'"></i><span class="type">'.$sTitle.'</span> n°<span class="item">$2</span></a>$3';
|
||||
|
||||
//Type + phrase
|
||||
if($sPage=='table') $asPatterns['`'.$sPreChar.'(?i)'.$sHash.'(?-i)\ ([_A-Z0-9]+)'.$sPostChar.'`mu'] = '$1<a href="#'.$sPage.'-$2" target="_blank" class="internal_link round"><i class="fa fa-inline fa-c-'.$sPage.'"></i><span class="type">'.$sTitle.'</span> <span class="item">$2</span></a>$3';
|
||||
if($sPage=='table') $asPatterns['`'.$sPreChar.'(?i)'.$sHash.'(?-i)\ ([_A-Z0-9\*\/]+)'.$sPostChar.'`mu'] = '$1<a href="#'.$sPage.'-$2" target="_blank" class="internal_link round"><i class="fa fa-inline fa-c-'.$sPage.'"></i><span class="type">'.$sTitle.'</span> <span class="item">$2</span></a>$3';
|
||||
}
|
||||
}
|
||||
$sText = preg_replace(array_keys($asPatterns), array_values($asPatterns), $sText);
|
||||
|
||||
Reference in New Issue
Block a user