Hey Gang,
Is there any documentation reference as to how I can add a field to the Preference Panel.
What I am looking to do in the Profile is add “for select user types” to have a new preference field called MainPhoto in which they can upload a picture.
Our site http://beta.hashbanggames.com/ which is coming together piece by piece has an about us page that I want to work on soon.
The idea behind this page http://beta.hashbanggames.com/about/our-team is to have our staff have a custom preference where they can add a main photo and upload that photo into the media manager.
Any ideas how this is done? Or any link to some docs I can check out?
Thanks,
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209
Marco,
The user object has the API for preferences available to you. This API will store and retrieve preferences, you don’t have to manage them. You can see this in ContentBox in the Tools > API Docs section:
setPreferences( any preferences )
Store a preferences structure or JSON data in the user prefernces
getAllPreferences()
Get all user preferences in inflated format
getPreference( any name, [any defaultValue = ‘’] )
Get a preference, you can pass a default value if preference does not exist
setPreference( any name, any value )
Set a preference in the user preferences
All preferences are stored as JSON internally. That’s step #1. Step #2 is to add a UI for the preferences you manage. This is done via the following event:
cbadmin_UserPreferencePanel
You can also listen to preference actions:
cbadmin_preAuthorPreferencesSave
cbadmin_postAuthorPreferencesSave

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com
Social: twitter.com/lmajano facebook.com/lmajano
Awesome thanks! That helped a lot.
I’m now digging through the Media Manager to find out how I can bind a button to bring up the media manager and whatever image I select will populate a text box.
Feel free to post a response, or I will once I find how to do it… Moo hoo ha ha ha!
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209

Hi Marco–
You might start by checking out the ckfilebrowser.cfc handler in ContentBox: https://github.com/Ortus-Solutions/ContentBox/blob/development/modules/contentbox-admin/handlers/ckfilebrowser.cfc
This is how CKEditor opens the Media Manager in “widget” mode. An important part to pay attention to is the “callback” – this allows you set the callback method (JavaScript) that you’d like to fire when you “choose” an item (either by double clicking or selecting “choose”). The callback will receive the path, the url and the type as arguments.
Hope this helps

It does, thanks!
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209

Luis,
Maybe I’m doing something wrong here and you can correct me… However, when I use the ckfilebrowser.cfc and pass a callback=opener.mycallback the callback variable is not getting overridden.
This is because in the prehandler, it’s being hardcoded to fbCKSelect.
// CKEditor callback
rc.callback=“fbCKSelect”;
Recommended codechange:
// CKEditor callback
if(!StructKeyExists(rc,“callback”)){
rc.callback=“fbCKSelect”;
}
Only hard code this value if the callback doesn’t already exists in the struct.
Thanks,

Hi Marco–
I would suggest that you should create your own handler. That one is specifically for CKEditor stuff.

Correct me if I am wrong here, but what has ckEditor got to do with standard file inputs? I was under the impression that is what the OP was asking, there is a ticket for using file browser with the HTML tag inputfile. It is about 2 years old, so I am not sure if Luis fixed this or not.
I can’t find the code that was I was using at the time, but it was based on something that File Browser has for file input tags, why would you suggest using ckEditor if that is not the section this is going into?

Andrew, I never suggested he use CKEditor, only that he look at that handler to see how it runs filebrowser in “widget” mode.

My first Coldbox Tutorial Video… on this topic
Since I got everything working …
PS… I’m terrible at tutorial videos especially since I have not done them in a while. LOL
http://youtu.be/CoFm_HfXytw
Enjoy, feel free to give thoughts.
Have a great weekend!
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209

Yes I know that… But…
FileBrowser used to have something like this
Now of course I don’t recall what it was as I can’t find the original ticket when it used to be over on the older server with whatever it the ticket system was then.
But I am sure this is what the OP was asking, there used to be a way where you could do the above via a helper os something that would drop a file input and activate the file browser. Are you saying that this method you speak of in the ckEditor is the same thing? Then what happened to the helper that dropped the input type of file gone then?

Marco, didn’t realise you are doing Unity work as well. I may if you don’t mind ping you off list, I am looking at writing an asset that uses ContentBox as a backend system for Indie developers. Trying to help push them Railo and ColdFusions way rather than PHP.

Also don’t know if you are speaking in the video but can’t here you…

Ok I see it now, it is identical which means Luis did fix the issue. Cool… I never actually got around to finishing that code I started, may have to look at it again now that I know it is fixed.

Hi Marco–
Awesome video–thanks for sharing!
I guess my point with creating your own handler is that you can bypass the CKEditor stuff altogether. All you would need to do would be to create a method in your handler, get the FileBrowser settings, and then run the contentbox-filebrowser:home.index event, passing in the args and callback. Then you wouldn’t have to use the CKEditor stuff at all.
For example:

Sure thing man, I am using CF for the back end of my AnyCoin Paywall service that I’ve been working on for the past few weeks. J
My personal email is marco@hashbanggames.com hit me up there when it comes to unity type stuff.
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209

Yeah, I was speaking L dang… Might have to turn the vol way up …haha.
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209

Oh I get it… yeah, that would have worked. I might change over to that since I don’t really want to have custom fixes in the base install of ContentBox.
Thanks,
Marco G. Williams
Information Technology Manager
Global Electronic Technology
949.380.0345 x209
