Thread Locked This thread is locked - replies are not allowed.


This question is answered.


Permlink Replies: 13 - Pages: 1 - Last Post: 15 Mar 21, 18:03 Last Post By: ctwist Threads: [ Previous | Next ]
fnijkampnl

Posts: 4
Registered: 4-Jan-2009
Codegenerator: New or Updated Codegenerator
Posted: 5 Mar 21, 17:48
 
Hi

is there someone out there who can update the skin Codegenerator?
See attachment.

I can use it very much

Thanks a lot in advance

Grtz Frank

Edited by: fnijkampnl on 05-Mar-2021 18:28
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 5 Mar 21, 19:32   in response to: fnijkampnl in response to: fnijkampnl
 
This skin contains "old style" references to variables.

E.g. $linkToIndex should be ${linkToIndex}

You can fix this yourself. Edit index.htt and fix each variable that is referenced incorrectly.

Alternatively, run this skin in jAlbum 17 or older; these versions tolerate the obsolete variable references.

You can also delete Thumbs.db; this is a Windows system file and is not part of the skin.

If you still have problems, tell us exactly what the problem is.
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 6 Mar 21, 00:50   in response to: fnijkampnl in response to: fnijkampnl
 
I have made some minor changes:
  • added skin.properties
  • disabled widgets
  • fixed $textEncoding in index.htt

Please test it. I will then upload the new skin version.
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 6 Mar 21, 17:26   in response to: ctwist in response to: ctwist
 
There is one more restriction in the "tighter" restrictions on variables. I should have remembered this.

A Java scriptlet is enclosed in <%= java code %>. If the Java code contains a variable, there is no need to include $. In fact you must not do this. So
<ja:if test="<%= "${formattingButtons}".equals("html") %>">
should be
<ja:if test="<%= formattingButtons.equals("html") %>">
or more simply:
<ja:if test="${formattingButtons}" value="html">
I have fixed a few instances of this problem.

Please test again.

Edited by: ctwist on 06-Mar-2021 12:53
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 9 Mar 21, 01:21   in response to: fnijkampnl in response to: fnijkampnl
 
Your jap file contains the setting
skin.linkBase=https\://fnijkampnl.jalbum.net/KNMV
The skin's read-me.txt file states "1) create an Album containing the pictures you would like to post. No sub folders please."

However, you have sub-folders.

Can't you set "Path to album" to
https://fnijkampnl.jalbum.net/KNMV/Help%20Bericht%20Aanmaken
This should work correctly. If you have multiple subfolders, run it once for each subfolder.

I really don't want to modify this skin to support subfolders, especially since there is a simple workaround. There is probably a very good reason why subfolders are not allowed, although I don't know what it is yet.
fnijkampnl

Posts: 4
Registered: 4-Jan-2009
Re: Codegenerator: New or Updated Codegenerator
Posted: 9 Mar 21, 15:35   in response to: ctwist in response to: ctwist
 
Hi,

Yes I've seen that request of not having subfolders at the beginning of using this skin, a decade ago.

But it is working. So why not use it I wonder.

So you don't have to modify the skin for this.

For public use just remove this comment and make sure the space in a subfolders name are replaced by %20

Meanwhile I replace them with underscores
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 9 Mar 21, 19:15   in response to: fnijkampnl in response to: fnijkampnl
 
fnijkampnl wrote:
And could you change this also
BBC [URL]...[/url]  should be  [A href=...]texttext[/a]
BBC [IMG]...[/img]  should be [img src=... style="max-width:100%;"]
I don't understand the skin well enough to make this change. This change may help you, but cause problems for other users.
Of course you can apply this change to your downloaded skin.
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 9 Mar 21, 19:24   in response to: ctwist in response to: ctwist
 
I have pruned this thread and deleted all obsolete attachments.

Final changes:
  • "Rows" is automatically set to 0 (in case the user changes it from its default value).
  • The documentation is updated.
A new version of this skin is available at https://jalbum.net/en/skins/skin/CodeGenerator

The "minimum version of jAlbum" for this skin is 7. I don't know whether or not this is correct. If the updated skin doesn't work with your version of jAlbum, you should continue to use the previous version 1.1.2. Version 1.1.3 is required for jAlbum 17 and later.
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 10 Mar 21, 00:51   in response to: ctwist in response to: ctwist
 
I just noticed that the release notes for the previous version 1.1.2 contains "sub folders supported". However, "read-me.txt" has not been updated, so it incorrectly says that sub-folders are not supported.

One of the reported problems in this thread is that sub-folder names containing spaces are not handled correctly. I am not going to release an updated version of the skin, but you can fix it yourself.

Edit index.txt.
Line 22 contains:
%>
Add this line above it:
relativePath = IO.urlEncode(relativePath);
Only do this if the URL is not already encoded, otherwise the URL will be corrupt (I don't know whether or not the URL could be already encoded).
JeffTucker

Posts: 8,490
Registered: 31-Jan-2006
Re: Codegenerator: New or Updated Codegenerator
Posted: 10 Mar 21, 01:14   in response to: ctwist in response to: ctwist
 
ctwist wrote:
Only do this if the URL is not already encoded, otherwise the URL will be corrupt (I don't know whether or not the URL could be already encoded).

I faced this conundrum in my own skins - if you encode a URL that has already been encoded, you end up with double encoding. In short, a mess. My brute-force solution? I just assume that any URL that contains a percent sign has already been encoded:
private String doEncoding(String s) {
	if(s == null || s.trim().equals("")) return null;
	if(!s.contains("%")) {
		s = IO.urlEncode(s.trim());
		return s.replaceAll("%3D", "=").replaceAll("%3F", "?").replaceAll("%23", "#");
	}
	return s;
}
ETA: The "replaceAll's" are there to take care of query strings. Not an issue in this skin, so the routine could be shortened to:
private String doEncoding(String s) {
	if(s == null || s.trim().equals("")) return null;
	if(!s.contains("%")) s = IO.urlEncode(s.trim());
	return s;
}
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 10 Mar 21, 01:29   in response to: JeffTucker in response to: JeffTucker
 
So the equiivalent change in this skin would be to add this before line 22:
if (!relativePath.contains("%")) relativePath = IO.urlEncode(relativePath);
I considered doing this, but I was unsure whether or not it would always work correctly. Since you have tested this technique, it should be safe.

Another option would be to decode the URL and then encode it; again I wasn't sure whether or not this would always work. I didn't want to get into a lot of research and testing for something so trivial.
JeffTucker

Posts: 8,490
Registered: 31-Jan-2006
Re: Codegenerator: New or Updated Codegenerator
Posted: 10 Mar 21, 01:39   in response to: ctwist in response to: ctwist
Correct
Yeah, that should be safe in about 99.9% of cases (I do the trimming and nulling because of the way I use the adjusted variables later - I don't want a URL that's just three empty spaces, and testing for null later is simpler than testing for null or empty string). Anyone who's doing anything weird that trips up the routine has only himself to blame.

(BTW, I haven't delved into this, but the OP's suggested changes to the BBCode don't appear to be valid BBCode.)
fnijkampnl

Posts: 4
Registered: 4-Jan-2009
Re: Codegenerator: New or Updated Codegenerator
Posted: 12 Mar 21, 23:45   in response to: JeffTucker in response to: JeffTucker
 
Hi,

thanks guys. It's working great. Now also for sub-folders.
In the attachment version 1.1.4
ctwist

Posts: 422
Registered: 27-Sep-2003
Re: Codegenerator: New or Updated Codegenerator
Posted: 15 Mar 21, 18:03   in response to: fnijkampnl in response to: fnijkampnl
 
Version 1.1.4 is available at https://jalbum.net/en/skins/skin/CodeGenerator.

This encodes sub-folder URLs.

I have changed the minimum jAlbum version from 7 to 9.6.1. I tested it with this version. It may work with earlier versions, but there is no reason to verify this; nobody should be using an older version.
Legend
Forum admins
Helpful Answer
Correct Answer

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