#31 ✓resolved
Kieran P

Themes interface broken, incomplete

Reported by Kieran P | July 30th, 2008 @ 05:10 PM | in 1.1

atz writes:

Client reports: =================

Able to get to the appearances → themes → add new theme, but now after uploading it doesn’t show up. It only shows the last two I’ve uploaded. I also can’t find a “delete theme” link. I’ve deleted the zip file containing the stylesheets and images, but the theme still shows up as selectable. Is 3 themes the max it can go? Can you remove themes?

Also, when I upload the zip file after clicking “add new theme”, it sends me a message to moderate the file. If you have to have admin level access to upload the file there, why do I need to moderate a file it knows came from an admin? =================

I confirmed the lack of “delete” button and apparent cap at 3 in display.

Comments and changes to this ticket

  • Kieran P

    Kieran P July 30th, 2008 @ 05:11 PM

    walter writes:

    Hi Joe,

    There is no web interface “remove theme” mechanism implemented right now. I’ve switched that to what this attachment is about and made it an enhancement.

    There are no maximum number of themes.

    Removing the source zip file document is just that, removing the zip file, not the its expanded contents. Themes are expanded under public/themes/theme_name. The appearance form simply checks for directories under public/themes/ and then lists them as theme options.

    My guess is there is that there is a permission problem when the appearance form tries to read theme directories. Your theme that is not showing up as an option is only readable by root. Try, from the command line, changing the owner of the files to “kete” user and “kete” group. Also, you may want to shutdown your mongrel instances and restart them as the kete user, this should prevent the problem in the future. This is a known problem and is outlined to fix in ticket #195.

    If you truly want to remove the theme that is not showing up, first make sure that no basket has its theme set to it, then from the command line do “rm -rf public/themes/theme_to_remove”.

    The “If you have admin level access… why do I need to moderate a file” bit really should be split into its own ticket and marked as an enhancement. I don’t disagree that that is more logical flow, but currently the moderate admin is submissions is working as designed.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:11 PM

    atz writes:

    I split off the two issues you identify as enhancements as separate tickets.

    There is no permissions issue in the relevant directories. The files are world-readable and all owned by kete:kete.

    When I try to “Add a Theme”, according to the instructions at http://kete.net.nz/themes/topics... it should be a zip, gz or tar file. But with any of those, I get the error:

    “Content type is not acceptable. It should be a .pdf, .doc, or other document file.”

    So that’s clearly broken. Browser is Firefox 2.0.0.7.

  • Kieran P

    Kieran P July 30th, 2008 @ 05:11 PM

    walter writes:

    The content types for documents are a system setting. Via the web administrator toolbox go to reconfigure site > advanced options > documents > document content types and make sure you have the following within them:

    'application/x-gtar', 'application/x-gzip', 'application/zip', 'application/octet-stream'

    If not, add them to the setting and restart your mongrels.

    Please report back here what the result is.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:12 PM

    • Tag changed from configuration to configuration, import

    atz writes:

    The system is already configured to accept all 4 content types listed. What criteria is used to identify an uploaded file? Any reason the tarfile I attached would fail those criteria?

  • Kieran P

    Kieran P July 30th, 2008 @ 05:12 PM

    walter writes:

    Turns out this is a “application/x-tar” content type rather than “application/x-gtar” (the g is for GNU version of tar).

    So, to generally support this file type, add ‘application/x-tar” to your Document Content Types system setting. I’ve added this in trunk to the boot strap process, but you’ll need to do it by hand and restart.

    For supporting this content type for themes… since there are relatively painless ways to workaround this, I’m afraid I’m going to wait and bundle it into some general refinements of the compression/decompression that are enhancements that will take place in trunk and make it into the 1.1 release branch.

    My suggestion for right now is to take the contents and recompress it as zip file. Though this is a Windows biased format, there are utilities for most platforms that allow for creating .zip files easily.

    You mentioned that you tried also tried gz and zip files and those failed, too. Could you attach those too, please? Maybe they have alternative content types to those I listed above. Feel free to look them up and post here.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:12 PM

    atz writes:

    Added MIME types, restarted, uploaded tar file OK. It still rejects the zip file (attached).

    Approved the tar file in moderation. It shows up in:

    ./public/documents/0000/0000/0015/joe_theme.tar

    But the theme still does not display as an option. In fact it doesn’t appear to recognize it as a theme at all. Shouldn’t it have gone in public/themes? What gives?

  • Kieran P

    Kieran P July 30th, 2008 @ 05:13 PM

    atz writes:

    Note the tar file is unprocessed, even when the mongrel cluster is running as kete, and the file saved in public/documents is owned by kete:kete.

  • Kieran P

    Kieran P July 30th, 2008 @ 05:13 PM

    walter writes:

    Hi Joe,

    I downloaded that zip file and Kete decompressed it. However, it is an empty folder, so Kete rightfully won’t list it as a valid theme choice. See http://kete.net.nz/themes/ for conventions that themes MUST follow to be listed as available themes. Otherwise, they will simply be made decompressed folders under public/themes (see the separate ticket to remove themes for enhancement to clean up things).

    An important detail is that they must include theme_folder/images/sample.jpg.

    Another point, if you have previously used “make theme” or used “add a new theme” link to upload a zip/tar/gzip file, but it isn’t a valid theme, it will still persist under public/themes/ and prevent you from replacing it with a theme with the same folder name. You should delete these invalid themes from public/themes.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:13 PM

    atz writes:

    Sorry about the bad zipfile. I’ll attach the correct one, created with the built-in “Archive” utility on MacOS. It still gets rejected as an unknown MIME type (would be useful if kete gave feedback what MIME type it thought it was).

    However, none of my uploads make it into public/themes at all, so it is not there to delete. The files are something like:

    ./documents/0000/0000/0015/joe_theme.tar

    And these shouldn’t affect the upload of a new theme, as I understand it. Should I delete those from ./documents ?

  • Kieran P

    Kieran P July 30th, 2008 @ 05:13 PM

    walter writes:

    Thanks I’ll take a look at your new file.

    Until a theme is decompressed under public/themes/ it is just like any other uploaded document. Its up to you if you want to tidy up by deleting the document.

    After you created the zip archive in Mac OS X, did you then upload the zip file via a browser under Mac OS X? We have had reports of problems with zip files, but mainly being uploaded via Windows (regardless of where the file was created).

    Most of the action as far as figuring out the content type of a file is handled by a third party plugin called attachment_fu under vendor/plugins/attachment_fu. It in turn relies on what the browser tells it for what the uploaded file’s content type. The browser in turn often gets its information about the file from the OS it is run under.

    In other words, Kete can be fed bad information about the file at several points during the process. Annoying for me as a developer and annoying for end users!

    As far as reporting what the acceptable file types are for documents (and all other uploadedable items), we’re happy to accept a patch. Katipo is also willing to develop it for Kete if there is a funder.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:13 PM

    walter writes:

    Hello again,

    Yep, as I suspected. I was able to take your zip file and ‘add a new theme’ successfully from the basket preferences > appearance form in both Firefox 3 and Safari to both a Kete development server running on my machine and one running on an actual site. I suspect Windows is your culprit. Windows often will report the default “application/octet-stream” for content type on all files.

    We’re looking into a workaround for Windows broken behavior on this. Annoying

    However, these sites were both running the latest Kete trunk. So maybe it is still an issue with your 1.0 based server. Could you confirm that uploading your theme works from Mac OS X as I suspect? It should also work under a Linux based desktop system, too.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:14 PM

    atz writes:

    Actually I tried the upload w/ Firefox 2 on Mac OS 10.4.11.

  • Kieran P

    Kieran P July 30th, 2008 @ 05:14 PM

    walter writes:

    Ok, I’ll fire up the old iBook with 10.4.11 and see if I can reproduce it.

    In the meantime, if you could put this code to replace the current definition of attachment_attributes_valid? in app/models/document.rb, stop and start your server, and then tail your log while making the request that fails, that would be good:

    def attachment_attributes_valid?

    [:size, :content_type].each do |attr_name|

    enum = attachment_options[attr_name]

    unless enum.blank?

    logger.info("what is received #{attr_name}: " + send(attr_name).inspect)

    end

    errors.add attr_name, 'is not acceptable. It should be a .pdf, .doc, or other document file.' unless enum.nil? || enum.include?(send(attr_name))

    end

    end

    Post what it says in the log here.

    Cheers,

    Walter

  • Kieran P

    Kieran P July 30th, 2008 @ 05:16 PM

    • Assigned user changed from “Kete” to “Kieran P”
    • State changed from “new” to “resolved”
    • Milestone set to 1.1

    After a fair bit of testing, some new code has been put in place which should solve this issue. If you experience this problem again, please report back.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Kete was developed by Horowhenua Library Trust and Katipo Communications Ltd. to build a digital library of Horowhenua material.

People watching this ticket

Pages