Hi,
Maybe a bit cryptic description, but what I'm after is the following:
- We use confluence to document a programming API. In the API are deprecated objects.
- I'd like to provide the user with a checkbox on the page to toggle the deprecated objects visiblility.
So, I can wrap the deprecated objects inside a builder-show/hide macro that acts on the status of a flag, question is: how to control the flag.
I was thinking of providing a button/checkbox through a (user)macro, some clientside JS to get/set a cookie, so their preference is stored persistent etc.
Question is: is this feasible to do? Can I, from a user action in the browser trigger the rerendering of the page, passing in the value for the flag somehow?
And on load of the page, can I set the flag value based on teh cookie value somehow?
Don;t mind doing a bit of digging myself, but don't like to spend much time going after something that is impossible ![]()
Any thought appreciated.
P.
.png)








Comments (10)
Jul 22, 2010
Alain Moran says:
I know the online documentation is not upto date, but I think what you are looki...I know the online documentation is not upto date, but I think what you are looking for is
{set-flag:myflag|type=user}
This will store the flag permanently against the user, other types are session & request (with 'request' being the default)
NB: this requires builder 4.0.3 or later
Jul 22, 2010
P says:
Cool (and: that was quick ) One question though: how can I allow the user to t...Cool
(and: that was quick
)
One question though: how can I allow the user to toggle the flag? I'm thinking hard and might be overlooking the obvious, but I cannot think of a way to let them trigger the set-flag macro.
P.
Jul 22, 2010
Alain Moran says:
Heh, you managed to catch me just as I was checking my mail. Hmm, interesting p...Heh, you managed to catch me just as I was checking my mail.
Hmm, interesting point, at the moment there is no clean way to set a flag through user input :s
One workaround would be to put the set-flag macro on a page and then link to it (you would probably need two pages, one for 'on' the other for 'off'), however long-term that's probably not going to scale if you have lots of user flags :s
I'll look into adding an action & link into an upcoming release however when that will happen I'm not sure at the moment - paid work has to take priority I'm afraid.
Jul 22, 2010
P says:
Hi Alain, Tnx for the response and for looking into it (in a hopefully not so d...Hi Alain,
Tnx for the response and for looking into it (in a hopefully not so distant future
)
P.
Aug 30, 2010
P says:
Hi Alain, had a brief look at the release notes, but didn't see anything. Did y...Hi Alain,
had a brief look at the release notes, but didn't see anything. Did you magane to squeeze in the action & link stuff you came up with?
P.
Sep 01, 2010
Alain Moran says:
No, unfortunately paid-for work got in the way.No, unfortunately paid-for work got in the way.
Jul 23, 2010
P says:
Hi Alain, If I use {set-flag:myflag|type=user}, is the flag page specific, or g...Hi Alain,
If I use {set-flag:myflag|type=user}, is the flag page specific, or global?
I'd like a have the ability to have the flag set persistant, on a global level, so if the user sets it on one page, the same value for the flag is also available on other pages.
In my example, if it wouldn't be like this, the user would have to check the checkbox on each page individually.
If the macro doesn't support this yet, could it be added as well?
Tnx.
P.
Jul 23, 2010
Alain Moran says:
User flags are set against the user, there is no 'page' element to them ... if y...User flags are set against the user, there is no 'page' element to them ... if you want to use a 'page' element against a user then I would suggest using the replace-and-render macro with the page-info macro to generate page specific flag id's.
Mar 27, 2011
marco polo says:
How well sis this work out for you with creating a globally persistent item that...How well sis this work out for you with creating a globally persistent item that the user can essentially toggle on or off anywhere in the site?
I have a macro that will display some content on a page, and am planning/hoping to allow them to hide the content is they wish and keep it out of sight until they choose again to show it by toggling or clicking something.
Any help would be appreciated!
m.
Mar 27, 2011
Alain Moran says:
Sadly paid work is still getting in the way of developing an action which you co...Sadly paid work is still getting in the way of developing an action which you could 'easily' use to set/unset these flags, for now you will need to resort to two pages, one with the set-flag in it, the other with set-flag:state=false to un-set it ... not great I know, but it will work.