From: <al...@us...> - 2008-10-21 19:47:44
|
Revision: 745 http://sciret.svn.sourceforge.net/sciret/?rev=745&view=rev Author: alpeb Date: 2008-10-21 19:47:40 +0000 (Tue, 21 Oct 2008) Log Message: ----------- moved the Latest Articles and Most Viewed sections to new tabs in the main view Modified Paths: -------------- trunk/templates/MainView.tpl trunk/templates/footer.tpl trunk/views/MainView.php trunk/views/Rss.php trunk/views/View.php Modified: trunk/templates/MainView.tpl =================================================================== --- trunk/templates/MainView.tpl 2008-10-21 16:56:02 UTC (rev 744) +++ trunk/templates/MainView.tpl 2008-10-21 19:47:40 UTC (rev 745) @@ -23,8 +23,14 @@ <a href="#categories"><em>[l]Categories[/l]</em></a> </li> <li> - <a href="#articles"><em>[l]Articles[/l]</em></a> + <a href="#whatsnew"><em>[l]What's New[/l]</em></a> </li> + <li> + <a href="#popular"><em>[l]Popular[/l]</em></a> + </li> + <li> + <a href="#articles"><em>[l]All Articles[/l]</em></a> + </li> </ul> <div class="yui-content"> <div> @@ -93,10 +99,83 @@ <!-- END requestCat_block --> </div> + <div> <div class="title_view"> <div class="title_content" style="position:relative"> <span> + [l]Latest Articles Added to the Knowledge Base[/l] + </span> + <span style="position:absolute; right:0; top:7px"> + <a href="{latest_rssLink}"><img src="images/rss.gif" /></a></span> + </div> + </div><!--end title_view--> + + + <!-- BEGIN latestArtsItem_block --> + <h2> + <i>({art_num}) </i> + <img src="images/{articleImage}" /> + <a href="{latestLink}">{latestTitle}</a> {bookmark_edit} + <!-- BEGIN latest_question_block --> + ({questionStr}) + <!-- END latest_question_block --> + </h2> + <div> + {modifOrCreated} {latestDate} - {img_stars} {attachment} + </div> + <div class="art_category">{latestCategory}</div> + <p>{art_excerpt}</p> + <div class="author"><span>{art_author}</span></div> + <!-- END latestArtsItem_block --> + <!-- BEGIN latest_noArticles_block --> + <div style="text-align:center; margin-top:15px"> + {noArticlesMessage} + </div> + <!-- END latest_noArticles_block --> + </div> + + <div> + <div class="title_view"> + <div class="title_content" style="position:relative"> + <span> + [l]Most Viewed Articles[/l] + </span> + <span style="position:absolute; right:0; top:7px"> + <a href="{popular_rssLink}"><img src="images/rss.gif" /></a></span> + </div> + </div><!--end title_view--> + + + <!-- BEGIN popularArtsItem_block --> + <h2> + <i>({art_num}) </i> + <img src="images/{articleImage}" /> + <a href="{popularLink}">{popularTitle}</a> + <span style='font-size: 80%'>({popularViews} [l]views[/l])</span> + {bookmark_edit} + <!-- BEGIN popular_question_block --> + ({questionStr}) + <!-- END popular_question_block --> + </h2> + <div> + {modifOrCreated} {popularDate} - {img_stars} {attachment} + </div> + <div class="art_category">{popularCategory}</div> + <p>{art_excerpt}</p> + <div class="author"><span>{art_author}</span></div> + <!-- END popularArtsItem_block --> + <!-- BEGIN popular_noArticles_block --> + <div style="text-align:center; margin-top:15px"> + {noArticlesMessage} + </div> + <!-- END popular_noArticles_block --> + </div> + + <div> + <div class="title_view"> + <div class="title_content" style="position:relative"> + <span> {navigationTitle} {showing} <a href="javascript:void(0)" onclick="addFavorite('location')"><img id="favoriteStarImg" src="images/star.png" alt="[l]Add location to favorites[/l]" title="[l]Add location to favorites[/l]" style="display:{favoriteLocationStarImgDisplay}" /><img id="unFavoriteStarImg" src="images/star_crossed.png" alt="[l]Remove location from favorites[/l]" title="[l]Remove location from favorites[/l]" style="display:{unFavoriteLocationStarImgDisplay}" /><img id="favoriteProgressImg" src="images/progress.gif" style="display:none" /></a> Modified: trunk/templates/footer.tpl =================================================================== --- trunk/templates/footer.tpl 2008-10-21 16:56:02 UTC (rev 744) +++ trunk/templates/footer.tpl 2008-10-21 19:47:40 UTC (rev 745) @@ -98,40 +98,6 @@ <div class="panel_bottom"></div> <!-- END todosLink_block --> - <!-- BEGIN latestArts_block --> - <div class="panel_gray"> - <div class="panel_title_gray"><a href="">[l]Latest[/l]</a></div> - <div class="inside_panel_gray"> - <ol> - <!-- BEGIN latestArtsItem_block --> - <li> - <a href="{latestLink}">{latestTitle} </a><span style='font-size: 80%'>({latestDate})</span><br> - <span class="category">{latestCategory}</span> - </li> - <!-- END latestArtsItem_block --> - </ol> - </div> - </div> - <div class="panel_bottom_gray"></div> - <!-- END latestArts_block --> - - <!-- BEGIN mostViewedArts_block --> - <div class="panel_gray"> - <div class="panel_title_gray"><a href="">[l]Most Viewed[/l]</a></div> - <div class="inside_panel_gray"> - <ol> - <!-- BEGIN mostViewedArtsItem_block --> - <li> - <a href="{mostViewedLink}">{mostViewedTitle} </a><span style='font-size: 80%'>({mostViewedViews} [l]views[/l])</span><br> - <span class="category">{mostViewedCategory}</span> - </li> - <!-- END mostViewedArtsItem_block --> - </ol> - </div> - </div> - <div class="panel_bottom_gray"></div> - <!-- END mostViewedArts_block --> - <!-- BEGIN unansweredQuestions_block --> <div class="panel_gray"> <div class="panel_title_gray"><a href="">[l]Unanswered Questions[/l]</a></div> Modified: trunk/views/MainView.php =================================================================== --- trunk/views/MainView.php 2008-10-21 16:56:02 UTC (rev 744) +++ trunk/views/MainView.php 2008-10-21 19:47:40 UTC (rev 745) @@ -29,7 +29,7 @@ if (!isset($_GET['tab']) || $_GET['tab'] == 'categories') { $_GET['tab'] = 0; } else { - $_GET['tab'] = 1; + $_GET['tab'] = 3; } if (!isset($_GET['set'])) { @@ -69,8 +69,12 @@ $this->tpl->set_file('main', 'MainView.tpl'); $this->tpl->set_block('main', 'articles_block', 'articles'); $this->tpl->set_block('main', 'noArticles_block', 'noArticles'); - $this->tpl->set_block('latestArts_block', 'latestArtsItem_block', 'latestArtsItem'); - $this->tpl->set_block('mostViewedArts_block', 'mostViewedArtsItem_block', 'mostViewedArtsItem'); + $this->tpl->set_block('main', 'latest_noArticles_block', 'latest_noArticles'); + $this->tpl->set_block('main', 'popular_noArticles_block', 'popular_noArticles'); + $this->tpl->set_block('main', 'latestArtsItem_block', 'latestArtsItem'); + $this->tpl->set_block('main', 'popularArtsItem_block', 'popularArtsItem'); + $this->tpl->set_block('latestArtsItem_block', 'latest_question_block', 'latest_question'); + $this->tpl->set_block('popularArtsItem_block', 'popular_question_block', 'popular_question'); $this->tpl->set_block('unansweredQuestions_block', 'unansweredQuestionsItem_block', 'unansweredQuestionsItem'); $this->tpl->set_block('main', 'totalNumArts_block', 'totalNumArts'); @@ -140,6 +144,16 @@ 'view' => 'Rss', 'catId' => $catId, 'items' => 10)), + 'latest_rssLink' => Library::getLink(array( + 'view' => 'Rss', + 'catId' => $catId, + 'latest' => 1, + 'items' => 10)), + 'popular_rssLink' => Library::getLink(array( + 'view' => 'Rss', + 'catId' => $catId, + 'popular' => 1, + 'items' => 10)), 'editCategoryLink' => Library::getLink(array( 'view' => 'EditCategory', 'catId' => $catId)), @@ -421,24 +435,43 @@ $firstIteration = true; while ($article = $articles->fetch()) { unset($this->tPath); - if ($article->getCategoryId() > 0) { - $path = $this->_getCategoryPath($article->getCategoryId(), 'MainView', false); - $this->tpl->set_var('mostViewedCategory', $this->user->lang('in %s', $path)); + $this->tpl->set_var(array( + 'popularLink' => Library::getLink(array('view' => ($article->isBookmark()? 'ViewBookmark' : 'ViewArticle'), 'id' => $article->getId())), + 'popularTitle' => $article->getTitle(), + 'popularViews' => $article->getViews(), + 'popularDate' => $this->user->formatDate($article->getCreationDate()), + 'modifOrCreated' => $article->getModifiedByUserId() > 0? $this->user->lang('Last Modified') : $this->user->lang('Created on'), + 'img_stars' => $article->getTotalVotes()? '<img src="images/'.round($article->getAverageRating()).'stars.png" width="50" height="10" />' : '', + 'attachment' => $article->getNumFiles()? '<img src="images/attach.gif" />' : '', + 'art_excerpt' => strip_tags($article->getExcerpt()).($article->isBookmark()? '' : '...'), + 'art_author' => $article->getCreatedBy(), + )); + + if ($article->isBookmark()) { + $this->tpl->set_var('articleImage', 'bookmark.png'); + } elseif ($article->getQuestion()) { + $this->tpl->set_var('articleImage', 'question.png'); + $this->tpl->set_var('questionStr', $article->getQuestion()); + $this->tpl->parse('popular_question', 'popular_question_block'); } else { - $this->tpl->set_var('mostViewedCategory', ''); + $this->tpl->set_var('articleImage', 'article.png'); + $this->tpl->set_var('popular_question', ''); } - $this->tpl->set_var(array( - 'mostViewedLink' => Library::getLink(array('view' => ($article->isBookmark()? 'ViewBookmark' : 'ViewArticle'), 'id' => $article->getId())), - 'mostViewedTitle' => $article->getTitle(), - 'mostViewedViews' => $article->getViews(), - )); - $this->tpl->parse('mostViewedArtsItem', 'mostViewedArtsItem_block', !$firstIteration); + + if ($article->getCategoryId() == 0) { + $this->tpl->set_var('popularCategory', ''); + } else { + $this->tpl->set_var('popularCategory', $this->user->lang('in %s', $this->_getCategoryPath($article->getCategoryId(), 'MainView', true))); + } + + $this->tpl->parse('popularArtsItem', 'popularArtsItem_block', !$firstIteration); $firstIteration = false; } if ($firstIteration) { - $this->tpl->set_var('mostViewedArts', ''); + $this->tpl->set_var('popularArtsItem', ''); + $this->tpl->parse('popular_noArticles', 'popular_noArticles_block'); } else { - $this->tpl->parse('mostViewedArts', 'mostViewedArts_block'); + $this->tpl->set_var('popular_noArticles', ''); } // ** LATEST LIST ** @@ -446,24 +479,42 @@ $firstIteration = true; while ($article = $articles->fetch()) { unset($this->tPath); - if ($article->getCategoryId() > 0) { - $path = $this->_getCategoryPath($article->getCategoryId(), 'MainView', false); - $this->tpl->set_var('latestCategory', $this->user->lang('in %s', $path)); - } else { - $this->tpl->set_var('latestCategory', ''); - } $this->tpl->set_var(array( 'latestLink' => Library::getLink(array('view' => ($article->isBookmark()? 'ViewBookmark' : 'ViewArticle'), 'id' => $article->getId())), 'latestTitle' => $article->getTitle(), 'latestDate' => $this->user->formatDate($article->getCreationDate()), + 'modifOrCreated' => $article->getModifiedByUserId() > 0? $this->user->lang('Last Modified') : $this->user->lang('Created on'), + 'img_stars' => $article->getTotalVotes()? '<img src="images/'.round($article->getAverageRating()).'stars.png" width="50" height="10" />' : '', + 'attachment' => $article->getNumFiles()? '<img src="images/attach.gif" />' : '', + 'art_excerpt' => strip_tags($article->getExcerpt()).($article->isBookmark()? '' : '...'), + 'art_author' => $article->getCreatedBy(), )); + + if ($article->isBookmark()) { + $this->tpl->set_var('articleImage', 'bookmark.png'); + } elseif ($article->getQuestion()) { + $this->tpl->set_var('articleImage', 'question.png'); + $this->tpl->set_var('questionStr', $article->getQuestion()); + $this->tpl->parse('latest_question', 'latest_question_block'); + } else { + $this->tpl->set_var('articleImage', 'article.png'); + $this->tpl->set_var('latest_question', ''); + } + + if ($article->getCategoryId() == 0) { + $this->tpl->set_var('latestCategory', ''); + } else { + $this->tpl->set_var('latestCategory', $this->user->lang('in %s', $this->_getCategoryPath($article->getCategoryId(), 'MainView', true))); + } + $this->tpl->parse('latestArtsItem', 'latestArtsItem_block', !$firstIteration); $firstIteration = false; } if ($firstIteration) { - $this->tpl->set_var('latestArts', ''); + $this->tpl->set_var('latestArtsItem', ''); + $this->tpl->parse('latest_noArticles', 'latest_noArticles_block'); } else { - $this->tpl->parse('latestArts', 'latestArts_block'); + $this->tpl->set_var('latest_noArticles', ''); } // ** UNANSWERED QUESTIONS LIST ** Modified: trunk/views/Rss.php =================================================================== --- trunk/views/Rss.php 2008-10-21 16:56:02 UTC (rev 744) +++ trunk/views/Rss.php 2008-10-21 19:47:40 UTC (rev 745) @@ -47,12 +47,21 @@ 'version' => $config->getConfigValue('version'), )); - $articleGateway = new ArticleGateway; + $articleGateway = new ArticleGateway(); + + if (isset($_GET['popular']) && $_GET['popular'] == 1) { + $specialList = 'mostViewed'; + } elseif (isset($_GET['latest']) && $_GET['latest'] == 1) { + $specialList = 'latest'; + } else { + $specialList = false; + } + $articles = $articleGateway->getArticles( $catId, $this->user->getPreference('navigationType') == 'catAndSubCats', + $specialList, false, false, - false, 0, $_GET['items'], isset($_GET['set'])? $_GET['set'] : 'all', Modified: trunk/views/View.php =================================================================== --- trunk/views/View.php 2008-10-21 16:56:02 UTC (rev 744) +++ trunk/views/View.php 2008-10-21 19:47:40 UTC (rev 745) @@ -44,8 +44,6 @@ $this->tpl->set_file('head', 'head.tpl'); $this->tpl->set_file('footer', 'footer.tpl'); $this->tpl->set_block('head', 'rtl_block', 'rtl'); - $this->tpl->set_block('footer', 'latestArts_block', 'latestArts'); - $this->tpl->set_block('footer', 'mostViewedArts_block', 'mostViewedArts'); $this->tpl->set_block('footer', 'unansweredQuestions_block', 'unansweredQuestions'); // reset sidebar. These vars will be redefined if needed (in MainView) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |