From: <al...@us...> - 2007-08-16 00:21:37
|
Revision: 486 http://sciret.svn.sourceforge.net/sciret/?rev=486&view=rev Author: alpeb Date: 2007-08-15 17:21:19 -0700 (Wed, 15 Aug 2007) Log Message: ----------- allow users to hide categories in the main screen Added Paths: ----------- branches/release-candidates/sciret-1.2/actions/HideCategory.php branches/release-candidates/sciret-1.2/actions/ShowCategory.php Added: branches/release-candidates/sciret-1.2/actions/HideCategory.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/HideCategory.php (rev 0) +++ branches/release-candidates/sciret-1.2/actions/HideCategory.php 2007-08-16 00:21:19 UTC (rev 486) @@ -0,0 +1,23 @@ +<?php + +require 'actions/Action.php'; + +class HideCategory extends Action { + + function dispatch() { + $hideCategories = $this->user->getPreference('hiddenCategories'); + if (!$hideCategories) { + $hideCategories = array(); + } else { + $hideCategories = explode(',', $hideCategories); + } + $hideCategories[] = (int)$_GET['catId']; + $this->user->setPreference('hiddenCategories', implode(',', $hideCategories)); + $this->user->save(); + + $_SESSION['message'] = $this->user->lang('Category won\'t be shown in the future'); + Library::redirect(Library::getLink(array('view' => 'EditCategories'))); + } +} + +?> Property changes on: branches/release-candidates/sciret-1.2/actions/HideCategory.php ___________________________________________________________________ Name: svn:executable + * Added: branches/release-candidates/sciret-1.2/actions/ShowCategory.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/ShowCategory.php (rev 0) +++ branches/release-candidates/sciret-1.2/actions/ShowCategory.php 2007-08-16 00:21:19 UTC (rev 486) @@ -0,0 +1,31 @@ +<?php + +require 'actions/Action.php'; + +class ShowCategory extends Action { + + function dispatch() { + $hideCategories = $this->user->getPreference('hiddenCategories'); + if (!$hideCategories) { + $hideCategories = array(); + } else { + $hideCategories = explode(',', $hideCategories); + } + + $newHideCategories = array(); + foreach ($hideCategories as $catId) { + if ($catId == $_GET['catId']) { + continue; + } + $newHideCategories[] = $catId; + } + + $this->user->setPreference('hiddenCategories', implode(',', $newHideCategories)); + $this->user->save(); + + $_SESSION['message'] = $this->user->lang('Category will be shown in the future'); + Library::redirect(Library::getLink(array('view' => 'EditCategories'))); + } +} + +?> Property changes on: branches/release-candidates/sciret-1.2/actions/ShowCategory.php ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2008-07-08 03:37:07
|
Revision: 604 http://sciret.svn.sourceforge.net/sciret/?rev=604&view=rev Author: alpeb Date: 2008-07-07 20:37:05 -0700 (Mon, 07 Jul 2008) Log Message: ----------- use class constants instead of global constants Modified Paths: -------------- branches/release-candidates/sciret-1.2/actions/DeleteArticle.php branches/release-candidates/sciret-1.2/actions/SaveArticle.php branches/release-candidates/sciret-1.2/actions/SavePreferences.php Modified: branches/release-candidates/sciret-1.2/actions/DeleteArticle.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/DeleteArticle.php 2008-07-08 03:36:20 UTC (rev 603) +++ branches/release-candidates/sciret-1.2/actions/DeleteArticle.php 2008-07-08 03:37:05 UTC (rev 604) @@ -20,7 +20,7 @@ if ($this->configuration->getConfigValue('restrictEditDelete')) { $article = new Article($artId); - if ($article->getUserId() != $this->user->getId() && ($this->user->getRole() & ROLE_ADMIN) != ROLE_ADMIN) { + if ($article->getUserId() != $this->user->getId() && ($this->user->getRole() & User::ROLE_ADMIN) != User::ROLE_ADMIN) { $_SESSION['message'] = $this->user->lang('Sorry, only the author or an admin can delete this article.'); Library::redirect(Library::getLink(array('view' => 'ViewArticle', 'id' => $artId))); } Modified: branches/release-candidates/sciret-1.2/actions/SaveArticle.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/SaveArticle.php 2008-07-08 03:36:20 UTC (rev 603) +++ branches/release-candidates/sciret-1.2/actions/SaveArticle.php 2008-07-08 03:37:05 UTC (rev 604) @@ -20,7 +20,7 @@ if ($articleId > 0 && $this->configuration->getConfigValue('restrictEditDelete')) { $article = new Article($articleId); - if ($article->getUserId() != $this->user->getId() && ($this->user->getRole() & ROLE_ADMIN) != ROLE_ADMIN) { + if ($article->getUserId() != $this->user->getId() && ($this->user->getRole() & User::ROLE_ADMIN) != User::ROLE_ADMIN) { $_SESSION['message'] = $this->user->lang('Sorry, only the author or an admin can modify this article.'); Library::redirect(Library::getLink(array('view' => 'ViewArticle', 'id' => $articleId))); } Modified: branches/release-candidates/sciret-1.2/actions/SavePreferences.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/SavePreferences.php 2008-07-08 03:36:20 UTC (rev 603) +++ branches/release-candidates/sciret-1.2/actions/SavePreferences.php 2008-07-08 03:37:05 UTC (rev 604) @@ -32,7 +32,7 @@ $this->user->setPreference('navigationType', $_POST['navigationType']); } - if (($this->user->getRole() & ROLE_ADMIN) == ROLE_ADMIN) { + if (($this->user->getRole() & User::ROLE_ADMIN) == User::ROLE_ADMIN) { $this->configuration->setConfigValue('publishKB', $_POST['publishKB'] == '1'? '1' : '0'); $this->configuration->setConfigValue('publishArticlesAuto', $_POST['publishArticlesAuto'] == '1'? '1' : '0'); $this->configuration->setConfigValue('publishBookmarksAuto', $_POST['publishBookmarksAuto'] == '1'? '1' : '0'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |