Author Topic: sub album configuration  (Read 2780 times)

0 Members and 1 Guest are viewing this topic.

Offline Systematic

  • album.pl User
  • *
  • Posts: 5
  • Karma: +0/-0
  • Always keen to learn..
    • Systematic (NI)
sub album configuration
« on: October 30, 2002, 07:25:52 »
Great app, and easy to modify...

I want to setup a subalbum which can contain files of more / different types than its parent album.

For example the top album just contains images, a sub-album is to contain .docs, both can receive user uploads.  I would have thought that putting an album.cfg in the subalbum with the required extensions should do the trick, unfortunately it seems that the upload function is just using the default album.cfg file...

Should this work? Is there another way. Have I screwed something up while altering authentication routines?

By the way I have altered authentication routines and .cfg files to:
  • allow most albums to be viewed by public
  • some sub albums require users to be authenticated with YaWPS, and know an album password before they can view or upload files to that sub album
  • all albums require user to be authenticated with YaWPS before uploading any files
  • upload initiated from a public viewable album sends files to the member's album

The security and authentication is still a bit weak but its still a useful tool for giving selected users accessible group file stores!

This is going to be so great....
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Systematic

  • album.pl User
  • *
  • Posts: 5
  • Karma: +0/-0
  • Always keen to learn..
    • Systematic (NI)
Re: sub album configuration
« Reply #1 on: October 30, 2002, 07:29:14 »
Oops, should have mentioned I am using ver5.7..
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: sub album configuration
« Reply #2 on: October 30, 2002, 07:53:08 »
Hi Systematic,

Looks like you've got a good understanding of how the album works, if you're tinkering with local configs and re-writing the authentication routines. :)

Right now, the best you could do is to define a local config that will only *display* certain file types in the sub album. Since the upload is global, it follows the rules for the global config. I haven't figured out how to make "global" things like upload work with a local config... :(

So you'd be able to upload images into the sub-album, but they wouldn't show up there. (Only the docs would.)

Imperfect for sure, but unfortunately there are problems that haven't been resolved yet...

I've never used YaWPS before, but it looks cool. I'd love to add YaPWS authentication into the main code stream, if you're willing to share. ;) I'd also love to see how you did the "upload initiated from a public viewable album sends files to the member's album" feature. Someone requested a similar feature not too long ago...

Cheers and thanks!
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Systematic

  • album.pl User
  • *
  • Posts: 5
  • Karma: +0/-0
  • Always keen to learn..
    • Systematic (NI)
Re: sub album configuration
« Reply #3 on: November 04, 2002, 07:45:00 »
Wow, your response time beats mine out of sight!

I thought you might look to look at my attempts to develop private file stores, and enable member subdirectories on some folders.  It works by checking local album.cfg during upload, so you can set local overrides to any variable.

You can have a look at a work in progress site. http://www.warrenpointmatters.com/YaWPS-0.3/cgi-bin/yawps.cgi From there you will get a cookie identifying you as a guest, or else login as "ordinary" password="ordinary".  Then click on Photo Archive on the left hand menu.

Get rid of the surrounding frame if you want by going to http://www.warrenpointmatters.com/album57/cgi-bin/album.pl in the same window.  (Presentation in frame needs work...)

If you did not login then you can browse everywhere except Paul_Smith.  And you cannot upload except to /Public.

If you logged in as "ordinary" you can browse everywhere - if you go to Paul_Smith you will be asked for an album password = "paul".  You can also upload
  • images to the root (per_member_upload=1)  so your file goes to member directory.
  • .doc to the Paul_Smith album. (per_member_upload=0, logfile changed so files don't end up in public recent list, password=paul, movies gif changed, movies type=doc,)
  • public album, you may view images, and upload.


Right you thought that was confusing.  Here is how it works  :-/ :

  • Upload Form amended such that category applies to all uploads, so only need to get default album.cfg then one other album.cfg for each set of uploads.  Category always points to a directory never "per_member_upload" as there can be many per_member_upload directories.  "No Upload Allowed" form disabled as I don't know all directory permissions when writing form  :(
  • Main routine amended to readconfig (categrory,1) early in script if function="upload".  Authentication in main now checks if user is recognised (username, password and authentication type) then checks if there is ALSO an album password set, if so then an additional cookie or form password is checked before granting view or upload to this private folder
  • local album.cfg amendments stored in album.cfg file in directory where default values need to be overridden.


As yet error messages to failed upload or authentication are poor, portability is poor, commenting is poor, confidence in algorithm is moderate....

Please bear in mind that I am still developing this as a proof of concept, so my code is not tidy and runs only with my modified membership and session authentication script.... but you can download my modifications to vers5.7 code from http://www.systematic-ni.com/downloads/perl/album5-7-PDS0-1.zip

Let me know if this is useful to yourself and or others.  How do you generally work with other contributors?  I'm prepared to put some time into helping to get this into the standard code - what would you like me to do next?

Thanks for a great app.
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Systematic

  • album.pl User
  • *
  • Posts: 5
  • Karma: +0/-0
  • Always keen to learn..
    • Systematic (NI)
Re: sub album configuration
« Reply #4 on: November 04, 2002, 09:43:15 »
Just saw your ToDo List and thought that the item about changing the default upload target to the current directory looked interesting:

Requirement upload button from an album should default to uploading to that album.  Then upload form should point to the same category after upload.

(I am working from v5.7 and have amended form to send concurrent uploads to the same destination)

1) album.pl substituteData() amended so that upload link from album page includes album=calling_page.  It is more generic to do this from passVars function but might have more unforeseen repercussions - this way it is just uploads button affected.

Code: [Select]
# Albumprog (with vars)
$vars=passVars(2);
$html_data=~s/####ALBUMPROG####/$albumprog?full=1$vars/g; # Don't put tags around albumprog, as it screws up the HTML if it's used in a link


appended with
Code: [Select]
if (($shortalbum ne $rootalbumname) && $shortalbum){
     $html_data=~s/function=upload"/function=upload&album=$shortalbum"/g;
}



2) album.pl uploadForm() calls recursiveScan() to build upload destination selection tree.  recursiveScan must be amended to select the value passed from upload button if present.
REPLACE:
Code: [Select]
if (!-e "$album_dir/$already_scanned/$single_directory/no_upload.txt"){
     $object.="<option value=\"$single_directory\">";

WITH: but see item below first!!
Code: [Select]
if (!-e "$album_dir/$already_scanned/$single_directory/no_upload.txt"){
     $object.="<option value=\"$single_directory\" ";
     if ($query->param(album) eq $single_directory){
           $object.="selected"
     }
     $object.=">";


3) Having uploaded files it would be good if the new upload form defaulted to uploading to the same place.  Ie upload should return a form with same category selected.  So change previous amendment. ( This relies on a previous amendment to the upload form such that all files uploaded from a single upload form go to the same category)
REPLACE ABOVE REPLACEMENT WITH:
Code: [Select]
if (!-e "$album_dir/$already_scanned/$single_directory/no_upload.txt"){
     $object.="<option value=\"$single_directory\" ";
     if ($query->param(album) eq $single_directory || $query->param('category') eq $single_directory){
           $object.="selected"
     }
     $object.=">";


« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: sub album configuration
« Reply #5 on: November 04, 2002, 10:29:06 »
Well all I can say is "wow!"

I was just about to reply to your last message when I saw your latest!

So first of all, amazing work. Understanding PERL is one thing, but understanding someone elses [poorly written] PERL is a whole other ball game. Well done!

I've downloaded your modified 5.7, and I'm going to try to figure out how you did what you did and copy it into the 6.0 code stream. I think your work would be widely appreciated, so I'd like to see it in album.pl to stay. :)

To date, I've been dealing with contributions by essentially doing a "diff" and merging the code. Works so far, but it can be pretty time consuming.

I've added in the "upload into current dir" code you provided, and it works great. (Thanks for knocking that one off the to do list!!) I haven't done the "one category for all" bit yet, so I didn't insert the 2nd example, just the first. Very elegant, I might add...

Well, thanks again for the code. I'm going to try to find the time to look into your mod'ed 5.7 and see what I can do, so please bear with me.

Cheers
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline AllenAyres

  • album.pl Contributor
  • ***
  • Posts: 61
  • Karma: +0/-0
  • I didn't forget to change the default text.
Re: sub album configuration
« Reply #6 on: November 11, 2002, 10:12:47 »
Yes, thank you for sharing :D
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: sub album configuration
« Reply #7 on: November 11, 2002, 19:41:43 »
Paul, I haven't forgotten about the list you sent me... The ball is in my court, I just have to sit down and read it!

Thanks
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Dino

  • album.pl Donor
  • I Spend Too Much Time Here
  • *****
  • Posts: 250
  • Karma: +5/-0
  • That's actually my childhood cookie jar!
    • Dino's Bulletin Board
Re: sub album configuration
« Reply #8 on: November 11, 2002, 21:43:42 »
Wow! I'm glad uploading to current dir was added. I didn't want to ask, since I've already given you TOO much feedback. Thanks, Systematic, for your expertise. I'm sure Mike appreciates it. I definitely do!

Mike, did you ever think your script would be the "benchmark" album script? PHP guys are converting to Perl everywhere I go. Good job, Mike! Long live Perl.
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

"He who seeks the truth must doubt everything."Aristotle
"Extraordinary claims require extraordinary proof."Sagan

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: sub album configuration
« Reply #9 on: November 12, 2002, 05:20:41 »
It's fun to see how this project has progressed. It started as a rough and ready program I wrote for myself, and I have to admit, it's gaining some popularity... :)
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »