Textpattern Forum

You are not logged in. Register | Login | Help

#91 2010-02-10 09:04:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,936
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

thebombsite wrote:

will not import Bzip and when I try it still reports “Installation successful”.

Dang, must have missed a function call that it requires. Thought I’d caught them all. Thanks for the feedback, I’ll trawl the code a bit harder (and test that bit on XAMPP if I can next time!)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#92 2010-02-10 15:24:36

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

Well I can easily test on thebombsite. Just install a new version and away I go. As I say I can export a Bzip file no problem so I obviously have access to that side of the function, just can’t import it back again. I wonder if that is confusing the plugin.

I did a bit of a check on the exported file by unzipping it (twice because it has to go through the tar format) then re-zipping it again but in .zip format and importing that file. It imported fine and when I switched themes to use it everything was hunky-dory. This suggests to my uncomplicated mind that there was no file corruption getting in the way.


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#93 2010-02-10 19:31:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,936
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

thebombsite wrote:

I can export a Bzip file no problem… just can’t import it back again.

Thanks for your extra diagnostics. Good to know the bzip export is definitely working.

Just took a more detailed lookie in the plugin. I had made a small oversight insofar as I thought the import was using bzdecompress()… but that was in the new library — and I’m not actually using that part of it. So I went through the existing library and it seems it first uses bzopen() and then a standard tar decompression routine to extract the files inside. If tar works (which it does) then the only difference it seems is bzopen().

My “import” checker just tests for the existence of bzdecompress() — it should instead check for bzopen(). BUT the “export” routine checks for bzopen() and a host of other ‘bz’ functions, and not only reports success it can also export fine. Therefore I’m betting it’s actually something deeper in the bzip decompression routine that’s going sideways and not merely the existence of the required functions that’s fouling things up.

Please would you e-mail me a bzipped theme, and EDIT: Scratch that, can you try something for me please — I can’t test it on xampp for some reason, but I have found a warning message issued by PHP. Visit line 2337 of the plugin. It should read:

return @bzopen($this->options['name'], "rb");

Change it to:

return bzopen($this->options['name'], "r");

i.e. remove the ‘at’ sign and also the binary flag, which my version of PHP is complaining about. See if that makes any difference. If it fails for some reason you shold now see an error message so we can at least see if it’s that.

I’ll see if I can find a way of setting up a local environment here that will accept them and run the bzimport routine in debug mode to track down why that particular portion fails. It might be a bug in the guy’s library (in which case I’ll either fix it or try and use the other library for decompression of bzips!) or it could be some weird permissions thing in that type of file that’s preventing extraction…. that’s a long shot though as it uses the same tar functions as gzip for decompression and that works fine on your system… very curious.

Sorry for the false start, and thanks for your continued patience while I iron this odd one out.

Last edited by Bloke (2010-02-10 20:13:09)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#94 2010-02-10 22:00:26

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

Still the same result Stef.

OT – but whilst I’m thinking about it, cuz you look after Plugin Composer now don’t you? It might be handy if we could have line numbers. Is that possible?

Last edited by thebombsite (2010-02-10 22:02:32)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#95 2010-02-11 15:15:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,936
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

thebombsite wrote:

Still the same result Stef.

Working on it. Might not be able to look at it in more detail until after the weekend though. ‘tis a puzzler for sure.

It might be handy if we could have line numbers. Is that possible?

OT: Not really, unless you install a syntax highlighter (there are loads out there). But a poor-man’s version of a line number assistant has popped in for a chat


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#96 2010-02-12 19:37:44

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

Bloke wrote:

OT: Not really, unless you install a syntax highlighter (there are loads out there). But a poor-man’s version of a line number assistant has popped in for a chat

That works nicely thanks. Now you can throw line numbers at me all day. ;)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#97 2010-02-15 21:43:02

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

How can I rename a theme? And/or what’s my best option if I’ve made edits to an existing theme but now want to give my version a new name and keep the original version around with its original name?

Forgive me if this was answered already (if so, I couldn’t find it).

Offline

#98 2010-02-15 22:33:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,936
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

floodfish wrote:

How can I rename a theme?

Currently it’s a bit involved. Make sure the theme you are intending to rename is not being used, then either:

  1. Export the theme to a zip file
  2. Extract it to your hard drive
  3. Rename the base directory to your_new_theme
  4. Rename the php file to your_new_theme.php
  5. Edit the PHP file and alter class your_old_theme extends classic_theme to class your_new_theme extends classic_theme
  6. Edit the manifest() information as well to suit
  7. Save the changes, rezip the archive from the main directory downward, and upload it via smd_admin_theme’s interface
  8. Delete the old theme from the interface any time after you’ve exported it

OR

  1. Click [Base] of the theme you want to rename (or [Create new theme])
  2. Enter the name of the renamed theme
  3. [Edit] the original, copy the old PHP file contents, switch to the new theme and paste it into the PHP file
  4. Alter the line class your_old_theme extends classic_theme to class your_new_theme extends classic_theme
  5. Save the changes
  6. Copy over the CSS file and upload any graphics again
  7. Delete the old theme at will

You can rename the theme’s PHP file in the [Edit] window but it doesn’t keep the directory name in sync. I think that’s perhaps a plugin failure, and a feature I should add so that if you rename a PHP file it automatically renames the base directory if it can. Hmmm.

I used to have a [Clone] option which would have been useful to you here, but it got sidelined when wet made the theme mechanism class-based. If the auto rename I mentioned above doesn’t work, I suppose I could find some way to [Rename] themes. It’s a bit involved because I have to essentially do parts of the above techniques in code, but it’s probably nothing a few regexes and some skulduggery can’t handle.

Leave it with me and I’ll see what I can do.

Last edited by Bloke (2010-02-15 23:11:57)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#99 2010-02-16 00:53:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,936
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

Scratch my previous post, floodfish. Install v0.22, [Edit] the theme of your choice and before you save the core theme’s PHP file, just alter its name in the upper box. It’ll rename the theme folder as well to keep things in step (thanks for spotting that). Note that it will not change the contents of the PHP file itself so it’s your responsibility to keep the class your_theme extends classic_theme line in sync with the current theme’s folder name. A small price to pay considering this version makes renaming a theme a one-stop process instead of a convoluted series of 7 or 8 steps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#100 2010-02-16 06:08:45

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: smd_admin_themes: Manage, edit, switch and share admin-side themes

Seems to have worked great! Thanks!

Offline

Board footer

Powered by FluxBB