Author Topic: New Module "OneForAll"  (Read 28931 times)

Offline jacobi22

  • Global Moderator
  • *****
  • Posts: 4454
  • Gender: Male
    • Jacobi22
Re: New Module "OneForAll"
« Reply #250 on: April 11, 2017, 10:32:11 AM »
from my point: no chance without code changes (like your example)

[IMAGE] is a pre-defined output code. i did not test it in the latest OFA-Version, but whats happend, if you use the field settings to define the needed output?
Du bist der Mensch, der mich zum Lachen bringt und der, der mit mir weint. Ich muss lachen, wenn du lachst und weinen, wenn du weinst und darum wirst du für immer ein Teil von meinem Herzen sein
(*miss you*)

Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #251 on: April 11, 2017, 04:24:42 PM »
@CodeALot - Thank you for your work-around idea.  I am comfortable altering the code, but I do not want go this route as I will have to maintain these changes with each upgrade... and this problem is not worth that future commitment.

I feel like I am chasing my tail.  I have gone through this thread re-reading all the suggestions, and I am starting to think I have either not made my needs clear, or I am trying to do something that OFA is not built to do.  I'm going to try one more time to explain what I am trying to accomplish.

In the backend, I wanted to have two (2) fields, where my client could:
  • upload or choose an image file (gif, jpg, png), with the option to either manually resize on upload, or resize later before output to page.
  • optional - input a URL which will link from the image
On the frontend you would see the images, and if there is a URL (2.) input, the image would link to the sponsor website.
Every approach I have tried, has failed to fully achieve this goal:
  • pre-upload files to Media folder.  Resize must be preset through "Modify Settings" which I have hidden from Clients.  Additionally, I don't want to preset the dimensions, because I have no way of knowing what dimensions will be best for each individual image.  So, the image upload / resize is a problem... but I can use a OFA field of "File from a sub directory of Media" to get the image, and adding the optional URL link works - http://forum.WebsiteBaker.org/index.php/topic,27895.msg204454.html#msg204454
  • use OFA "3. Add Images" to upload and resize image.  This works great for the upload part of the equation, but then I can't get the "optional" URL link to work with this [IMAGE] without changing OFA files - http://forum.WebsiteBaker.org/index.php/topic,27895.msg210870.html#msg210870


I had originally used a WYSIWYG page, and instructed my clients on how to add all their Sponsor images (which they had to upload to a Media folder beforehand) and optional links.  But of course this opens up all kinds of possible formatting issues, as clients "get creative".

So, then I switched to the News module, at least then I could have them separate the sponsors into individual posts, where if formatting went wrong, I could more quickly assist.  This also allowed for them to make individual sponsors Posts Active or not.  And I could use AnyNews to show a random sponsor on each page in the sidebar.  This has been the best fit, but for years I have had to deal with so many headaches with new admins each year messing up the formatting.

So, when OFA came along, I thought I might be able to automate the process, and eliminate (or lessen) the chance for formatting issues.  Just provide two fields.  One to choose the image.  One to add the URL (optional).  But I can't seem to get to that point with and unmodified OFA.

Right now I have resigned to using OFA, with one WYSIWYG field.  So, I can achieve everything I want as far as image sizing and linking, but the Admins still have the editor to play around in and mess things up.

If anyone has a solution, I would be grateful.  If this is not something that can be done presently with an unmodified OFA, I will accept that, and move on.  OFA is such a great module, which I use successfully in so many other ways, I won't hold this against it.   :)

Offline Ruud

  • WebsiteBaker Org e.V.
  • **
  • Posts: 3551
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Module "OneForAll"
« Reply #252 on: April 11, 2017, 05:12:31 PM »
Just a trick that might do it for you..  8-)

Create a droplet called "geturl" with this content.
Code:
Only registered users can see contents. Please click here to Register or Login.
Wherever in your OFA output you need the image url just do:
Code:
Only registered users can see contents. Please click here to Register or Login.
The droplet will return the "href" value of the [IMAGE].



Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #253 on: April 11, 2017, 05:19:00 PM »
Ruud - While I read your post, my face LITERALLY did this -  :o
Then I couldn't stop laughing to myself.

But, you have never led me wrong before, so I will give it a try and let you know how I make out.
Do I use "$ofa" or do I use the actual name of my renamed OFA module... or does if even matter?

Offline Ruud

  • WebsiteBaker Org e.V.
  • **
  • Posts: 3551
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Module "OneForAll"
« Reply #254 on: April 11, 2017, 05:25:46 PM »
Do I use "$ofa" or do I use the actual name of my renamed OFA module... or does if even matter?
The $ofa in the droplet must be the same as the parameter in the call [[geturl?ofa=....]]. It does not matter what is used.
But if you change one, you need to change both..

I would suggest to just copy/paste the code :-)

Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #255 on: April 11, 2017, 06:27:49 PM »
I created the droplet (copy and pasted your code).... and Activated it!

Then I put the following in my SPONSOR_URL (external Link) Field:
Code:
Only registered users can see contents. Please click here to Register or Login.
Page Settings - Overview (Item-Loop):
Code:
Only registered users can see contents. Please click here to Register or Login.
I uploaded an image using OFA "3. Upload File" and the image appears in the backend "2. Backend Images"

Tried it and I get the alt Title with a link to the URL, but the IMAGE source is empty.
Code:
Only registered users can see contents. Please click here to Register or Login.
So, I tested with just your droplet in the Page Settings - Overview (Item-Loop):
Code:
Only registered users can see contents. Please click here to Register or Login.
This gives no output.  Am I doing something wrong?

To test, I put your droplet code in a WYSIWYG section, and nothing is shown... but then I figured it doesn't have an [IMAGE] to pull the href from... so I guess this didn't test anything.

Does it make a difference if I am testing locally with WB Portable?
« Last Edit: April 11, 2017, 06:35:29 PM by sky writer »

Offline Ruud

  • WebsiteBaker Org e.V.
  • **
  • Posts: 3551
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Module "OneForAll"
« Reply #256 on: April 11, 2017, 11:07:44 PM »
Ok, I was testing with lightbox enabled output. This will add a <a href="..imagename.." around the image, and the droplet would extract this href value.
You are not using the lightbox option, so there is no href to find.

This second version of the droplet will find and return the "src" in the image (works with and without lightbox option enabled)
Code:
Only registered users can see contents. Please click here to Register or Login.
Testing in portable is fine..
Tesing on WYSIWYG pages will not work :wink:

Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #257 on: April 12, 2017, 01:07:26 AM »
This is unrelated to my [IMAGE] pursuit above.

I think I have found an issue or at least something to be aware of, with OFA.

Before I ever started using OFA, I had a sub folder in my Media folder, named "sponsors".  It was filled with folders filled with sponsor image files.  I decided to start using OFA, and locally, I renamed the latest 1.6.0 OFA to "sponsors" (seemed like a suitable name at the time), zipped and installed the module.  I didn't realize that OFA creates a Media sub-folder with the same name as the Module name.  Because my OFA module has the same name as my previous media folder, it didn't overwrite the folder, but it did add two sub-folders (images and thumbs) to the already present "sponsors" folder.  So far, so good.

During my [IMAGE] trials above, I tried several different re-named OFA modules.  At some point along the way of my local testing, I decided to stop using the OFA "Sponsors" module, and uninstalled it.  The uninstall completely removed the "sponsors" sub folder from Media... and so all of my previous folders and sponsor image files were removed.  Not good.

I had back ups for all, so all if fine... but I thought I should report this.

I've recreated this to test that it wasn't user error.  I also tried adding an "images" and "thumbs" folder to my "test" sub-folder, and filled them with files.  I then uploaded OFA renamed "test" and it left all the files alone in the media/test/images and media/test/thumbs folders and just added it's own folders internally.  But of course all folders and files are deleted when the module is uninstalled.

Basically - you should not rename OFA to the same name as a sub-folder in your Media folder.

Hope this helps.

Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #258 on: April 12, 2017, 02:42:50 AM »
@Ruud - Your initial droplet code was not the issue.
The problem was the double quotes I had around the droplet code:
Code:
Only registered users can see contents. Please click here to Register or Login.
I changed it to single quotes:
Code:
Only registered users can see contents. Please click here to Register or Login.
And now both droplet code examples work.  Thank you!

Offline CodeALot

  • Posts: 353
  • Gender: Male
Re: New Module "OneForAll"
« Reply #259 on: April 12, 2017, 05:12:53 PM »
Basically - you should not rename OFA to the same name as a sub-folder in your Media folder.

This is (to my knowledge) fairly easy to tackle, by checking for such a media folder upon installing the renamed module.

Suggestion:

In install.php of OFA, insert on line 41
Code:
Only registered users can see contents. Please click here to Register or Login.

Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #260 on: April 13, 2017, 10:34:44 AM »
I wasn't looking for a personal fix.  I was just reporting this to the developer of the module.  I thought it might be of interest.

Offline CodeALot

  • Posts: 353
  • Gender: Male
Re: New Module "OneForAll"
« Reply #261 on: April 13, 2017, 06:10:52 PM »
The nice thing about a forum is that it's not a one-on-one communication ;-)

Just like you pointed out something that went wrong, I made a suggestion on how to fix that. That's how a community works on making things better for everyone ;)

Offline sky writer

  • Posts: 847
Re: New Module "OneForAll"
« Reply #262 on: April 14, 2017, 03:43:54 PM »
Your proposed check is an option to consider moving forward.   (Y)

This still leaves the possibility of media loss for anyone who already installed the module.

I suggested warning to current users could be something along the lines of:

If you have installed a oneforeall module, and the renamed module name matches one of your preexisting Media sub-folder, or if you have added non-OFA media files to the folder(s) automatically created by oneforall, backup that Media sub-folder before uninstalling said OFA module.

Offline freeSbee

  • Posts: 1117
    • BAKERY - Website Baker shop module
Re: New Module "OneForAll"
« Reply #263 on: May 30, 2017, 10:11:51 AM »

New Version of OneForAll:

VERSION 1.0.7 (05/30/2017)


VERSION HISTORY
  • [install.php] Added check to see if there is already a media directory using the module name.
    Can cause problems when deleting the module (reported by sky writer, thanks to CodeALot)
  • [delete_item.php] Bugfix: For items without access file the field link is empty and hence the page access file will be deleted instead of the item access file (reported by dbs, thanks to Ruud)

KNOW HOW
Further information can be found on the first post of this thread.

DOWNLOAD
Download the zip from this download link.


Christoph

Offline artidens

  • Posts: 2
Re: New Module "OneForAll"
« Reply #264 on: August 03, 2017, 05:21:28 PM »
First of all, I'd like to thank the author for this great addon!

But is it possible to hide certain Custom Fields per page in the admin area?

Imagine having 10 or more fields of which only two or three individual ones are used in different pages. Having lots of unnecessary editable fields or other options in every page might confuse the content editor.


Offline Ruud

  • WebsiteBaker Org e.V.
  • **
  • Posts: 3551
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Module "OneForAll"
« Reply #265 on: August 03, 2017, 05:30:53 PM »
Just rename and install the module for every layout.

The module named as "portfolio" could have other fields (and therefore another backend) than the module "projects".

Offline artidens

  • Posts: 2
Re: New Module "OneForAll"
« Reply #266 on: August 03, 2017, 05:48:19 PM »
Good idea, seems like the module install script also supports this method.

However, it doesn't seem very convenient approach considering future module version upgrades etc. Also, I would assume a simple option to hide/show field shouldn't be too difficult to add.

Offline Ruud

  • WebsiteBaker Org e.V.
  • **
  • Posts: 3551
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Module "OneForAll"
« Reply #267 on: August 03, 2017, 10:59:25 PM »
Good idea, seems like the module install script also supports this method.
This module was designed with this multi-use-renaming in mind. Ideal for creating your own "specials".
As long as you change the variable $module_name in info.php before uploading, both fresh installs and upgrades will be using the defined name.


Offline freeSbee

  • Posts: 1117
    • BAKERY - Website Baker shop module
Re: New Module "OneForAll"
« Reply #268 on: September 12, 2017, 06:20:30 PM »

New Version of OneForAll:

VERSION 1.0.8 (09/12/2017)


PLEASE NOTE:
After upgrading to this version and resaving an item the url of the item can be changed (droped item_id).



VERSION HISTORY
  • [upload.php] Changed require() to require_once() for file framework/functions.php (thanks to Norbert Heimsath)
  • [save_item.php] Changed require() to require_once() for file framework/functions.php (thanks to Norbert Heimsath)
  • [resize_img.php] Added better support for images taken on mobile devices using exif data 'orientation' (thanks to Ruud)
  • [save_item.php] Changed the way of item filename creation. The item_id is no longer used unless two names are identical (thanks to Ruud)
  • [save_item.php] Removed code for image handling - not concerning duplicating items! (thanks to Ruud)

KNOW HOW
Further information can be found on the first post of this thread.

DOWNLOAD
Download the zip from this download link.


Christoph

Offline astricia

  • Posts: 334
  • Gender: Female
    • netSchmiede24
Re: New Module "OneForAll"
« Reply #269 on: September 20, 2017, 11:55:05 AM »
Hi,

I was looking for a way to just extract the URL of the main image in an OFA-module, because a client isn't happy about the way the lightbox works (he wants to navigate between the lightbox images and have the title underneath the image and close them with an X button - all of which is missing in the current lightbox version of OFA). So I found this:

Just a trick that might do it for you..  8-)

Create a droplet called "geturl" with this content.
Code:
Only registered users can see contents. Please click here to Register or Login.
Wherever in your OFA output you need the image url just do:
Code:
Only registered users can see contents. Please click here to Register or Login.
The droplet will return the "href" value of the [IMAGE].

and it works perfectly for the URL of the image - but I also need the URL of the thumb to create my own lightbox setup! And if I use [[geturl?ofa=[THUMB]]], strangely enough it still gives me the URL of the picture in the image directory and not the one in the thumb directory...! Any idea anyone (apart from just manually setting a "width=200px" inside the code...)?

Thanks,
Astrid