This is a migrated thread and some comments may be shown as answers.

Template Manager Upload and New Folder

3 Answers 47 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 22 Feb 2014, 06:20 PM
Hi,

It appears that we cannot create new folders without allowing uploads in the template manager.
I need to create new folders but not allow uploads - is this possible please? ..or have I missed something?

Cheers,

Jack

3 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 26 Feb 2014, 12:47 PM
Hello Jack,

You are correct, folders can be created only if the UploadPaths property is correctly set. The logic for file uploading and folder creation needs the same configuration and currently I cannot suggest a proper approach to allow only the folder creation.

Nevertheless, I believe that removing the HTML button should fit your expectation, this can be done with a simple custom implementation that gets the element and removes it from the DOM:
<telerik:RadEditor runat="server" ID="RadEditor1" OnClientCommandExecuted="OnClientCommandExecuted">
    <TemplateManager ViewPaths="~/Folder" UploadPaths="~/Folder" />
</telerik:RadEditor>
 
<script type="text/javascript">
    function OnClientCommandExecuted(editor, args) {
        var command = args.get_commandName();
        if (command === "TemplateManager") { // You should check for all desired file browser dialogs
            var dialog = editor.get_dialogOpener()._dialogContainers[command];
 
            dialog.add_pageLoad(function () {
                var oDoc = dialog.get_contentFrame().contentDocument;
                $telerik.$(oDoc).find(".icnUpload").remove();
            })
        }
    }
</script>


Regards,
Ianko
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Jon
Top achievements
Rank 1
answered on 26 Feb 2014, 01:03 PM
Hi Ianko,

Yes that works great - Thank you!

Jack
0
Accepted
Ianko
Telerik team
answered on 26 Feb 2014, 03:52 PM
Hi Jon,

After some further investigation I found that the users will be able to upload files through the context menus.

You can refer to this updated example:
<telerik:RadEditor runat="server" ID="RadEditor1" OnClientCommandExecuted="OnClientCommandExecuted">
    <TemplateManager ViewPaths="~/Paths" UploadPaths="~/Paths"/>
</telerik:RadEditor>
 
<script type="text/javascript">
    function OnClientCommandExecuted(editor, args) {
        var command = args.get_commandName();
        if (command === "TemplateManager") { // You should check for all desired file browser dialogs
            var dialog = editor.get_dialogOpener()._dialogContainers[command];
             
            dialog.add_pageLoad(function () {
                var oDoc = dialog.get_contentFrame().contentDocument;
                var oWin = dialog.get_contentFrame().contentWindow;
                var fileExplorerID = oDoc.getElementsByClassName("RadFileExplorer")[0].id;
                var feControl = oWin.$find(fileExplorerID);
                // Get context upload button
                var gridContextUpload = feControl.get_gridContextMenu().findItemByText("Upload");
                var gridContextItems = feControl.get_gridContextMenu().get_items();
                // Get tree upload button
                var treeContextUpload = feControl.get_tree().get_contextMenus()[0].findItemByText("Upload");
                var treeContextItems = feControl.get_tree().get_contextMenus()[0].get_items();
 
                gridContextItems.remove(gridContextUpload);
                treeContextItems.remove(treeContextUpload);
                $telerik.$(oDoc).find(".icnUpload").remove();
            })
        }
    }
</script>


Regards,
Ianko
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Editor
Asked by
Jon
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Jon
Top achievements
Rank 1
Share this question
or