<?php
script('registration', 'settings');
?>
<style>.w50{width:50%;}
table th{ font-weight: bold; }
table tbody td{
    height: 45px;
}
</style>
<form id="registration_settings_form" class="section">
  <!-- <h2><?php p($l->t('Xfcloud account login')); ?></h2><span id="registration_settings_msg" class="msg"></span> 
   <p> <label for="client_id"><?php p($l->t('Xfcloud app ClientId')); ?></label></p>
       <p> <input class="w50" type="text" id="client_id" name="client_id" value="<?php p($_['client_id']);?>" placeholder="<?php p($l->t('Can not be filled in')); ?>">     
   </p>
     <p> <label for="secret_id"><?php p($l->t('Xfcloud app SecretId')); ?></label></p>
	 <p><input class="w50" type="text" id="secret_id" name="secret_id" value="<?php p($_['secret_id']);?>" placeholder="<?php p($l->t('Can not be filled in')); ?>">     
   </p>
    
   <p> <label for="authrize_url"><?php p($l->t('Xfcloud authorization URL')); ?></label></p>-->
         <p>     <input class="w50" type="hidden" id="authrize_url" placeholder="<?php p($l->t('Please enter the website authorized by xfplay (for example: https://cloud.xfplay.com)')); ?>" name="authrize_url" value="<?php p($_['authrize_url']);?>">     
   </p>
    <div style="margin-top:20px; margin-bottom: 20px;">
    <h2><?php p($l->t('Domain name management')); ?></h2><span id="registration_domain_msg" class="msg"></span> 
    </div>
         <p> <label for="appPackage"><?php p($l->t('Add-on Domains')); ?></label></p>
	 <p><input class="w50" type="text" id="appPackage" name="appPackage" value="" placeholder="<?php p($l->t('Please enter your website address (for example: http://Domain Name: port number)')); ?>" >     
         </p>
   <div style="margin:20px 0px;">
       <table class="domaintable" style="width:100%;">
       <thead>
           <tr>
              <th width="5%"><?php p($l->t('ID')); ?></th> 
              <th width="70%"><?php p($l->t('Domain')); ?></th>
              <th width="15%"><?php p($l->t('Status')); ?></th>
              <th width="10%"><?php p($l->t('Action')); ?></th>
           </tr>
       </thead>
       <tbody>
         <?php foreach($_['trusted_domains'] as $key => $domain) {?>
           <tr data-key="<?php p($key);?>" data-domain="<?php p($domain);?>" data-nostr="<?php p($_['nostr']);?>">
               <td><?php p($key);?></td>
               <td><div class="edit"><?php p($domain);?></div></td>
                <td><div class="dstatus">loading..</div> </td>
                <td>
                    <?php if($key>0){?>
                    <a class="ddelete"><span class="delete"><?php p($l->t('Delete'));?></span></a>
                    <?php }else {?>
                         <span class="delete">-</span> 
                    <?php }?>
                
                </td>
           </tr>
   <?php }?>     
       </tbody>
   </table>
   </div>


   <!--以下是授权后关联注册设置-->
   <h2 style="margin-top:30px;"><?php p($l->t('Registration')); ?></h2><span id="registration_settings_msg" class="msg"></span>
   <p>
	<label for="close_userlogin_from"><?php p($l->t('Close account password login, only keep pioneer authorized login?')); ?>
     <input type="checkbox" id="close_userlogin_from" name="close_userlogin_from" <?php if($_['close_userlogin_from'] === "yes" ) echo " checked"; ?>>
	</label>
	</p>	
   <p>
	<label for="registered_user_group"><?php p($l->t('Default group that all registered users belong')); ?></label>
	<select id="registered_user_group" name="registered_user_group">
		<option value="none" <?php echo $_['current'] === 'none' ? 'selected="selected"' : ''; ?>><?php p($l->t('None')); ?></option>
<?php
foreach ( $_['groups'] as $group ) {
        if($group == 'admin'){
            continue;
        }
	$selected = $_['current'] === $group ? 'selected="selected"' : '';
	echo '<option value="'.$group.'" '.$selected.'>'.$group.'</option>';
}
?>
	</select>
	</p>
	<!--<p>
	<label for="allowed_domains"><?php p($l->t('Allowed mail address domains for registration')); ?></label>
	<input type="text" id="allowed_domains" name="allowed_domains" value=<?php p($_['allowed']);?>>
	</p>
	<p>
	<em><?php p($l->t('Enter a semicolon-separated list of allowed domains. Example: xfcloud.com;github.com'));?></em>
	</p>

	<p>
	<label for="admin_approval_required"><?php p($l->t('Require admin approval?')); ?>
	<input type="checkbox" id="admin_approval_required" name="admin_approval_required" <?php if($_['approval_required'] === "yes" ) echo " checked"; ?>>
	</label>
	</p>-->
</form>
