From: <lu...@us...> - 2007-08-16 18:18:34
|
Revision: 492 http://sciret.svn.sourceforge.net/sciret/?rev=492&view=rev Author: lugo04 Date: 2007-08-16 11:10:19 -0700 (Thu, 16 Aug 2007) Log Message: ----------- Add SF patch 1775353 Allow / disallow comments and ratings Modified Paths: -------------- branches/release-candidates/sciret-1.2/CHANGELOG branches/release-candidates/sciret-1.2/actions/SavePreferences.php branches/release-candidates/sciret-1.2/languages/English.txt branches/release-candidates/sciret-1.2/setup/final.sql branches/release-candidates/sciret-1.2/setup/upgrade_1.2.0.sql branches/release-candidates/sciret-1.2/templates/EditPreferences.tpl branches/release-candidates/sciret-1.2/views/EditPreferences.php branches/release-candidates/sciret-1.2/views/ViewArticle.php branches/release-candidates/sciret-1.2/views/ViewBookmark.php Modified: branches/release-candidates/sciret-1.2/CHANGELOG =================================================================== --- branches/release-candidates/sciret-1.2/CHANGELOG 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/CHANGELOG 2007-08-16 18:10:19 UTC (rev 492) @@ -1,3 +1,7 @@ +2007-08-15 Lucie Goga <lg...@th...> + * Add SF patch 1775353 from Trond Viggo Håpnes. This patch + allows / disallow coments and ratings. + 2007-08-16 Alejandro Pedraza <ale...@gm...> * User can manage the categories and hide them with the Manage categories Modified: branches/release-candidates/sciret-1.2/actions/SavePreferences.php =================================================================== --- branches/release-candidates/sciret-1.2/actions/SavePreferences.php 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/actions/SavePreferences.php 2007-08-16 18:10:19 UTC (rev 492) @@ -39,6 +39,7 @@ $this->configuration->setConfigValue('publishCommentsAuto', $_POST['publishCommentsAuto'] == '1'? '1' : '0'); $this->configuration->setConfigValue('publishQuestionsAuto', $_POST['publishQuestionsAuto'] == '1'? '1' : '0'); $this->configuration->setConfigValue('internalByDefault', $_POST['internalByDefault'] == '1'? '1' : '0'); + $this->configuration->setConfigValue('allowCommentsRatings', $_POST['allowCommentsRatings'] == '1'? '1' : '0'); $this->configuration->setConfigValue('passwordExpirationDays', $_POST['passwordExpirationDays']); $this->configuration->setConfigValue('mailTransport', $_POST['mailTransport'] == 'smtp' ? 'smtp' : 'sendmail'); $this->configuration->setConfigValue('mailFromName', $_POST['mailFromName']); Modified: branches/release-candidates/sciret-1.2/languages/English.txt =================================================================== --- branches/release-candidates/sciret-1.2/languages/English.txt 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/languages/English.txt 2007-08-16 18:10:19 UTC (rev 492) @@ -661,3 +661,5 @@ Usage Sorry, this article is for internal use only. + +Allow comments and ratings Modified: branches/release-candidates/sciret-1.2/setup/final.sql =================================================================== --- branches/release-candidates/sciret-1.2/setup/final.sql 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/setup/final.sql 2007-08-16 18:10:19 UTC (rev 492) @@ -21,6 +21,7 @@ `votes_4` int(11) NOT NULL default '0', `votes_5` int(11) NOT NULL default '0', `internal` tinyint(4) NOT NULL default '0', + `allowCommentsRatings` tinyint(4) NOT NULL default '1', PRIMARY KEY (`art_id`), FULLTEXT KEY `title` (`title`,`content`, `url`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; Modified: branches/release-candidates/sciret-1.2/setup/upgrade_1.2.0.sql =================================================================== --- branches/release-candidates/sciret-1.2/setup/upgrade_1.2.0.sql 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/setup/upgrade_1.2.0.sql 2007-08-16 18:10:19 UTC (rev 492) @@ -1,4 +1,4 @@ -INSERT INTO `configuration` (`field`, `value`) VALUES ('publishKB', '1'), ('internalByDefault', '0'), ('passwordExpirationDays', '60'), ('mailTransport', 'sendmail'), ('mailFromName', 'Sciret Knowledgebase'), ('mailFromMail', 'root@localhost'), ('smtpServer', ''), ('smtpUser', ''), ('smtpPassword', ''), ('smtpPort', '25'); +INSERT INTO `configuration` (`field`, `value`) VALUES ('publishKB', '1'), ('internalByDefault', '0'), ('passwordExpirationDays', '60'), ('mailTransport', 'sendmail'), ('mailFromName', 'Sciret Knowledgebase'), ('mailFromMail', 'root@localhost'), ('smtpServer', ''), ('smtpUser', ''), ('smtpPassword', ''), ('smtpPort', '25'), ('allowCommentsRatings', '1'); ALTER TABLE `articles` ADD `internal` tinyint(4) NOT NULL default '0'; Modified: branches/release-candidates/sciret-1.2/templates/EditPreferences.tpl =================================================================== --- branches/release-candidates/sciret-1.2/templates/EditPreferences.tpl 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/templates/EditPreferences.tpl 2007-08-16 18:10:19 UTC (rev 492) @@ -120,12 +120,21 @@ </td> </tr> <tr class="row_off"> + <td style="text-align:right; font-weight:bold">[l]Allow comments and ratings[/l]:</td> + <td> + <select name="allowCommentsRatings"> + <option value="1" {allowCommentsRatings_yes_selected}>[l]Yes[/l]</option> + <option value="0" {allowCommentsRatings_no_selected}>[l]No[/l]</option> + </select> + </td> + </tr> + + <tr class="row_on"> <td style="text-align:right; font-weight:bold">[l]Days before password expires[/l]:</td> <td> <input type="text" name="passwordExpirationDays" value="{passwordExpirationDays}" size="2" /> </td> </tr> - <tr class="row_off"> <td style="text-align:right; font-weight:bold">[l]Send mail from (name)[/l]:</td> <td> Modified: branches/release-candidates/sciret-1.2/views/EditPreferences.php =================================================================== --- branches/release-candidates/sciret-1.2/views/EditPreferences.php 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/views/EditPreferences.php 2007-08-16 18:10:19 UTC (rev 492) @@ -47,6 +47,8 @@ 'publishQuestionsAuto_no_selected' => $this->configuration->getConfigValue('publishQuestionsAuto') == '0'? 'selected="true" ': '', 'internalByDefault_yes_selected' => $this->configuration->getConfigValue('internalByDefault') == '1'? 'selected="true" ': '', 'internalByDefault_no_selected' => $this->configuration->getConfigValue('internalByDefault') == '0'? 'selected="true" ': '', + 'allowCommentsRatings_yes_selected' => $this->configuration->getConfigValue('allowCommentsRatings') == '1'? 'selected="true" ': '', + 'allowCommentsRatings_no_selected' => $this->configuration->getConfigValue('allowCommentsRatings') == '0'? 'selected="true" ': '', 'passwordExpirationDays' => $this->configuration->getConfigValue('passwordExpirationDays'), 'mailFromName' => $this->configuration->getConfigValue('mailFromName'), 'mailFromMail' => $this->configuration->getConfigValue('mailFromMail'), @@ -58,7 +60,7 @@ 'smtpPassword' => $this->configuration->getConfigValue('smtpPassword'), 'smtpPort' => $this->configuration->getConfigValue('smtpPort'), )); - + // *** LANGUAGES *** $dirname = 'languages'; $dir = dir($dirname); Modified: branches/release-candidates/sciret-1.2/views/ViewArticle.php =================================================================== --- branches/release-candidates/sciret-1.2/views/ViewArticle.php 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/views/ViewArticle.php 2007-08-16 18:10:19 UTC (rev 492) @@ -49,11 +49,18 @@ $this->tpl->set_block('view_article', 'mailArticle_block', 'mailArticle'); // *** COMMENTS **** - $viewComments = new ViewComments($this->user, $this->configuration); - $viewComments->setArticle($article); - $viewComments->setTemplate($this->tpl); - $this->tpl->set_var('commentsTable', $viewComments->dispatch(true)); + $config = $this->configuration; + $allowCommentsRatings = $config->getConfigValue('allowCommentsRatings'); + if ($allowCommentsRatings) { + $viewComments = new ViewComments($this->user, $this->configuration); + $viewComments->setArticle($article); + $viewComments->setTemplate($this->tpl); + $this->tpl->set_var('commentsTable', $viewComments->dispatch(true)); + } else { + $this->tpl->set_var('commentsTable', ''); + } + // *** ATTACHED FILES **** $files = $article->getFiles(); $notFirstPass = false; Modified: branches/release-candidates/sciret-1.2/views/ViewBookmark.php =================================================================== --- branches/release-candidates/sciret-1.2/views/ViewBookmark.php 2007-08-16 10:02:39 UTC (rev 491) +++ branches/release-candidates/sciret-1.2/views/ViewBookmark.php 2007-08-16 18:10:19 UTC (rev 492) @@ -43,11 +43,18 @@ $this->tpl->set_var('mailBookmarkLink', Library::getLink(array('view' => 'MailArticle', 'artId' => $article->getId()))); // *** COMMENTS **** - $viewComments = new ViewComments($this->user, $this->configuration); - $viewComments->setArticle($article); - $viewComments->setTemplate($this->tpl); - $this->tpl->set_var('commentsTable', $viewComments->dispatch(true)); + $config = $this->configuration; + $allowCommentsRatings = $config->getConfigValue('allowCommentsRatings'); + if ($allowCommentsRatings) { + $viewComments = new ViewComments($this->user, $this->configuration); + $viewComments->setArticle($article); + $viewComments->setTemplate($this->tpl); + $this->tpl->set_var('commentsTable', $viewComments->dispatch(true)); + } else { + $this->tpl->set_var('commentsTable', ''); + } + // *** GENERAL *** $this->tpl->set_var(array( 'bookmark_id' => $article->getId(), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |