aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-02-15 17:06:09 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-02-15 17:06:09 +0000
commit4a27b517fc52dde60e5c1837860e4785317490a6 (patch)
tree73b91c5d212f1bb67eb83fea9694cf8d1a360846
parentd85570c9946aef61d8d935d9f50169215338d665 (diff)
improved wiki
-rw-r--r--h-source/Application/Controllers/BaseController.php6
-rw-r--r--h-source/Application/Controllers/HistoryController.php59
-rw-r--r--h-source/Application/Controllers/LastController.php2
-rw-r--r--h-source/Application/Controllers/WikiController.php76
-rw-r--r--h-source/Application/Include/languages.php13
-rw-r--r--h-source/Application/Include/myFunctions.php7
-rw-r--r--h-source/Application/Models/IssuesModel.php4
-rw-r--r--h-source/Application/Models/MessagesModel.php5
-rw-r--r--h-source/Application/Models/TalkModel.php5
-rwxr-xr-xh-source/Application/Models/UsersModel.php5
-rw-r--r--h-source/Application/Models/WikiModel.php38
-rw-r--r--h-source/Application/Models/WikitalkModel.php5
-rw-r--r--h-source/Application/Views/Last/modifications.php2
-rw-r--r--h-source/Application/Views/Wiki/form.php10
-rw-r--r--h-source/Application/Views/Wiki/history.php2
-rw-r--r--h-source/Application/Views/Wiki/modifications.php45
-rw-r--r--h-source/Application/Views/Wiki/page.php36
-rw-r--r--h-source/Application/Views/Wiki/pages.php45
-rw-r--r--h-source/Application/Views/Wiki/talk.php163
-rw-r--r--h-source/Application/Views/header.php1
-rw-r--r--h-source/Application/Views/right.php9
-rw-r--r--h-source/Config/Route.php4
-rw-r--r--h-source/Public/Css/main.css6
-rwxr-xr-xh-source/Public/Img/Crystal/lock.pngbin0 -> 3604 bytes
-rwxr-xr-xh-source/Public/Img/Crystal/unlock.pngbin0 -> 3995 bytes
-rw-r--r--h-source/tables.sql5
26 files changed, 453 insertions, 100 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 29d0642..5340954 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -25,6 +25,7 @@ class BaseController extends Controller
protected $lang;
protected $ismoderator = false;
+ protected $isadmin = false;
protected $querySanitized = true;
protected $token = 'token';
@@ -59,6 +60,7 @@ class BaseController extends Controller
$data['islogged'] = 'no';
$data['token'] = 'token';
$data['ismoderator'] = false;
+ $data['isadmin'] = false;
if ($this->s['registered']->status['status'] === 'logged')
{
@@ -66,8 +68,12 @@ class BaseController extends Controller
$data['islogged'] = 'yes';
$data['token'] = $this->s['registered']->status['token'];
$this->token = $data['token'];
+
$data['ismoderator'] = in_array('moderator',$this->s['registered']->status['groups']) ? true : false;
$this->ismoderator = $data['ismoderator'];
+
+ $data['isadmin'] = in_array('admin',$this->s['registered']->status['groups']) ? true : false;
+ $this->isadmin = $data['isadmin'];
}
$data['lang'] = 'en';
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index cc4b3d0..2154a0e 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -84,6 +84,26 @@ class HistoryController extends BaseController
'error_string' => 'Error: the issue is already closed',
),
+
+ 'pageblock' => array(
+
+ 'action' => 'pageblock',
+ 'check_status' => 'no',
+ 'to_status' => 'yes',
+ 'exec_string' => 'The wiki page has been blocked. Just reload the page',
+ 'error_string' => 'Error: the wiki page is already blocked',
+
+ ),
+
+ 'pageunblock' => array(
+
+ 'action' => 'pageunblock',
+ 'check_status' => 'yes',
+ 'to_status' => 'no',
+ 'exec_string' => 'The wiki page is no more blocked. Just reload the page',
+ 'error_string' => 'Error: the wiki page is already un-blocked',
+
+ ),
);
@@ -143,7 +163,17 @@ class HistoryController extends BaseController
'group' => 'moderator',
),
-
+
+ 'page' => array(
+
+ 'clean_type' => 'page',
+ 'model_name' => 'WikiModel',
+ 'id_name' => 'id_wiki',
+ 'field_name' => 'blocked',
+ 'actions' => array('pageblock','pageunblock'),
+ 'group' => 'admin',
+
+ ),
);
public function __construct($model, $controller, $queryString)
@@ -184,6 +214,16 @@ class HistoryController extends BaseController
{
$this->generic($lang, $token, 'close');
}
+
+ public function pageblock($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'pageblock');
+ }
+
+ public function pageunblock($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'pageunblock');
+ }
protected function generic($lang = 'en', $token = '', $action = 'hide')
{
@@ -232,7 +272,7 @@ class HistoryController extends BaseController
{
//hide the message
$model->values = array($clean['field_name'] => $this->strings[$action]['to_status']);
- $model->update($clean['id']);
+ $model->pUpdate($clean['id']);
if ($model->queryResult)
{
@@ -289,6 +329,10 @@ class HistoryController extends BaseController
$data['object'] = 'user';
$data['box_class'] = 'details_of_actions_inner_user';
break;
+ case 'page':
+ $data['object'] = 'wiki page';
+ $data['box_class'] = 'details_of_actions_inner_user';
+ break;
case 'issue':
$data['object'] = 'issue';
$data['box_class'] = 'details_of_actions_inner_user';
@@ -301,7 +345,16 @@ class HistoryController extends BaseController
$data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type'],'gr'=>$clean['group']))->send();
- $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked','open'=>'opened again','close'=>'closed');
+ $data['md_action'] = array(
+ 'hide' => 'hidden',
+ 'show' => 'restored',
+ 'block' => 'blocked',
+ 'unblock' => 'un-blocked',
+ 'open' => 'opened again',
+ 'close' => 'closed',
+ 'pageblock' => 'blocked',
+ 'pageunblock' => 'un-blocked',
+ );
$this->append($data);
$this->load('viewall');
diff --git a/h-source/Application/Controllers/LastController.php b/h-source/Application/Controllers/LastController.php
index c357c1a..6fe66a2 100644
--- a/h-source/Application/Controllers/LastController.php
+++ b/h-source/Application/Controllers/LastController.php
@@ -29,7 +29,7 @@ class LastController extends BaseController
$this->model('HistoryModel');
- $data['title'] = 'last - '.Website::$generalName;
+ $data['title'] = gtext('last modifications').' - '.Website::$generalName;
$this->append($data);
$this->setArgKeys(array('page:forceNat'=>1));
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 1c4c154..65a615a 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -100,6 +100,8 @@ class WikiController extends BaseController
{
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
$deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
@@ -161,7 +163,8 @@ class WikiController extends BaseController
$clean['title_clean'] = sanitizeAll($title_clean);
$data['isDeleted'] = 'no';
-
+ $data['isBlocked'] = false;
+
if (isset($title_clean))
{
$res = $this->m['WikiModel']->select()->where(array('title_clean'=>$clean['title_clean']))->orderBy('id_wiki desc')->limit(1)->send();
@@ -172,6 +175,7 @@ class WikiController extends BaseController
$data['tree_name'] = $res[0]['wiki']['title'];
$data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
$data['isDeleted'] = $res[0]['wiki']['deleted'];
+ $data['isBlocked'] = $this->m['WikiModel']->isBlocked($res[0]['wiki']['id_wiki']);
if ( count($res) < 2 )
{
@@ -205,11 +209,14 @@ class WikiController extends BaseController
{
$this->redirect('wiki/page/'.$this->lang.'/Main-Page');
}
+
+ $data['md_javascript'] = "moderator_dialog(\"pageblock\",\"page\");moderator_dialog(\"pageunblock\",\"page\");";
$this->append($data);
$this->load($viewFile);
$this->load('bottom_left');
+ $this->load('moderator_dialog');
$this->right();
}
@@ -225,6 +232,7 @@ class WikiController extends BaseController
$clean['id'] = (int)$id;
$data['id'] = $clean['id'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id']);
+ $data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id']);
$data['title'] = 'history - '.Website::$generalName;
@@ -285,6 +293,7 @@ class WikiController extends BaseController
if (count($data['table']) > 0)
{
$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');
@@ -400,8 +409,9 @@ class WikiController extends BaseController
if ($this->s['registered']->status['status'] === 'logged')
{
-
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
if (isset($_POST['confirmAction']))
{
@@ -442,6 +452,7 @@ class WikiController extends BaseController
$clean['id_wiki'] = (int)$id_wiki;
$data['id_wiki'] = $clean['id_wiki'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
+ $data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id_wiki']);
$data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; ".gtext('Talk');
if (isset($_POST['insertAction']))
@@ -449,6 +460,8 @@ class WikiController extends BaseController
if ($this->s['registered']->status['status'] === 'logged')
{
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
+
+ if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
$this->m['WikitalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
$this->m['WikitalkModel']->values['id_wiki'] = $clean['id_wiki'];
@@ -476,7 +489,64 @@ class WikiController extends BaseController
$this->load('talk');
$this->load('moderator_dialog');
$this->right();
-// $this->loadViewAll('talk,moderator_dialog');
+ }
+
+ public function pages($lang = 'en')
+ {
+ $data['title'] = gtext('list of pages').' - '.Website::$generalName;
+
+ $this->setArgKeys(array('page:forceNat'=>1));
+
+ $this->shift(1);
+
+ $this->helper('Pages','wiki/pages/'.$this->lang,'page');
+
+ $this->m['WikiModel']->clear()->select()->where(array('-deleted'=>'no'))->orderBy('id_wiki desc');
+
+ $recordNumber = $this->m['WikiModel']->rowNumber();
+ $page = $this->viewArgs['page'];
+
+ $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);
+ $this->load('pages');
+ $this->right();
+ }
+
+ //print all the modifications to the wiki
+ public function modifications($lang = 'en')
+ {
+ $data['title'] = gtext('last modifications').' - '.Website::$generalName;
+
+ $this->setArgKeys(array('page:forceNat'=>1));
+
+ $this->shift(1);
+
+ $whereClauseArray = array(
+ 'gr' => 'registered',
+ 'type' => 'wiki',
+ );
+
+ $this->helper('Pages','wiki/modifications/'.$this->lang,'page');
+
+ $this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc');
+
+ $recordNumber = $this->m['HistoryModel']->rowNumber();
+ $page = $this->viewArgs['page'];
+
+ $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
+
+ $data['table'] = $this->m['HistoryModel']->send();
+
+ $data['pageList'] = $this->h['Pages']->render($page-7,15);
+
+ $this->append($data);
+ $this->load('modifications');
+ $this->right();
}
protected function getViewLink($ne_name)
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index 692c214..0a8a728 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -175,8 +175,8 @@ class Lang
"at" => "alle ore",
"last modifications" => "ultime modifiche",
"watch all modifications" => "guarda tutte le modifiche",
- "title" => "titolo",
- "text of the wiki page" => "testo della pagina",
+ "the title" => "il titolo",
+ "the text of the wiki page" => "il testo della pagina",
"the wiki page has not been found" => "la pagina della wiki non è stata trovata",
"Page not-found" => "Pagina non trovata",
"Insert" => "Inserisci",
@@ -198,6 +198,13 @@ class Lang
"the page text is too length" => "il testo della pagina è troppo lungo",
"History of the wiki page" => "History della pagina della wiki",
"Would you like to insert it?" => "Vuoi inserirla?",
+ "Wiki modifications" => "Modifiche alla Wiki",
+ "List of the wiki modifications carried out by users" => "Lista delle modifiche apportate alla Wiki dagli utenti",
+ "list of pages" => "lista delle pagine",
+ "List of wiki pages" => "Lista delle pagine della wiki",
+ "This wiki page has been blocked" => "Questa pagina della wiki è stata bloccata",
+ "unblock the wiki page" => "sblocca la pagina",
+ "block the wiki page" => "blocca la pagina",
),
'es' => array
(
@@ -499,7 +506,7 @@ class Go
$urls = getUrlsFromIdHard($clean['idHard']);
return $urls['urlView'];
}
-
+
}
class MyStrings
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php
index 8299157..d2b54e7 100644
--- a/h-source/Application/Include/myFunctions.php
+++ b/h-source/Application/Include/myFunctions.php
@@ -195,6 +195,8 @@ function decodeWikiText($string)
$string = preg_replace('/(\[hr\])/', '<hr />',$string);
+ $string = preg_replace_callback('/(\[\[)(.*?)\|(.*?)(\]\])/', 'linkToInternalPageWithText' ,$string);
+
$string = preg_replace_callback('/(\[\[)(.*?)(\]\])/', 'linkToInternalPage' ,$string);
$string = preg_replace_callback('/(\[a\])(.*?)(\[\/a\])/', 'linkTo',$string);
@@ -276,6 +278,11 @@ function linkToInternalPage($match)
return "<a title = '".$match[2]."' href='http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".encodeUrl($match[2])."'>".$match[2]."</a>";
}
+function linkToInternalPageWithText($match)
+{
+ return "<a title = '".$match[2]."' href='http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".encodeUrl($match[2])."'>".$match[3]."</a>";
+}
+
function linkToWithText($match)
{
if (checkUrl($match[2]))
diff --git a/h-source/Application/Models/IssuesModel.php b/h-source/Application/Models/IssuesModel.php
index 4593bea..eec86be 100644
--- a/h-source/Application/Models/IssuesModel.php
+++ b/h-source/Application/Models/IssuesModel.php
@@ -99,4 +99,8 @@ class IssuesModel extends Model_Tree {
parent::__construct();
}
+ public function pUpdate($id)
+ {
+ return parent::update($id);
+ }
} \ No newline at end of file
diff --git a/h-source/Application/Models/MessagesModel.php b/h-source/Application/Models/MessagesModel.php
index 2417739..989facc 100644
--- a/h-source/Application/Models/MessagesModel.php
+++ b/h-source/Application/Models/MessagesModel.php
@@ -45,6 +45,11 @@ class MessagesModel extends Model_Tree {
parent::__construct();
}
+ public function pUpdate($id)
+ {
+ return parent::update($id);
+ }
+
public $formStruct = array(
'entries' => array(
'deleted' => array('type'=>'Select','options'=>'no,yes'),
diff --git a/h-source/Application/Models/TalkModel.php b/h-source/Application/Models/TalkModel.php
index e29e073..b98a5a4 100644
--- a/h-source/Application/Models/TalkModel.php
+++ b/h-source/Application/Models/TalkModel.php
@@ -43,6 +43,11 @@ class TalkModel extends Model_Tree {
parent::__construct();
}
+ public function pUpdate($id)
+ {
+ return parent::update($id);
+ }
+
public function insert()
{
if (parent::insert())
diff --git a/h-source/Application/Models/UsersModel.php b/h-source/Application/Models/UsersModel.php
index fe72ce7..d4ef745 100755
--- a/h-source/Application/Models/UsersModel.php
+++ b/h-source/Application/Models/UsersModel.php
@@ -59,6 +59,11 @@ class UsersModel extends Model_Map
$this->deleteNotRegistered();
}
+ public function pUpdate($id)
+ {
+ return parent::update($id);
+ }
+
public function deleteNotRegistered()
{
$limit = time() - Account::$confirmTime;
diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php
index 0a00bfb..6cdc632 100644
--- a/h-source/Application/Models/WikiModel.php
+++ b/h-source/Application/Models/WikiModel.php
@@ -37,7 +37,9 @@ class WikiModel extends Model_Map {
'username' => 'regusers',
'id_user' => 'regusers',
'has_confirmed' => 'regusers',
- 'deleted' => 'regusers'
+ 'deleted' => 'regusers',
+ '-deleted' => 'wiki',
+ '-blocked' => 'wiki',
);
$this->printAssError = "no";
@@ -70,6 +72,11 @@ class WikiModel extends Model_Map {
parent::__construct();
}
+ public function pUpdate($id)
+ {
+ return parent::update($id);
+ }
+
public function insert()
{
$this->values['created_by'] = (int)$this->id_user;
@@ -254,6 +261,35 @@ class WikiModel extends Model_Map {
return false;
}
+ public function isDeleted($id)
+ {
+ $clean['id'] = (int)$id;
+ $res = $this->select('wiki.deleted')->where(array('id_wiki'=>$clean['id']))->send();
+ if ( count($res) > 0 )
+ {
+ return $res[0]['wiki']['deleted'];
+ }
+ return 'no';
+ }
+
+ public function isBlocked($id)
+ {
+ $clean['id'] = (int)$id;
+ $res = $this->select('blocked')->where(array('id_wiki'=>$clean['id']))->send();
+ if ( count($res) > 0 )
+ {
+ return strcmp($res[0]['wiki']['blocked'],'no') === 0 ? false : true;
+ }
+ return false;
+ }
+
+ public function toWikiPage($id)
+ {
+ $clean['id'] = (int)$id;
+ $title = $this->getTheModelName($clean['id']);
+ return "http://".DOMAIN_NAME."/wiki/page/".Lang::$current."/".encodeUrl($title);
+ }
+
public function getDiffArray($oldArray, $newArray)
{
return getDiffArray($this->diffFields, $oldArray, $newArray);
diff --git a/h-source/Application/Models/WikitalkModel.php b/h-source/Application/Models/WikitalkModel.php
index 608fbae..3bff3d3 100644
--- a/h-source/Application/Models/WikitalkModel.php
+++ b/h-source/Application/Models/WikitalkModel.php
@@ -37,6 +37,11 @@ class WikitalkModel extends Model_Tree
parent::__construct();
}
+ public function pUpdate($id)
+ {
+ return parent::update($id);
+ }
+
public $formStruct = array(
'entries' => array(
'title' => array(),
diff --git a/h-source/Application/Views/Last/modifications.php b/h-source/Application/Views/Last/modifications.php
index 8683615..1caca34 100644
--- a/h-source/Application/Views/Last/modifications.php
+++ b/h-source/Application/Views/Last/modifications.php
@@ -33,7 +33,7 @@
<div class="notebooks_viewall">
<ul class="page_history">
<?php foreach ($table as $row) { ?>
- <li class="page_history_item"><?php echo gtext('the model');?> <a href="<?php echo Go::toHardwarePage($row['history']['id']);?>"><?php echo $hw->getTheModelName($row['history']['id']);?></a> <?php echo gtext('has been '.$translations[$row['history']['action']].' by');?> <?php echo getLinkToUser($u->getUser($row['history']['created_by']))?> <?php echo gtext('at');?> <?php echo smartDate($row['history']['creation_date']);?></li>
+ <li class="page_history_item"><?php echo gtext('the model');?> <a href="<?php echo Go::toHardwarePage($row['history']['id']);?>"><?php echo $hw->getTheModelName($row['history']['id']);?></a> <?php echo gtext('has been '.$translations[$row['history']['action']].' by');?> <?php echo $u->getLinkToUserFromId($row['history']['created_by'])?> <?php echo gtext('at');?> <?php echo smartDate($row['history']['creation_date']);?></li>
<?php } ?>
</ul>
</div>
diff --git a/h-source/Application/Views/Wiki/form.php b/h-source/Application/Views/Wiki/form.php
index 0a448dd..b3f7578 100644
--- a/h-source/Application/Views/Wiki/form.php
+++ b/h-source/Application/Views/Wiki/form.php
@@ -35,7 +35,7 @@
<?php if ( strcmp($this->action,'insert') === 0 ) { ?>
<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; <?php echo gtext('Insert'); ?>
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang/Main-Page";?>">Wiki</a> &raquo; <?php echo gtext('Insert'); ?>
</div>
<div class="notebook_view_title">
@@ -43,13 +43,13 @@
</div>
<div class="notebook_insert_link">
- <a title="Back to the wiki main page" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/";?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
+ <a title="Back to the wiki main page" href="<?php echo $this->baseUrl."/".$this->controller."/page/$lang/Main-Page";?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/back-60.png"></a>
</div>
<?php } else if ( strcmp($this->action,'update') === 0 ) { ?>
<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('Update'); ?>
+ <a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang/Main-Page";?>">Wiki</a> &raquo; <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($tree_name);?>"><?php echo $tree_name;?></a> &raquo; <?php echo gtext('Update'); ?>
</div>
<div class="notebook_view_title">
@@ -76,12 +76,12 @@
<div class="edit_form">
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("title");?>:</div>
+ <div class="entry_label"><?php echo gtext("the title");?>:</div>
<?php echo Html_Form::input('title',$values['title'],'input_entry');?>
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("text of the wiki page");?>:<br /><a href="<?php echo $this->baseUrl."/help/index/$lang#wiki-syntax";?>"><?php echo gtext("discover all the wiki tags");?></a></div>
+ <div class="entry_label"><?php echo gtext("the text of the wiki page");?>:<br /><a href="<?php echo $this->baseUrl."/help/index/$lang#wiki-syntax";?>"><?php echo gtext("discover all the wiki tags");?></a></div>
<?php echo Html_Form::textarea('page',$values['page'],'textarea_entry','bb_code');?>
</div>
diff --git a/h-source/Application/Views/Wiki/history.php b/h-source/Application/Views/Wiki/history.php
index 5e5c041..ec394f4 100644
--- a/h-source/Application/Views/Wiki/history.php
+++ b/h-source/Application/Views/Wiki/history.php
@@ -53,7 +53,7 @@
(<a href="<?php echo $this->baseUrl."/".$this->controller."/differences/$lang/$id/".$rev['wiki_revisions']['id_rev'].$this->viewStatus;?>">diff</a>)
<?php } ?>
- <?php if ($islogged === 'yes') { ?>
+ <?php if ($islogged === 'yes' and !$isBlocked) { ?>
(<a href="<?php echo $this->baseUrl.'/'.$this->controller.'/climb/'.$lang.'/'.$rev['wiki_revisions']['id_rev'].$this->viewStatus;?>"><?php echo gtext('Make current'); ?></a>)
<?php } ?>
diff --git a/h-source/Application/Views/Wiki/modifications.php b/h-source/Application/Views/Wiki/modifications.php
new file mode 100644
index 0000000..71e50c9
--- /dev/null
+++ b/h-source/Application/Views/Wiki/modifications.php
@@ -0,0 +1,45 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?php
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This file is part of h-source
+//
+// h-source is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// h-source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with h-source. If not, see <http://www.gnu.org/licenses/>.
+?>
+
+ <div id="left">
+
+ <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/Main-Page";?>">Wiki</a> &raquo; <?php echo gtext('Wiki modifications');?>
+ </div>
+
+ <div class="contrib_explain_box">
+ <?php echo gtext('List of the wiki modifications carried out by users');?>
+ </div>
+
+ <div class="notebooks_viewall">
+ <ul class="page_history">
+ <?php foreach ($table as $row) { ?>
+ <li class="page_history_item"><?php echo gtext('the text of the wiki page');?> <a href="<?php echo $wiki->toWikiPage($row['history']['id']);?>"><?php echo $wiki->getTheModelName($row['history']['id']);?></a> <?php echo gtext('has been '.$translations[$row['history']['action']].' by');?> <?php echo $u->getLinkToUserFromId($row['history']['created_by'])?> <?php echo gtext('at');?> <?php echo smartDate($row['history']['creation_date']);?></li>
+ <?php } ?>
+ </ul>
+ </div>
+
+ <div class="history_page_list">
+ <?php echo gtext("page list");?>: <?php echo $pageList;?>
+ </div>
+
+ </div>
diff --git a/h-source/Application/Views/Wiki/page.php b/h-source/Application/Views/Wiki/page.php
index c690771..d386704 100644
--- a/h-source/Application/Views/Wiki/page.php
+++ b/h-source/Application/Views/Wiki/page.php
@@ -29,8 +29,35 @@
<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/Main-Page";?>">Wiki</a> &raquo; <?php echo $tree_name;?>
</div>
-
+
+ <?php if ($isadmin) { ?>
+ <div class="moderator_box">
+ <?php if ($isBlocked) { ?>
+ <?php echo gtext('This wiki page has been blocked'); ?>
+
+ <a id="<?php echo $id_wiki;?>" class="pageunblock_page block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/unlock.png"><?php echo gtext('unblock the wiki page'); ?></a>
+
+ <?php } else { ?>
+
+ <a id="<?php echo $id_wiki;?>" class="pageblock_page block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/lock.png"><?php echo gtext('block the wiki page'); ?></a>
+
+ <?php } ?>
+
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">page</div>
+ <a id="<?php echo $id_wiki;?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+ <div class="moderation_details_box"></div>
+ </div>
+
+ </div>
+ <?php } ?>
+
<div class="notebook_insert_link">
+ <div class="view_page_back_button">
+ <a title="Insert a new wiki page" href="<?php echo $this->baseUrl."/".$this->controller."/insert/$lang";?>"><img class="top_left_images" src="<?php echo $this->baseUrl;?>/Public/Img/new-60.png"></a>
+ </div>
+
<div class="view_page_history_button">
<a title="talk page" href="<?php echo $this->baseUrl."/".$this->controller."/talk/$lang/$id_wiki";?>"><img class="top_left_note_image" src="<?php echo $this->baseUrl;?>/Public/Img/talk-60.png"></a>
</div>
@@ -39,7 +66,7 @@
<a title="history page" href="<?php echo $this->baseUrl."/".$this->controller."/history/$lang/$id_wiki";?>"><img class="top_left_note_image" src="<?php echo $this->baseUrl;?>/Public/Img/history-60.png"></a>
</div>
- <?php if (strcmp($isDeleted,'no') === 0) { ?>
+ <?php if (strcmp($isDeleted,'no') === 0 and !$isBlocked) { ?>
<div class="view_page_update_button">
<form action="<?php echo $this->baseUrl."/".$this->controller."/update/$lang";?>" method="POST">
<input title="edit page" class="update_submit_class" type="image" src="<?php echo $this->baseUrl;?>/Public/Img/edit-60.png" value="xedit">
@@ -79,7 +106,7 @@
<?php } ?>
- <?php if ( strcmp($isDeleted,'no') === 0 or $ismoderator) { ?>
+ <?php if ( strcmp($isDeleted,'no') === 0) { ?>
<!--if revision-->
<?php if (strcmp($this->action,'revision') === 0) { ?>
@@ -91,6 +118,9 @@
<?php foreach ($table as $page) { ?>
<div class="wiki_page_title">
<?php echo $page[$tableName]['title']?>
+ <?php if ($isBlocked) { ?>
+ <span class="blocked_notice"><?php echo gtext('This wiki page has been blocked'); ?></span>
+ <?php } ?>
</div>
<div class="wiki_page_content">
<?php echo decodeWikiText($page[$tableName]['page'])?>
diff --git a/h-source/Application/Views/Wiki/pages.php b/h-source/Application/Views/Wiki/pages.php
new file mode 100644
index 0000000..f944f36
--- /dev/null
+++ b/h-source/Application/Views/Wiki/pages.php
@@ -0,0 +1,45 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?php
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010 Antonio Gallo (h-source-copyright.txt)
+//
+// This file is part of h-source
+//
+// h-source is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// h-source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with h-source. If not, see <http://www.gnu.org/licenses/>.
+?>
+
+ <div id="left">
+
+ <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/Main-Page";?>">Wiki</a> &raquo; <?php echo gtext('list of pages');?>
+ </div>
+
+ <div class="contrib_explain_box">
+ <?php echo gtext('List of wiki pages');?>
+ </div>
+
+ <div class="notebooks_viewall">
+ <ul class="page_history">
+ <?php foreach ($table as $row) { ?>
+ <li class="page_history_item"><a href="<?php echo $wiki->toWikiPage($row['wiki']['id_wiki']);?>"><?php echo $row['wiki']['title'];?></a></li>
+ <?php } ?>
+ </ul>
+ </div>
+
+ <div class="history_page_list">
+ <?php echo gtext("page list");?>: <?php echo $pageList;?>
+ </div>
+
+ </div>
diff --git a/h-source/Application/Views/Wiki/talk.php b/h-source/Application/Views/Wiki/talk.php
index 9835f04..724b273 100644
--- a/h-source/Application/Views/Wiki/talk.php
+++ b/h-source/Application/Views/Wiki/talk.php
@@ -43,120 +43,127 @@
<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>
</div>
+
+ <?php if (!$isBlocked) { ?>
- <div class="wiki_external_box">
+ <div class="wiki_external_box">
- <?php foreach ($table as $message) { ?>
+ <?php foreach ($table as $message) { ?>
- <?php if (strcmp($message['wiki_talk']['deleted'],'no') === 0) { ?>
+ <?php if (strcmp($message['wiki_talk']['deleted'],'no') === 0) { ?>
- <a name="wiki-talk-<?php echo $message['wiki_talk']['id_talk'];?>"></a>
- <div class="talk_message_item">
+ <a name="wiki-talk-<?php echo $message['wiki_talk']['id_talk'];?>"></a>
+ <div class="talk_message_item">
- <div class="talk_message_item_title_date">
- <?php if ($ismoderator) { ?>
- <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hide_wiki_talk hide_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png">hide</a>
- <?php } ?>
-
- <div class="talk_message_item_title">
- <?php echo $message['wiki_talk']['title'];?>
+ <div class="talk_message_item_title_date">
+ <?php if ($ismoderator) { ?>
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hide_wiki_talk hide_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png">hide</a>
+ <?php } ?>
+
+ <div class="talk_message_item_title">
+ <?php echo $message['wiki_talk']['title'];?>
+ </div>
+
+ <div class="talk_message_item_date">
+ by <?php echo getLinkToUser($u->getUser($message['wiki_talk']['created_by']));?>, <?php echo smartDate($message['wiki_talk']['creation_date']);?>
+ </div>
</div>
- <div class="talk_message_item_date">
- by <?php echo getLinkToUser($u->getUser($message['wiki_talk']['created_by']));?>, <?php echo smartDate($message['wiki_talk']['creation_date']);?>
+ <div class="talk_message_item_content">
+ <?php echo decodeWikiText($message['wiki_talk']['message']);?>
</div>
- </div>
- <div class="talk_message_item_content">
- <?php echo decodeWikiText($message['wiki_talk']['message']);?>
- </div>
+ <?php if ($ismoderator) { ?>
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">wiki_talk</div>
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+ <div class="moderation_details_box"></div>
+ </div>
+ <?php } ?>
- <?php if ($ismoderator) { ?>
- <!--view details-->
- <div class="show_hidden_box_ext">
- <div class="md_type">wiki_talk</div>
- <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
- <div class="moderation_details_box"></div>
</div>
- <?php } ?>
-
- </div>
-
- <?php } else { ?>
-
- <?php if ($ismoderator) { ?>
- <a name="wiki-talk-<?php echo $message['wiki_talk']['id_talk'];?>"></a>
- <div class="talk_message_item_hidden">
- this message has been deleted
-
- <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="show_wiki_talk hide_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png">make visible</a>
- <!--view details-->
- <div class="show_hidden_box_ext">
- <div class="md_type">wiki_talk</div>
+ <?php } else { ?>
- <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
-
- <div class="details_of_hidden_message">
- <div class="details_of_hidden_message_inner">
- <div class="talk_message_item_date">
- submitted by <?php echo getLinkToUser($u->getUser($message['wiki_talk']['created_by']));?>, <?php echo smartDate($message['wiki_talk']['creation_date']);?>
- </div>
- <div class="message_view_description_hidden">
- <?php echo decodeWikiText($message['wiki_talk']['message']);?>
+ <?php if ($ismoderator) { ?>
+ <a name="wiki-talk-<?php echo $message['wiki_talk']['id_talk'];?>"></a>
+ <div class="talk_message_item_hidden">
+ this message has been deleted
+
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="show_wiki_talk hide_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png">make visible</a>
+
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">wiki_talk</div>
+
+ <a id="<?php echo $message['wiki_talk']['id_talk'];?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+
+ <div class="details_of_hidden_message">
+ <div class="details_of_hidden_message_inner">
+ <div class="talk_message_item_date">
+ submitted by <?php echo getLinkToUser($u->getUser($message['wiki_talk']['created_by']));?>, <?php echo smartDate($message['wiki_talk']['creation_date']);?>
+ </div>
+ <div class="message_view_description_hidden">
+ <?php echo decodeWikiText($message['wiki_talk']['message']);?>
+ </div>
</div>
+ <div class="moderation_details_box"></div>
</div>
- <div class="moderation_details_box"></div>
</div>
- </div>
- </div>
+ </div>
+ <?php } ?>
+
<?php } ?>
<?php } ?>
+ </div>
- <?php } ?>
- </div>
+ <?php if ($islogged === 'yes') { ?>
- <?php if ($islogged === 'yes') { ?>
+ <div class="talk_form_external_box">
+ <div class="talk_login_notice">
+ <a name="form">Add a message</a>
+ </div>
- <div class="talk_form_external_box">
- <div class="talk_login_notice">
- <a name="form">Add a message</a>
- </div>
+ <?php echo $notice;?>
- <?php echo $notice;?>
+ <div class="notebooks_insert_form">
+ <form action="<?php echo $this->baseUrl."/".$this->controller."/talk/$lang/$id_wiki";?>#form" method="POST">
- <div class="notebooks_insert_form">
- <form action="<?php echo $this->baseUrl."/".$this->controller."/talk/$lang/$id_wiki";?>#form" method="POST">
+ <div class="edit_form">
- <div class="edit_form">
+ <div class="form_entry">
+ <div class="entry_label">Title:</div>
+ <?php echo Html_Form::input('title',$values['title'],'talk_input_entry');?>
+ </div>
- <div class="form_entry">
- <div class="entry_label">Title:</div>
- <?php echo Html_Form::input('title',$values['title'],'talk_input_entry');?>
- </div>
+ <div class="form_entry">
+ <div class="entry_label">Message:</div>
+ <?php echo Html_Form::textarea('message',$values['message'],'talk_textarea_entry','bb_code');?>
+ </div>
+
+ <input type="submit" name="insertAction" value="Save">
- <div class="form_entry">
- <div class="entry_label">Message:</div>
- <?php echo Html_Form::textarea('message',$values['message'],'talk_textarea_entry','bb_code');?>
</div>
- <input type="submit" name="insertAction" value="Save">
+ </form>
+ </div>
+ </div>
- </div>
+ <?php } else { ?>
- </form>
+ <div class="talk_login_notice">
+ <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
</div>
- </div>
- <?php } else { ?>
+ <?php } ?>
- <div class="talk_login_notice">
- <a name="form"><?php echo gtext("You have to");?> <a href="<?php echo $this->baseUrl."/users/login/$lang?redirect=".$currPos.$queryString;?>">login</a> <?php echo gtext("in order to add a message");?></a>
+ <?php } else { ?>
+ <div class="wiki_external_box">
+ <?php echo gtext('This wiki page has been blocked'); ?>
</div>
-
<?php } ?>
-
</div> \ No newline at end of file
diff --git a/h-source/Application/Views/header.php b/h-source/Application/Views/header.php
index 625ebae..e86006b 100644
--- a/h-source/Application/Views/header.php
+++ b/h-source/Application/Views/header.php
@@ -23,6 +23,7 @@
<?php
$u = new UsersModel();
$hw = new HardwareModel();
+$wiki = new WikiModel();
$translations = array('insert'=>'inserted','update'=>'updated');
$currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index';
?>
diff --git a/h-source/Application/Views/right.php b/h-source/Application/Views/right.php
index 3bde69e..89f3d85 100644
--- a/h-source/Application/Views/right.php
+++ b/h-source/Application/Views/right.php
@@ -90,6 +90,15 @@
<a href="<?php echo $this->baseUrl."/download/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/download.png"></a>
</div>
+ <?php if ( strcmp($this->controller,'wiki') === 0 ) { ?>
+ <div class="wiki_control_box">
+ <ul>
+ <li><a href="<?php echo $this->baseUrl."/wiki/pages/$lang";?>"><?php echo gtext('list of pages'); ?></a></li>
+ <li><a href="<?php echo $this->baseUrl."/wiki/modifications/$lang";?>"><?php echo gtext('last modifications'); ?></a></li>
+ </ul>
+ </div>
+ <?php } ?>
+
<?php if ( strcmp($this->controller,'wiki') !== 0 ) { ?>
<div class="last_modifications">
<div class="last_modifications_title">
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php
index 7aaf55b..31a5238 100644
--- a/h-source/Config/Route.php
+++ b/h-source/Config/Route.php
@@ -105,6 +105,8 @@ class Route
'history,unblock',
'history,open',
'history,close',
+ 'history,pageblock',
+ 'history,pageunblock',
'history,viewall',
'threegcards,catalogue',
'threegcards,view',
@@ -143,6 +145,8 @@ class Route
'wiki,differences',
'wiki,climb',
'wiki,talk',
+ 'wiki,modifications',
+ 'wiki,pages',
);
//it can be 'yes' or 'no'
diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css
index abdeb0a..dfe6882 100644
--- a/h-source/Public/Css/main.css
+++ b/h-source/Public/Css/main.css
@@ -1684,4 +1684,10 @@ td.text_item_date
float:left;
text-align:left;
margin-left:10px;
+}
+.blocked_notice
+{
+ float:right;
+ font:normal 12px/1 sans-serif;
+ color:#000;
} \ No newline at end of file
diff --git a/h-source/Public/Img/Crystal/lock.png b/h-source/Public/Img/Crystal/lock.png
new file mode 100755
index 0000000..d1d0706
--- /dev/null
+++ b/h-source/Public/Img/Crystal/lock.png
Binary files differ
diff --git a/h-source/Public/Img/Crystal/unlock.png b/h-source/Public/Img/Crystal/unlock.png
new file mode 100755
index 0000000..13b1090
--- /dev/null
+++ b/h-source/Public/Img/Crystal/unlock.png
Binary files differ
diff --git a/h-source/tables.sql b/h-source/tables.sql
index c59cf23..b22e0be 100644
--- a/h-source/tables.sql
+++ b/h-source/tables.sql
@@ -224,7 +224,7 @@ create table history (
created_by int not null,
creation_date timestamp default CURRENT_TIMESTAMP,
type char(10) not null,
- action char(10) not null,
+ action char(15) not null,
id INT UNSIGNED NOT NULL,
message text CHARACTER SET utf8 not null,
gr char(15) not null
@@ -233,6 +233,8 @@ create table history (
insert into reggroups (name) values ('moderator');
+insert into reggroups (name) values ('admin');
+
create table wiki (
id_wiki INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
created_by int not null,
@@ -242,6 +244,7 @@ create table wiki (
title_clean varchar(100) CHARACTER SET utf8 not null,
page text CHARACTER SET utf8 not null,
deleted char(3) not null default 'no',
+ blocked CHAR(3) NOT NULL default 'no',
is_main char(3) not null default 'no'
)engine=innodb;