FAQ-OMatic

 view release on metacpan or  search on metacpan

lib/FAQ/OMatic/Item.pm  view on Meta::CPAN


	my @permNum = (7);
	push @permNum, FAQ::OMatic::Groups::getGroupCodeList();
	push @permNum, (5, 3);

	my @permDesc = map { nameForPerm($_); } @permNum;

	push @permNum, ('');
	push @permDesc, gettext('Inherit');

	return popup($perm, \@permNum, \@permDesc, $self->{$perm}||'');
}

sub popup {
	my $name = shift;
	my $values = shift;			# ary ref
	my $descary = shift;		# ary ref; 1:1 with $values
	my $curvalue = shift;		# one of @{$values}

	$curvalue = '' if (not defined $curvalue);

	my $rt = '';
	$rt.="<select name=\"_$name\">\n";
	for (my $i=0; $i<@{$values}; $i++) {

lib/FAQ/OMatic/Item.pm  view on Meta::CPAN

			."<input type=text name=\"_Moderator\" value=\""
			.($self->{'Moderator'}||'')."\" size=60></td>\n";
	$rt .= "<td>$inherited"
			."</td></tr>\n";

	# ModeratorMail
	$rt .= "<tr>"
			."<td><b>MailModerator</b>"
			."<br>".gettext("Send mail to the moderator when someone other than the moderator edits this item:")."</td>\n";
	$rt .= "<td>\n";
	$rt .= popup('MailModerator', [1, 0, ''], [gettext('Yes'), gettext('No'), gettext('Inherit')],
			$self->{'MailModerator'});
	$inherited =
		$self->getInheritance($params, 'MailModerator', '<br>',
			sub {(gettext("No"), gettext("Yes"))[shift()] || gettext("undefined")});
	$rt .= "<td>$inherited</td>\n";
	$rt .= "</tr>\n";


	# Notifier
	# THANKS to John Nolan for suggesting a better permissions layout.

lib/FAQ/OMatic/Item.pm  view on Meta::CPAN

			."<input type=text name=\"_Notifier\" value=\""
			.($self->{'Notifier'}||'')."\" size=60></td>\n";
	$rt .= "<td>$inherited"
			."</td></tr>\n";

	# NotifierMail
	$rt .= "<tr>"
			."<td><b>MailNotifier</b>"
			."<br>".gettext("Send mail to the Notifier when someone other than the moderator edits this item:")."</td>\n";
	$rt .= "<td>\n";
	$rt .= popup('MailNotifier', [1, 0, ''], [gettext('Yes'), gettext('No'), gettext('Inherit')],
			$self->{'MailNotifier'});
	$inherited =
		$self->getInheritance($params, 'MailNotifier', '<br>',
			sub {(gettext("No"), gettext("Yes"))[shift()] || gettext("undefined")});
	$rt .= "<td>$inherited</td>\n";
	$rt .= "</tr>\n";

	# Permission info
	$rt .= "<tr><th colspan=3>".gettext("Permissions")."</th></tr>\n";

lib/FAQ/OMatic/Item.pm  view on Meta::CPAN

		my $ph = $permissionsInfo->{$key};	# permission descriptor hash
		next if ($ph->{'global'} and $self->{'filename'} ne '1');
			# only display global permissions for item 1, where they are set
		my $pname = $ph->{'name'};
		my $inherited =
			$self->getInheritance($params, $pname, '<br>', \&nameForPerm);
		$rt.="<tr><!-- $pname -->\n";
		$rt.="  <td><b>$pname</b>"
			."<br>".$ph->{'desc'}."</td>\n";	# Perm description column
		$rt.="  <td>".$self->permissionBox($ph->{'name'})."</td>\n";
												# popup choice column
		$rt.="  <td>$inherited</td>\n";			# inherited value column
		$rt.="</tr>\n";
	}

	# RelaxChildPerms
	$rt .= "<tr>"
			."<td><b>"."RelaxChildPerms"."</b>"
			."<br>".gettext("Relax: New answers and subcategories will be moderated ")
				.gettext("by the creator of the item, allowing that person full ")
				.gettext("freedom to edit that new item.")
			."<br>".gettext("Don't Relax: new items will be moderated by ")
			.gettext("the moderator of this item.")
			."</td>\n";
	$rt .= "<td>\n";
	$rt .= popup('RelaxChildPerms',
			['relax', 'norelax', ''],
			[gettext("Relax"), gettext("Don\'t Relax"), gettext("Inherit")],
			$self->{'RelaxChildPerms'});
	$inherited =
		$self->getInheritance($params, 'RelaxChildPerms', '<br>',
			sub {{'relax'=>gettext("Relax"), 'norelax'=>gettext("Don\'t Relax")}->{shift()}
				|| gettext("undefined")});
	$rt .= "<td>$inherited</td>\n";
	$rt .= "</tr>\n";



( run in 1.627 second using v1.01-cache-2.11-cpan-364913b4093 )