From 3a5dafcdc4efff42ff7f6d4f630b7666ff73248f Mon Sep 17 00:00:00 2001 From: mensonge Date: Mon, 9 Feb 2009 14:05:21 +0000 Subject: [PATCH] Minor Fix: improve common description of tags and add variable into config file to allow or not everybody to edit these descriptions [Config file modified: ] git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@263 b3834d28-1941-0410-a4f8-b48e95affb8f --- config.inc.php.example | 3 ++- scuttle.css | 1 + tagcommondescriptionedit.php | 2 +- templates/bookmarks.tpl.php | 31 ++++++++++++++------------ templates/sidebar.block.tagactions.php | 2 +- upgrade.txt | 1 + 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/config.inc.php.example b/config.inc.php.example index e8fc9b2..02ec288 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -15,7 +15,7 @@ $usecache = false; # use cache ? {true,false} $dir_cache = dirname(__FILE__) .'/cache/'; # directory where cache files will be stored $cleanurls = false; # Use mod_rewrite to hide PHP extensions {true,false[default]} # be cautious, doesn't work for all hosts, you may need to modify the .htaccess file -$debugMode = false; # if true, show debug messages +$debugMode = false; # if true, show debug messages #### Database #### $dbtype = 'mysql4'; # Database driver {mysql, mysqli, mysql4, oracle, postgres, sqlite, db2, firebird, mssql, mssq-odbc} @@ -78,6 +78,7 @@ $thumbnailsKey = ''; #then artviper.net send you a UserId and a secretKey ### Tags ### $enableCommonTagDescription = true; # enableCommonTagDescription {true, false} +$enableCommonTagDescriptionEditedByAll = true; #true mean everybody can edit common description. Else just the admins can do it. $menuTag = 'menu'; # name of the tag whose subtags will appear into the menu box $maxSizeMenuBlock = 7; # maximum number of items (tags) appearing into menu box $menu2Tags = array('example', 'of', 'menu', 'tags'); # list of tags used by menu2 sidebar box (void list = hidden menu2 box) diff --git a/scuttle.css b/scuttle.css index 28377e0..17fe23a 100644 --- a/scuttle.css +++ b/scuttle.css @@ -302,6 +302,7 @@ p.commondescription { padding-left:5px; color: #555; font-weight: bold; + font-size: medium; border-left: 1px solid #CC8; width: 70%; } diff --git a/tagcommondescriptionedit.php b/tagcommondescriptionedit.php index 3d13d66..aba7c43 100644 --- a/tagcommondescriptionedit.php +++ b/tagcommondescriptionedit.php @@ -39,7 +39,7 @@ $currentUser = $userservice->getCurrentObjectUser(); list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']); //permissions -if(!$userservice->isLoggedOn()) { +if(!$userservice->isLoggedOn() || (!$GLOBALS['enableCommonTagDescriptionEditedByAll'] && !$currentUser->isAdmin())) { $tplVars['error'] = T_('Permission denied.'); $templateservice->loadTemplate('error.500.tpl', $tplVars); exit(); diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index adb6b24..b0ed3e8 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -35,23 +35,25 @@ if(($currenttag!= '' && $GLOBALS['enableCommonTagDescription'])

getLastTagDescription($currenttag)) { - $description = $cdservice->getLastTagDescription($currenttag); - echo nl2br(filter($description['cdDescription'])); + $cDescription = $cdservice->getLastTagDescription($currenttag); + echo nl2br(filter($cDescription['cdDescription'])); } elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) { - $description = $cdservice->getLastBookmarkDescription($hash); - echo nl2br(filter($description['cdTitle'])). "
"; - echo nl2br(filter($description['cdDescription'])). "
"; + $cDescription = $cdservice->getLastBookmarkDescription($hash); + echo nl2br(filter($cDescription['cdTitle'])). "
"; + echo nl2br(filter($cDescription['cdDescription'])). "
"; } //common tag description edit if($userservice->isLoggedOn()) { - if($currenttag!= '') { - echo ' '; - echo T_('common description').' '; + if($currenttag!= '' && ($GLOBALS['enableCommonTagDescriptionEditedByAll'] || $currentUser->isAdmin())) { + echo ' '; + echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):''; + echo ' '; } elseif(isset($hash)) { - echo ' ('; - echo T_('edit common description').')'; + echo ' ('; + echo T_('Edit the common description of this bookmark').')'; } } ?>

@@ -65,14 +67,15 @@ if($currenttag!= '' && $user!='') { if($tagservice->getDescription($currenttag, $userObject['uId'])) { ?>

getDescription($currenttag, $userObject['uId']); -echo nl2br(filter($description['tDescription'])); +$pDescription = $tagservice->getDescription($currenttag, $userObject['uId']); +echo nl2br(filter($pDescription['tDescription'])); //personal tag description edit if($userservice->isLoggedOn()) { if($currenttag!= '') { - echo ' '; - echo T_('personal description').' '; + echo ' '; + echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):''; + echo ' '; } } ?>

diff --git a/templates/sidebar.block.tagactions.php b/templates/sidebar.block.tagactions.php index 37bf5c6..3351866 100644 --- a/templates/sidebar.block.tagactions.php +++ b/templates/sidebar.block.tagactions.php @@ -22,7 +22,7 @@ if ($userservice->isLoggedOn()) {
  • - + isAdmin() )): ?>
  • diff --git a/upgrade.txt b/upgrade.txt index 023b93f..485e3e0 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -95,6 +95,7 @@ ALTER TABLE `sc_searchhistory` CHARACTER SET utf8 COLLATE utf8_general_ci; - Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example * Add variable : $descriptionAnchors = array("author", "isbn", "address"=>"[address][street][/street][city][/city][/address]"); #add a possible anchor (structured content) for bookmarks' description field +* Add variable : $enableCommonTagDescriptionEditedByAll = true; #true mean everybody can edit common description. Else just the admins can do it. === From version 0.90 to 0.91 === - Backup you database