display of privacy values?

yoyoman - February 11, 2008 - 22:45
Project:CCK Field Privacy
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:obsidiandesign
Status:postponed (maintainer needs more info)
Description

Does the form ever display the privacy setting for the field, or will the user have to click the padlock to see the privacy setting?

#1

obsidiandesign - February 12, 2008 - 01:01

Currently, the setting is only displayed if the user clicks on the padlock icon. I guess the idea of also displaying the current setting on the form itself didn't come up during initial development.

#2

mikesmullin - February 12, 2008 - 01:53

@yoyoman: What is your use case for that? How do you envision the privacy setting being displayed other than the way it is now?

#3

yoyoman - February 12, 2008 - 18:48

Assuming my installation is working properly, whenever I get to a screen where I can edit data, I see a padlock next to the field label. It would be nice to see the privacy settings of the various fields w/o having to click on each padlock.

#4

yoyoman - February 13, 2008 - 00:01

Showing the privacy values is probably beyond the development of this module since people probably are going to have different layouts for their forms. I am getting something useful with something like this l
switch(radio.val()) {
case "e": $("#" + field_name + "_visible").text("everyone"); break;
case "b": $("#" + field_name + "_visible").text("buddies"); break;
case "n": $("#" + field_name + "_visible").text("nobody"); break;
}
In this case, I have a that will show the privacy setting. I added this after line 49 of the .js file after jQuery posts the value to the file for saving. I didn't know how to grab the label value of each radio button, so this is the best I could do ... If we gave the label a "for" value or the input an "id" value, would I be able to grab that value based on the jquery "radio" value?

#5

bomarmonk - February 26, 2008 - 15:58

I have an idea: simply have two icons. One is an unlocked padlock (the one we already have), and the other is a locked padlock. The unlocked padlock would have two colors (green for "everyone, blue for "buddylist," for example). The locked padlock would show that nobody could see the field (with the exception of the user). I think that would work and would make sense within the scope of this module's basic functionality and usability (easy for me to say, since I have only tested and do not code). Thanks for the great module!

#6

yoyoman - February 26, 2008 - 19:08

I've gone the route of having 3 colors: red - only the user, orange - buddies, green - everyone. Right now, I have that to the right of the data values, but I was actually considering 3 colored padlocks with the initial color being red.

#7

obsidiandesign - February 26, 2008 - 21:13
Version:5.x-1.x-dev» 5.x-2.x-dev
Assigned to:Anonymous» obsidiandesign

I like the idea - I'll see what can be added to the 2.x version.

@yoyoman - do you have this coded in already (colored padlocks), or is it just text?

#8

yoyoman - February 26, 2008 - 21:31
Version:5.x-2.x-dev» 5.x-1.x-dev

right now it's just colored text, however, the text does change as the radio button is selected and the small window goes away. That text could easily be replaced with the HTML for an image. It would be nice if I could replace the original padlock with a colored version.

#9

obsidiandesign - November 19, 2008 - 04:14
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:active» needs work

I've created a 6.x patch that shows a colored padlock (red/yellow/green) based on the color. The outstanding issue at the moment is how to change the icon (do we need to?) when the user selects a privacy option in the jquery window. Can it wait until the user refreshes the page, or is the expectation (from a user standpoint) that the icon would change too?

Please test out the patch in terms of the basic functionality (colored icons on page load & refresh). I'll backport when things are worked out.

AttachmentSize
cck_field_privacy.module.colored_padlocks.patch 3.13 KB
padlock_green.png 47.47 KB
padlock_red.png 47.12 KB
padlock_yellow.png 47.12 KB

#10

sethcohn - November 24, 2008 - 20:08

actually, the patch applies nicely to 5.x-1.3, and works well. +1

I'd adjust the padlock images a bit (the colored dots are too subtle a difference.. Maybe Open (no lock, eyeball?) (green), Locked (red) and Partial Open (current lock image) (yellow)

#11

obsidiandesign - November 24, 2008 - 22:31

@sethcohn - thanks for the heads up about it applying to 5.x. I agree that different padlocks may work better, but I have the artistic skills of a 2-year-old. I'll see if my partner can whip something up tonight, if not, is there a volunteer?

#12

obsidiandesign - November 25, 2008 - 03:04

Here are three new icons, following sethcohn's ideas in #10. Will these work better? If so, I'll recode the patch to use them.

Bryan

AttachmentSize
padlock.png 46.26 KB
padlock-closed.png 46.69 KB
padlock-open.png 46.62 KB

#13

bensemmel - November 26, 2008 - 20:20

Hi Bryan,

tested the patch with the new padlock files (Changed the file names in the patch) and it worked. Anyway I think I like more the coloured padlock approach...

Thanks and regards,

Ben

#14

obsidiandesign - November 27, 2008 - 02:11

Would it be a good idea to just setup the names like:
padlock-none
padlock-medium
padlock-locked
and allow users to download different sets of icons (or switch out via the admin panel or something)? Is that necessary? I'm noticing already a difference in opinion, just based on a couple people.

#15

sethcohn - December 1, 2008 - 16:18

I agree that loading different sets of images makes sense (and would allow customized theming that way... similar to fivestar, for example) A bit more work, but guaranteed to please everyone.

#16

obsidiandesign - December 6, 2008 - 21:58

I've redone the patch to include the option of (1) colored icons (2) white icons and (3) custom icons, including the text boxes to name three icons. They must be placed in the icons/ folder inside the module directory. I've also attached an icons/ directory in a zip file that includes all six images from this issue, as I renamed the white set to use an underscore rather than a hyphen. Please test & let me know, I'm pretty sure it's ready but want to be sure. It will be backported once it's tested here on 6.x. @sethcohn - does it apply to 5.x already?

The patch is completely re-done, so please roll back to the 'clean' version if you tried the patch in #9.

AttachmentSize
cck_field_privacy.module.privacy_icons.patch 7.97 KB
icons.zip 202.48 KB

#17

sethcohn - December 8, 2008 - 16:14

Patch almost applies perfectly. There is one failure, due to an extra space in the 5.x module:

<?php
if ($enabled_type) {
       
$form['field_fields'][$enabled_type] = array(
         
'#type' => 'fieldset',
         
'#title' => $types[$enabled_type]['name'] . ' content fields',
         
'#description' => t('Checking this box will hide this complete field group'),
        );
?>

Remove the space after the period before ' content fields' in the 5.x module, and then the patch correctly fuzzily applies.

And actually, while we're at it, that description is wrong: there is no box to hide the complete field group. Either code is missing, or the description is plain wrong.

Can I suggest a change that will make this more robust and themeable? Don't force icons to be put into module directory under icons. Instead of this logic (sample to illustrate):

<?php
elseif ($cckfp_icon_set == "white") {
                 
$cckfp_open_icon = "padlock_open.png";
...
(
later in code):
                  default:
                   
$padlock = $cckfp_open_icon;
                  break;
...
(
later in code):
$form[$field]['#title'] .= "<a href='#' id='". $field ."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy') ."/icons/". $padlock ."' /></a>";
?>

Change to this:

<?php
elseif ($cckfp_icon_set == "white") {
                 
$cckfp_open_icon = base_path() . drupal_get_path('module', 'cck_field_privacy') ."/icons/padlock_open.png";
...
(
later in code):
                  default:
                   
$padlock = $cckfp_open_icon;
                  break;
...
(
later in code):
$form[$field]['#title'] .= "<a href='#' id='". $field ."link' ><img src='". $padlock ."' /></a>";
?>

In other words, set the path right away, as part of the white or colored set, and then custom icons don't have to live in the icon directory.
That way: custom images can be entered as full paths, meaning they could be in a theme, in /files, or anyplace else the admin wishes.
The orig module directory doesn't have to be touched, nor upgrades worried about.

Ideally, a theme call (which can be overridden) is an even better way to deal with this, but this is a good start.

#18

sethcohn - December 8, 2008 - 16:37

Actually, thinking about this, one current flaw is that after updating the permission, once the impromptu dialog is done, there is no change in the icon, even though the change was made.

It would be nice to change the icon to the right one, but if the names vary, there is no good way to do so, unless you populate the javascript with the image urls.
Maybe making the names standardized, and merely change the directory url? So padlock_open.jpg is always the "everyone" jpg, and changing status to "nobody" , in addition to the db change, means change it on the fly to padlock_closed.jpg (easy enough to do with js), but keep the same directory location? Locations would be icons/colored/ and icons/white and custom (merely set the one directory to look for these 3 icons with the right names, instead of 3 urls to enter)

#19

sethcohn - January 9, 2009 - 21:50

bump. I'm using some variation of the above, merged into the current dev version. I'll generate a patch early next week for it.

#20

obsidiandesign - January 9, 2009 - 21:59

@sethcohn, I'll be working on the issue queue this weekend, trying to clear some of the bigger issues (like this one) - did you take the approach as your listed in #18? I can write up a patch, just need to know the 'preferred' route.

Bryan

#21

sethcohn - January 12, 2009 - 12:50

Bryan, I didn't, but solely due to lack of time... I'm using essentially the patch in #16 right now, but #17 and #18 approaches are worth looking into.

#22

SocialNicheGuru - January 23, 2009 - 18:13

subscribing. I had a similar issue on d5. I will wait for the fix for 21 to re-test.

#23

otsuarez - August 4, 2009 - 14:56

I'd tried to apply the patch on the version 1.3.2.2.2.13 without any success (actually i'd tried both, #9 and #16).
Could it be possible that current code does not support this patch (#16 at least) or it was just me?
This is the console log:

patch -p0 < cck_field_privacy.module.privacy_icons.patch
(Stripping trailing CRs from patch.)
patching file cck_field_privacy.module
Hunk #1 FAILED at 187.
Hunk #2 succeeded at 456 (offset 126 lines).
Hunk #3 succeeded at 469 (offset 126 lines).
Hunk #4 succeeded at 488 (offset 126 lines).
Hunk #5 succeeded at 616 with fuzz 2 (offset 126 lines).
1 out of 5 hunks FAILED -- saving rejects to file cck_field_privacy.module.rej

#24

obsidiandesign - August 7, 2009 - 22:25
Status:needs work» postponed (maintainer needs more info)

I'm going to postpone this temporarily. I think once we can get #540644: Make privacy-button themeable integrated (pending the big changes for UR + popups integration), I think it will be much easier to display the privacy values via the theme function.

Bryan O'Shea

 
 

Drupal is a registered trademark of Dries Buytaert.