{if $mgmurls}
<div class="lms-ui-tab-table-row header">
	<div class="lms-ui-tab-table-wrapper col-2">
		<div class="lms-ui-tab-table-column url">
			<strong>{trans("URL:")}</strong>
		</div>
		<div class="lms-ui-tab-table-column comment">
			{trans("Comment:")}
		</div>
	</div>

	<div class="lms-ui-tab-table-column buttons">
		&nbsp;
	</div>
</div>
{/if}

{foreach $mgmurls as $mgmurl}
{$urlid = $mgmurl.id}
{if $formdata.urlid && $formdata.urlid == $urlid}{$edit = true}{else}{$edit = false}{/if}
<div class="lms-ui-tab-table-row" data-urlid="{$urlid}">
	<div class="lms-ui-tab-table-wrapper col-2">
		<div class="lms-ui-tab-table-column url">
			<span id="url_{$urlid}"{if $edit} style="display: none;"{/if} class="url-info-field">
				<a href="{$mgmurl.url}"{if preg_match("/^(https?|ftp):/", $mgmurl.url)} target="_blank"{/if}>{$mgmurl.url}</a>
			</span>
			<input type="text" size="80" name="url_edit_{$urlid}" id="url_edit_{$urlid}"
					value="{if $edit}{$formdata.url}{else}{$mgmurl.url}{/if}"
					class="url-edit-field"
					{tip text="Enter management URL" trigger="url_edit_{$urlid}"}{if !$edit} style="display: none;"{/if}>
		</div>
		<div class="lms-ui-tab-table-column comment">
			<span id="comment_{$urlid}"{if $edit} style="display: none;"{/if} class="url-info-field">
				{$mgmurl.comment}
			</span>
			<input type="text" size="40" name="comment_edit_{$urlid}" id="comment_edit_{$urlid}"
					value="{if $edit}{$formdata.comment}{else}{$mgmurl.comment}{/if}"
					class="url-edit-field"
					{tip text="Enter URL comment" trigger="comment_edit_{$urlid}"}{if !$edit} style="display: none;"{/if}>
		</div>
	</div>

	<div class="lms-ui-tab-table-column buttons">
		{if ConfigHelper::checkConfig('privileges.superuser') || ConfigHelper::checkConfig('privileges.network_management')}
		{button type="link" icon="edit" id="edit_button_{$urlid}"
			onclick="javascript:toggleEditManagementUrl({$urlid});"
			tip="Edit management URL" visible=!$edit}
		{button type="link" icon="save" id="save_button_{$urlid}"
			onclick="javascript:updateManagementUrl({$urlid});"
			tip="Save" visible=$edit}
		{button type="link" icon="cancel" id="cancel_button_{$urlid}"
			onclick="javascript:toggleEditManagementUrl({$urlid});"
			tip="Cancel" visible=$edit}
		{button type="link" icon="delete" id="delete_button_{$urlid}"
			onclick="javascript:delManagementUrl({$urlid});"
			tip="Remove management URL"}
		{/if}
	</div>
</div>

{foreachelse}
<div class="lms-ui-tab-empty-table" id="no_management_urls">
	{trans("No management URL's.")}
</div>
{/foreach}
