I have got a situation to define a specific document library for picture/file uploading through RichTextEditor(Multi line of text - Enhanced Rich Text).
where I have used the ListFieldIterator in my Application page for entering value to the List through RichTextEditor.
By default the sharepoint uses the RteUploadDialog.aspx for this. This default page looks like below snapshot
There is a dropdown, where user can select the the library in which they wanna upload the image or file. By default the dropdown shorted with ascending order and the first item is being selected.
But in my case i wanna hide this option from user view and set a specific doucment library for uploading. For this i have gone with following javascript
If you open RteUploadDialog.aspx in some editor, you will see already existing javascript code there, something like:
It already have a variable listDD that references library dropdown. You should change it to:
Just change the variable defaultLibraryName to the library you want to select and this code should do the trick. In my case I have selected "HFSite Assets".
To hide the dropdown from user view, i have i have change the display:none in the style of the respective table row.
Now I have achieved my requirement, the default library for the uploading picture/file is "HFSite Assets" and user can not view and modify the library. The new RteUploadingDialog now looks like
where I have used the ListFieldIterator in my Application page for entering value to the List through RichTextEditor.
By default the sharepoint uses the RteUploadDialog.aspx for this. This default page looks like below snapshot
But in my case i wanna hide this option from user view and set a specific doucment library for uploading. For this i have gone with following javascript
If you open RteUploadDialog.aspx in some editor, you will see already existing javascript code there, something like:
<script type="text/javascript"> function ULSXuo(){var o=new Object;o.ULSTeamName="Microsoft SharePoint Foundation";
o.ULSFileName="RteUploadDialog.aspx";return o;} ... SetFocus(); </script>
It already have a variable listDD that references library dropdown. You should change it to:
<script type="text/javascript"> function ULSXuo(){var o=new Object;o.ULSTeamName="Microsoft SharePoint Foundation";
o.ULSFileName="RteUploadDialog.aspx";return o;} ... SetFocus();
// Default upload library - Manikandan Jaguva Rajaram var defaultLibraryName = "HFSite Assets"; var i = 0; while (listDD.options[i].text != defaultLibraryName && i < listDD.options.length) { i++; } if (i < listDD.options.length) { listDD.selectedIndex = i; } </script>
Just change the variable defaultLibraryName to the library you want to select and this code should do the trick. In my case I have selected "HFSite Assets".
To hide the dropdown from user view, i have i have change the display:none in the style of the respective table row.
Now I have achieved my requirement, the default library for the uploading picture/file is "HFSite Assets" and user can not view and modify the library. The new RteUploadingDialog now looks like
No comments:
Post a Comment