Current File : //etc/sentora/panel/modules/protected_directories/module.zpm
<div class="zmodule_content panel" id="zmodule_header_<@ ModuleName @>">
    <div class="panel-heading">
        <img src="<@ ModuleIcon @>" width="35" height="35" border="0" alt="<@ ModuleName @>">

        <div class="zmodule_title">
            <@ ModuleName @>
        </div>

        <div class="zmodule_desc" id="zmodule_desc_<@ ModuleName @>"><@ ModuleDesc @></div>

    </div>
<style>
.helpicon {
display: block;
float: right;
border: 1px solid #ccc;
background-color: #f3f3f3;
padding: 5px 10px;
font-size: 12px;
margin-top:-80px;
margin-right:6px;    
-webkit-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);    
box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);    
-webkit-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
}
</style>
<div class="helpicon">
<a href="<@ helpicon @>" target="_blank"><img src="etc/styles/CstyleX-master/images/help.png" style="float:left;" ><span style="float:left;margin-top:8px;font-weight:bold;font-size:12px;" >Video Tutorial</span></a>
</div>

    <% if ModuleMode %>
        <% loop FlashDebugMessages %><div class="alert alert-info"><& debug &></div><% endloop %>
    <% endif %>
    
    <% loop FlashErrorMessages %><div class="alert alert-danger"><& error &></div><% endloop %>
    
    
    <% if isIndex %>
    <div class="pull-right">
        <a href="/?module=protected_directories&control=CreateProtection" class="button-loader btn btn-success btn-small">
            Create
        </a>
    </div>
    
    <div class="clearfix">&nbsp;</div>
    
    <table class="table table-stripped table-bordered" style="margin-top: 20px; width:100%; margin-left:auto; margin-right:auto;">
        <tr>
            <td style="text-align: center;"><strong>Protected Directory</strong></td>
            <td style="text-align: center;"><strong>Message</strong></td>
            <td style="text-align: center;"><strong>Created On</strong></td>
            <td style="text-align: center;"><strong>Manage</strong></td>
        </tr>
        <% loop FileList %>
        <tr>
            <td><& x_htpasswd_file_target &></td>
            <td><& x_htpasswd_file_message &></td>
            <td><& x_htpasswd_file_created &></td>
            <td>
                <a href="/?module=protected_directories&control=EditProtection&id=<& x_htpasswd_file_id &>" class="button-loader btn btn-primary btn-small">
                    Edit
                </a>
                <a href="/?module=protected_directories&control=DeleteProtection&id=<& x_htpasswd_file_id &>" class="button-loader btn btn-danger btn-small">
                    Delete
                </a>
            </td>
        </tr>
        <% endloop %>
    </table>
    <% endif %>
    
    
    
    <% if isEditProtection %>
    <div class="pull-right">
        <a href="/?module=protected_directories&control=Index" class="button-loader btn btn-default">Back</a>
    </div>

    <div class="clearfix">&nbsp;</div>
    <form action="/?module=protected_directories&control=EditProtection&action=EditProtection&id=<@ Id @>" method="post" name="EditProtection">
        <table class="table table-stripped table-bordered" style="width:700px; margin-left:auto; margin-right:auto;">
            <tr>
                <td><strong>Protected Directory</strong></td>
                <td><strong>Message</strong></td>
                <td><strong>Created On</strong></td>
                <td>&nbsp;</td>
            </tr>
            <% loop File %>
            <tr>
                <td><& x_htpasswd_file_target &></td>
                <td>
                    <input type="text" name="message" value="<& x_htpasswd_file_message &>" class="input input-medium">
                </td>
                <td style="white-space: nowrap;"><& x_htpasswd_file_created &></td>
                <td>
                    <input type="submit" name="submitCreateProtection" value="Update" class="btn btn-primary">
                    <@ CSFR_Tag @>
                </td>
            </tr>
            <% endloop %>
        </table>
    </form>
    
    <div class="pull-right">
        <a href="/?module=protected_directories&control=CreateUser&id=<@ Id @>" class="button-loader btn btn-success btn-small">
            Create
        </a>
    </div>
    
    <div class="clearfix">&nbsp;</div>
    
    <table class="table table-stripped table-bordered" style="margin-top: 20px; width:100%; margin-left:auto; margin-right:auto;">
        <tr>
            <td style="text-align: center;"><strong>Username</strong></td>
            <td style="text-align: center;"><strong>Created On</strong></td>
            <td style="text-align: center;"><strong>Manage</strong></td>
        </tr>
        <% loop UserFileList %>
        <tr>
            
            <td><& x_htpasswd_user_username &></td>
            <td><& x_htpasswd_user_created &></td>
            <td>
                <a href="/?module=protected_directories&control=DeleteUser&id=<& x_htpasswd_file_id &>&userid=<& x_htpasswd_user_id &>" class="button-loader btn btn-danger btn-small">
                    Delete
                </a>
                <a href="/?module=protected_directories&control=EditUser&id=<& x_htpasswd_file_id &>&userid=<& x_htpasswd_user_id &>" class="button-loader btn btn-primary btn-small">
                    Edit
                </a>
            </td>
        </tr>
        <% endloop %>
    </table>
    
    <% endif %>
    
    <% if isCreateProtection %>
    <div><h3>Protect A Directory</h3></div>
    <div class="clearfix">&nbsp;</div>
    
    <div class="pull-right">
        <a href="/?module=protected_directories&control=Index" class="button-loader btn btn-default">Back</a>
    </div>
	<@ Init @>
    <div class="clearfix">&nbsp;</div>
    
    <div>Protect a directory inside <@ HostDir @><# ui_tpl_username #>/public_html/<br><br><br></div>
    <div class="clearfix">&nbsp;</div>
    
    
    <form action="/?module=protected_directories&control=CreateProtection&action=CreateProtection" method="post" name="CreateProtection">
      <div id="Treecontainer"> </div>
	  <div id="selected_file"></div>
	  <input type="hidden" Id="hosted_path" name="hosted_path" value="<@ HostDir @><# ui_tpl_username #>/public_html/" />
		<br/>
     	<label>Selected File Path:</label>
        <@ HostDir @><# ui_tpl_username #>/public_html/
        <span Id="selected_path"></span>
		<input type="hidden" name="file" class="input input-medium">
		<br/>
		<br/>
        <label>Message:</label>
        <input type="text" name="message" class="input input-medium">
        <br><br>
        <input type="submit" name="submitCreateProtection" value="Submit" class="btn btn-primary">
        <@ CSFR_Tag @>
    </form>
    <% endif %>
    
    <% if isDeleteProtection %>
    <div>Please confirm the delete request:</div>
    <form action="/?module=protected_directories&control=DeleteProtection&action=DeleteProtection&id=<@ Id @>" method="post" name="DeleteProtection">
        <input type="submit" name="submitDeleteProtection" value="Submit" class="btn btn-primary">
        <@ CSFR_Tag @>
    </form>
    <% endif %>

    <% if isCreateUser %>
    <div class="pull-right">
        <a href="/?module=protected_directories&control=EditProtection&id=<@ Id @>" class="button-loader btn btn-default">Back</a>
    </div>
    
    <div class="clearfix">&nbsp;</div>
    
    <table class="table table-stripped table-bordered" style="width:700px; margin-left:auto; margin-right:auto;">
        <tr>
            <td><strong>Protected Directory</strong></td>
            <td><strong>Message</strong></td>
            <td><strong>Created On</strong></td>
        </tr>
        <% loop File %>
        <tr>
            <td><& x_htpasswd_file_target &></td>
            <td>
                <& x_htpasswd_file_message &>
            </td>
            <td style="white-space: nowrap;"><& x_htpasswd_file_created &></td>
        </tr>
        <% endloop %>
    </table>
    
    <div class="clearfix">&nbsp;</div>
    
    <form action="/?module=protected_directories&control=CreateUser&action=CreateUser&id=<@ Id @>" method="post" name="CreateUser">
        <label>Username:</label>
        <input type="text" name="username" class="input input-medium">
        <label>Password:</label>
        <input type="password" name="password" class="input input-medium">
        <br><br>
        <input type="submit" name="submitCreateUser" value="Submit" class="btn btn-primary">
        <@ CSFR_Tag @>
    </form>
    <% endif %>
    
    <% if isEditUser %>
    <div class="pull-right">
        <a href="/?module=protected_directories&control=EditProtection&id=<@ Id @>" class="button-loader btn btn-default">Back</a>
    </div>
    
    <div class="clearfix">&nbsp;</div>
    
    <table class="table table-stripped table-bordered" style="width:700px; margin-left:auto; margin-right:auto;">
            <tr>
                <td><strong>Protected Directory</strong></td>
                <td><strong>Message</strong></td>
                <td><strong>Created On</strong></td>
            </tr>
            <% loop File %>
            <tr>
                <td><& x_htpasswd_file_target &></td>
                <td>
                    <& x_htpasswd_file_message &>
                </td>
                <td style="white-space: nowrap;"><& x_htpasswd_file_created &></td>
            </tr>
            <% endloop %>
        </table>
    
    <div class="clearfix">&nbsp;</div>
    
    <form action="/?module=protected_directories&control=EditUser&action=EditUser&id=<@ Id @>&userid=<@ UserId @>" method="post" name="EditUser">
        <label>Username:</label>
        <% loop User %>
            <& x_htpasswd_user_username &>
        <% endloop %>
        <label>Password:</label>
        <input type="password" name="password" class="input input-medium">
        <br><br>
        <input type="submit" name="submitEditUser" value="Submit" class="btn btn-primary">
        <@ CSFR_Tag @>
    </form>
    <% endif %>

    <% if isDeleteUser %>
        <div>Please confirm the user delete request:</div>
        <form action="/?module=protected_directories&control=DeleteUser&action=DeleteUser&id=<@ Id @>&userid=<@ UserId @>" method="post" name="DeleteUser">
            <input type="submit" name="submitDeleteUser" value="Submit" class="btn btn-primary">
            <@ CSFR_Tag @>
        </form>
    <% endif %>
    
</div>

<script type="text/javascript" >
$(document).ready( function() {

	$( '#Treecontainer' ).html( '<ul class="filetree start"><li class="wait">' + 'Generating Tree...' + '<li></ul>' );
	
	getfilelist( $('#Treecontainer') , $("#hosted_path").val() );
	
	function getfilelist( cont, root ) {
	
		$( cont ).addClass( 'wait' );
			
		$.post( '/modules/protected_directories/Foldertree.php', { dir: root }, function( data ) {
	
			$( cont ).find( '.start' ).html( '' );
			$( cont ).removeClass( 'wait' ).append( data );
			if( 'Sample' == root ) 
				$( cont ).find('UL:hidden').show();
			else 
				$( cont ).find('UL:hidden').slideDown({ duration: 500, easing: null });
			
		});
	}
	
	$( '#Treecontainer' ).on('click', 'LI A', function() {
		var entry = $(this).parent();
		
		if( entry.hasClass('folder') ) {
			if( entry.hasClass('collapsed') ) {
						
				entry.find('UL').remove();
				getfilelist( entry, escape( $(this).attr('rel') ));
				entry.removeClass('collapsed').addClass('expanded');
				 // $("input[name$='file']").val($(this).attr( 'rel' ));
				 var getrel=$(this).attr( 'rel' );
				 var replacedstring=getrel.replace($("#hosted_path").val(),"");
				$("input[name$='file']").val(replacedstring);
				$("#selected_path").html(replacedstring);
			}
			else {
				
				entry.find('UL').slideUp({ duration: 500, easing: null });
				entry.removeClass('expanded').addClass('collapsed');
				 $("input[name$='file']").val($(this).attr( 'rel' ));
				 // $("input[name$='file']").val($(this).attr( 'rel' ));
				 var getrel=$(this).attr( 'rel' );
				 var replacedstring=getrel.replace($("#hosted_path").val(),"");
				$("input[name$='file']").val(replacedstring);
				$("#selected_path").html(replacedstring);
			}
		} else {
			
			$( '#selected_file' ).text( "File:  " + $(this).attr( 'rel' ));
			$("input[name$='file']").val($(this).attr( 'rel' ));
				 // $("input[name$='file']").val($(this).attr( 'rel' ));
				 var getrel=$(this).attr( 'rel' );
				 var replacedstring=getrel.replace($("#hosted_path").val(),"");
				$("input[name$='file']").val(replacedstring);
				$("#selected_path").html(replacedstring);
		}
	return false;
	});
	
});
</script>