shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

security.twig (6111B)


      1 <div id="modal-security" class="modal">
      2   <div class="modal-dialog">
      3     <div class="modal-content">
      4       <div class="modal-header">
      5         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      6         <h4 class="modal-title text-danger"><i class="fa fa-exclamation-triangle"></i> {{ heading_title }}</h4>
      7       </div>
      8       <div class="modal-body">
      9         <div class="alert alert-info"><i class="fa fa-exclamation-circle"></i> {{text_security }}</div>
     10         <form class="form-horizontal">
     11           <fieldset>
     12             <legend>{{ text_choose }}</legend>
     13             <div class="form-group">
     14               <select name="type" id="input-type" class="form-control">
     15                 <option value="automatic">{{ text_automatic }}</option>
     16                 <option value="manual">{{ text_manual }}</option>
     17               </select>
     18             </div>
     19           </fieldset>
     20           <fieldset id="collapse-automatic" class="collapse">
     21             <legend>{{ text_automatic }}</legend>
     22             <div class="form-group">
     23               <div class="input-group">
     24                 <div class="input-group-btn dropdown">
     25                   <button type="button" id="button-path" data-toggle="dropdown" class="btn btn-default">{{ document_root }} <span class="caret"></span></button>
     26                   <ul class="dropdown-menu">
     27                     {% for path in paths %}
     28                     {% if path|length > document_root|length %}
     29                     <li><a href="{{ path }}"><i class="fa fa-exclamation-triangle fa-fw text-danger"></i> {{ path }}</a></li>
     30                     {% else %}
     31                     <li><a href="{{ path }}"><i class="fa fa-check-circle fa-fw text-success"></i> {{ path }}</a></li>
     32                     {% endif %}
     33                     {% endfor %}
     34                   </ul>
     35                 </div>
     36                 <input type="text" name="directory" value="storage" placeholder="{{ entry_directory }}" class="form-control" />
     37                 <div class="input-group-btn">
     38                   <button type="button" id="button-move" data-loading-text="{{ text_loading }}" class="btn btn-danger"><i class="fa fa-exclamation-triangle"></i> {{ button_move }}</button>
     39                 </div>
     40               </div>
     41               <input type="hidden" name="path" value="{{ document_root }}" />
     42             </div>
     43           </fieldset>
     44           <fieldset id="collapse-manual" class="collapse">
     45             <legend>{{ text_manual }}</legend>
     46             <div class="form-group">
     47               <div style="height: 300px; overflow-y: scroll;" class="form-control" disabled="disabled"></div>
     48             </div>
     49           </fieldset>
     50         </form>
     51       </div>
     52     </div>
     53   </div>
     54 </div>
     55 <script type="text/javascript"><!--
     56 $(document).ready(function() {
     57 	$('#modal-security').modal('show');
     58 });
     59 
     60 $('#modal-security select[name=\'type\']').on('change', function() {
     61 	$('#modal-security fieldset.collapse').removeClass('in');
     62 	
     63 	$('#modal-security #collapse-' + $(this).val()).addClass('in');
     64 });
     65 
     66 $('#modal-security select[name=\'type\']').trigger('change');
     67 
     68 $('#modal-security .dropdown-menu a').on('click', function(e) {
     69 	e.preventDefault();
     70 	
     71 	$('#modal-security #button-path').html($(this).html() + ' <span class="caret"></span>');
     72 	
     73 	$('#modal-security input[name=\'path\']').val($(this).attr('href'));
     74 });
     75 
     76 
     77 $('#modal-security .dropdown-menu a').on('click', function(e) {
     78 	e.preventDefault();
     79 	
     80 	$('#button-path').html($(this).text() + ' <span class="caret"></span>');
     81 	
     82 	$('input[name=\'path\']').val($(this).attr('href'));
     83 	
     84 	$('input[name=\'path\']').trigger('change');
     85 });
     86 
     87 $('#button-move').on('click', function() {
     88 	var element = this;
     89 	
     90 	$.ajax({
     91 		url: 'index.php?route=common/security/move&user_token={{ user_token }}',
     92 		type: 'post',
     93 		data: $('input[name=\'path\'], input[name=\'directory\']'),
     94 		dataType: 'json',
     95 		crossDomain: true,
     96 		beforeSend: function() {
     97 			$(element).button('loading');
     98 		},
     99 		complete: function() {
    100 			$(element).button('reset');
    101 		},
    102 		success: function(json) {
    103 			$('.alert-dismissible').remove();
    104 
    105 			if (json['error']) {
    106 				$('#modal-security .modal-body').prepend('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
    107 			}
    108 
    109 			if (json['success']) {
    110 				$('#modal-security .modal-body').prepend('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
    111 			}
    112 		},
    113 		error: function(xhr, ajaxOptions, thrownError) {
    114 			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
    115 		}
    116 	});
    117 });
    118 
    119 $('#modal-security select[name=\'type\']').on('change', function () {
    120 	html  = '<ol>';
    121 	html += '<li><p>{{ text_move }}</p>';
    122 	html += '<p><strong>{{ storage }}</strong></p>';
    123 	html += '<p>{{ text_to }}</p>';
    124 	html += '<p><strong>' + $('#modal-security input[name=\'path\']').val() + $('#modal-security input[name=\'directory\']').val() + '/</strong></p></li>';
    125 	html += '<li><p>{{ text_config }}</p>';
    126 	html += '<p><strong>define(\'DIR_STORAGE\', DIR_SYSTEM . \'storage/\');</strong></p>';
    127 	html += '<p>to</p>';
    128 	html += '<p><strong>define(\'DIR_STORAGE\', \'' + $('#modal-security input[name=\'path\']').val() + $('#modal-security input[name=\'directory\']').val() + '/\');</strong></p></li>';
    129 	html += '<li><p>{{ text_admin }}</p>';
    130 	html += '<p><strong>define(\'DIR_STORAGE\', DIR_SYSTEM . \'storage/\');</strong></p>';
    131 	html += '<p>to</p>';
    132 	html += '<p><strong>define(\'DIR_STORAGE\', \'' + $('#modal-security input[name=\'path\']').val() + $('#modal-security input[name=\'directory\']').val() + '/\');</strong></p></li>';
    133 	
    134   	html += '</li>';
    135     html += '</ol>';
    136 	
    137 	$('#collapse-manual .form-control').html(html);
    138 });
    139 
    140 $('input[name=\'path\']').trigger('change');
    141 //--></script>