Closed (fixed)
Project:
Skinr
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2011 at 23:24 UTC
Updated:
10 Jul 2011 at 21:57 UTC
Jump to comment: Most recent file
An enabled status makes skins available to the end-user configuring the look of their site.
Setting the status of a skin per theme is currently only possible in the skin plugin (in code).
We currently have a UI at admin/appearance/skinr/skins (which is broken) that allows an admin to override the status settings from the skin plugin.
The question is whether we really need it, considering you could enable or disable the module containing the skin.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | patch_commit_ae80c19ecccb.patch | 24.06 KB | moonray |
| #27 | skinr-override-status-1050472-27.patch | 24.06 KB | coltrane |
| #27 | skinr-ui-disable-confirm.jpg | 37.43 KB | coltrane |
| #27 | skinr-ui-disable-confirm-after.jpg | 16.8 KB | coltrane |
| #25 | patch_commit_a0ec9899c827.patch | 23.97 KB | moonray |
Comments
Comment #1
moonray commentedSome previous discussion (and some code) is available in #977118: Skins in disabled basetheme cannot be enabled for basetheme (to appear in subtheme) in comments #23 through #26.
Comment #2
moonray commentedHere's an argument for having this functionality:
A module or theme will usually have a multitude of skins. Enabling/disabling the module or theme will also enable/disable every skin, not allowing you to fine-tune your selection of skins. This means you'd have to have separate modules for related skins that conflict with each other. An example of this is 960 grid system where you can have 12, 16, or 24 column layouts which you might not all want enabled at the same time.
Comment #3
ChrisBryant commentedI think it's important to be able to disable skins, as we had it before, due to the same reason you mention. Disabling the module or theme providing it wouldn't be sufficient.
Ideally access to enabling and disabling skins should also be able to be controlled by a specific permission for it.
Comment #4
jacineAgreed.
I would like to stop allowing edits of all enabled themes at the same time, but that's really a separate issue.
So, what do we need to do to fix this?
Comment #5
jacineWe already have different permissions for configuring skin settings vs. administering skinr. Anything else would be overkill IMO.
Comment #6
ChrisBryant commented@jacine, makes sense and fine with me. :-)
Comment #7
sunx-posting:
I understand. However, manual administration/management of skin statuses is a much larger topic, which we need to discuss in detail in a separate issue. Based on the current code, it seems like that information was previously stored in the database. Technically, this information rather belongs into a system variable — unless we are going to revamp the entire handling of skin information to be stored in the database, too (i.e., a
{skinr_info}table that'd be similar to the{system}table, tracking what exists, information and API versions, status, etc); but as of now, I don't really see a need for this yet, and TBH, if you ever dealt with bug reports and issues related to that {system} table behavior, you'd be similarly hesitant of forking/using that pattern. In the end, there's a lot to discuss with regard to manual configuration of skin statuses, and most likely also plenty of expectations (which might have changed?).Comment #8
moonray commentedLet me try and sum up expectations:
Comment #9
coltraneIn order to satisfy the order you provide moonray would the user-applied status override default status in the skin object? Otherwise there needs to be another property that is checked when applying.
Comment #10
moonray commentedDefault status already gets overridden by status in existing code. We just need to add user-configurable (through admin ui) status overrides.
Comment #11
coltraneHere's the start of this, it allows the admin/appearance/skinr/skins screen to save Skin statuses to skinr_skinsets table, and correctly loads the saved status with a new skinr.module function
skinr_get_skin_statuses().The next step, assuming this approach is correct, would be to invoke skinr_get_skin_statuses() in skinr_preprocess() I think. But I'm not sure what skinr_skin_extract() is about and where the best place to check if the skin is enabled.
Also, I've seen discussion about the table skinr_skinsets. It seems the agreement is to handle the renaming of the tables (if at all) in another issue.
Comment #12
moonray commented@coltrane: I'm sorry you had to do all this work for nothing. I had already contributed a similar patch in comment #22 of issue #977118: Skins in disabled basetheme cannot be enabled for basetheme (to appear in subtheme) (see post #1 in this issue). I'll repost what was discussed in the other thread to hopefully avoid further issues.
sun: @moonray: Sorry, but that's the exact opposite of where we need to go; this logic does not belong into the skin processing code. Skin info handling has to be entirely decoupled from actual skin configuration. In other words: We have two APIs - one for registering and handling skin information (and only that), and second and separate one for loading/saving/applying skins ("skin configuration objects" if you will).
moonray: The ability to set the status of a skin (from plugin info, not an applied skin) has nothing to do with the ability to apply skins. I don't see how that needs to be separated.
sun: I understand. However, manual administration/management of skin statuses is a much larger topic, which we need to discuss in detail in a separate issue. Based on the current code, it seems like that information was previously stored in the database. Technically, this information rather belongs into a system variable — unless we are going to revamp the entire handling of skin information to be stored in the database, too (i.e., a {skinr_info} table that'd be similar to the {system} table, tracking what exists, information and API versions, status, etc); but as of now, I don't really see a need for this yet, and TBH, if you ever dealt with bug reports and issues related to that {system} table behavior, you'd be similarly hesitant of forking/using that pattern. In the end, there's a lot to discuss with regard to manual configuration of skin statuses, and most likely also plenty of expectations (which might have changed?).
(emphasis mine)
Comment #13
sunskinr_preprocess() is the heart and performance-critical part of the runtime logic. In there, we only deal with applying configured skins, and nothing else. If a skin has been configured, and later on disabled, then we will still apply it. The administrative UI needs to disallow disabling of skins for which configuration exists.
Comment #14
aquariumtap commented@coltrane - I started to build out this patch as well. This is a hard project to jump into! And this seems like a natural starting point. The "enabled" checkbox in the admin UI is a manual override to the skin info's "default status". That default status itself has a default --- disabled --- which was chosen to encourage site administers to only enable the skins they intend to use, to avoid end-user UI clutter. Right now, unless someone is aware of this "default status" property, they'll never get to the point of fully registering a new skin.
skinr_preprocess() is the heart and performance-critical part of the runtime logic. In there, we only deal with applying configured skins, and nothing else. If a skin has been configured, and later on disabled, then we will still apply it.That makes sense to me, but where should this go? What function is responsible for listing out applicable skins to the end (administrative) user?
System variables are only name/value pairs, and the values are json encrypted. It would not allow us to write a query to gather a list of enabled skins, for example -- unless that is exactly the data stored in the json-encrypted object. What benefits would come from using the variables table?
Either way, moving from
{skinr_skinsets}to{variable}for storage seems fairly easy at this point. As for the bigger consideration that would require lots of discussion, using a more robust structure like {system}: is there a need for storing multiple skinr data formats (i.e., from different API versions) in the same table? Unless there's a strong case for that, it'd be great to move forward with this patch as-is.Comment #15
moonray commentedI found that we're going to need more granular control over skin configuration; we need to be able to easily disable skin configurations that contains skins that get disabled. Hence #1082842: Update storage of skin configurations to give more granular control.
Once that's in we can get my patch (which I've almost completed) posted and tested.
Comment #16
moonray commentedThis patch, commit a51b62f7c45c89a7bd19ccdf748f613129cab4b1 on github, depends on #1082842: Update storage of skin configurations to give more granular control, but I thought I'd share it anyway since git makes things so much more flexible.
Obviously we should review, tweak and commit the patch this one depends on first, but I felt we need to move things along and get Skinr to a fully usable state as soon as possible.
So, the above kept in mind, feel free to leave your feedback on my proposed approach.
Comment #17
rickmanelius commentedHey Everyone,
I definitely understand the need for granularity. Hashing out some ideas on paper, let me put this out there.
Sun mentioned here http://drupal.org/node/1029058#comment-4014070
The need for "one theme, one theme hook, and one skin".
Moonray posted a suggestion here http://drupal.org/node/1050472#comment-4048414
Stating the need for a default status, per theme status, and then user status.
Moonray also gave an example of a situation where many skins may become available but they might not be relevant
http://drupal.org/node/1050472#comment-4044918
So why not have a skin install settings menu (see attached)
This could provide a default enable skinset and enable skin option per theme. And even a default setting for new
themes. This would essentially control the default toggles for these urls
admin/build/skinr/skins
admin/build/skinr/skins/settings/tables
Now if a theme or module creates a skin that it NEEDS but the system is set to NOT ENABLE it by default, send a system warning saying this module needs it to be enabled.
Lastly, for situations where there is a conflict. Perhaps a skinset (particularly in a theme or module) defines a new default tag so that if one has both the skinset and the skins enabled by default for a theme, that only one or one set of the initial skins are enabled per toggled theme.
Thoughts?
Comment #18
coltrane@rickman, I'm not seeing how that's better/different than the current UI, except that the current one lives within admin/appearance
Comment #19
moonray commentedRerolled patch now that #1082842: Update storage of skin configurations to give more granular control has been committed.
To reiterate:
Comment #20
coltranePatch works well!
Minor issues:
1. skinr_ui_skin_status_set() is defined in skinr_ui.module but the menu definition loads skinr_ui.admin.inc, so I think the definition could be moved over to it
Questions:
2. There's little UI change when you enable/disable a Skin's configuration status, perhaps a drupal_set_message() in skinr_ui_skin_status_set() would be good?
3. Is this patch/functionality suppose to touch the appearance of the widget settings form? For example, with a Skin's element disabled on admin/appearance/skinr the form for it still appears (with it's default value set) and when saved it re-enables the element. Is that suppose to be? If not that's fine, if so I'd like to talk about the UX of it. A status of disabled (IMO) implies the form wouldn't be available.
4. The skin configuration enable/disable URL is susceptible to a CSRF attack, though there's little value for an attacker to exploit it. Does it seem worth it to you to tokenize those URLs?
5. Additionally, the enable/disable URL could be one menu router definition, admin/appearance/skinr/toggle/%skinr_skin which would just flip the status of the requested skin. Seem worth it?
Attached patch does items (1), (2), and (5).
Comment #21
coltrane#20 was wrong patch actually. This patch implements items 1, 2, and 5 of what's discussed in #20
Comment #22
moonray commentedThe reason I put skinr_ui_skin_status_set() in the main module file is that it's an API function that could be used without the admin interface. Think of CTools export in the future, for instance.You were actually right on this one.Comment #23
moonray commentedThoughts?
Comment #24
jacineRegarding tokenizing the URLs, I think it'd be worth it. It would be strange to only be able to toggle these settings via bulk updating. Having the "actions" listed next to each skin seems to be standard UI practice anyway.
Comment #25
moonray commentedAnd now we have tokenized URLs for enable/disable links.
That should wrap up any issues.
Please test and set to RTBC. :)
Comment #26
moonray commentedTests need to account for tokenized URLs.
Comment #27
coltraneStill works great, leaving as CNW for the tests though per #26
One change I'd recommend is the text on the confirmation form when you disable skin sets for an entire theme, I found it pretty confusing. I propose changing
to
Attached patch with the change, or here is the relevant code (note that
$themes = list_themes();can be removed from later in the fn)Comment #28
moonray commentedChanges from #27 are incorporated (thanks @coltrane) and the tests now work again.
Comment #29
g76 commentedsubscribe
Comment #30
moonray commentedCommitted this.
Any problems, file a bug report. :)
Comment #32
CharlieCastle commentedCan someone please tell a newbie how to apply a .patch?
I've got the problem discussed in this tread but don't know how to fix it.
I did a bit of googling and found http://drupal.org/node/60108 which may have the needed information.
But I get an access denied on that page. Why?
Comment #33
rickmanelius commented@CharlieCastle Here's an example of how to apply a patch: http://data.agaric.com/how-apply-patch-drupal-module