/** * Apply the comments changes * * @param SiteComponent $siteComponent * @return void * @access public * @since 1/16/07 */ function applyCommentsEnabled($siteComponent) { if (RequestContext::value('commentsEnabled') && RequestContext::value('commentsEnabled') !== $siteComponent->commentsEnabled()) { $siteComponent->updateCommentsEnabled(RequestContext::value('commentsEnabled')); } }
/** * Print the discussion controls * * @param SiteComponent $siteComponent * @return void * @access public * @since 7/16/07 */ function printCommentSettings($siteComponent, $isSite = false) { print "\n\t\t\t\t<tr><td class='ui2_settingborder'>"; print "\n\t\t\t\t<div class='ui2_settingtitle'>"; print _('Discussion: ') . "\n\t\t\t\t</div>"; print "\n\t\t\t\t</td><td class='ui2_settingborder'>"; $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $siteComponent->getQualifierId())) { $canEdit = true; } else { $canEdit = false; } print "\n\t\t\t\t\t<select class='ui2_field'"; print $canEdit ? "" : " disabled='disabled'"; print " name='" . RequestContext::name('commentsEnabled') . "'>"; $parent = $siteComponent->getParentComponent(); // if not site setting (i.e. root node of site), the include default option if (!$isSite) { print "\n\t\t\t\t\t\t<option value='default'"; if ($siteComponent->commentsEnabled() === 'default') { print " selected='selected'>"; } else { print ">"; } print _("default"); if ($parent) { print " (" . _("current") . ": "; if ($parent->commentsEnabled() === true) { print _("yes"); } else { print _("no"); } print ")"; } print "</option>"; } // other setting select option print "\n\t\t\t\t\t\t<option value='true'"; if ($siteComponent->commentsEnabled() === true) { print " selected='selected'"; } print ">"; print _("yes"); print "</option>"; print "\n\t\t\t\t\t\t<option value='false'"; if ($siteComponent->commentsEnabled() === false) { print " selected='selected'"; } print ">"; print _("no"); print "</option>"; print "\n\t\t\t\t\t</select> "; // print out default settings // $parent = $siteComponent->getParentComponent(); // if ($parent) { // print "\n<span class='ui2_text'>("._("default").": "; // print (($parent->showComments() === true)?_("yes"):_("no")); // print ")</span>"; // } print "\n\t\t\t\t</td></tr>"; }