aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2012-07-28 10:56:06 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2012-07-28 10:56:06 +0000
commit3081877cf551efbf0da8a573f80606e04b629a38 (patch)
tree6534eb89b44346eec5037e98e864a53cbacf8438 /h-source/Application
parenta214e6553572eaba8bab16e4234c6b0e345a2de1 (diff)
improved the way wiki pages are linked
Diffstat (limited to 'h-source/Application')
-rw-r--r--h-source/Application/Controllers/WikiController.php10
-rw-r--r--h-source/Application/Models/WikiModel.php21
-rw-r--r--h-source/Application/Views/Desktop/Wiki/history.php4
-rw-r--r--h-source/Application/Views/Desktop/Wiki/page.php2
-rw-r--r--h-source/Application/Views/Desktop/Wiki/talk.php2
5 files changed, 25 insertions, 14 deletions
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 72f4220..7a0cd4d 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -313,7 +313,7 @@ class WikiController extends BaseController
$data['id_wiki'] = (int)$data['table'][0]['wiki_revisions']['id_wiki'];
$data['isDeleted'] = $this->m['WikiModel']->isDeleted($data['id_wiki']);
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($data['id_wiki']);
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Revision');
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($data['id_wiki'])."'>".$data['tree_name']."</a>"." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Revision');
$data['created_by'] = $data['table'][0]['wiki_revisions']['created_by'];
$data['update_date'] = $data['table'][0]['wiki_revisions']['update_date'];
@@ -337,7 +337,7 @@ class WikiController extends BaseController
$data['id_wiki'] = $clean['id_wiki'];
$tree_name = $this->m['WikiModel']->getTheModelName((int)$clean['id_wiki']);
$data['tree_name'] = $tree_name;
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Differences');
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($clean['id_wiki'])."'>".$data['tree_name']."</a>" ." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Differences');
$data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
$data['showDiff'] = false;
@@ -420,7 +420,7 @@ class WikiController extends BaseController
$data['id_wiki'] = $clean['id_wiki'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
$data['name'] = $data['tree_name'];
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($clean['id_wiki']) . " &raquo; " . gtext('Make current');
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($clean['id_wiki'])."'>".$data['tree_name']."</a>"." &raquo; " . $this->getHistoryLink($clean['id_wiki']) . " &raquo; " . gtext('Make current');
$data['notice'] = null;
$this->s['registered']->checkStatus();
@@ -472,7 +472,7 @@ class WikiController extends BaseController
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id_wiki']);
$data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
- $data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; ".gtext('Talk');
+ $data['tree'] = $this->getSpecPageLink() . " &raquo; " . "<a href='".$this->m['WikiModel']->toWikiPage($clean['id_wiki'])."'>".$data['tree_name']."</a>"." &raquo; ".gtext('Talk');
if (isset($_POST['insertAction']))
{
@@ -531,7 +531,7 @@ class WikiController extends BaseController
$this->m['WikiModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
$data['table'] = $this->m['WikiModel']->send();
-
+
$data['pageList'] = $this->h['Pages']->render($page-7,15);
$this->append($data);
diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php
index dd8d5a6..7357705 100644
--- a/h-source/Application/Models/WikiModel.php
+++ b/h-source/Application/Models/WikiModel.php
@@ -223,12 +223,23 @@ class WikiModel extends Model_Map {
}
//get the model name
- public function getTheModelName($id)
+ public function getTheModelName($id, $cleaned = false)
{
$clean['id'] = (int)$id;
$this->setWhereQueryClause(array('id_wiki' => $clean['id']));
- $res = $this->getFields('title');
- $name = count($res) > 0 ? $res[0]['wiki']['title'] : '';
+ $res = $this->getFields('title,title_clean');
+ $name = '';
+ if (count($res) > 0)
+ {
+ if ($cleaned)
+ {
+ $name = $res[0]['wiki']['title_clean'];
+ }
+ else
+ {
+ $name = $res[0]['wiki']['title'];
+ }
+ }
return $name;
}
@@ -297,8 +308,8 @@ class WikiModel extends Model_Map {
public function toWikiPage($id)
{
$clean['id'] = (int)$id;
- $title = $this->getTheModelName($clean['id']);
- return "http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".encodeUrl($title);
+ $title = $this->getTheModelName($clean['id'], true);
+ return "http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".$title;
}
public function getDiffArray($oldArray, $newArray)
diff --git a/h-source/Application/Views/Desktop/Wiki/history.php b/h-source/Application/Views/Desktop/Wiki/history.php
index e8180f5..08fa4ac 100644
--- a/h-source/Application/Views/Desktop/Wiki/history.php
+++ b/h-source/Application/Views/Desktop/Wiki/history.php
@@ -25,7 +25,7 @@
<?php if (!$isDeleted) { ?>
<div class="position_tree_box">
- <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($tree_name);?>"><?php echo $tree_name;?></a> &raquo; <?php echo gtext('History');?>
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang";?>">Wiki</a> &raquo; <a href="<?php echo $wiki->toWikiPage($id);?>"><?php echo $tree_name;?></a> &raquo; <?php echo gtext('History');?>
</div>
<div class="notebook_view_title">
@@ -33,7 +33,7 @@
</div>
<div class="notebook_insert_link">
- <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/".encodeUrl($tree_name);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $wiki->toWikiPage($id);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
</div>
<div class="wiki_external_box">
diff --git a/h-source/Application/Views/Desktop/Wiki/page.php b/h-source/Application/Views/Desktop/Wiki/page.php
index 1716edc..6e016e2 100644
--- a/h-source/Application/Views/Desktop/Wiki/page.php
+++ b/h-source/Application/Views/Desktop/Wiki/page.php
@@ -125,7 +125,7 @@
<!--if revision-->
<?php if (strcmp($this->action,'revision') === 0) { ?>
<div class="revision_alert">
- <?php echo gtext("This is an old revision of this page, as edited by");?> <b><?php echo $u->getLinkToUserFromId($created_by);?></b> <?php echo gtext('at');?> <b><?php echo smartDate($update_date); ?></b>. <?php echo gtext("It may differ significantly from the");?> <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($tree_name);?>"><?php echo gtext("Current revision");?></a></a>.
+ <?php echo gtext("This is an old revision of this page, as edited by");?> <b><?php echo $u->getLinkToUserFromId($created_by);?></b> <?php echo gtext('at');?> <b><?php echo smartDate($update_date); ?></b>. <?php echo gtext("It may differ significantly from the");?> <a href="<?php echo $wiki->toWikiPage($id_wiki);?>"><?php echo gtext("Current revision");?></a></a>.
</div>
<?php } ?>
diff --git a/h-source/Application/Views/Desktop/Wiki/talk.php b/h-source/Application/Views/Desktop/Wiki/talk.php
index 67947d2..4e93798 100644
--- a/h-source/Application/Views/Desktop/Wiki/talk.php
+++ b/h-source/Application/Views/Desktop/Wiki/talk.php
@@ -41,7 +41,7 @@
</div>
<div class="notebook_insert_link">
- <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/".encodeUrl($tree_name);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ <a title="Back to the page <?php echo $tree_name;?>" href="<?php echo $wiki->toWikiPage($id_wiki);?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
</div>
<?php if (!$isDeleted) { ?>