2015-04-26 117 views

回答

0

解決方案:

添加此自定義頁面佈局。

<a href="javascript:;" onclick="openInDialog(500,600,true,true,false,'https://harepoint.com/sites/site/_layouts/15/Upload.aspx?List=%7BFBD05330-969D-4853-B00A-6E728BA87F0B%7D');" class="ms-cui-ctl-large "><span unselectable="on" class="ms-cui-ctl-largeIconContainer"><span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float"><img unselectable="on" src="/_layouts/15/3082/images/formatmap32x32.png?rev=38" alt="" style="top: -239px; left: -35px;"></span></span><span unselectable="on" class="ms-cui-ctl-largelabel">Cargar<br>archivo</span></a> 

有了這個js:

function openInDialog(dlgWidth, dlgHeight, dlgAllowMaximize,dlgShowClose,needCallbackFunction, pageUrl, opcion) 
{  
    //cojo las opciones que le paso desde el href . 
    var options = { url: pageUrl,showClose: dlgShowClose}; 

    if(needCallbackFunction) 
    { 
     options.dialogReturnValueCallback = Function.createDelegate(null, CloseDialogCallback); 
    } 
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); 
} 

function CloseDialogCallback(dialogResult, returnValue) 
{ 
    if(dialogResult == SP.UI.DialogResult.OK) 
    { 
     SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.RefreshPage', SP.UI.DialogResult.OK);   
    } 
    else if(dialogResult == SP.UI.DialogResult.cancel) 
    { 
    }else{ 
    } 
} 

代碼不是Refactorized!

相關問題