Document Manager - Insert from file system

Posted by Community Admin on 03-Aug-2018 14:02

Document Manager - Insert from file system

All Replies

Posted by Community Admin on 28-Mar-2011 00:00

Hi Team,

I am working on a project for a client. Previously they had a website running on Sitefinity 3.1. They had around 4000 documents saved on the file system which they inserted / would insert to pages. Currently in the document manager, can only upload files or insert from library. Is there any way to extend the designer to support adding files that already exist on the file system ? Or should i go ahead and upload all of the documents programmatically which i don't think it's a wise thing to do since the documents are going to be saved in the database.

Posted by Community Admin on 30-Mar-2011 00:00

Hello Fawzi Rahal,

Thank you for conatcting Telerik Support.

If I got you right, you want to insert links to these documents, without importing them. You can do tihs using app relative paths (~/DocumentLocationInProjectFolder/Document), but this poses the risk of broken links if you accidentally delete something later. Can you elaborate more on the use case scenario where you want to use these documents - do you want to display only links to them, or import them for editing/browsing onto your pages?

Kind regards,
Boyan Barnev
the Telerik team

Posted by Community Admin on 31-Mar-2011 00:00

Hi Team,

I think the subject here is how to insert a link to a document through the document manager without having the links uploaded to a library. Let's say we have 4000 documents migrated from an older version of Sitefinity, they reside in a folder on the file system. The user editing the page do not go to the html code to add the link. How can he add a link to a document in this case?

Is there any workaround for the document manager to support links for files residing on the file system?

Thanks,

George

Posted by Community Admin on 31-Mar-2011 00:00

Hello George ,

You can use the built-in functionality of RadEditor to browse the file system and create your custom control similar to Content Block. You just have to add it as a user control and set the path to your documents folder like this:

<telerik:RadEditor ID="Editor" runat="server">
<DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" DeletePaths="~/Documents" />
</telerik:RadEditor>
 and you'll get the desired functionality. You might also want to look at this article form the  RadEditor demos.

I hope this information helps. If you need any further assistance, please do not hesitate to contact me.

All the best,
Boyan Barnev
the Telerik team

Posted by Community Admin on 31-Mar-2011 00:00

Thank you for your response. I have already mapped the Content Block to an external template that looks like this 

<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
   
<sf:ResourceLinks id="resourcesLinks" runat="server">
    <sf:ResourceFile Name="Styles/Window.css" />
</sf:ResourceLinks>
   
<sf:FormManager ID="formManager" runat="server" />
<div style="width: 660px; overflow: hidden;">
    <sf:HtmlField
        ID="htmlEditor"
        runat="server"
        Width="99%"
        Height="370px"
        EditorToolsConfiguration="Custom"
        EditorConfigurations="~/Custom/ControlTemplates/EditorConfiguration.xml"
        EditorToolsConfigurationKey="ToolsFile"
        EditorContentFilters="None"
        EditorStripFormattingOptions="MSWord,Css,Font,Span,ConvertWordLists"
        DisplayMode="Write"
        FixCursorIssue="True" >
    </sf:HtmlField>
</div>
<script type="text/javascript">
    $("body").addClass("sfContentBlockDesigner");
</script>

How can i change the document manager properties? and Is there anyway to have the two options : 1- Add document from a library or 2- add document from file system

Thanks,

G

Posted by Community Admin on 31-Mar-2011 00:00

Hello George ,

Thank you for getting back to me. The reason I did not recommend you the option of mapping the template for Content Block editor is that if you do this, you can specify again DocumentManager Paths, but you won't be able to browse uploaded documents. You have to write a custom control that implements this functionality based on RadEditor.

Best wishes,
Boyan Barnev
the Telerik team

Posted by Community Admin on 31-Mar-2011 00:00

Thank you Boyan.

I have mapped the content block template so that I can modify the toolbox for the RadEditor. Can you point me in the direction on how to proceed. Maybe a code snippet. I do want to have the document manager for the content block and not as an other control since my client will be adding links to document through content block.

Waiting for your reply

George

Posted by Community Admin on 31-Mar-2011 00:00

Hi George ,

I see your concern. The problem is, that the Document manager we are using for the Content Block editor works with uploaded documents only, and mapping a template that substitutes it with a document manager that works with file system is tricky - either of the manager will be called first, but both will not work simultaneously.
In this case we'll have to try something else. How about adding a custom button for the Document manager that browses the file system. Please review the samples about adding a custom button and use them to implement your instance of the Document Manager 

<DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" DeletePaths="~/Documents" />



Regards,
Boyan Barnev
the Telerik team

Posted by Community Admin on 01-Apr-2011 00:00

Hi Boyan,

Thank you for getting back to me. I am working on the solution that you suggested. I managed to add the button to the editor along side the document manager button. I also managed to write the code that will open the document manager and display the files in the specified folder. However, I am getting a javascript error and the files are not being displayed inside the document manager.

I have uploaded the files for you maybe you would help me fix the bug. I am working on the external control that i have mapped for the Content Block as well as the Tools file. I included all the files that you basically need.

You can download it from here

I am getting the javascript error on this line 

_loadLinkProperties: function()
    var currentLink = this._clientParameters.get_value();


Thanks for checking it out.

Best,

G

Posted by Community Admin on 07-Apr-2011 00:00

Hi Team,

Did anyone have a chance to look at the code, I really need to get this working ...

Appreciate it

Posted by Community Admin on 07-Apr-2011 00:00

Hello George ,

Can you please take a look at the sample that I've attached to this reply. It implements a basic functionality to your custom button in the toolbar - browsing the File System via our Document Manager (you can see how the paths are set in DocumentManagerFS.ascx.cs), naming your link, and you have the option to specify target and class as well before inserting the link to the selected document.

Please inform me if this functionality suits your project requirements, and if I can provide you with any additional help regarding this issue.

Kind regards,
Boyan Barnev
the Telerik team


Posted by Community Admin on 07-Apr-2011 00:00

Hi Boyan,

Thank you so much. It did the trick. I modified something in the code, added styles and added the HTTP module for the DialogOpener.

I am going to work on the aspx page and change it to a control that inherits from SimpleView if possible. Otherwise, i will just leave is as is.

Again, appreciate it !

Posted by Community Admin on 07-Apr-2011 00:00

Hi George ,

I am glad that the issue you were facing is now resolved. Please feel free to customize the code I sent - it's just a sample implementation that can be modified to suit your project needs. It was a pleasure for me to assist you.

Kind regards,
Boyan Barnev
the Telerik team


Posted by Community Admin on 22-Apr-2011 00:00

I have a client that has several hundred PDF files that are catalogs and assembly instructions.  The files are really quite large and not a great fit for database storage.  I really wish Sitefinity had  built-in capability to configure file system storage for document (image or video) libraries with the metadata stored in the database.  I do have SQL2008 so I know I can configure something for blobs, but I wouldn't dare make the changes for fear of breaking Sitefinity.  Additionally, for something like this, I am not fond of implementing a custom solution because it seems that customizing something so intrinsic to the system only leads to issues at upgrade time. I realize that having items on the file system can cause problems for Sitefinity if users delete the files, but I would think that any admin configuring the system to use the file system would compensate by locking down access to the physical files.  At any rate, I think it would be a nice feature to have.  Please consider adding this to your feature request.

Posted by Community Admin on 25-Apr-2011 00:00

Hi Allen,

I really appreciate the constructive feedback all of you have provided us with in this forum thread. I have logged a task for implementing the desired functionality, you can track its status and vote for it in PITS on this public URL.

Regards,
Boyan Barnev
the Telerik team


This thread is closed