Uploading private files? - django-cms

I want to be able to upload files using django-cms, and have those files only be visible to authenticated users.
I've gotten as far as creating a "Members only" page, clicking "Login required" and selecting "for logged in users only" for Menu visibility ("advanced settings under /admin/cms/page). This gets me some of what I want; the page itself is not visible unless you're logged in. And the menu item goes away too.
But, the next step is a problem. I can upload a file using the "file" plugin. This puts the file under /media/cms_page_media/. Even though you can't see the page which displays the link, you can still get to the file if you have the direct URL to it. What I need is something which not only protects the page, but the files uploaded to it.
I know my way around most (well, some) of django, so I could do a bit of hacking to get a solution. I'm hoping to avoid writing an entire file manager from scratch (not that it wouldn't make a nice little OSS project).

Django Filer (https://github.com/stefanfoulis/django-filer) has this option in the newest release. It also has a nice set of CMS Plugins which add a lot of value over the default File plugin: https://github.com/stefanfoulis/cmsplugin-filer

Related

Best Way to Implement Basic Content Manager Permissions

We've added a role to DNN named, "Content Manager." Almost all the site's content is in 2sxc Content app stuff; Basic Content, Links, Locations, etc. What is the most efficient way to get DNN and 2sxc setup so that these users can only Edit the content. Not change the template (View) or get in to DNN's module or page settings or anything else. Most of our efforts so far either involve a lot of setup work and module permission changes - or - if we stick close to the defaults, we give these users too many options when logged in. Basically we want them to only see the blue circle edit pencil button and nothing else.
So I found this by accident, but it seems to work! Perhaps #iJungleBoy has some additional feedback.
Get the RoleID from the database for the role you created for Content Editors. Then, in your 2SXC app, go to the apps Administration page, click App in the top toolbar, click the icon next to App Permissions, add a new permission with the ID of the role in the Identity field, leave the condition unset, and choose from the Grant options that meets your need. The entry for "Edit (Create, Read, Update, Delete)" may be what you are looking for.
If that doesn't work, you may need to manage the App Permissions for all 2sxc apps. You can follow this link for background on it. Basically you need to put the page in Edit mode and then on the gear icon select Apps Management. On that screen, click the Features button on the toolbar. Click Manage Features, and then enable the one entitled "Permission by Group / Role".
For more background on permissions, check here.
Hope that helps get you on a good path.

Best way to track down dependencies? (Wordpress + Woocommerce)

I am wondering what the best ways are to track down dependencies (I think that is the best way to describe it) between several files. Here are the details.
Context: I am working on adding a plugin called WooCommerce Product Bundles to the online store that I am managing. The plugin takes several products and combines them onto one page with a short description for each product.
The Problem: When the plugin is pulling in the short description for each product it is also pulling in the contents of product-elements.php which has a "Find a Dealer" button inside of it. This big button is then repeated 4 times on the rendered page and looks terrible.
The Goal: Is to remove these buttons by removing the hook for "product-elements.php" from the plugin, since nothing in that file needs to be displayed on the rendered page.
However... I cannot for the life of me find any references to product-elements.php in the plugin files... which means it is probably referencing another product page template file, which is then referencing something else, which is then referencing "product-elements.php".
If you guys understand what I am saying here... what is the best way to trace the full path of these files so I can find the actual reference I am looking for (and kill it with fire)?
Additional details:
- product-elements.php is a file in my theme. It is a default Woocommerce file that has been copied over and modified (sort of like a child theme, but it is a child file).
- Something in the bundle plugin files is pulling product-elements.php into the rendered page, but it is not referenced directly.
- There has to be some middle step in between these directories where there is a trail of references, how do I find it?
- Tools I am using, OSX, Tower(GIT), Atom text editor

WordPress' Tribe Events leads to main page

My client is using Tribe Events for, well, managing his events :) I was asked to make a new theme for him. I downloaded his old installation and created new theme, checked and everything was great. I uploaded the whole thing to my server - works as well. But when I finally got the thing on my client's host, every link leading to Tribe Events' content is leading back to main page. Strange thing - it happens only when my theme is on. But then again, I tried removing tribe-events directory from the theme, renaming it etc. Nothing helps. Any ideas?
You didn't provide details about the way you use it so I am not sure the way to provide exact reply.
If you use it without default page template (plugin one) then you should check your loop.
Did you override any files or did you change plugin files at all.
Make sure there is no extra loop running and if you use lops on page make sure you finish it properly
And finally - try to reset permalings, both theme and plugin, if any

Asp.Net Google style file upload

Does someone knows of a user control that can work exactly like the file upload Google has?
I want that the use will select the files to upload, then that upload will start and the progress bar will work, and the user can continue to the next field he has to fill in the page as the file is uploaded in the background.
Willing to pay. Free is better.
Thanks
I recently used AjaxUploader with great results. One of its demos is actually GMail Style. It runs $99 for 1 domain.

How can I get Gmail-like file uploads for my web app?

I want to add gmail-like file upload functionality for one of my projects. Can anybody help me with this?
My application is built in vb.net.
I would appreciate any kind of help or guidance.
Thanks
Check out SWFUpload, which is essentially a javascript api to flash's absolutely superior file upload handling capabilities. Best thing out there until the browsers finally catch up.
From link:
Upload multiple files at once by ctrl/shift-selecting in dialog
Javascript callbacks on all events
Get file information before upload starts
Style upload elements with XHTML and css
Display information while files are uploading using HTML
No page reloads necessary
Works on all platforms/browsers that has Flash support.
Degrades gracefully to normal HTML upload form if Flash or
javascript is unavailable
Control filesize before upload starts
Only display chosen filetypes in dialog
Queue uploads, remove/add files before starting upload
Demos
----- iframe upload -----
To start, you want to have an iframe on your page. This is meant for server communication. You'll hide it later, but for now, keep it visible. Give that iframe a name attribute, like "uploader" or something.
Now, in your form, set the target to the iframe's name and the action to a script you have on the server that will accept a file upload (like a normal form with a file upload). Add a link inside that form with the text "Add File". Set that link to run a javascript function which will add a new input to the form. This can be done via the DOM, but I would recommend a javascript library like jquery.
Once the new file input is added to the form, set the blur event of that input to a javascript function that will submit the form and then check it periodically for output. Reading an iframe can be tricky, but it's possible.
Have your file upload script output a "Done." or a filename or something when the upload is complete.
Check it every second or so until there is content. Once you have content, kill your timer and replace the file input with the name of the file (or "File Uploaded") or whatever.
Hide your iframe with css.
From YUI! (Yahoo User Interface), https://yuilibrary.com/yui/docs/uploader/
Multiple file selection in a single "Open File" dialog.
File extension filters to facilitate the user's selection.
Progress tracking for file uploads.
A range of file metadata: filename, size, date created, date modified, and author.
A set of events dispatched on various aspects of the file upload process: file selection, upload progress, upload completion, etc.
Inclusion of additional data in the file upload POST request.
Faster file upload on broadband connections due to the modified SEND buffer size.
Same-page server response upon completion of the file upload.
Totally Free
Here is the gmail uploader clone. This is the exact clone of gmail uploader with some extra facilities. You can see the thumbnails of images after uploading, Drag the thumbnails to change the order and replace any thumbnail. It is done using jQuery.
You can see the demo here. The source code is free to download in a single zip file.
I hope you can easily remove some code and get the desired thing. You may leave comments on the ABCoder blog if you need further help.
For a non-flash solution, you can use NeatUpload. I used it on an extensive project last year with a no-flash requirement. It's very easy to integrate into existing solutions. I thought it was a breeze to work with. Easier, in my limited experience, than working with SWFUpload in ASP.NET. Probably because NeatUpload is built just for ASP.NET.
You may use Flickr Uploader clone instead.
Are you talking about an upload without a full page postback? Take a look at http://www.phpletter.com/Demo/AjaxFileUpload-Demo/, which creates a hidden iframe, copies the input control, and uses the iframe to perform the post to get the file on the server.
If you're looking for the behavior where when the user clicks "attach file" and the file browsing dialog automatically pops up, that can be done via Javascript but doesn't work in FireFox, which has the security precaution of requiring the user to invoke the "Browse" button directly (rather than programmatically through script).
For the "automatic" upload, use Javascript to attach to the "change" event for the "value" property of the the 'input' control so that the will perform when a file has been selected.
Now it has been 2 years, I used the uploadify in my legacy system and it works good. but you need to write some hack code (such like hold the session).
I recommend you use jquery upload, which is pure HTML, no swf, no session problems and really great!
== on 2013, what I wrote:
I am considering which to choose, SWFupload or uploadify .
but on SWFupload's official website , it says that it has not been under active development and the author is hoping someday the SWFupload could revive...
so ... I decided to try "uploadify", which seems supports many options, callbacks with lots of demos. (after checking its source code, I guess the author wraps the "SWFupload v1" and "SWFupload v2" in his "uploadify v3"...)
and there's a full list of this kind of uploaders.
I'd like a little more clarification of "Gmail-like" file uploading.
do you mean how if it sits for a little bit, it automatically attaches it to a draft?
Gmail's code is difficult to find your way around, but if I had to guess, this is how it works:
When you click "attach another file", it inserts a regular input type file control. On IE, it may also programmatically trigger the click event on the "browse" button so the file dialog opens immediately (it doesn't do this on firefox, and I don't have IE handy, but I believe IE allows for this)
After you select a file, it detects the change event of the input control, and starts a timer.
When the timer triggers, it detaches the input element from the form, and adds it to a different form in a hidden iframe, placing a simple link in the main (visible) form. The hidden iframe is then submitted to upload the file. (It may also clone the input element, but I haven't tried whether this works.)
You can use iFrames for this

Resources