Your IP : 216.73.217.77


Current Path : /home/users/unlimited/www/facebook.codeskitter.site/themes/sunshine/layout/modals/
Upload File :
Current File : /home/users/unlimited/www/facebook.codeskitter.site/themes/sunshine/layout/modals/edit-post.phtml

<div class="modal fade" id="edit-post" role="dialog">
	<div class="modal-dialog modal-md wow_mat_mdl">
		<form id="edit-post-form-<?php echo $wo['story']['id'];?>" method="post">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></span></button>
					<h4 class="modal-title"><svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.75 5.05741C9.23497 5.56243 7.21492 3.54238 7.71993 2.02734M8.34238 1.40489L5.07836 4.66891C3.65936 6.08791 2.65269 7.86589 2.16597 9.81274L2.00826 10.4436C1.95912 10.6402 2.13717 10.8182 2.33374 10.7691L2.9646 10.6114C4.91146 10.1247 6.68943 9.11798 8.10843 7.69898L11.3725 4.43496C11.7743 4.03315 12 3.48818 12 2.91993C12 1.73661 11.0407 0.777344 9.85742 0.777344C9.28917 0.777344 8.74419 1.00308 8.34238 1.40489Z" stroke="currentColor" stroke-width="1.5"></path><path d="M8.34217 1.40489C8.74398 1.00308 9.28895 0.777344 9.8572 0.777344C11.0405 0.777344 11.9998 1.73661 11.9998 2.91993C11.9998 3.48818 11.7741 4.03315 11.3722 4.43496L10.7498 5.05741C9.23475 5.56243 7.21471 3.54238 7.71972 2.02734L8.34217 1.40489Z" class="icon_main" stroke-width="1.5"></path><path d="M12.8332 14.1113H1.1665" class="icon_main" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> <?php echo $wo['lang']['edit_post']; ?></h4>
				</div>
				<div class="modal-body edit-textarea-<?php echo $wo['story']['id'];?>" style="padding:0;">
					<div class="edit_alert"></div>
					
					<div class="wow_form_fields">
						<textarea placeholder="<?php echo $wo['lang']['edit_post']?>" dir="auto" rows="5" onkeyup="Wo_Get_Mention(this)" name="text"><?php echo $wo['story']['Orginaltext']?></textarea>
					</div>
					
					<?php 
					$show_images = false;
					if (!empty($wo['story']['postFile'])) {
						$file_extension = pathinfo($wo['story']['postFile'], PATHINFO_EXTENSION);
						if ($file_extension == 'jpg' || $file_extension == 'jpeg' || $file_extension == 'png' || $file_extension == 'gif') {
							$show_images = true;
						}
					} 
					if (!empty($wo['story']['photo_multi'])) {
						$show_images = true;
					}
					if ($show_images) {
					?>
					<br>
					<div class="wow_prod_imgs">
						<input type="file" name="images[]" id="publisher-post-photos-<?php echo $wo['story']['id']; ?>" class="hidden" multiple="multiple" accept="image/x-png, image/gif, image/jpeg">
						<div class="upload-product-image" onclick="document.getElementById('publisher-post-photos-<?php echo $wo['story']['id']; ?>').click(); return false">
							<div class="upload-image-content">
								<svg xmlns="http://www.w3.org/2000/svg" class="feather" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M4,4H7L9,2H15L17,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9Z" /></svg>
							</div>
						</div>
						<div id="productimage-holder">
							<span id="uploaded-productimage-holder-<?php echo $wo['story']['id']; ?>"></span>
							<?php if (!empty($wo['story']['postFile']) && empty($wo['story']['photo_multi'])) { 
								$file_extension = pathinfo($wo['story']['postFile'], PATHINFO_EXTENSION);
								if ($file_extension == 'jpg' || $file_extension == 'jpeg' || $file_extension == 'png' || $file_extension == 'gif') { ?>
									<span class="thumb-image thumb-image-delete" id="delete_image_by_id">
										<span onclick="DeletePostImage(<?php echo $wo['story']['id']; ?>)" class="pointer thumb-image-delete-btn"><i class="fa fa-remove"></i></span>
										<div class="background_image_product" style="background-image: url('<?php echo Wo_GetMedia($wo['story']['postFile']); ?>');"></div>
									</span>
								<?php }
						    }
						    if (!empty($wo['story']['photo_multi'])) {
						    	foreach ($wo['story']['photo_multi'] as $key => $value) { ?>
						    	<span class="thumb-image thumb-image-delete thumb-image-old" id="delete_image_by_id_<?php echo $value['id']; ?>">
									<span onclick="DeletePostImage(<?php echo $wo['story']['id']; ?>,<?php echo $value['id']; ?>)" class="pointer thumb-image-delete-btn"><i class="fa fa-remove"></i></span>
									<div class="background_image_product" style="background-image: url('<?php echo $value['image']; ?>');"></div>
								</span>

						    <?php } } ?>
						</div>
					</div>
				    <?php } ?>
				    <input type="hidden" name="post_id" value="<?php echo $wo['story']['id']; ?>">
				    <input type="hidden" name="all_images" value="0" id="all_images">
				</div>
				<div class="modal-footer" style="border: none">
					<div class="ball-pulse"><div></div><div></div><div></div></div>
					<button type="submit" class="btn main btn-mat" id="edit-post-button"><?php echo $wo['lang']['update']; ?></button>
				</div>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		post_id = <?php echo $wo['story']['id']; ?>;
	        var post = $('#post-' + post_id);
		  var edit_box = $('#post-' + post_id).find('#edit-post');
		  var edit_textarea = post.find('.edit-textarea-' + post_id + ' textarea');
		  var text = edit_textarea.val();
		  var post_text = post.find('.post-description p');
		  var type = post.attr('data-post-type');
		$('#edit-post-form-<?php echo $wo['story']['id'];?>').ajaxForm({
	      url: Wo_Ajax_Requests_File() + '?f=posts&s=edit_post',
	      beforeSubmit: function(arr, $form, options) { 
	      	if ($('#edit-post-form-'+<?php echo $wo['story']['id'];?>).find('.thumb-image').length < 1 && $('#edit-post-form-'+<?php echo $wo['story']['id'];?>).find('textarea').val() == '') {
		      $('#edit-post-form-'+<?php echo $wo['story']['id'];?>).find('.edit_alert').html("<div class='alert alert-danger'><?php echo $wo['lang']['you_must_add_text_or_image_first']; ?></div>");
		      return false;
		    }
	      },
	      beforeSend: function() {
	      	
		  if (type == 'share') {
		    var post_text = post.find('.post-description .edited_text');
		  }
		  else{
		    var post_text = post.find('.post-description p');
		  }
		  Wo_progressIconLoader(post.find('#edit-post-button'));
		  $('#post-' + post_id).find('#edit-post .ball-pulse').fadeIn(100);

	      },
	      success: function(data) {
	        if(data.status == 200) {
	        	if (data.html != '') {
	        		post_text.html(data.html);
	        	}
	        	if (data.reload == 'reload') {
	        		location.reload();
	        	}
		      
		      edit_box.modal('hide');
		    }
		    $('#post-' + post_id).find('#edit-post .ball-pulse').fadeOut(100);
		    if (data.can_send == 1) {
		        Wo_SendMessages();
		    }
		    edit_box.modal('hide');
	      }});
        <?php if ($show_images) { ?>
		$("#publisher-post-photos-<?php echo $wo['story']['id']; ?>").on('change', function() {
			var product_countFiles = $(this)[0].files.length;
			var product_imgPath = $(this)[0].value;
			var extn = product_imgPath.substring(product_imgPath.lastIndexOf('.') + 1).toLowerCase();
			var product_image_holder = $("#uploaded-productimage-holder-<?php echo $wo['story']['id']; ?>");
			product_image_holder.empty();
			if (extn == "gif" || extn == "png" || extn == "jpg" || extn == "jpeg") {
				if (typeof(FileReader) != "undefined") {
					for (var i = 0; i < product_countFiles; i++) 
					{
						var product_reader = new FileReader();
						var ii = 0;
						product_reader.onload = function(e) {
						name = "'"+$("#publisher-post-photos-<?php echo $wo['story']['id']; ?>")[0].files[ii].name+"'";
						src = "'"+e.target.result+"'";
						$(product_image_holder).prepend('<span class="thumb-image thumb-image-delete" id="delete_uploaded_image_by_id_'+ii+'"><span class="pointer thumb-image-delete-btn" onclick="DeleteUploadedImageById('+name+','+ii+',<?php echo $wo['story']['id']; ?>)"><i class="fa fa-remove"></i></span><div class="background_image_product" style="background-image: url('+src+');"></div></span>');
						ii = ii +1;
		                };
		                product_image_holder.show();
		                product_reader.readAsDataURL($(this)[0].files[i]);
					
		             }
	            } else {
	              product_image_holder.html("<p>This browser does not support FileReader.</p>");
	            }
		    }
		});
	<?php } ?>
	});
</script>