Subdirectories
-
Hi!
I’m testing your plugins (awesome by the way… :D)
It´s exactly what I need.My question is regarding directories, I have a lot of media files, in many diferent directories, say, a make a new directory on my FTP server every upload I Make
http://www.kardecriopreto.com.br/mediaIs there a way for File Way to index all these files inside different directories (that are all inside the primary directory /media)
?THanks!
Regards,
Alan
-
And I’ve got it working with folders linking to the next level, and breadcrumbs at the top for navigating backward to the level of your choice. Still a ways to go aesthetically.
I think it was Aristotle who said, “No great mind has ever existed without a touch of madness… and a sweet beard.”
WHO wants to beta test it?
Hey, nutlog, or whoever else. I’ve uploaded an easter-egg version of the plugin. It’s the same release number so you’ll have to manually download it. I want some beta-testers to tell me what else it needs. Note that I’m not done figuring out the aesthetics. Once you have the plugin manually downloaded and installed, just use “directories=whatever” in your shortcode. If set, “recursive” will be disabled, the type will be set to “table,” and “sortfirst” will be set to type, so that directories appear at the top of the table.
Give me Feedback!
And with directories activated, currently only the files are filtered out when using File Away’s include/exclude attributes. I probably will extend that filtering functionality to directories before proper release.
Anyone who beta-tests the Directories feature, here’s a neat trick for you:
1. Save the following code as a .php file and upload it to your theme’s template directory (usually the theme’s main directory):
<?php /** Template Name: File Away iFrame */ ?> <html><head><link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <style>#wpadminbar{display:none!important;}</style><?php wp_head(); ?></head> <body><?php while (have_posts()) : the_post(); ?><div id="page-content"><?php the_content(); endwhile; ?></div> <?php wp_footer(); ?></body></html>2. Create a new page and assign it the above template when creating it. For our purposes, we’ll title the page: “File Away iFrame.” (See slug in iFrame src attribute below.)
3. On that page include your File Away shortcode with directories turned on and whatever specifications you want. That’s all that goes on that page. Your shortcode should look something like this:
[fileaway base=1 style=silver-bullet directories=hellyes type=table paginate=yes pagesize=10 sortfirst=type]4. On another page (the page where you want your table to be in use, include the following:
<iframe src='http://your-domain.com/file-away-iframe' width=100% height=1200px sandbox='allow-scripts' scrolling=no frameborder=0 marginwidth=0 marginheight=0 seamless></iframe>Be sure to change the url and slug to match the page with the custom template where you put your [fileaway directories=hellyes] shortcode. We give it a nice big height and correspondingly we gave the File Away table a pagesize of 10 per page (adjust to your pleasure) so that the iFrame never has to scroll.
Now you’ve got a directory tree with full breadcrumb navigation, without having to reload the parent page, and without displaying the querystrings in the url.
Awesome… I’m on it. 🙂
Cool. Thanks, you Nut. There’s a CSS issue with the breadcrumb links because of my weird margin stuff, but it’ll be fixed in the proper release. Meantime, you may have to move the mouse to the top part of the text for the link to work.
Also, right now I’m working on having File Away automatically add the iframe template to your theme’s directory, and then (when I can) I’ll add an iframe generator option to the shortcode generator modal.
Oh and in your iframe template php file, I’d recommend replacing this:
<style>#wpadminbar{display:none!important;}</style>with this:
<?php if (is_page_template('mytemplate.php')) show_admin_bar(false); ?>and then be sure to change “mytemplate.php” to whatever you named the template file .php
Just discovered that the sandbox=allow-scripts attribute in the iframe tag was preventing files from opening in a new window if that file type is set to open in a new window. So you can remove sandbox=allow-scripts from the iframe tag. It’s not necessary, and is annoying.
I’ve uploaded some changes to the same version number, so if you want to get the latest easter eggs, again, manually download and install. If you want to test out all the new functionality, here it is:
This version automatically places “file-away-iframe-template.php” in your theme’s directory, so all you have to do is edit or create a new page and change the template to “File Away iFrame” using the template dropdown.
On that iframe page, include your fileaway shortcode, something like this:
[fileaway base=3 style=silver-bullet directories="on" type="table" paginate="yes" pagesize=10](By the way, with directories activated, I changed it from sortfirst=type hardcoded, to sortfirst=filename hardcoded, and I gave the table cells of the File Directories in the table a data-value of “00-” + the filename. That way, they will be sorted by directories at the top, and in alphabetical order, then by files below in alpha order. I also gave a data-value of “00-” + filename to the file type column, so if someone sorts by filetype, directories will be at the top. End digression.)
Now, go to a page with your normal theme template and you can now use a new File Away iframe shortcode, to place the iFrame page into the parent page, like so:
[fileaframe source="/fakepath/" height="1200px"](Note: this shortcode is not in the generator yet. Like I said, easter egg.)
The only two required attributes are “source” and “height”. Height has to be entered in pixels as above. Source can be your full url or just the pageslug of the iFrame-templated page that has your [fileaway] shortcode. I gave my iframe page a slug of “fakepath” to confuse people who look at the status bar at the bottom of the browser when hovering over links.
Anyway, the other optional attributes for [fileaframe] include:
width, scroll, frame, mwidth, mheight, and seamless. All of these have defaults if left out of the shortcode.
width defaults to ‘100%’
scroll defaults to ‘no’
frame (i.e., frameborder) defaults to ‘0’ (boolean “false,” that is)
mwidth (i.e., marginwidth) defaults to ‘0px’
mheight defaults to ‘0px’
seamless defaults to ‘seamless’ (anything else and it will become null)So throw that shortcode in your parent page and you’ve got a directory tree.
Now in the new template that File Away creates for you, I added a fade in effect on pageload, and a fadeout effect whenever a directory link is clicked. That way, it simulates an ajax refresh of the iframe page content.
If you want to have more than one directory tree table on the same page, just put one each in a different iframe-templated page, and that way the navigation systems won’t interfere with each other.
Found a big bug with the navigation system, but have fixed it. What else is buggy, what else needs improved?
Also just wanted to let everyone know that I’ve got a prototype for a front-end multiple file uploader in the works. It uploads multiple files to the server directory that you specify in the upload form, and will allow renaming and appending customdata to the file name for display in File Away custom data table columns (which are unlimited now, by the way, if you hadn’t noticed). The uploader does not utilize the WordPress media uploader. It’s pure php, using sessions to pass the uploaded file information back to the page on refresh to display the list of successfully uploaded files with their final file names.
LOL – you have already fixed almost every single thing I was going to post!
I haven’t checked out the newest build yet, but I was coming back to post about the breadcrumb links not being clickable, an issue with the initial “secondary” sorting (after file type) not being alphabetical, and the folders not staying fixed at the top of the list. Sounds like you’ve already taken care of those. Well done, sir. I do have a few other notes:
1) Bug – files and folders with apostrophes in the name will not load. A file named John’s_List.doc or a folder called /John’s Files will get cut off at /John. Files will return a File Not Found error, while folders will just keep loading the current page.
2) The folders are displaying with the full underscored folder name. i.e. 2013_MEETING_FILES, rather than the cleaned-up “2013 Meeting Files” format that the actual documents/files show.
3) Speaking of formatting, this may be a pro/con gray area… for us, at least, we have a ton of files that have the date as part of the filename… i.e. Organizational_Report_2-8-13.pdf. Because the cleaned-up name strips underscores AND hyphens, the filenames look strange… i.e. Organizational Report 2 8 13. I suppose there’s no way to NOT strip the hyphens? If not it’s not the end of the world; I wouldn’t want to screw up something somewhere else in the plugin. 🙂
But everything is looking awesome. I know I (and others) really appreciate everything you’re doing.
Thanks for all that great feedback. Fixing the apostrophe issue shouldn’t be a problem. FTR, the folders are still not _fixed_ at the top. They are initially, but can be moved to the bottom if sorted backwards. But because they only have content in the two cells, they will always be at the top or the bottom, which seems desirable as a user preference when browsing.
Thanks for reminding me about prettying up the directory output. In the plans, but was lost in the warzone. Regarding dates, I will attempt to build a regex that doesn’t strip dashes from in between numbers. Alternatively, you can put them in square brackets and throw them in a custom column. And I can remove strip dashes from the square brackets content.
When I eventually get the new File Up (trademark) 🙂 additions done, I hope to be able to include the ability to rename files from the front end, but we shall see. I can tell you it will include the ability to auto rename and auto-create new directories in bulk, according to specified user meta. Like, you’d tell it to put a sub directory for every user’s Display_Name in such and such a directory. And every time a new user registers, the button to auto-generate their directory will show up again. If activated per admin preference. In addition to bulk uploading, you’ll also be able to bulk copy and bulk move files from one location on the server to another.
The challenge is figuring out how to implement directory navigation for choosing source and target locations in a web form. Short of, of course, just making you type in the paths manually, which would be really mean of me.
OK, Nutlog. I haven’t uploaded it yet, but I’ve fixed all three issues you reported.
1. Apostrophes no longer break links or directory navigation. Had to use stripslashes() for the Directories because the browser was escaping the apostrophe with \’. Took me a few minutes to figure out. The problem with the links breaking was just because I had some of the links wrapped in single-quotes instead of double, which I think I did recently while focusing on another issue.
2. The Directory Names both in the table and in the breadcrumbs are now prettified, with underscores, dashes, and other dumb characters removed, EXCEPT BETWEEN….
3. Numbers. Dashes are now preserved when they appear between numbers, both in file names and in directory names.
Again, haven’t uploaded it yet. But when the next version comes out, all that will be fixed.
The topic ‘Subdirectories’ is closed to new replies.