diff options
-rw-r--r-- | h-source/Application/Controllers/MeetController.php | 40 | ||||
-rw-r--r-- | h-source/Application/Controllers/WikiController.php | 65 | ||||
-rw-r--r-- | h-source/Application/Include/languages.php | 2 | ||||
-rw-r--r-- | h-source/Application/Include/myFunctions.php | 34 | ||||
-rw-r--r-- | h-source/Application/Views/Meet/contributions.php | 7 | ||||
-rw-r--r-- | h-source/Application/Views/Meet/wiki.php | 55 | ||||
-rw-r--r-- | h-source/Application/Views/right.php | 10 | ||||
-rw-r--r-- | h-source/Config/Route.php | 2 | ||||
-rw-r--r-- | h-source/Public/Css/main.css | 43 | ||||
-rw-r--r-- | h-source/Public/Img/back_wiki.png | bin | 0 -> 2548 bytes | |||
-rw-r--r-- | h-source/tables.sql | 8 |
11 files changed, 216 insertions, 50 deletions
diff --git a/h-source/Application/Controllers/MeetController.php b/h-source/Application/Controllers/MeetController.php index 72e9006..5395a21 100644 --- a/h-source/Application/Controllers/MeetController.php +++ b/h-source/Application/Controllers/MeetController.php @@ -37,6 +37,7 @@ class MeetController extends BaseController $this->model('IssuesModel'); $this->model('MessagesModel'); $this->model('TalkModel'); + $this->model('WikiModel'); $argKeys = array( 'page:forceNat' => 1, @@ -120,11 +121,14 @@ class MeetController extends BaseController $messNumb = $this->m['MessagesModel']->select('id_mes,messages.id_issue,messages.creation_date')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); $talkNumb = $this->m['TalkModel']->select('talk.title')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); + + $wikiNumb = $this->m['WikiModel']->select()->where($this->whereArray)->rowNumber(); $data['hasHardware'] = $hardNumb > 0 ? true : false; $data['hasIssues'] = $issuesNumb > 0 ? true : false; $data['hasMessages'] = $messNumb > 0 ? true : false; $data['hasTalk'] = $talkNumb > 0 ? true : false; + $data['hasWiki'] = $wikiNumb > 0 ? true : false; $this->append($data); $this->load('contributions'); @@ -258,4 +262,40 @@ class MeetController extends BaseController $this->right(); } } + + //hardware contributions + public function wiki($lang = 'en', $user = '') + { + $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; + $data['title'] = "wiki contributions - ".Website::$generalName; + + $this->shift(2); + + if ($this->userExists($clean['user'])) + { + //load the Pages helper + $this->helper('Pages','meet/wiki/'.$this->lang.'/'.$clean['user'],'page'); + + $this->whereArray['username'] = $clean['user']; + + $data['table'] = $this->m['WikiModel']->select('wiki.*,regusers.username')->where($this->whereArray)->orderBy('wiki.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['meet_username'] = $clean['user']; + + $data['pageList'] = $this->h['Pages']->render($page-5,11); + + $this->append($data); + $this->load('wiki'); + $this->right(); + } + + } + }
\ No newline at end of file diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php index 8e26454..a1b39ce 100644 --- a/h-source/Application/Controllers/WikiController.php +++ b/h-source/Application/Controllers/WikiController.php @@ -58,7 +58,10 @@ class WikiController extends BaseController //insert the new wiki page $this->m['WikiModel']->updateTable('insert'); - $this->viewRedirect($this->m['WikiModel']->lastTitleClean); + if ($this->m['WikiModel']->queryResult) + { + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean); + } } $data['notice'] = $this->m['WikiModel']->notice; @@ -114,7 +117,10 @@ class WikiController extends BaseController //carry out the update database action $this->m['WikiModel']->updateTable('update'); - $this->viewRedirect($this->m['WikiModel']->lastTitleClean); + if ($this->m['WikiModel']->queryResult) + { + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean); + } } $data['notice'] = $this->m['WikiModel']->notice; @@ -142,13 +148,13 @@ class WikiController extends BaseController } } - protected function viewRedirect($titleClean) - { - if ($this->m['WikiModel']->queryResult) - { - $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean); - } - } +// protected function viewRedirect($titleClean) +// { +// if ($this->m['WikiModel']->queryResult) +// { +// $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean); +// } +// } public function page($lang = 'en', $title_clean = null) { @@ -313,10 +319,11 @@ class WikiController extends BaseController $clean['id_rev'] = (int)$id_rev; $data['id_wiki'] = $clean['id_wiki']; - $tree_name = $this->m['WikiModel']->getTheModelName((int)$data['id_wiki']); + $tree_name = $this->m['WikiModel']->getTheModelName((int)$clean['id_wiki']); $data['tree_name'] = $tree_name; $data['tree'] = $this->getSpecPageLink() . " » " . $this->getViewLink($data['tree_name'])." » " . $this->getHistoryLink($data['id_wiki']) . " » ".gtext('Differences'); - + + $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']); $data['showDiff'] = false; $diffArray = array(); @@ -414,7 +421,10 @@ class WikiController extends BaseController { $this->m['WikiModel']->makeCurrent($clean['id_rev']); - $this->viewRedirect($this->m['WikiModel']->lastTitleClean); + if ($this->m['WikiModel']->queryResult) + { + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean); + } $data['notice'] = $this->m['WikiModel']->notice; } @@ -512,20 +522,31 @@ class WikiController extends BaseController $this->right(); } - public function deleted($lang = 'en') + protected function see($lang = 'en', $status = 'blocked') { $this->s['registered']->check('admin'); - $data['topString'] = 'list of deleted pages'; - $data['title'] = gtext('list of deleted pages').' - '.Website::$generalName; + switch ($status) + { + case 'deleted': + $data['topString'] = 'list of deleted pages'; + $data['title'] = gtext('list of deleted pages').' - '.Website::$generalName; + $whereClause = '-deleted'; + break; + case 'blocked': + $data['topString'] = 'list of blocked pages'; + $data['title'] = gtext('list of blocked pages').' - '.Website::$generalName; + $whereClause = 'blocked'; + break; + } $this->setArgKeys(array('page:forceNat'=>1)); $this->shift(1); - $this->helper('Pages','wiki/deleted/'.$this->lang,'page'); + $this->helper('Pages','wiki/'.$status.'/'.$this->lang,'page'); - $this->m['WikiModel']->clear()->select()->where(array('-deleted'=>'yes'))->orderBy('id_wiki desc'); + $this->m['WikiModel']->clear()->select()->where(array($whereClause=>'yes'))->orderBy('id_wiki desc'); $recordNumber = $this->m['WikiModel']->rowNumber(); $page = $this->viewArgs['page']; @@ -541,6 +562,16 @@ class WikiController extends BaseController $this->right(); } + public function deleted($lang = 'en') + { + $this->see($lang,'deleted'); + } + + public function blocked($lang = 'en') + { + $this->see($lang,'blocked'); + } + //print all the modifications to the wiki public function modifications($lang = 'en') { diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 5145029..4bfb40e 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -210,6 +210,8 @@ class Lang "list of deleted pages" => "lista delle pagine cancellate", "restore the wiki page" => "ripristina la pagina", "delete the wiki page" => "cancella la pagina", + "list of blocked pages" => "lista delle pagine bloccate", + "special pages" => "pagine speciali", ), 'es' => array ( diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index d731062..6b87958 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -23,28 +23,32 @@ if (!defined('EG')) die('Direct access not allowed!'); function encodeUrl($url) { $url = str_replace(' ','-',$url); + $url = str_replace('.','-',$url); $url = str_replace('[','-',$url); $url = str_replace(']','-',$url); $url = str_replace('(','-',$url); $url = str_replace(')','-',$url); $url = str_replace('/','-',$url); $url = str_replace('@','-at-',$url); + $url = str_replace('#','-at-',$url); + $url = str_replace('?','-at-',$url); - $temp = null; - for ($i=0;$i<strlen($url); $i++) - { - if (strcmp($url[$i],' ') === 0) - { - $temp .= '-'; - } - else - { - if (preg_match('/^[a-zA-Z0-9\-]$/',$url[$i])) $temp .= $url[$i]; - } - } +// $temp = null; +// for ($i=0;$i<strlen($url); $i++) +// { +// if (strcmp($url[$i],' ') === 0) +// { +// $temp .= '-'; +// } +// else +// { +// if (preg_match('/^[a-zA-Z0-9\-]$/',$url[$i])) $temp .= $url[$i]; +// } +// } - $temp = urlencode($temp); - return $temp; +// $url = urlencode($url); +// $url = urlencode($url); + return $url; } // function encodeUrl($url) @@ -232,6 +236,8 @@ function decodeWikiText($string) $string = preg_replace('/(\[h2\])(.*?)(\[\/h2\])/s', '<div class="div_h2">${2}</div>',$string); $string = preg_replace('/(\[h3\])(.*?)(\[\/h3\])/s', '<div class="div_h3">${2}</div>',$string); + + $string = preg_replace('/(\[lang\])(.*?)(\[\/lang\])/s', '<div class="div_lang">${2}</div>',$string); return $string; } diff --git a/h-source/Application/Views/Meet/contributions.php b/h-source/Application/Views/Meet/contributions.php index 2f38987..82921f7 100644 --- a/h-source/Application/Views/Meet/contributions.php +++ b/h-source/Application/Views/Meet/contributions.php @@ -59,6 +59,13 @@ <a href="<?php echo $this->baseUrl."/meet/messages/$lang/$meet_username".$this->viewStatus;?>">messages submitted by <b><?php echo $meet_username;?></b></a> </div> <?php } ?> + + <!--messages submitted--> + <?php if ($hasWiki) { ?> + <div class="user_hardware_pages"> + <a href="<?php echo $this->baseUrl."/meet/wiki/$lang/$meet_username".$this->viewStatus;?>">wiki pages inserted/updated by <b><?php echo $meet_username;?></b></a> + </div> + <?php } ?> </div> diff --git a/h-source/Application/Views/Meet/wiki.php b/h-source/Application/Views/Meet/wiki.php new file mode 100644 index 0000000..b813cda --- /dev/null +++ b/h-source/Application/Views/Meet/wiki.php @@ -0,0 +1,55 @@ +<?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> » <a href="<?php echo $this->baseUrl."/meet/user/$lang/$meet_username";?>">meet <b><?php echo $meet_username;?></b></a> » <a href="<?php echo $this->baseUrl."/meet/contributions/$lang/$meet_username";?>">contributions</a> » wiki contributions + </div> + + <div class="contrib_explain_box"> + wiki contributions of <?php echo $meet_username;?> + </div> + + <div class="external_users_contrib"> + <?php foreach ($table as $item) {?> + <div class="users_contrib_item"> + + <div class="contribution_item"> + <?php + + $name = $item['wiki']['title']; + $id_wiki = $item['wiki']['id_wiki']; + + ?> + <a href="<?php echo $this->baseUrl."/wiki/page/$lang/".encodeUrl($name);?>"><?php echo $name;?></a> + </div> + + </div> + <?php } ?> + </div> + + <div class="history_page_list"> + <?php echo gtext("page list");?>: <?php echo $pageList;?> + </div> + + </div>
\ No newline at end of file diff --git a/h-source/Application/Views/right.php b/h-source/Application/Views/right.php index 8c415cd..60b5f31 100644 --- a/h-source/Application/Views/right.php +++ b/h-source/Application/Views/right.php @@ -92,9 +92,15 @@ <?php if ( strcmp($this->controller,'wiki') === 0 ) { ?> <div class="wiki_control_box"> + <div class="last_modifications_title"> + <?php echo gtext('special pages');?> + </div> <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/deleted/$lang";?>"><?php echo gtext('list of deleted pages'); ?></a></li> + <?php if ($isadmin) { ?> + <li><a href="<?php echo $this->baseUrl."/wiki/deleted/$lang";?>"><?php echo gtext('list of deleted pages'); ?></a></li> + <li><a href="<?php echo $this->baseUrl."/wiki/blocked/$lang";?>"><?php echo gtext('list of blocked pages'); ?></a></li> + <?php } ?> <li><a href="<?php echo $this->baseUrl."/wiki/modifications/$lang";?>"><?php echo gtext('last modifications'); ?></a></li> </ul> </div> @@ -107,7 +113,7 @@ </div> <ul> <?php foreach ($lastModif as $row) { ?> - <li><a class="last_modifications_model" href="<?php echo Go::toHardwarePage($row['history']['id']);?>"><?php echo $hw->getTheModelName($row['history']['id']);?></a> <?php echo gtext('by');?> <?php echo getLinkToUser($u->getUser($row['history']['created_by']))?></li> + <li><a class="last_modifications_model" href="<?php echo Go::toHardwarePage($row['history']['id']);?>"><?php echo $hw->getTheModelName($row['history']['id']);?></a> <?php echo gtext('by');?> <?php echo $u->getLinkToUserFromId($row['history']['created_by'])?></li> <?php } ?> </ul> <div class="last_modifications_all"> diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index 8d541f0..c5c4493 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -47,6 +47,7 @@ class Route 'meet,issues', 'meet,messages', 'meet,talk', + 'meet,wiki', 'wifi,catalogue', 'wifi,view', 'wifi,history', @@ -150,6 +151,7 @@ class Route 'wiki,modifications', 'wiki,pages', 'wiki,deleted', + 'wiki,blocked', ); //it can be 'yes' or 'no' diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css index d91cf3b..73b2aec 100644 --- a/h-source/Public/Css/main.css +++ b/h-source/Public/Css/main.css @@ -683,23 +683,33 @@ ins .div_h1 { - font:bold 15px/1 sans-serif,arial; - border-bottom:1px dashed #000; + font:bold 18px/1 sans-serif,arial; + border-bottom:1px solid gray; padding:3px 0px; - margin:10px 0px; + margin:20px 0px 10px 0px; color:gray; } .div_h2 { - font:bold 14px/1 sans-serif,arial; + font:bold 17px/1 sans-serif,arial; color:gray; } .div_h3 { - font:bold 13px/1 sans-serif,arial; + font:bold 16px/1 sans-serif,arial; color:gray; } - +.div_lang +{ + padding:8px; + background:#cfe2ff; + /*border-top:1px solid #FFA500; + border-bottom:1px solid #FFA500;*/ +} +.div_lang a +{ + padding:0px 3px; +} .talk_login_notice { margin:5px 5px; @@ -1470,8 +1480,8 @@ ins margin:10px 5px; padding:10px; background:#F1D8D8; - border-bottom:1px solid #DC143C; - border-top:1px solid #DC143C; + /*border-bottom:1px solid #DC143C; + border-top:1px solid #DC143C;*/ } .moderator_box, .moderator_box_deleted @@ -1619,20 +1629,27 @@ td.text_item_date font:normal 16px/1 sans-serif; } -.last_modifications +.last_modifications, .wiki_control_box { margin:5px; width:190px; -/* background:red; */ margin-bottom:2em; background: url(../Img/back_last.png) no-repeat top left; } -.last_modifications ul +.wiki_control_box +{ + background: url(../Img/back_wiki.png) no-repeat top left; +} +.last_modifications ul, .wiki_control_box ul { padding:8px; padding-top:0px; } -.last_modifications li +.wiki_control_box ul +{ + background: url(../Img/back_wiki.png) no-repeat bottom left; +} +.last_modifications li, .wiki_control_box li { list-style-type:none; margin:10px 5px; @@ -1671,7 +1688,7 @@ td.text_item_date } .wiki_page_title { - font:bold 16px/1 sans-serif,arial; + font:bold 18px/1 sans-serif,arial; color:gray; margin:20px 0px; padding-bottom:4px; diff --git a/h-source/Public/Img/back_wiki.png b/h-source/Public/Img/back_wiki.png Binary files differnew file mode 100644 index 0000000..b34a9b9 --- /dev/null +++ b/h-source/Public/Img/back_wiki.png diff --git a/h-source/tables.sql b/h-source/tables.sql index b22e0be..c04e4d3 100644 --- a/h-source/tables.sql +++ b/h-source/tables.sql @@ -240,8 +240,8 @@ create table wiki ( created_by int not null, creation_date timestamp default CURRENT_TIMESTAMP, update_date datetime not null, - title varchar(100) CHARACTER SET utf8 not null, - title_clean varchar(100) CHARACTER SET utf8 not null, + title varchar(200) CHARACTER SET utf8 not null, + title_clean varchar(200) 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', @@ -253,8 +253,8 @@ create table wiki_revisions ( created_by int not null, creation_date timestamp default CURRENT_TIMESTAMP, update_date datetime not null, - title varchar(100) CHARACTER SET utf8 not null, - title_clean varchar(100) CHARACTER SET utf8 not null, + title varchar(200) CHARACTER SET utf8 not null, + title_clean varchar(200) CHARACTER SET utf8 not null, page text CHARACTER SET utf8 not null, id_wiki INT UNSIGNED NOT NULL )engine=innodb; |