I have the following script in the Announcement Banner, which will set the default comment permissions only on a particular project ID... however, I'm not sure how to get the projectID that the banner is currently displayed on. Does anyone know how to do this?
<script language="JavaScript">
<!--
var defaultRoleName = "role:10001";
var customRoleSelected = false;
var projectID = ???????;
function changeCommentLevel()
{
if (customRoleSelected)
return;
if (projectID != "MAINT")
return;
var commentLevelSelect = jQuery('.security-level select#commentLevel option[value=\'' + defaultRoleName + '\']');
if (commentLevelSelect)
{ var labelText = commentLevelSelect.first().text();
jQuery("select#commentLevel").val(defaultRoleName);
jQuery("#commentLevel-multi-select a.drop span.icon").removeClass("icon-unlocked").addClass("icon-locked");
var htmlEscapedLabel = AJS.$("<div/>").text(labelText).html();
jQuery(".security-level span.current-level").html(AJS.format(AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel));
}
}
jQuery('#comment').live('focus', changeCommentLevel);
jQuery('#commentLevel-suggestions').live('click', function(){ customRoleSelected = true; });
//-->
</script>
<style>
.alertHeader
{display:none;}
</style>
Community moderators have prevented the ability to post new answers.
function getProjectKey()
{
var projectLink = AJS.$('#project-name-val').attr('href');
var projectKey = '';
if (typeof projectLink != 'undefined') {
projectKey = projectLink.replace(/^\/browse\//, '');
}
return projectKey;
}
It needs to be set at any screen that could possibly have a comment entered, so this was the recommended suggestion I found elsewhere, but it was not project-specific. If there's a script that would do the same thing that would be fine as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you explain me more where you need to set that? transition screen or any where .... and what is your JIRA version
Using javascript is not recommended, you can use one of the scripting plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.