How to get SiteRelative link from FileManager Editor

Last post 12-21-2009, 7:46 PM by sedatkumcu. 4 replies.
Sort Posts: Previous Next
  •  12-21-2009, 7:32 AM 57859

    How to get SiteRelative link from FileManager Editor

    Hi,
    i can get the SiteRelative file path from ImageManager with the below code:
    1. document.getElementById("imageFld").value = imgs[imgs.length-1].getAttribute("src_cetemp")
    But i can't get Relative filepath from FileManager. You also have the same problem.
     
    How can i get SiteRelative path from FileManager?
     


    My Code ise below;
    1. <!--#edDOSYAFile-->  
    2. <div class="Gizle">  
    3. <input type="text" name="DOSYA" id="DOSYA" size="50" class="CleanFld" value="" />  
    4. <input id="BtnDosyaFile" type="button" value="Dosya Seçin"/> 
    5. </div>  
    6. <div style="clear:both;">  
    7.   
    8. <!--js fn for edDOSYAFile-->  
    9. <script type="text/javascript">  
    10.     $(document).ready(function(){  
    11.    
    12.         var edDosyaFile = document.getElementById("CE_edDOSYAFile_ID");  
    13.    
    14.         $("#BtnDosyaFile").click(function(){  
    15.             edDosyaFile.FocusDocument();  
    16.             var editdoc = edDosyaFile.GetDocument();  
    17.             edDosyaFile.ExecCommand('new');  
    18.             edDosyaFile.ExecCommand('insertdocument');  
    19.             fnFileToDosyaFile();  
    20.         });  
    21.    
    22.         function fnFileToDosyaFile(){  
    23.             var editdoc = edDosyaFile.GetDocument();  
    24.             var links = editdoc.getElementsByTagName("a");  
    25.             if(links.length>0&&links[links.length-1].href!=""){  
    26.                 document.getElementById("DOSYA").value = links[links.length-1].href;  
    27.             } else{  
    28.                 setTimeout(fnFileToDosyaFile,500);  
    29.             }  
    30.         }  
    31.     });  
    32. </script>  
    33. <!--//js fn for edDOSYAFile-->  
    34.    
    35.  <!-- CuteEditor Version 6.3 edDOSYAFile Begin -->   
    36. .....editor codes...  
    37. ......  
    38.  <!-- CuteEditor edDOSYAFile End 9,765625E-02s-->   
    39.    
    40. </div>  
    41. <!--//#edDOSYAFile--> 
     
    My ASP Code is below,
    1. Set edDosyaFile = New CuteEditor  
    2. edDosyaFile.ID = "edDOSYAFile"  
    3. edDosyaFile.ConfigurationPath = "Includes/Editor/Files/Configuration/DosyaSec.config"  
    4. edDosyaFile.Width = 200    :CodeEdID.Height = 200  
    5. edDosyaFile.Text = ""  
    6. edDosyaFile.Draw() 
     
    My config file (DosyaSec.config) is below;
    1. <?xml version="1.0" encoding="utf-8" ?>  
    2. <configuration>  
    3.     <contextmenu>  
    4.     </contextmenu>  
    5.       
    6.     <codeviewToolbars>  
    7.     </codeviewToolbars>  
    8.       
    9.     <toolbars>          
    10.     </toolbars>  
    11. </configuration> 
     
     
     
    My screenshot is below,
     
     
     
     
    Best regards..
  •  12-21-2009, 8:21 AM 57861 in reply to 57859

    Re: How to get SiteRelative link from FileManager Editor

    Dear sedatkumcu,
     
     
    Regards,
    Eric
  •  12-21-2009, 10:00 AM 57862 in reply to 57861

    Re: How to get SiteRelative link from FileManager Editor

    Hi Eric,
     
    i am used  Editor.URLType property like below,
    1. edDosyaFile.URLType = "SiteRelative" 
     
     But same problem continuesI had tried this method before.
     
     
    Thanks for your support.
    Good works.
  •  12-21-2009, 10:44 AM 57866 in reply to 57862

    Re: How to get SiteRelative link from FileManager Editor

    Please change  document.getElementById("DOSYA").value = links[links.length-1].href;  
     
    to
     
    var h=links[links.length-1].href;
    h=h.replace((new RegExp("http(s?)://yahoo.com/","ig")),"/");
    document.getElementById("DOSYA").value = h;  
     
    Please change yahoo.com to your own domain name.
     
    Keep me posted

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-21-2009, 7:46 PM 57887 in reply to 57866

    Re: How to get SiteRelative link from FileManager Editor

    Hi Adam,
     
    Your solution is works fine. 
     
    But In the meantime, I've created my own solution :)
     
     I changed my JS function code as follows and works fine too;
    1. function fnFileToDosyaFile(){      
    2.     var sFileUrl='';  
    3.     var sHostName = location.protocol +'//'+ location.host; //define currrent host name  
    4.     var editdoc = edDosyaFile.GetDocument();      
    5.     var links = editdoc.getElementsByTagName("a");      
    6.     if(links.length>0&&links[links.length-1].href!=""){      
    7.         sFileUrl = links[links.length-1].href;  
    8.         sFileUrl = sFileUrl.replace(sHostName, ''); //clear hostname from Fullpath  
    9.         document.getElementById("DOSYA").value = sFileUrl;      
    10.     } else{      
    11.         setTimeout(fnFileToDosyaFile,500);      
    12.     }      
    13. }   
View as RSS news feed in XML