From fe4d464805d9c6d3471dbfab6e20cc960fdfd329 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 25 Dec 2011 00:57:23 +0000 Subject: improved user history and improved mobile version --- .../Application/Controllers/BaseController.php | 1 + .../Application/Controllers/MeetController.php | 109 ++++++++++++++------- h-source/Application/Models/UsersModel.php | 18 ++++ .../Views/Desktop/Meet/contributions.php | 11 ++- .../Application/Views/Desktop/Meet/hardware.php | 36 ++----- h-source/Application/Views/Desktop/Meet/issues.php | 42 ++------ .../Views/Desktop/Meet/list_template.php | 50 ++++++++++ .../Application/Views/Desktop/Meet/messages.php | 41 ++------ h-source/Application/Views/Desktop/Meet/talk.php | 44 ++------- h-source/Application/Views/Desktop/Meet/wiki.php | 36 +------ .../Application/Views/Desktop/Meet/wikitalk.php | 31 ++++++ h-source/Application/Views/Mobile/header.php | 18 +++- h-source/Config/Route.php | 1 + h-source/Public/Css/mobile.css | 53 ++++++++++ h-source/Public/Js/jquery/images/ajax-loader.png | Bin 0 -> 503 bytes .../Public/Js/jquery/images/icon-search-black.png | Bin 0 -> 1245 bytes .../Public/Js/jquery/images/icons-18-black.png | Bin 0 -> 2064 bytes .../Public/Js/jquery/images/icons-18-white.png | Bin 0 -> 2200 bytes .../Public/Js/jquery/images/icons-36-black.png | Bin 0 -> 3403 bytes .../Public/Js/jquery/images/icons-36-white.png | Bin 0 -> 4020 bytes 20 files changed, 286 insertions(+), 205 deletions(-) create mode 100644 h-source/Application/Views/Desktop/Meet/list_template.php create mode 100644 h-source/Application/Views/Desktop/Meet/wikitalk.php create mode 100644 h-source/Public/Css/mobile.css create mode 100644 h-source/Public/Js/jquery/images/ajax-loader.png create mode 100644 h-source/Public/Js/jquery/images/icon-search-black.png create mode 100644 h-source/Public/Js/jquery/images/icons-18-black.png create mode 100644 h-source/Public/Js/jquery/images/icons-18-white.png create mode 100644 h-source/Public/Js/jquery/images/icons-36-black.png create mode 100644 h-source/Public/Js/jquery/images/icons-36-white.png (limited to 'h-source') diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php index 260d6dc..69b47ac 100644 --- a/h-source/Application/Controllers/BaseController.php +++ b/h-source/Application/Controllers/BaseController.php @@ -54,6 +54,7 @@ class BaseController extends Controller $this->model('BoxesModel'); $this->model('HistoryModel'); $this->model('ParamsModel'); + $this->model('UsersModel'); $this->load('header'); $this->load('footer','last'); diff --git a/h-source/Application/Controllers/MeetController.php b/h-source/Application/Controllers/MeetController.php index 5395a21..808b951 100644 --- a/h-source/Application/Controllers/MeetController.php +++ b/h-source/Application/Controllers/MeetController.php @@ -32,12 +32,12 @@ class MeetController extends BaseController parent::__construct($model, $controller, $queryString); $this->model('ProfileModel'); - $this->model('UsersModel'); $this->model('HardwareModel'); $this->model('IssuesModel'); $this->model('MessagesModel'); $this->model('TalkModel'); $this->model('WikiModel'); + $this->model('WikitalkModel'); $argKeys = array( 'page:forceNat' => 1, @@ -49,23 +49,6 @@ class MeetController extends BaseController $this->append($data); } - //check if the users exists - private function userExists($user) - { - $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; - - if (strcmp($clean['user'],'') !== 0) - { - $res = $this->m['UsersModel']->db->select('regusers','has_confirmed,deleted,username','username="'.$clean['user'].'" and has_confirmed=0 and deleted="no"'); - - if (count($res) > 0) - { - return true; - } - } - return false; - } - //public page of the user public function user($lang = 'en', $user = '') { @@ -74,7 +57,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); $data['meet_id_user'] = $clean['id_user']; @@ -106,7 +89,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); @@ -120,15 +103,18 @@ 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(); + $talkNumb = $this->m['TalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber(); + + $wikiNumb = $this->m['WikiModel']->where($this->whereArray)->rowNumber(); - $wikiNumb = $this->m['WikiModel']->select()->where($this->whereArray)->rowNumber(); + $wikiTalkNumb = $this->m['WikitalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->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; + $data['hasWikiTalk'] = $wikiTalkNumb > 0 ? true : false; $this->append($data); $this->load('contributions'); @@ -145,7 +131,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { $this->whereArray['username'] = $clean['user']; @@ -153,8 +139,11 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "hardware contributions"; + $data['page_explanation_title'] = "hardware contributions of"; + $this->append($data); - $this->load('hardware'); + $this->load('list_template'); $this->right(); } @@ -168,7 +157,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/issues/'.$this->lang.'/'.$clean['user'],'page'); @@ -188,8 +177,11 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "issues opened"; + $data['page_explanation_title'] = "issues opened by"; + $this->append($data); - $this->load('issues'); + $this->load('list_template'); $this->right(); } @@ -203,7 +195,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/messages/'.$this->lang.'/'.$clean['user'],'page'); @@ -221,30 +213,33 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "messages submitted"; + $data['page_explanation_title'] = "messages submitted by"; + $data['pageList'] = $this->h['Pages']->render($page-3,7); $this->append($data); - $this->load('messages'); + $this->load('list_template'); $this->right(); } } - //messages in the talk page + //messages in the talk page of the devices public function talk($lang = 'en', $user = '') { $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; - $data['title'] = "messages submitted - ".Website::$generalName; + $data['title'] = "talk messages submitted - ".Website::$generalName; $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/talk/'.$this->lang.'/'.$clean['user'],'page'); $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); - $this->m['TalkModel']->from('talk inner join hardware')->using('id_hard')->select('talk.title,talk.creation_date,talk.id_hard,talk.id_talk,hardware.type')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc'); + $this->m['TalkModel']->inner('hardware')->using('id_hard')->select('talk.*,hardware.*')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc'); $recordNumber = $this->m['TalkModel']->rowNumber(); $page = $this->viewArgs['page']; @@ -255,10 +250,13 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "talk messages (hardware pages)"; + $data['page_explanation_title'] = "talk messages (hardware pages) submitted by"; + $data['pageList'] = $this->h['Pages']->render($page-3,7); $this->append($data); - $this->load('talk'); + $this->load('list_template'); $this->right(); } } @@ -271,7 +269,7 @@ class MeetController extends BaseController $this->shift(2); - if ($this->userExists($clean['user'])) + if ($this->m['UsersModel']->userExists($clean['user'])) { //load the Pages helper $this->helper('Pages','meet/wiki/'.$this->lang.'/'.$clean['user'],'page'); @@ -289,13 +287,52 @@ class MeetController extends BaseController $data['meet_username'] = $clean['user']; + $data['tree_last_string'] = "wiki contributions"; + $data['page_explanation_title'] = "wiki contributions of"; + $data['pageList'] = $this->h['Pages']->render($page-5,11); $this->append($data); - $this->load('wiki'); + $this->load('list_template'); $this->right(); } } - + + //messages in the talk page of the wiki pages + public function wikitalk($lang = 'en', $user = '') + { + $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; + $data['title'] = "talk messages submitted - ".Website::$generalName; + + $this->shift(2); + + if ($this->m['UsersModel']->userExists($clean['user'])) + { + //load the Pages helper + $this->helper('Pages','meet/wikitalk/'.$this->lang.'/'.$clean['user'],'page'); + + $clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']); + + $this->m['WikitalkModel']->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc'); + + $recordNumber = $this->m['WikitalkModel']->rowNumber(); + $page = $this->viewArgs['page']; + + $this->m['WikitalkModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20); + + $data['table'] = $this->m['WikitalkModel']->send(); + + $data['meet_username'] = $clean['user']; + + $data['tree_last_string'] = "talk messages (wiki pages)"; + $data['page_explanation_title'] = "talk messages (wiki pages) submitted by"; + + $data['pageList'] = $this->h['Pages']->render($page-3,7); + + $this->append($data); + $this->load('list_template'); + $this->right(); + } + } } \ No newline at end of file diff --git a/h-source/Application/Models/UsersModel.php b/h-source/Application/Models/UsersModel.php index 0d84bb4..ea19a7b 100755 --- a/h-source/Application/Models/UsersModel.php +++ b/h-source/Application/Models/UsersModel.php @@ -112,6 +112,24 @@ class UsersModel extends Model_Map return $this->getLinkToUser($this->getUser($clean['id_user'])); } + //check if the user exists + public function userExists($user) + { + $clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : ''; + + if (strcmp($clean['user'],'') !== 0) + { + $res = $this->where(array("username"=>$clean['user'],"has_confirmed"=>"0","deleted"=>"no"))->send(); +// $res = $this->db->select('regusers','has_confirmed','username="'.$clean['user'].'" and has_confirmed=0 and deleted="no"'); + + if (count($res) > 0) + { + return true; + } + } + return false; + } + //get the user id from the username public function getUserId($username = '') { diff --git a/h-source/Application/Views/Desktop/Meet/contributions.php b/h-source/Application/Views/Desktop/Meet/contributions.php index 82921f7..43f56dd 100644 --- a/h-source/Application/Views/Desktop/Meet/contributions.php +++ b/h-source/Application/Views/Desktop/Meet/contributions.php @@ -39,10 +39,10 @@ - +
- viewStatus;?>">talk messages submitted by + viewStatus;?>">talk messages submitted by (hardware pages)
@@ -66,6 +66,13 @@ viewStatus;?>">wiki pages inserted/updated by + + + +
+ viewStatus;?>">talk messages submitted by (wiki pages) +
+ diff --git a/h-source/Application/Views/Desktop/Meet/hardware.php b/h-source/Application/Views/Desktop/Meet/hardware.php index 337c644..c8f5a7a 100644 --- a/h-source/Application/Views/Desktop/Meet/hardware.php +++ b/h-source/Application/Views/Desktop/Meet/hardware.php @@ -20,33 +20,11 @@ // along with h-source. If not, see . ?> -
- -
- ">Home » ">meet » ">contributions » hardware contributions -
- -
- hardware contributions of -
- -
- -
+ - - "> -
- -
- -
- - \ No newline at end of file + $name = $item['hardware']['model']; + $type = $item['hardware']['type']; + $id_hard = $item['hardware']['id_hard']; + + ?> + "> \ No newline at end of file diff --git a/h-source/Application/Views/Desktop/Meet/issues.php b/h-source/Application/Views/Desktop/Meet/issues.php index 94bf8ed..2e88d5f 100644 --- a/h-source/Application/Views/Desktop/Meet/issues.php +++ b/h-source/Application/Views/Desktop/Meet/issues.php @@ -20,38 +20,12 @@ // along with h-source. If not, see . ?> -
- -
- ">Home » ">meet » ">contributions » issues opened -
- -
- issues opened by -
- -
- -
+ - - - baseUrl."/issues/view/$lang/$i_id'>".$i_title." at ".smartDate($i_date);?> -
- -
- -
- -
- : -
- - \ No newline at end of file + $i_date = $item['issues']['creation_date']; + $i_title = $item['issues']['title']; + $i_id = $item['issues']['id_issue']; + + ?> + + baseUrl."/issues/view/$lang/$i_id'>".$i_title." at ".smartDate($i_date);?> \ No newline at end of file diff --git a/h-source/Application/Views/Desktop/Meet/list_template.php b/h-source/Application/Views/Desktop/Meet/list_template.php new file mode 100644 index 0000000..2c2f6d3 --- /dev/null +++ b/h-source/Application/Views/Desktop/Meet/list_template.php @@ -0,0 +1,50 @@ + + +. +?> + +
+ + + +
+ +
+ +
+ +
+ +
+ action.".php");?> +
+ +
+ +
+ + action,'hardware') !== 0) {?> +
+ : +
+ +
\ No newline at end of file diff --git a/h-source/Application/Views/Desktop/Meet/messages.php b/h-source/Application/Views/Desktop/Meet/messages.php index 82d2402..f85686b 100644 --- a/h-source/Application/Views/Desktop/Meet/messages.php +++ b/h-source/Application/Views/Desktop/Meet/messages.php @@ -20,37 +20,12 @@ // along with h-source. If not, see . ?> -
- -
- ">Home » ">meet » ">contributions » messages submitted -
- -
- messages submitted by -
- -
- -
+ - - - baseUrl."/issues/view/$lang/$i_id#message-$m_id'>".smartDate($m_date)."";?> submitted to the issue -
- -
- -
- -
- : -
- \ No newline at end of file + $m_date = $item['messages']['creation_date']; + $m_id = $item['messages']['id_mes']; + $i_id = $item['messages']['id_issue']; + + ?> + + baseUrl."/issues/view/$lang/$i_id#message-$m_id'>".smartDate($m_date)."";?> submitted to the issue \ No newline at end of file diff --git a/h-source/Application/Views/Desktop/Meet/talk.php b/h-source/Application/Views/Desktop/Meet/talk.php index c6258d5..cd36c33 100644 --- a/h-source/Application/Views/Desktop/Meet/talk.php +++ b/h-source/Application/Views/Desktop/Meet/talk.php @@ -20,39 +20,13 @@ // along with h-source. If not, see . ?> -
- -
- ">Home » ">meet » ">contributions » talk messages -
- -
- talk messages submitted by -
- -
- -
+ - - - baseUrl."/$controller/talk/$lang/$t_id#talk-$t_id_talk'>".$t_title." at ".smartDate($t_date);?> -
- -
- -
- -
- : -
- - \ No newline at end of file + $t_date = $item['talk']['creation_date']; + $t_title = $item['talk']['title']; + $t_id = $item['talk']['id_hard']; + $t_id_talk = $item['talk']['id_talk']; + $controller = MyStrings::$reverse[$item['hardware']['type']]; + ?> + + baseUrl."/$controller/talk/$lang/$t_id#talk-$t_id_talk'>".$t_title." at ".smartDate($t_date);?> \ No newline at end of file diff --git a/h-source/Application/Views/Desktop/Meet/wiki.php b/h-source/Application/Views/Desktop/Meet/wiki.php index b813cda..1ec339e 100644 --- a/h-source/Application/Views/Desktop/Meet/wiki.php +++ b/h-source/Application/Views/Desktop/Meet/wiki.php @@ -20,36 +20,10 @@ // along with h-source. If not, see . ?> -
- -
- ">Home » ">meet » ">contributions » wiki contributions -
- -
- wiki contributions of -
- -
- -
+ - - "> -
- -
- -
+ $name = $item['wiki']['title']; + $id_wiki = $item['wiki']['id_wiki']; -
- : -
- - \ No newline at end of file + ?> + "> \ No newline at end of file diff --git a/h-source/Application/Views/Desktop/Meet/wikitalk.php b/h-source/Application/Views/Desktop/Meet/wikitalk.php new file mode 100644 index 0000000..351960d --- /dev/null +++ b/h-source/Application/Views/Desktop/Meet/wikitalk.php @@ -0,0 +1,31 @@ + + +. +?> + + + + baseUrl."/wiki/talk/$lang/$t_id#wiki-talk-$t_id_talk'>".$t_title." at ".smartDate($t_date);?> \ No newline at end of file diff --git a/h-source/Application/Views/Mobile/header.php b/h-source/Application/Views/Mobile/header.php index 474ff4a..1d109c8 100644 --- a/h-source/Application/Views/Mobile/header.php +++ b/h-source/Application/Views/Mobile/header.php @@ -35,16 +35,15 @@ $currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index'; - - - - + + +