Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2017-12-24 00:30:19

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,677
Website

Re: Hello Themes!

Bloke wrote #308417:

In retrospect, I can’t see any reason to forbid upper case characters, given that we permit them when saving in the UI. If we were making Txp class or function names out of the names, then we would have to forbid numbers in the first character, but I don’t think any file system has this restriction, so we should be okay to lift this.

I’m not aware of any file system that has issues with valid UTF8 characters. The only character that macOS disallows in a filename is the column : (it is treated as path separator internally). I think some UNIX variants had the same restriction. Not sure about Windows OS.

At the moment, when saving an asset in the UI, we only forbid < > & " ' characters. I think we should continue this (for backwards compatibility) but also perform a secondary check to see if it’s likely to fail an export too. And in that case, issue a warning on save.

Yes, warning people about the issue when saving an asset will probably be a good thing – form names written with CJK characters or emoji?

Your new regex works fine for me now. Assets with an uppercase character or starting with a digit export correctly.

Offline

#12 2017-12-24 03:52:29

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,677
Website

Re: Hello Themes!

A minor issue I encountered, after messing a little with form names (CJK characters, :,…), and then deleting those forms.

From the Themes panel, select the theme and using the multi-edit widget, chose “duplicate”.

Warning "Invalid argument supplied for foreach()"
in /Users/username/Sites/_txp472/textpattern/vendors/Textpattern/Skin/AssetBase.php at line 347.

The theme duplicated correctly (green message box) and nothing was missing. and yeah, it is a warning.

Note also, duplicating that copy worked perfectly.

Offline

#13 2017-12-24 12:12:33

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: Hello Themes!

With the latest version, and the patch of Stef, I was able to export my default theme, without more errors.

I have two questions:

  1. What is the “remove_extra_templates” option for?
  2. For me a theme is also sections (listed in the skin grid but not exported – why not in the json file -) and plugins, with their installation and settings. Many plugins are called from forms and pages. Is this planned / possible?

Sed-cleaner had a fully configurable companion file cleaner.php which allowed the installation of a series of indispensable plugins …

Last edited by jpdupont (2017-12-24 12:25:18)

Offline

#14 2017-12-24 16:52:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Hello Themes!

phiw13 wrote #308422:

A minor issue I encountered, after messing a little with form names (CJK characters, :,…), and then deleting those forms.

Thanks for the report. Where would we be without your awesome diligence!

Will play with this. At the moment the regex that finds files and checks if things are “valid” is a standard ASCII regex. I think this should be changed to a Unicode-aware regex using p{L} and things like that. That’s probably fairly easy but I’m not sure how mb_strlen() works in tandem with it.

For example, write a loooong filename (>63 chars) containing some multi-byte characters, sanitize the string using the Unicode regex, then truncate them using mb_strlen() to 63 characters and try to store the result in the MySQL table with its name field set to a max of 63 ‘chars’. What’ll happen? Could it get chopped off mid-byte in the last character? Will it try to store ‘more’ characters than there is space in the column? I’m not sure.

jpdupont wrote #308424:

With the latest version… I was able to export my default theme, without more errors.

Excellent.

What is the “remove_extra_templates” option for?

It deletes all assets first before the operation. So if there are any left over from a previous import (into the DB) or export (out to the filesystem) they will be deleted before the operation so the action is “clean”.

For me a theme is also sections

We’re probably going to call that a “Template”. See this post by Bert for an example of what we may be able to bring in future.

For now, it’s too risky to start automatically adding and removing Sections that may or may not already exist in a person’s Txp. And too much work (for now) to write an import/export wizard so people can choose which things to bring in and which to leave out. So we’ve gone very very basic and taken the least destructive path to fruition.

And this way, you get to preview your theme without anyone knowing about it before making it live, which is very useful to people who make incremental or step changes to a live site, as it means you don’t need to worry about making a staging environment and faff with syncing databases on go-live.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#15 2017-12-25 09:27:03

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,677
Website

Re: Hello Themes!

So, a couple of weird things I experienced yesterday:

Prelude: updating a live site from TXP 4.6 to TXP 4.7dev – server: Dreamhost + PHP 5.6

step 1: verify health site, set it to maintenance mode (smd_at_work). OK
step 2: upload the whole package of files + the ‘version_up’ theme folder (have to use the new toys! Thanks Oleg for evaluate and more).
step 3 update PHP to v7.1 (DH control panel). Then, update a couple of extensions.
step 4 Import new theme, verify that all new pages / forms work OK – done.

Flip the switch on the sections panel (that is actually a bit of work…) (and we’re still in maintenance mode) Everything should now use the new theme, right?

Out of curiosity, a check with Firefox – it shows the error_503 page as expected, BUT with a weirdness (at least to me): it uses the error_503 page template from the old theme, with the forms from the new theme (2 calls with <txp::output_form />). But checking in Safari all pages appear to use the new page templates. Some use different names from the old ones, some have the same name (ditto for form names); perhaps that is not a great idea.

Turn off maintenance mode.

Now for some more weirdness, part of which is user error, I think, and part I don’t know. Something might be related to my previous comment .

Back to the Themes panel, where I have 2 two themes: “default” and “new_theme”. First thing I open the “default” theme in the edit panel and change all fields. Here I made a maybe typo. For version I specified v1.1 – note the “v“. I think this confused the system. When saving I got this message (but all data was correctly displayed –as I had edited– in the table):

!https://dev.l-c-n.com/_b/helpfull.png!

From this point on I could not edit that theme metadata anymore. Creating a copy failed as well. I tried exporting the theme, but that failed as well. Here is probably a user error, in that, when uploading all the files (“step 2” above), I set the permissions for the new_theme, but not on the parent themes folder (DH requires 777). Part of my export attempts woos probably stem from this, in that TXP apparently managed to create the old_theme folder + lock folder but could not do anything more. And having that lock folder caused some editing weirdness? But that is a guess, as at no point did TXP tell why the export failed (TXP was in testing mode, perhaps debug mode would have more verbose).

I fixed it… With Transmit I deleted the old_theme folder, then verified the permissions on the parent themes folder. But still no editing of that theme. I accessed the DB directly (Sequel Pro) and changed that version field. Editing was now possible, but not duplicating. Finally, I changed the name of some of the pages and forms that had capital letters to use only lowercase letters. That fixed it all. Exporting + duplicating worked as expected.

After all that I deleted the old_theme (all I wanted is keep it as a back up locally).

PS – Do I love to break beta software?

Offline

#16 2017-12-25 15:04:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Hello Themes!

Ah, regarding the 503 thing, I think Txp’s die handling tag probably needs changing to pick up the theme in use. Oversight on my part. Will try and fix.

The only issue is that the skin is tied to a Section but when a page is missing (for example) or issues another error page, there may not be a Section (as such). So how would we know which skin to check? We can fallback on ‘default’ for sure, but it should (at very least) use the skin_editing pref and pull the skin details from there so admins will see the correct error pages from their last-used skin. But I’m not sure what to do about the rest of the user base under general error conditions. Anyone just typing a bogus URL in needs to be directed to one of the error pages. e.g. Typing https://example.org/ytqwukklk into a browser that uses section/id/title permlink scheme: which skin would we use to return the error page?

As for the other thing, there’s probably an assumption made that the version is just numbers in the meta data. We need to sanitize that if it’s not done already. If it’s not that I’ll replicate your situation and figure out what’s going on.

Love having you around to highlight and help fix all this stuff. Textpattern would be far poorer without you, thanks.

Last edited by Bloke (2017-12-25 15:21:05)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#17 2017-12-26 09:16:49

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,268
Website

Re: Hello Themes!

Here is a strange behavior.
Starting with a fresh installation (latest 4.7-dev) and choosen the option “empty theme” (two indispensables page templates only: “default” and “error_default”), I can’t render any errors page: I’ve got a blank page without any HTML markup (even if I inject the content keeping from the ‘default’ website model).
Note: this seems not occurs if we choose a ‘normal’ installation with the ‘default’ website model and create a theme over it.

Last edited by Pat64 (2017-12-26 09:26:07)


Patrick.

Github | CodePen | Simplr theme | Wait Me a maintenance theme

Offline

#18 2017-12-26 09:34:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Hello Themes!

Pat64 wrote #308429:

I can’t render any errors page

Same issue as phiw13 raised above I think. We need to find a way to handle error pages from a theme somehow.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#19 2017-12-26 10:32:10

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,268
Website

Re: Hello Themes!

Fine.
Otherwise, themes support is super cool (and new tags very useful) ;)


Patrick.

Github | CodePen | Simplr theme | Wait Me a maintenance theme

Offline

#20 2017-12-26 17:10:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: Hello Themes!

Should have fixed the error page scenario now. Please test.

Will do some more investigation into sanitizing the page/form names.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB