<commit_before>{* $Id$ *}

{title help="Users+Management" admpage="login" url="tiki-adminusers.php"}{tr}Admin Users{/tr}{/title}

<div class="navbar">
	{if $tiki_p_admin eq 'y'} {* only full admins can manage groups, not tiki_p_admin_users *}
		{button href="tiki-admingroups.php" _text="{tr}Admin Groups{/tr}"}
	{/if}
	{button _text="{tr}Admin Users{/tr}"}
	{if $userinfo.userId}
		{button href="?add=1" _text="{tr}Add a New User{/tr}"}
	{/if}
</div>

{if $prefs.feature_intertiki eq 'y' and ($prefs.feature_intertiki_import_groups eq 'y' or $prefs.feature_intertiki_import_preferences eq 'y')}
	{remarksbox type="warning" title="{tr}Warning{/tr}"}
		{if $prefs.feature_intertiki_import_groups eq 'y'}{tr}Since this tiki site is in slave mode and import groups, the master groups will be automatically reimported at each login{/tr}{/if}
		{if $prefs.feature_intertiki_import_preferences eq 'y'}{tr}Since this tiki site is in slave mode and import preferences, the master user preferences will be automatically reimported at each login{/tr}{/if}
	{/remarksbox}
{/if}

{if $tikifeedback}
	{remarksbox type="feedback" title="{tr}Feedback{/tr}"}
	{section name=n loop=$tikifeedback}
	{tr}{$tikifeedback[n].mes|escape}{/tr}
	<br />
	{/section}{/remarksbox}
{/if}

{if $added != "" or $discarded != "" or $discardlist != ''}
	{remarksbox type="feedback" title="Batch Upload Results"}
		{tr}Updated users:{/tr} {$added}
		{if $discarded != ""}- {tr}Rejected users:{/tr} {$discarded}{/if}
		<br />
		<br />
		{if $discardlist != ''}
			<table class="normal">
				<tr>
					<th>{tr}Username{/tr}</th>
					<th>{tr}Reason{/tr}</th>
				</tr>
				{section name=reject loop=$discardlist}
					<tr>
						<td class="odd">{$discardlist[reject].login}</td>
						<td class="odd">{$discardlist[reject].reason}</td>
					</tr>
				{/section}
			</table>
		{/if}

		{if $errors}
			<br />
			{section name=ix loop=$errors}
				{$errors[ix]}<br />
			{/section}
		{/if}
	{/remarksbox}
{/if}

{tabset name='tabs_adminuers'}

{* ---------------------- tab with list -------------------- *}
{tab name="{tr}Users{/tr}"}
	<h2>{tr}Users{/tr}</h2>

	<form method="get" action="tiki-adminusers.php">
		<table class="findtable">
			<tr>
				<td><label for="find">{tr}Find{/tr}</label></td>
				<td><input type="text" id="find" name="find" value="{$find|escape}" /></td>
				<td><input type="submit" value="{tr}Find{/tr}" name="search" /></td>
				<td><label for="numrows">{tr}Number of displayed rows{/tr}</label></td>
				<td><input type="text" size="4" id="numrows" name="numrows" value="{$numrows|escape}" /></td>
			</tr>
			<tr>
				<td colspan="2"></td>
				<td colspan="3">
					<a href="javascript:toggleBlock('search')" class="link">{icon _id='add' alt="{tr}more{/tr}"}&nbsp;{tr}More Criteria{/tr}</a>
				</td>
			</tr>
		</table>
		{jq}$("#find").tiki("autocomplete", "username"){/jq}

		<div id="search" {if $filterGroup or $filterEmail}style="display:block;"{else}style="display:none;"{/if}>
			<table class="findtable">
				<tr>
					<td><label for="filterGroup">{tr}Group (direct){/tr}</label></td>
					<td>
						<select name="filterGroup" id="filterGroup">
							<option value=""></option>
							{section name=ix loop=$all_groups}
								{if $all_groups[ix] != 'Registered' && $all_groups[ix] != 'Anonymous'}
									<option value="{$all_groups[ix]|escape}" {if $filterGroup eq $all_groups[ix]}selected{/if}>{$all_groups[ix]|escape}</option>
								{/if}
							{/section}
						</select>
					</td>
				</tr>
				<tr>
					<td><label for="filterEmail">{tr}Email{/tr}</label></td>
					<td><input type="text" id="filterEmail" name="filterEmail" value="{$filterEmail}" /></td>
				</tr>
			</table>

			<input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
		</div>
	</form>

	{if $cant > $numrows or !empty($initial)}
		{initials_filter_links}
	{/if}

	<form name="checkform" method="post" action="{$smarty.server.PHP_SELF}{if $group_management_mode ne 'y' and $set_default_groups_mode ne 'y' and $email_mode ne 'y'}#multiple{/if}">
		<table class="normal">
			<tr>
				<th class="auto">
					{if $users}
					   {select_all checkbox_names='checked[]'}
					{/if}
				</th>
				<th>{self_link _sort_arg='sort_mode' _sort_field='login'}{tr}User{/tr}{/self_link}</th>
				{if $prefs.login_is_email neq 'y'}
					<th>{self_link _sort_arg='sort_mode' _sort_field='email}{tr}Email{/tr}{/self_link}</th>
				{/if}
				{if $prefs.auth_method eq 'openid'}
					<th>{self_link _sort_arg='sort_mode' _sort_field='openID'}{tr}OpenID{/tr}{/self_link}</th>
				{/if}
				<th>{self_link _sort_arg='sort_mode' _sort_field='currentLogin'}{tr}Last login{/tr}{/self_link}</th>
				<th colspan="2">{tr}Groups{/tr}</th>
				<th>{tr}Action{/tr}</th>
			</tr>
			{cycle print=false values="even,odd"}
			{section name=user loop=$users}
				{if $users[user].editable}
					{capture assign=username}{$users[user].user|escape}{/capture}
					<tr class="{cycle}">
						<td class="thin">
							{if $users[user].user ne 'admin'}
								<input type="checkbox" name="checked[]" value="{$users[user].user|escape}" {if $users[user].checked eq 'y'}checked="checked" {/if}/>
							{/if}
						</td>
	
						<td>
							{capture name=username}{$users[user].user|username}{/capture}
							<a class="link" href="tiki-adminusers.php?offset={$offset}&amp;numrows={$numrows}&amp;sort_mode={$sort_mode}&amp;user={$users[user].userId}{if $prefs.feature_tabs ne 'y'}#2{/if}" title="{tr}Edit Account Settings:{/tr} {$smarty.capture.username}">
							   {$users[user].user|escape}
							</a>
							{if $prefs.user_show_realnames eq 'y' and $smarty.capture.username ne $users[user].user}
								<div class="subcomment">
									{$smarty.capture.username|escape}
								</div>
							{/if}
						</td>
	
						{if $prefs.login_is_email ne 'y'}
							<td>{$users[user].email}</td>
						{/if}
						{if $prefs.auth_method eq 'openid'}
							<td>{$users[user].openid_url|default:"{tr}N{/tr}"}</td>
						{/if}	
						<td>
							{if $users[user].currentLogin eq ''}
								{tr}Never{/tr} <em>({tr}Registered{/tr} {$users[user].age|duration_short} {tr}ago{/tr})</em>
							{else}
								{$users[user].currentLogin|tiki_long_datetime}
							{/if}
					
							{if $users[user].waiting eq 'u'}
								<br />
								{tr}Need to validate email{/tr}
							{/if}
						</td>
	
						<td class="thin">
							<a class="link" href="tiki-assignuser.php?assign_user={$users[user].user|escape:url}" title="{tr}Assign to group{/tr}">{icon _id='group_key' alt="{tr}Assign{/tr} `$username` {tr}to groups{/tr} "}</a>
						</td>
	
						<td>
							{foreach from=$users[user].groups key=grs item=what name=gr}
								<div style="white-space:nowrap">
									{if $grs != "Anonymous" and ($tiki_p_admin eq 'y' || in_array($grs, $all_groups))}
										{if $what ne 'included' and $grs != "Registered"}
											{capture assign=grse}{$grs|escape}{/capture}
											{self_link _class='link' user=$users[user].user action='removegroup' group=$grs _icon='cross' _title="{tr}Remove{/tr} `$username` {tr}from{/tr} $grse"}{/self_link}
										{else}
											{icon _id='bullet_white'}
										{/if}
										{if $what eq 'included'}<i>{/if}
										{if $tiki_p_admin eq 'y'}
											<a class="link" {$link_style} href="tiki-admingroups.php?group={$grs|escape:"url"}" title={if $what eq 'included'}"{tr}Edit Included Group{/tr}"{else}"{tr}Edit Group:{/tr} {$grs|escape}"{/if}>
										{/if}
										{$grs|escape}
										{if $tiki_p_admin eq 'y'}
											</a>
										{/if}									
										{if $what eq 'included'}</i>{/if}
										{if $grs eq $users[user].default_group}<small>({tr}default{/tr})</small>{/if}
										{if !$smarty.foreach.gr.last}<br />{/if}
									{/if}
								</div>
							{/foreach}
						</td>
	
						<td><commit_msg>[FIX] there are no "thin" classes<commit_after>{* $Id$ *}

{title help="Users+Management" admpage="login" url="tiki-adminusers.php"}{tr}Admin Users{/tr}{/title}

<div class="navbar">
	{if $tiki_p_admin eq 'y'} {* only full admins can manage groups, not tiki_p_admin_users *}
		{button href="tiki-admingroups.php" _text="{tr}Admin Groups{/tr}"}
	{/if}
	{button _text="{tr}Admin Users{/tr}"}
	{if $userinfo.userId}
		{button href="?add=1" _text="{tr}Add a New User{/tr}"}
	{/if}
</div>

{if $prefs.feature_intertiki eq 'y' and ($prefs.feature_intertiki_import_groups eq 'y' or $prefs.feature_intertiki_import_preferences eq 'y')}
	{remarksbox type="warning" title="{tr}Warning{/tr}"}
		{if $prefs.feature_intertiki_import_groups eq 'y'}{tr}Since this tiki site is in slave mode and import groups, the master groups will be automatically reimported at each login{/tr}{/if}
		{if $prefs.feature_intertiki_import_preferences eq 'y'}{tr}Since this tiki site is in slave mode and import preferences, the master user preferences will be automatically reimported at each login{/tr}{/if}
	{/remarksbox}
{/if}

{if $tikifeedback}
	{remarksbox type="feedback" title="{tr}Feedback{/tr}"}
	{section name=n loop=$tikifeedback}
	{tr}{$tikifeedback[n].mes|escape}{/tr}
	<br />
	{/section}{/remarksbox}
{/if}

{if $added != "" or $discarded != "" or $discardlist != ''}
	{remarksbox type="feedback" title="Batch Upload Results"}
		{tr}Updated users:{/tr} {$added}
		{if $discarded != ""}- {tr}Rejected users:{/tr} {$discarded}{/if}
		<br />
		<br />
		{if $discardlist != ''}
			<table class="normal">
				<tr>
					<th>{tr}Username{/tr}</th>
					<th>{tr}Reason{/tr}</th>
				</tr>
				{section name=reject loop=$discardlist}
					<tr>
						<td class="odd">{$discardlist[reject].login}</td>
						<td class="odd">{$discardlist[reject].reason}</td>
					</tr>
				{/section}
			</table>
		{/if}

		{if $errors}
			<br />
			{section name=ix loop=$errors}
				{$errors[ix]}<br />
			{/section}
		{/if}
	{/remarksbox}
{/if}

{tabset name='tabs_adminuers'}

{* ---------------------- tab with list -------------------- *}
{tab name="{tr}Users{/tr}"}
	<h2>{tr}Users{/tr}</h2>

	<form method="get" action="tiki-adminusers.php">
		<table class="findtable">
			<tr>
				<td><label for="find">{tr}Find{/tr}</label></td>
				<td><input type="text" id="find" name="find" value="{$find|escape}" /></td>
				<td><input type="submit" value="{tr}Find{/tr}" name="search" /></td>
				<td><label for="numrows">{tr}Number of displayed rows{/tr}</label></td>
				<td><input type="text" size="4" id="numrows" name="numrows" value="{$numrows|escape}" /></td>
			</tr>
			<tr>
				<td colspan="2"></td>
				<td colspan="3">
					<a href="javascript:toggleBlock('search')" class="link">{icon _id='add' alt="{tr}more{/tr}"}&nbsp;{tr}More Criteria{/tr}</a>
				</td>
			</tr>
		</table>
		{jq}$("#find").tiki("autocomplete", "username"){/jq}

		<div id="search" {if $filterGroup or $filterEmail}style="display:block;"{else}style="display:none;"{/if}>
			<table class="findtable">
				<tr>
					<td><label for="filterGroup">{tr}Group (direct){/tr}</label></td>
					<td>
						<select name="filterGroup" id="filterGroup">
							<option value=""></option>
							{section name=ix loop=$all_groups}
								{if $all_groups[ix] != 'Registered' && $all_groups[ix] != 'Anonymous'}
									<option value="{$all_groups[ix]|escape}" {if $filterGroup eq $all_groups[ix]}selected{/if}>{$all_groups[ix]|escape}</option>
								{/if}
							{/section}
						</select>
					</td>
				</tr>
				<tr>
					<td><label for="filterEmail">{tr}Email{/tr}</label></td>
					<td><input type="text" id="filterEmail" name="filterEmail" value="{$filterEmail}" /></td>
				</tr>
			</table>

			<input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
		</div>
	</form>

	{if $cant > $numrows or !empty($initial)}
		{initials_filter_links}
	{/if}

	<form name="checkform" method="post" action="{$smarty.server.PHP_SELF}{if $group_management_mode ne 'y' and $set_default_groups_mode ne 'y' and $email_mode ne 'y'}#multiple{/if}">
		<table class="normal">
			<tr>
				<th class="auto">
					{if $users}
					   {select_all checkbox_names='checked[]'}
					{/if}
				</th>
				<th>{self_link _sort_arg='sort_mode' _sort_field='login'}{tr}User{/tr}{/self_link}</th>
				{if $prefs.login_is_email neq 'y'}
					<th>{self_link _sort_arg='sort_mode' _sort_field='email}{tr}Email{/tr}{/self_link}</th>
				{/if}
				{if $prefs.auth_method eq 'openid'}
					<th>{self_link _sort_arg='sort_mode' _sort_field='openID'}{tr}OpenID{/tr}{/self_link}</th>
				{/if}
				<th>{self_link _sort_arg='sort_mode' _sort_field='currentLogin'}{tr}Last login{/tr}{/self_link}</th>
				<th colspan="2">{tr}Groups{/tr}</th>
				<th>{tr}Action{/tr}</th>
			</tr>
			{cycle print=false values="even,odd"}
			{section name=user loop=$users}
				{if $users[user].editable}
					{capture assign=username}{$users[user].user|escape}{/capture}
					<tr class="{cycle}">
						<td>
							{if $users[user].user ne 'admin'}
								<input type="checkbox" name="checked[]" value="{$users[user].user|escape}" {if $users[user].checked eq 'y'}checked="checked" {/if}/>
							{/if}
						</td>
	
						<td>
							{capture name=username}{$users[user].user|username}{/capture}
							<a class="link" href="tiki-adminusers.php?offset={$offset}&amp;numrows={$numrows}&amp;sort_mode={$sort_mode}&amp;user={$users[user].userId}{if $prefs.feature_tabs ne 'y'}#2{/if}" title="{tr}Edit Account Settings:{/tr} {$smarty.capture.username}">
							   {$users[user].user|escape}
							</a>
							{if $prefs.user_show_realnames eq 'y' and $smarty.capture.username ne $users[user].user}
								<div class="subcomment">
									{$smarty.capture.username|escape}
								</div>
							{/if}
						</td>
	
						{if $prefs.login_is_email ne 'y'}
							<td>{$users[user].email}</td>
						{/if}
						{if $prefs.auth_method eq 'openid'}
							<td>{$users[user].openid_url|default:"{tr}N{/tr}"}</td>
						{/if}	
						<td>
							{if $users[user].currentLogin eq ''}
								{tr}Never{/tr} <em>({tr}Registered{/tr} {$users[user].age|duration_short} {tr}ago{/tr})</em>
							{else}
								{$users[user].currentLogin|tiki_long_datetime}
							{/if}
					
							{if $users[user].waiting eq 'u'}
								<br />
								{tr}Need to validate email{/tr}
							{/if}
						</td>
	
						<td>
							<a class="link" href="tiki-assignuser.php?assign_user={$users[user].user|escape:url}" title="{tr}Assign to group{/tr}">{icon _id='group_key' alt="{tr}Assign{/tr} `$username` {tr}to groups{/tr} "}</a>
						</td>
	
						<td>
							{foreach from=$users[user].groups key=grs item=what name=gr}
								<div style="white-space:nowrap">
									{if $grs != "Anonymous" and ($tiki_p_admin eq 'y' || in_array($grs, $all_groups))}
										{if $what ne 'included' and $grs != "Registered"}
											{capture assign=grse}{$grs|escape}{/capture}
											{self_link _class='link' user=$users[user].user action='removegroup' group=$grs _icon='cross' _title="{tr}Remove{/tr} `$username` {tr}from{/tr} $grse"}{/self_link}
										{else}
											{icon _id='bullet_white'}
										{/if}
										{if $what eq 'included'}<i>{/if}
										{if $tiki_p_admin eq 'y'}
											<a class="link" {$link_style} href="tiki-admingroups.php?group={$grs|escape:"url"}" title={if $what eq 'included'}"{tr}Edit Included Group{/tr}"{else}"{tr}Edit Group:{/tr} {$grs|escape}"{/if}>
										{/if}
										{$grs|escape}
										{if $tiki_p_admin eq 'y'}
											</a>
										{/if}									
										{if $what eq 'included'}</i>{/if}
										{if $grs eq $users[user].default_group}<small>({tr}default{/tr})</small>{/if}
										{if !$smarty.foreach.gr.last}<br />{/if}
									{/if}
								</div>
							{/foreach}
						</td>
	
						<td>
{'fraction_non_alphanumeric': 0.21853459280061271, 'fraction_numerical': 0.0010211896859841716, 'mean_word_length': 3.502586206896552, 'pattern_counts': {'":': 0, '<': 273, '<?xml version=': 0, '>': 275, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4797836', 'n_tokens_mistral': 7354, 'n_tokens_neox': 5877, 'n_words': 1062}