This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 27 - Pages: 2 [ 1 2 | Next ] - Last Post: 01-Apr-2020 22:35 Last Post By: davidekholm Threads: [ Previous | Next ]
ctwist

Posts: 590
Registered: 27-Sep-2003
Variables needed for chaining
Posted: 16-Feb-2020 16:54
 
  Click to reply to this thread Reply
Some album objects must be displayed outside of the album (e.g. a web location where the web server prohibits cross-origin framing), so the skin does not create a slide page. If chained folders is enabled, the nextPage or previousPage variable points to a non-existent slide page, which causes a "page not found" error.

In such circumstances, the skin must override nextPage or previousPage and jump to the next slide, but it cannot do this because it does not know the target AlbumObject.

Please add variables nextAlbumObject and previousAlbumObject. For my purposes, these are only needed when iterating through slides, when chained folders is enabled.

Edited by: ctwist on 20-Feb-2020 13:49
Moved from Feature requests to Skin development
davidekholm

Posts: 3,512
Registered: 18-Oct-2002
Re: Variables needed for chaining
Posted: 18-Feb-2020 11:34   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
Could you use the currentObjects array which delivers AlbumObjects? Use
currentObjects[imageNum-1]
to index the current album object,
currentObjects[imageNum]
to index the next object and
currentObjects[imageNum-2]
to index the previous object.
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 18-Feb-2020 23:10   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
I was unaware of currentObjects, and I can't find any documentation about it. Shouldn't it be documented in "Variables / Implicit objects"?

Maybe this is what I need. I will experiment with it.
davidekholm

Posts: 3,512
Registered: 18-Oct-2002
Re: Variables needed for chaining
Posted: 19-Feb-2020 07:42   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
I was unaware of currentObjects, and I can't find any documentation about it. Shouldn't it be documented in "Variables / Implicit objects"?

Maybe this is what I need. I will experiment with it.


I guess so. I flagged it as a "cool experiment" when I introduced it so it was obviously experimental at that time, but it's been around since v10.3 so I guess it's time to make it official, given that you get along with it.
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 21-Feb-2020 23:01   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Actually, this only partially solves my problem. I can skip objects in the current folder that do not have a slide page, but if an object's nextPage points to a page in a different folder, I lose track of where I am in the folder structure, so I can't test whether or not the next object has a slide page.

If AlbumObject contained "nextObject" and "previousObject", I would be able to fix this easily, and I wouldn't need currentObjects.
davidekholm

Posts: 3,512
Registered: 18-Oct-2002
Re: Variables needed for chaining
Posted: 22-Feb-2020 15:44   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
What's wrong with testing if "next" and "previous" is not null and then do
AlbumObject nextObject = (AlbumObject)next.get("currentObject");
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 22-Feb-2020 15:59   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Ah, yes. That should work. I didn't think of that!
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 23-Feb-2020 01:18   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
I've done some more testing.

If "chained folders" is enabled, a "next slide" button may jump into a sub-folder or a parent folder. When this happens, CompiledScript.next.get("currentObject") returns null, which causes the skin to lose track of the current object. It seems that "CompiledScript.next" only iterates through the current folder. Is this intentional?

Yes I know that I should use CompiledBase; I am guessing that this would show similar behaviour.

This is not a big deal for me. I noticed a problem in one of my twisted test albums. If this is intended behaviour, I can recommend that chained folders should be avoided.

Edited by: ctwist on 24-Feb-2020 09:21
Actually, I wonder if this is a timing problem. Maybe I am accessing a variable before it has been populated.
I will think about this some more.
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 24-Feb-2020 20:41   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
I have confirmed what I thought.

At the last object in a subfolder, the "next" map is null. Similarly, at the first object in a subfolder, "previous" is null. This is true even if "chain directories" is selected. This is reasonable if not chaining, but if chaining I suggest that they should be populated.

The consequence of the current behaviour (in Mirage):

If the user is at the last image in a folder, and clicks the "next" button, this goes to the first object in the chained folder (the "nextPage" variable provides the href). If this doesn't have a slide page, a "page not found" error occurs. Since there is no "next" map for the last image, the skin cannot iterate to the first slide page in the chained folder.

More specifically, when chaining:
  • "next" is null for the last object in a subfolder, and for each object that precedes a sub-folder at the same level,
  • "previous" is null for the first object in a subfolder, and for each object that follows a sub-folder at the same level

What I would like is for next and previous to be populated in these circumstances. Is this practical?

BTW
  • My technique of using "next" to skip past objects that don't have slide pages works well. This is just 12 lines of Java code.
  • I do not use currentObjects.
jGromit

Posts: 7,808
Registered: 31-Jan-2006
Re: Variables needed for chaining
Posted: 24-Feb-2020 21:24   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
All very familiar....

https://jalbum.net/forum/thread.jspa?threadID=52069

This is one of those problems that I finally got fed up with. In seven of my eight active skins, I solve the problem with this code in init.bsh:
if(engine.isChainDirectories()) {
	meWarning("Chained directories are not supported. Setting turned off.");
	engine.setChainDirectories(false);
}
The "warning" function is just a little utility:
private void meWarning(String var) {
	String w = "<html>" + var + "</html>";
	JOptionPane.showMessageDialog(null, w, "Warning", JOptionPane.WARNING_MESSAGE);
}
I detest chained directories. They just produce confusing, "how the hell did I get here, and from where I am now, what does 'up' mean, or 'next?'" navigation. If the chaining were restricted to sibling directories, the problems might be solvable. But as it is, it's just a mess.
jGromit

Posts: 7,808
Registered: 31-Jan-2006
Re: Variables needed for chaining
Posted: 24-Feb-2020 21:32   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
On the same subject, you might well ask how I deal with chained directories in the one skin where they're allowed, Jupiter. It supports images, videos, audios, PDF's, and web locations. Each of those has a slide page except for web locations - those thumbnails take you out of the album. In skin.properties, I make sure no slide pages are generated for them:
makeWebLocationSlides=false
ETA: But lo and behold, with the right sequence of objects, I get the same error you do.

Guess which skin is going to have chained directories disabled in its next release. Do I need to give you a hint? ;)
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 24-Feb-2020 22:03   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
I don't want to disable web pages for all web locations, because in most cases they can be embedded. However, some web servers do not allow cross-origin framing (i.e. a web page cannot be embedded in an iframe in another web page on another web server). In such cases, you are shown a blank page when you open the slide page; it is not possible to automatically identify the problem and show an error message. Consequently, a custom ui variable allows the user to open specific web locations outside the album.

Anyway, if David is able to make the change that I requested, I am sure that I will have a working solution.
jGromit

Posts: 7,808
Registered: 31-Jan-2006
Re: Variables needed for chaining
Posted: 24-Feb-2020 22:54   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
I don't want to disable web pages for all web locations, because in most cases they can be embedded.

IMO, that almost always looks awful, and produces horrible navigation (e.g., when the embedded page has its own navigation). And on a smartphone, it's a mess. Just my $0.02.
ctwist

Posts: 590
Registered: 27-Sep-2003
Re: Variables needed for chaining
Posted: 25-Feb-2020 00:37   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Yes, if you want the user to walk around the website, it is usually a bad idea, but if you want to show a single page that complements the current folder, it can work well, and it is more compact than opening a separate tab.

I like to give options to the album creator. He can choose the best structure.

Just my £0.03.
jGromit

Posts: 7,808
Registered: 31-Jan-2006
Re: Variables needed for chaining
Posted: 25-Feb-2020 00:38   in response to: ctwist in response to: ctwist
 
  Click to reply to this thread Reply
ctwist wrote:
...but if you want to show a single page that complements the current folder, it can work well....

That's why the good lord gave us PDF's. ;)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums