如何让sharepoint里面的编辑器发布视频

在Sharepoint2007里面,无论是发discussion还是blog,如果你想发一个视频,是不行的!【至少我这里是不可以的,不知还是另有设置】

下面让SharePoint自带的编辑器发视频,只需要拷贝别人写的JS既可以,简单吧! 感兴趣的朋友可以研究一下他的JS。

JS源码:

展开源码// Extended RTE 1.2 for SharePoint
        // Created By Boris Gomiunik 
        // Please visit my Blog to find more tricks for SharePoint: http://boris.gomiunik.net
        // More info about ERTE on http://boris.gomiunik.net/erte
        // Project posted on CodePlex -- http://www.codeplex.com/erte

        ///Settings:
        //imagePath - enter the RTE Toolbar button icon if location is different than the one below
        var imagePath = "/_catalogs/masterpage/erte.gif"

        //Localization arrays. To localize, copy the line below and change the LCID.
        var erte1033 = new Array("Please input details", "Alt Text", "This will be displayed in RSS feeds", "Embed Code", "Paste your Embed code here", "Insert", "Close"); //english
        var erte1060 = new Array("Vnesite parametre", "Besedilo", "Besedilo bo izpisano v RSS-viru", "Embed koda", "Prilepite Embed kodo v polje", "Vstavi", "Zapri"); //english
        var erte1036 = new Array("Parametres de configuration", "Texte de remplacement", "Ce texte sera affiche dans le flux RSS a la place de l'objet insere.", "Code Embed", "Coller le code HTML de l'object ici.", "Inserer", "Fermer"); //French - thanks to Slash71

        /*-------------No need to edit below this line------------------*/

        //set the language. If there is no localization array available, use english as default
        if (window['erte' + L_Menu_LCID]) {
            erte_lang = window['erte' + L_Menu_LCID];
        }
        else {
            erte_lang = window['erte1033']
        }

        //this is the function that generates the "Insert Flash" dialog.
        function embedFlash(gb_whichElement) {
            while (gb_whichElement.id.indexOf('_toolbar') == -1) {
                gb_whichElement = gb_whichElement.parentNode;
            }
            fieldID = gb_whichElement.id;
            fieldID = fieldID.substring(0, fieldID.indexOf('_toolbar'));
            RTE_SaveSelection(fieldID);
            var generator = window.open('', 'question', 'height=300,width=300,scrollbar=no,menu=no,toolbar=no,status=no,location=no');
            generator.document.write('<html><head><title>' + erte_lang[0] + '</title>' +
  '<script type="text/javascript">function insertFlash() { \n' +
  'var finalString = "<span class=erte_embed id=" \n' +
  'var embedCode = document.getElementById("embed").innerText; \n' +
  'if(embedCode.indexOf("<object") != -1) { \n' +
  '	embedCode = embedCode.substring(embedCode.indexOf("<embed")); \n' +
  '	embedCode = embedCode.substring(0, embedCode.indexOf("</embed>")+8); \n' +
  '} \n' +
  'finalString += escape(embedCode) \n' +
  'finalString += ">" \n' +
  'finalString += document.getElementById("alt").value\n' +
  'finalString += "</span>"\n' +
  'window.opener.document.getElementById("' + fieldID + '_iframe").focus();' +
  'window.opener.RTE_GetSelection(document.getElementById("field").value).pasteHTML(finalString)\n' +
  'window.close()\n;' +
  '}' + "<\/script>" +
  '</head><body style="margin:10px; font-family: verdana; font-size: 10px;">' +
  '<strong>' + erte_lang[1] + ':</strong> <input id="alt" type="text" style="border: 1px black solid; width: 200px; font-family: verdana; font-size: 10px;"/><br/><span style="color: gray">(' + erte_lang[2] + ')</span>' +
  '<br/> <br/><strong>' + erte_lang[3] + ':</strong><br/>' +
  '<textarea id="embed" style="width: 250px; height: 100px; border: 1px black solid; font-family: verdana; font-size: 10px;"></textarea>' +
  '<br/><span style="color: gray">(' + erte_lang[4] + ')</span><br/>' +
  '<input type="hidden" id="field" value="' + fieldID + '"' +
  '<br/> <br/><button style="font-family: verdana; font-size: 10px;" οnclick="insertFlash()">' + erte_lang[5] + '</button>' +
  '&nbsp;&nbsp;<button style="font-family: verdana; font-size: 10px;" οnclick="window.close()">' + erte_lang[6] + '</button>' +
  '</body></html>');
            generator.document.close();
        }

        function embedVideos() {
            /* --- This part here adds the button --- */
            objekty = document.getElementsByTagName('table');
            for (i = 0; i < objekty.length; i++) {
                if (objekty[i].className == 'ms-rtetoolbarmenu ms-long' && objekty[i].childNodes[0].childNodes.length == 2) {
                    var newCell = objekty[i].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].insertCell();
                    newCell.setAttribute('unselectable', 'on');
                    newCell.setAttribute('class', 'ms-rtetoolbarmenu');
                    newCell.innerHTML = '<a href="javascript:" unselectable="on" οnclick="embedFlash(this); return false"><img unselectable="on" border="0" src="' + imagePath + '"/></a>'
                }
            }

            /* --- This part will render the display --- */
            objekty2 = document.getElementsByTagName('span');
            for (i = 0; i < objekty2.length; i++) {
                if (objekty2[i].className == 'erte_embed') {
                    objekty2[i].innerHTML = unescape(objekty2[i].id)
                }
            }
        }

        if (window['_spBodyOnLoadFunctionNames']) {
            _spBodyOnLoadFunctionNames.push("embedVideos");
        }
        else { embedVideos() }

使用方法:

To install this script:

1. upload both of the files (.js and .gif) to your masterpage folder on your root site. (http://yoursite.com/_catalogs/masterpage).  use SPD open .

2. Edit the master page of your site add the following line just below the </body> tag.

<script type="text/javascript" src="/_catalogs/masterpage/erte.js"></script>

That should do it.
If this saved you from lots of problems or you earned a lot of money with this open source project, please visit my blog (http://boris.gomiunik.net/erte) and donate couple of bucks to support the future of this project.

 

效果图:

使用前: 你也许会用HTML的形式添加视频 , 但是点击OK后,发现并没有视频

1 

使用后,发现多了个 按钮

2

点击红色按钮, 把你的视频HTML代码copy进去吧!

3

现在,就可以看到视频了!

5

使用后的源文件:

6 

当自定义sharepoint开发的时候,你需要用JS替换为如上格式的标记就可以了!

使用前的源文件: 注意对比一下上面的源文件

7

 文件下载

更多:http://erte.codeplex.com/

相关文章:使用sharepoint自带的文本编辑器

转载于:https://www.cnblogs.com/jinho/archive/2010/09/14/1825896.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值