Home
TeamSite
Worksite... Browsing for Folders/Not files or workspaces
jamesn
In chapter 3 of the Application Integration Toolkit (v 8.5) it talks about the Enhanced Browse Dialog which works fine for selecting files or workspaces --
But I want to select a content folder as a target - there is no way of selecting a folder from this last and having it make a callback to your function. And yes, I tried the Folder constant that is defined in BrowseTreeEnums as well. It returns an error that your session has expired (even though it has not.)
Anyone else face this challenge and have any ideas?
Find more posts tagged with
Comments
jamesn
I actually figured out the answer to this. Posting it here as it might come in handy for someone else.
Here's the
original example from the integration guide
, this seems to let you choose almost anything other than a folder:
[html]
<script language="javascript" src="
http://localhost/worksite/includes/utility.js
"></script>
<script language="javascript" src="
http://localhost/worksite/includes/common.js
"></script>
<script>
function attachDocument()
{
var treeEnum = new BrowseTreeNodeEnums();
var contentType = treeEnum.Document;
//this url does not have a workspace moniker, so the enhanced browse
//dialog will display My WorkSite only
var url =
"
http://localhost/worksite/scripts/BrowseDlgEx.aspx?multiSelect=1&title=Attach&callback=myCustomCallback&contentType=
" +
contentType + "&context=myContextString";
window.open(url);
}
function myCustomCallback(wnd, cmd, objArray, id, target, context)
{
//for each object in the array, write the properties out in HTML
for( i=0; i < objArray.length; i++ )
{
var nrtid = objArray
.nrtid;
var title = objArray
.title;
var img = objArray
.img;
var href = objArray
.href;
//we grab the div tag that's in the html body and give it some HTML
var divTag = document.getElementById('testDiv');
if ( divTag )
{
divTag.innerHTML += "Item #" + (i+1) + " selected in the enhanced browse dialog:" +
"" +
"nrtid=" + nrtid + "" +
"title=" + title + "" +
"img=" + img + "" +
"href=" + href + ""
}
}
//we close the window with the enhanced browse dialog in it
if ( wnd )
{
wnd.close()
}
}
</script>
Select WorkSite Documents
[/html]
In the Web.config, you can see a list of all the pages, under the HttpHandlers section
There's a Browse and BrowseDlg in addition to BrowseDlgEx... so I made a couple of a substitutions and gave it a shot and this seemed to work. I changed the page called, removed a couple of parameters (see URL line below.), changed the parameter list on the callback (there may be more than 3 parameters, but only 1-3 were what I needed) and added a line of logic in the beginning. I almost removed some of the inner HTML loop. This allowed me to browse only for ordinary folders.
[html]
<script type="text/javascript">
function attachDocument() {
var url = "
http://[server]/worksite/scripts/BrowseDlg.aspx?title=Attach&callback=myCustomCallback
";
window.open(url);
}
function myCustomCallback(wnd, cmd, folderId) {
//for each object in the array, write the properties out in HTML
if ((folderId.indexOf("folder
rdinary") <= 0) && (cmd == "ok"))
return;
var divTag = document.getElementById('testDiv');
if (divTag) {
divTag.innerHTML += "This folder selected in the enhanced browse dialog:" +
"" +
"nrtid=" + folderId + "" +
"";
}
//we close the window with the enhanced browse dialog in it
if (wnd) {
wnd.close();
}
}
</script>
Select WorkSite Documents
[/html]
Migrateduser
In WSW look at the paramete passed for "Move Folder" command . You can pass same parameters to make target as workspace, db or folder and then remove the DB and workspace flag
We have build our own custom app for browing because we also wanted it to work on iPad and phone