I find that the directory names get too unweildy, and if i browse them on the file server they don't make sense. An example where this is confusing is where two fileshares have the same name, which happens when pages are nested in the menu system. An example might be breadcrumbed menus like:
home » members » file share
home » public » file share
To the user it is logical that these are different file share pages. However, the site admin sees something like
/files/file_share234
/files/file_share246
which is not very clear at all.

I'd propose adding a new field where the actual directory name can be specified on creation of the the fileshare. That way I could create member_file_share & pulic_file_share directories, but let both pages have the name 'file share'.

Obviously some rules are required.
You could require each file shares' directory to be unique.
OR, if the same directory is specified, they are in essence the same fileshare but with a different page context.

Comments

Craig Gardner’s picture

Status: Active » Needs review
StatusFileSize
new3.27 KB

I thought I'd give it a try. We'll see how it works.

cboshuizen’s picture

Thanks for the patch. This is a patch against 5.x, right? I'm using 4.7.6 on both my production and development servers, so I couldn't test it. Do you think it'd work if I tried to modify the 4.7.6 version file in the same way?

Chris

Craig Gardner’s picture

I'll see what I can do for you.

Craig Gardner’s picture

StatusFileSize
new15.92 KB

Give this one a try.

Go easy on me though, I'm new.

cboshuizen’s picture

Thanks, I'm sure you are way ahead of me when it comes to patching modules.

Did you upload the right file though? This looks more like a release patch than the one you posted yesterday.

Chris

Craig Gardner’s picture

Should be pretty much the same. I did the same things when I created this one.

lvadillo’s picture

I've been testing the new feature with the 5.1 dev version.
I can change the name of the real directory instead of the defaulted "node name" + "node number", this is what we wanted.

I found the following:

1) The option to change the name becomes available after the node has been created, it's below the "Upload and New folder Options" when (I think/hope only when the "admin" is accesssing it). Can you please confirm that only the admin can change the name?
2) The name cannot be changed to one that is already being used. This I understand is a feature to be maintained and seems logical.

To have 2 fileshare nodes pointing to the same directory I still can resort to changing the path name in the node_fileshare table. CARE must be taken, as if one of those nodes is deleted the directory "is also" deleted!

---
Congratulations, this was the module I was hoping to have at hand a long time ago. Now I can do all type of file availability/exchange within Drupal.

Craig Gardner’s picture

1) I can confirm that the only people that can change the filepath are those that you give "set file paths" permission.
2) That is correct and I really don't see any reason to have that any other way. I don't see why you would want to have multiple fileshares pointing to the same directory when you can have just one.

cboshuizen’s picture

Sorry, now I am totally confused.

The 4.7 version patch you have supplied is 15 KB versus the 3 KB for the 5.0 version patch. When I run the patch 16 of the 20 hunks fail because they are already in the fileshare.module file that I am patching. With the 4 hunks that do get patched, I see no extra functionality at all.

Are you sure you uploaded the right file, or ran the diff against the two correct versions?

I'm using fileshare-4.7.x-2.1 with release date 2007-Jan-16:

// $Id: fileshare.module,v 1.20 2007/01/16 23:06:06 jamier Exp $

I'm really looking forward to trying out your updates, and I hope I'm not being totally stupid here. Thanks!

Chris

cboshuizen’s picture

I worked it out. The patch creates the v4.7 module when run against the v5.0 module. That wasn't quite what I expected, but it's all fine now I worked that out. I hadn't realised that was how drupal releases worked, so sorry for the hassle.

I'm pleased to say I have it working now! It provides the essential functionality I was looking for, thank you!

I do have a couple of suggestions, if I may.

  1. The ability to change the node base path could probably be on the edit page, rather than the actual node page itself. Being an admin function rather than a user one, this makes sense.
  2. The Node base path setting doesn't appear unless "Allow files to be uploaded to and deleted from this directory" is ticked. There really is no connection between these two functions. It can be used to lock the base path though, which may or may not be a useful thing
  3. It'd be great to be able to set the path from the create content page, rather than having to do it in two steps. I guess some caution needs to be followed since the current path dialog doesn't allow you to specify non-existing directories, and currently refers to the base of the fileshare, not the fileshare directory itself.
  4. Regarding the sharing of directories by different fileshare pages, I can see a number of instances where this is useful, mostly driven by the fact that you can create different page contexts using this module. An example might be if I have a folder called downloads. I might want create a locked page for public access downloads with some public-ready copy like

    "Here you can download files related to this project...",

    but, I'd like to also create a page with private access for privileged users to upload files. That page may need to say something like

    "This is the upload site for the public downloads section [link to other fileshare node]. Please follow these instructions for uploading files..."

    This is something I've wanted to do quite often.

    Another case is that where there is a pre-existing directory of files on the server, perhaps even unrelated to drupal. If user X decides to create a fileshare pointing to this directory for their own purposes, there is no reason why user Y cannot then make one, given that they might not even know of the existence of this other directory.

    This latter example of course opens up the entire conundrum of fine-grained user permissions. For the site I administer we would never allow users to create their own fileshares anyway so the problem is avoided in my case, but I can see us hitting the first use case quite often.

Anyway, this patch is already great for cleaning up the fileshares I have, so I'll definitely be using it. Thank you again.

- Chris

lvadillo’s picture

Answer to cgardner "I don't see why you would want to have multiple fileshares pointing to the same directory when you can have just one."

I let registered users to see the fileshare directory, but I need a smaller set of users to being able to add/delete files in the same directory, so, one group has the "Allow files to be uploaded to and deleted from this directory" set, and the other hasn't. Thus the need for dual nodes pointing to the same place. I have several instances of this, and not always the same users are allowed to modify. I use the module "node Privacy by Role" to modulate this.

Regards, Luis

Andrei Toutoukine’s picture

Version: master » 4.7.x-1.x-dev
Assigned: Unassigned » Andrei Toutoukine
Category: feature » bug

I tried to apply the patch but it did not worked for me (Drupal 4.7.x) until I've changed
$orig = node_load($node->nid); to $orig = node_load($node->nid, null, true);
inside the fileshare_update() function. This disables a cache of loaded nodes.

PS. Thanks to cgardner for the patch!

Andrei Toutoukine’s picture

Another bug is found. Maybe I should post it somewhere else... but still:
fileshare.module, line 459 must be: if(user_access('set file paths')) {