Post by kec » Fri Jul 31, 2015 6:37 pm

Hi,

In OC 1.5.6.4 we always implemented the direct url of the Image Manager because it should be in the menu period.

Code: Select all

<li><a target="_blank" href="index.php?route=common/filemanager&token=<?php echo $this->session->data['token']; ?>">Image Manager</a></li>
In OC 2 the above custom code doesn't work any more. Since it's build on Bootstrap the Image Manager is called with the Modal popup code and jquery and therefore it seems not directly accessable any more.

Can anyone provide us and other OC users with help how to implement the direct Image Manager url in the admin/view/template/common/menu.tpl in order to get this to work for our clients?

Hope for an answer.

Kind regards,

Kec
Last edited by kec on Fri Oct 28, 2016 11:11 pm, edited 3 times in total.

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by viethemes » Sat Aug 01, 2015 8:57 pm

You may like this extension http://bit.ly/1KGqnVj :)

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by kec » Mon Aug 03, 2015 4:35 pm

Thank you for your respond. But all what I'm looking for is the direct url.

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by kec » Tue Aug 18, 2015 5:19 pm

No solution?

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by viethemes » Tue Aug 18, 2015 9:12 pm

I have made a customization to do that. You can open file admin\view\template\common\filemanager.tpl
and replace all contents with content below

Code: Select all

<?php if ( ! ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) ) {?>
<?php global $loader; ?>
<?php echo $loader->controller('common/header'); ?><?php echo $loader->controller('common/column_left'); ?>
<div id="modal-image">
<?php } ?>
<div class="modal-dialog modal-lg">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h4 class="modal-title"><?php echo $heading_title; ?></h4>
    </div>
    <div class="modal-body">
      <div class="row">
        <div class="col-sm-5"><a href="<?php echo $parent; ?>" data-toggle="tooltip" title="<?php echo $button_parent; ?>" id="button-parent" class="btn btn-default"><i class="fa fa-level-up"></i></a> <a href="<?php echo $refresh; ?>" data-toggle="tooltip" title="<?php echo $button_refresh; ?>" id="button-refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a>
          <button type="button" data-toggle="tooltip" title="<?php echo $button_upload; ?>" id="button-upload" class="btn btn-primary"><i class="fa fa-upload"></i></button>
          <button type="button" data-toggle="tooltip" title="<?php echo $button_folder; ?>" id="button-folder" class="btn btn-default"><i class="fa fa-folder"></i></button>
          <button type="button" data-toggle="tooltip" title="<?php echo $button_delete; ?>" id="button-delete" class="btn btn-danger"><i class="fa fa-trash-o"></i></button>
        </div>
        <div class="col-sm-7">
          <div class="input-group">
            <input type="text" name="search" value="<?php echo $filter_name; ?>" placeholder="<?php echo $entry_search; ?>" class="form-control">
            <span class="input-group-btn">
            <button type="button" data-toggle="tooltip" title="<?php echo $button_search; ?>" id="button-search" class="btn btn-primary"><i class="fa fa-search"></i></button>
            </span></div>
        </div>
      </div>
      <hr />
      <?php foreach (array_chunk($images, 4) as $image) { ?>
      <div class="row">
        <?php foreach ($image as $image) { ?>
        <div class="col-sm-3 text-center">
          <?php if ($image['type'] == 'directory') { ?>
          <div class="text-center"><a href="<?php echo $image['href']; ?>" class="directory" style="vertical-align: middle;"><i class="fa fa-folder fa-5x"></i></a></div>
          <label>
            <input type="checkbox" name="path[]" value="<?php echo $image['path']; ?>" />
            <?php echo $image['name']; ?></label>
          <?php } ?>
          <?php if ($image['type'] == 'image') { ?>
          <a href="<?php echo $image['href']; ?>" class="thumbnail"><img src="<?php echo $image['thumb']; ?>" alt="<?php echo $image['name']; ?>" title="<?php echo $image['name']; ?>" /></a>
          <label>
            <input type="checkbox" name="path[]" value="<?php echo $image['path']; ?>" />
            <?php echo $image['name']; ?></label>
          <?php } ?>
        </div>
        <?php } ?>
      </div>
      <br />
      <?php } ?>
    </div>
    <div class="modal-footer"><?php echo $pagination; ?></div>
  </div>
</div>
<script type="text/javascript"><!--
$('a.thumbnail').on('click', function(e) {
	e.preventDefault();

	<?php if ($thumb) { ?>
	$('#<?php echo $thumb; ?>').find('img').attr('src', $(this).find('img').attr('src'));
	<?php } ?>
	
	<?php if ($target) { ?>
	$('#<?php echo $target; ?>').attr('value', $(this).parent().find('input').attr('value'));
	<?php } else { ?>
	var range, sel = document.getSelection(); 
	
	if (sel.rangeCount) { 
		var img = document.createElement('img');
		img.src = $(this).attr('href');
	
		range = sel.getRangeAt(0); 
		range.insertNode(img); 
	}
	<?php } ?>

	$('#modal-image').modal('hide');
});

$('a.directory').on('click', function(e) {
	e.preventDefault();
	
	$('#modal-image').load($(this).attr('href'));
});

$('.pagination a').on('click', function(e) {
	e.preventDefault();
	
	$('#modal-image').load($(this).attr('href'));
});

$('#button-parent').on('click', function(e) {
	e.preventDefault();
	
	$('#modal-image').load($(this).attr('href'));
});

$('#button-refresh').on('click', function(e) {
	e.preventDefault();
	
	$('#modal-image').load($(this).attr('href'));
});

$('input[name=\'search\']').on('keydown', function(e) {
	if (e.which == 13) {
		$('#button-search').trigger('click');
	}
});

$('#button-search').on('click', function(e) {
	var url = 'index.php?route=common/filemanager&token=<?php echo $token; ?>&directory=<?php echo $directory; ?>';
		
	var filter_name = $('input[name=\'search\']').val();
	
	if (filter_name) {
		url += '&filter_name=' + encodeURIComponent(filter_name);
	}
							
	<?php if ($thumb) { ?>
	url += '&thumb=' + '<?php echo $thumb; ?>';
	<?php } ?>
	
	<?php if ($target) { ?>
	url += '&target=' + '<?php echo $target; ?>';
	<?php } ?>
			
	$('#modal-image').load(url);
});
//--></script> 
<script type="text/javascript"><!--
$('#button-upload').on('click', function() {
	$('#form-upload').remove();
	
	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" value="" /></form>');
	
	$('#form-upload input[name=\'file\']').trigger('click');
	
	if (typeof timer != 'undefined') {
    	clearInterval(timer);
	}
		
	timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);
			
			$.ajax({
				url: 'index.php?route=common/filemanager/upload&token=<?php echo $token; ?>&directory=<?php echo $directory; ?>',
				type: 'post',		
				dataType: 'json',
				data: new FormData($('#form-upload')[0]),
				cache: false,
				contentType: false,
				processData: false,		
				beforeSend: function() {
					$('#button-upload i').replaceWith('<i class="fa fa-circle-o-notch fa-spin"></i>');
					$('#button-upload').prop('disabled', true);
				},
				complete: function() {
					$('#button-upload i').replaceWith('<i class="fa fa-upload"></i>');
					$('#button-upload').prop('disabled', false);
				},
				success: function(json) {
					if (json['error']) {
						alert(json['error']);
					}
					
					if (json['success']) {
						alert(json['success']);
						
						$('#button-refresh').trigger('click');
					}
				},			
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});	
		}
	}, 500);
});

$('#button-folder').popover({
	html: true,
	placement: 'bottom',
	trigger: 'click',
	title: '<?php echo $entry_folder; ?>',
	content: function() {
		html  = '<div class="input-group">';
		html += '  <input type="text" name="folder" value="" placeholder="<?php echo $entry_folder; ?>" class="form-control">';
		html += '  <span class="input-group-btn"><button type="button" title="<?php echo $button_folder; ?>" id="button-create" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></span>';
		html += '</div>';
		
		return html;	
	}
});

$('#button-folder').on('shown.bs.popover', function() {
	$('#button-create').on('click', function() {
		$.ajax({
			url: 'index.php?route=common/filemanager/folder&token=<?php echo $token; ?>&directory=<?php echo $directory; ?>',
			type: 'post',		
			dataType: 'json',
			data: 'folder=' + encodeURIComponent($('input[name=\'folder\']').val()),
			beforeSend: function() {
				$('#button-create').prop('disabled', true);
			},
			complete: function() {
				$('#button-create').prop('disabled', false);
			},
			success: function(json) {
				if (json['error']) {
					alert(json['error']);
				}
				
				if (json['success']) {
					alert(json['success']);
										
					$('#button-refresh').trigger('click');
				}
			},			
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	});	
});

$('#modal-image #button-delete').on('click', function(e) {
	if (confirm('<?php echo $text_confirm; ?>')) {
		$.ajax({
			url: 'index.php?route=common/filemanager/delete&token=<?php echo $token; ?>',
			type: 'post',		
			dataType: 'json',
			data: $('input[name^=\'path\']:checked'),
			beforeSend: function() {
				$('#button-delete').prop('disabled', true);
			},	
			complete: function() {
				$('#button-delete').prop('disabled', false);
			},		
			success: function(json) {
				if (json['error']) {
					alert(json['error']);
				}
				
				if (json['success']) {
					alert(json['success']);
					
					$('#button-refresh').trigger('click');
				}
			},			
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	}
});
//--></script>
<?php if ( ! ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) ) {?>
</div>
<?php echo $loader->controller('common/footer'); ?>
<?php } ?>

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by kec » Thu Aug 20, 2015 3:32 pm

Hi,

Thank you for your respond and solution. Unfortenately I don't see any difference in the admin. What should be different after changing the filemanager.tpl in the admin?

Kind regards,

Kec

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by viethemes » Thu Aug 20, 2015 8:34 pm

Hi,
To access Image Manager directly, you can use this url: {your_site_url}/admin/index.php?route=common/filemanager

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by OSWorX » Thu Aug 20, 2015 9:47 pm

viethemes wrote:Hi,
To access Image Manager directly, you can use this url: {your_site_url}/admin/index.php?route=common/filemanager
If that would work, we would have a problem ..

But adding the token &token=CORRECT_VALUE should do it.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by IP_CAM » Thu Aug 20, 2015 11:59 pm

I am unable to follow this discussion, because I have no idea, what difference it would make, to either use one, or the other, manager, but the filemanager seems to functions, as informed by Viethemes, on my OC v.2x - nonShop Test CMS at least. Besides of NOT adding an Admin Link, but this would be a minor detail, if it really serves a purpose.
But still trying to figure out, which one... ???

Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by kec » Fri Aug 21, 2015 3:28 am

Thnx for your all your answers. I partially get it to work. But as you will understand it's not wise to implement the token directly into the url In the OC 1.5 version you could call the token by this code:

Code: Select all

&token=<?php echo $this->session->data['token']; ?>
This is not possible any more in 2.0. With what code can this be acchieved?

@IP_CAM, the reason for wanting this seems clear; there is no other way to call the filemanager directly, only when adding a product or category. I want to access the Filemanager directly so I can make changes, upload/edit/delete files when I need to and not only when I add or edit a product. :)

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by IP_CAM » Fri Aug 21, 2015 3:43 am

oops, sorry, I should have checked in the OC Demo Admin first...
In My GrandCMS V2, it's already built-in... 8)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by OSWorX » Fri Aug 21, 2015 4:05 am

kec wrote:I want to access the Filemanager directly so I can make changes, upload/edit/delete files when I need to and not only when I add or edit a product. :)
To get this, you have to use another shopsystem based on Opencart - there you have this from the beginning.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by kec » Fri Aug 21, 2015 3:21 pm

To get this, you have to use another shopsystem based on Opencart - there you have this from the beginning.
So in short, what worked in OC 1.5 does not work any more in OC2.0?

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by viethemes » Fri Aug 21, 2015 10:21 pm

I have made a VQMOD extension to add link to Image Manager. You download it here: https://www.dropbox.com/s/u1okgjh4zh1zn ... k.xml?dl=0

Attachments

Screenshot_1.png

Screenshot_1.png (8.73 KiB) Viewed 9123 times


http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by IP_CAM » Fri Aug 21, 2015 11:39 pm

kec wrote:So in short, what worked in OC 1.5 does not work any more in OC2.0?
In most cases, this matches your impression. V.2.x is entirely different, in KEY-matters.
The possibly only Problem is, that this has not been published, in an adequate Way.
Would it have been, there would be a few thousand less Forum Postings, on that matter, I assume.

But this is my very personal impression.
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by kec » Mon Aug 24, 2015 2:04 am

http://forum.opencart.com/viewtopic.php ... 27#p577634

Thank you for your VQMOD! :)

It's working though it seems the css behind it is not loading.

Attachments

_-_2015-08-23_20.04.25.jpg

_-_2015-08-23_20.04.25.jpg (16.86 KiB) Viewed 9107 times


kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by viethemes » Mon Aug 24, 2015 10:11 pm

kec wrote:http://forum.opencart.com/viewtopic.php ... 27#p577634

Thank you for your VQMOD! :)

It's working though it seems the css behind it is not loading.
Could you send me a admin account and a FTP account, so I can take a look at the problem closer?
I have tested on my local store. But I don't see any problem.

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by IP_CAM » Tue Aug 25, 2015 9:51 am

viethemes wrote:I have made a VQMOD extension to add link to Image Manager....
many thanks, saved me from defining an otherways unused Variable, so cheating mvc ... :D
so, I give you back something, found, just laying around ...
Ernie

BTW, The Code Manager is, for some reason, still not activated. Just to mention it, but
I found no time yet to check for a reason... :-\ .

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by kec » Wed Oct 26, 2016 11:41 pm

Hi,Back again.

After downloading OC 2.3.0.2 I noticed that lots of changes are made. Therefore the above Image Manager solution doesn't work any more.

**************************************************************************************************************
Off-topic: It's total ridiculous that in OC still there is NO direct link to the Image Manager. Shoot me, but am I the only one who think this is b******t?
**************************************************************************************************************
Anyway. After struggling for lots of hours (I'm not a coder) I managed to create a direct link in the menu tot the Image Manager. This link is created with a xml file in the vqmod folder. Besides that 1 file needs some extra coding.

The Image Manager works good now. BUT there is still 1 issue that I cannot solve: the Image Manager itself is a Bootstrap Modal popup.But when clicking the link in the admin the Image Manager shows up as a new page instead of a Modal popup.

I did my part, Hopefully another OC member can solve this riddle and make the link Modal so all things are cool again.

Step 1: upload the attachment into the vqmod
Step 2: insert the following code above the other code on line 1 in the following file:

admin/view/template/common/filemanager.tpl

Code: Select all

<!DOCTYPE html>
<link href="view/stylesheet/bootstrap.css" type="text/css" rel="stylesheet" />
<link href="view/javascript/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet" />
Hope for some help with the modal.

Attachments

Upload this file in the vqmod


kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by METAMORPHOZE » Sat Oct 30, 2021 5:21 pm

Hello

I solved the problem for direct opening File Manager on admin panel. Actually I just saw this post, so I reply a little (6 years) late :) Anyway solution in below, I hope it can help you

Firstly find this code on admin/view/template/common/header.tpl

Code: Select all

<ul class="nav pull-right">
After, add this code below

Code: Select all

<style>
     .button-adminfilemanager {
     color: #fff;
     padding: 10px 12px 10px 8px;
     margin: 2px;
     border-radius: 4px;
     background: #1e91cf;
     vertical-align:middle;
     float: left;
     }
     .button-adminfilemanager:hover {
     color: #ffffff;
     background: #1978ab;
     }
     </style>
     <a href="" id="thumb-icon" data-toggle="image" class="img-thumbnail button-adminfilemanager"><img src="<?php echo $icon; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" /> File Manager</a>
Thats all, you will see File Manager on right top at admin panel. If you want easier way, you can download ocmod file (for v2.3.0.2) in below. Best regards

Attachments

Admin File Manager Shortcut (for OC v2.3.0.2)


Newbie

Posts

Joined
Sat Oct 30, 2021 5:03 pm
Who is online

Users browsing this forum: No registered users and 3 guests