欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

系統 1693 0
?

一.自定義文檔庫/列表庫中項目的右鍵關聯菜單

  原始菜單如下圖所示:

?

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

  下面開始我們本次的工作歷程:

  首先,找到C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS這個目錄下的2052目錄(這個默認是中文版本的路徑,英文版本的MOSS是1033目錄),其中有個core.js的JS文件,MS已經給我們預留了自定義的接口來實現我們自己的菜單定義了

  添加以下兩個JS的函數代碼:

funtion AddListMenuItems(m,ctx)
{
if(typeof(Custom_AddListMenuItems) != "undefined")
{
 if(Custom_AddListMenuItems(m,ctx))
 return;
}
}

funtion AddDocLibMenuItems(m,ctx)
{
if(typeof(Custom_AddListMenuItems) != "undefined")
{
 if(Custom_AddListMenuItems(m,ctx))
 return;
}
}

  然后我們實現自定義函數AddListMenuItems(列表庫)和AddDocLibMenuItems(文檔庫)

  ,在頁面右上角點擊‘網站操作’--編輯網頁--添加Webpart部件,選擇

?

  點擊Webpart部件右邊的‘編輯’--修改共享Webpart部件

?

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

  在頁面中點擊‘源編輯器’

  ,在彈出的窗口中添加自定義函數AddListMenuItems(列表庫)和AddDocLibMenuItems(文檔庫)

<script language="javascript">
function Custom_AddDocLibMenuItems(m, ctx)
{
  strDisplayText = "報表統計";
  var rootMenu = CASubM(m,strDisplayText,"","",500);
  strDisplayText = "匯總表";
  strAction = "STSNavigate('~site/_layouts/ItemAudit.aspx?ItemId={ItemId}&amp;ListId={ListId}')";
  strImagePath=ctx.imagesPath+"oisweb.gif";
  menuOption = CAMOpt(rootMenu,strDisplayText,strAction,strImagePath);
  menuOption.id = "ID_MySubMenu";

  //var rootMenu = CASubM(m,strDisplayText,"","",500);
  strDisplayText = "數字統計表";
  strAction = "STSNavigate('~site/_layouts/ItemAudit.aspx?ItemId={ItemId}&amp;ListId={ListId}')";
  strImagePath=ctx.imagesPath+"oisweb.gif";
  menuOption = CAMOpt(rootMenu,strDisplayText,strAction,strImagePath);
  menuOption.id = "ID_MySubMenu";

  strDisplayText = "行列匯總表";
  strAction = "STSNavigate('~site/_layouts/ItemAudit.aspx?ItemId={ItemId}&amp;ListId={ListId}')";
  strImagePath=ctx.imagesPath+"oisweb.gif";
  menuOption = CAMOpt(rootMenu,strDisplayText,strAction,strImagePath);
  menuOption.id = "ID_MySubMenu";

  strDisplayText = "并列匯總表";
  strAction = "STSNavigate('~site/_layouts/ItemAudit.aspx?ItemId={ItemId}&amp;ListId={ListId}')";
  strImagePath=ctx.imagesPath+"oisweb.gif";
  menuOption = CAMOpt(rootMenu,strDisplayText,strAction,strImagePath);
  menuOption.id = "ID_MySubMenu";

  return false;
}
</script>

  點擊保存--應用--確定--退出編輯模式

  好,看到我們期待已久的最終結果,

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

注意,這里是List和Doc是2個分別的JS方法名。?

?

?

?

?

這個菜單是用Feature部署上去的功能,先提一下Feature的作用:

  微軟在MOSS中利用Feature的特性,可以將Feature.xml中以特定格式描述的功能部署到MOSS中,這些功能包括工作流,菜單項,網站欄、內容類型...等等。然后可以在MOSS中配置啟用或者停用這些功能,由于這個特性不需要進行代碼開發,只需要配置Feature.xml和其中指定的另一個xml,方法簡單可行。

  Feature.xml如下:

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="6098EC11-8128-409A-8D2C-414E93F67DD4"

      Title="add my menu"

      Description="this is a custom menu"

      Version="1.0.0.0"

      Scope="Site"

      Hidden="FALSE"

      DefaultResourceFile="customDocumentLibrary"

      xmlns="http://schemas.microsoft.com/sharepoint/
">

      <ElementManifests>

        <ElementManifest Location="elements.xml" />

      </ElementManifests>

</Feature>

  解釋一下其中的內容,Id是GUID類型標示的唯一值,可以由VS自帶的GUID Generator來生成,Tiltle是功能標題,Version是版本號,Description:對description的描述,Scope:其值可以是Web或Site,它指明了這個Feature是應用于整個的Site Collection還是僅僅用于單獨的一個子站點。Hidden:值可以是True或False.該設置指定了這個Feature是否在Site Feature頁面上顯示。DefaultResourceFile: 資源文件名字,Feature依賴它提供其它附加的配置信息。

Feature.xml文件中的<ElementManifests>元素,這個元素包含了另一個XML文件的位置,而這個文件包含的<Elemnets>的內容是Feature要實現的。

  <ElementManifest>元素指明了要使用一個名為ProvisionedFiles.xml的文件,以下是該文件的<Elements>元素內容。

  下面是Feature.xml中指定的elements.xml內容:

<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">
<!-- create command link site setting page -->
<CustomAction Id="SiteSettings" GroupId="Customization"
        Location="Microsoft.SharePoint.SiteSettings"
              Sequence="106"
              Title="Custom Litware Site Setting Command">
              <UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=SiteSettingCommand"/>
   </CustomAction>
   <!--Add command to site action dropdow -->
    <CustomActionId="SiteActionsToolbar111111111111"

            GroupId="SiteActions"
                  Location="Microsoft.SharePoint.StandardMenu"
                  Sequence="1000"
                  Title="Litware custom Action"
                  Description="custom litware site action"
                  ImageUrl="/_layouts/images/ACL16.GIF">
                  <UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=SiteActionCommand"/>
  </CustomAction>
    <!-- Document Library Toolbar New Menu DropDown-->
    <CustomAction Id="DocLibNewToolbar"
        RegistrationType="List"
           RegistrationId="101"
           GroupId="NewMenu"
           Rights="ManagePermissions"
           Location="Microsoft.SharePoint.StandardMenu"
           Sequence="1000"
           Title="Litware Custom New Command"
           Description="THis Command Creates a new Litware doc"
           ImageUrl="/_layouts/images/ACL16.GIF">
           <UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=NewDocCommand"/>
  </CustomAction>
    <!-- Document library Toolbar Actions Menu Dropdown-->
    <CustomAction Id="DocLibActionsToolbar"
        RegistrationType="List"
           RegistrationId="101"
           GroupId="ActionsMenu"
           Rights="ManagePermissions"
           Location="Microsoft.SharePoint.StandardMenu"
           Sequence="1000"
           Title="Litware Command on Document Library"
           Description="THis Command Creates a new Litware doc"
           ImageUrl="/_layouts/images/ACL16.GIF">
           <UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=DocLibCommand"/>
     </CustomAction>
     <CustomActionId="ECBItemToolbar"
        RegistrationType="List"
           RegistrationId="101"
           Type="ECBItem"
           Location="BugWorkaround:LocationShouldEqualEditControlBlock"
           Sequence="106"
           Title="Litware ECB item Command">
           <UrlActionUrl="/_layouts/litwarefeaturelab.aspx?command=SiteSettingCommand"/>
     </CustomAction>
</Elements>

其中第一個CustomAction在Site Setting頁面中的LOOK AND FEEL標題下創建了一個自定義鏈接.第二個CustomAction在頁面的Site Action菜單下增加了一個用戶自定義菜單項.第三個CustomAction在文檔庫的New下拉菜單下創建了一個自定義菜單項.第四個CustomAction在文檔庫的Action下拉菜單下創建了一個自定義菜單項.

  注意第五個CustomAction本來是在文檔庫的每個列表項的菜單上增加一個菜單項,但是不知什么原因不能正確加入,有待進一步的研究.

  再做倆個批處理文件來部署和卸載這個Feature

  部署批處理文件InstallFeature.bat

@rem======================================================================
@rem
@rem  InstallFeature.bat
@rem
@rem======================================================================
@echo off
setlocal
pushd .
goto InstallFeature
@rem----------------------------------------------------------------------
@rem  InstallFeature
@rem----------------------------------------------------------------------
:InstallFeature
  set SPAdminTool=%CommonProgramFiles%Microsoft Sharedweb server extensions12BINstsadm.exe
  set TargetUrl=http://huijianming
  set FeaturePath=menuFeature.xml
  echo InstallFeature %FeaturePath%
  "%SPAdminTool%" -o installfeature -filename %FeaturePath% -force
  echo Activating feature %FeaturePath%
  "%SPAdminTool%" -o activatefeature -filename %FeaturePath% -url %TargetUrl% -force
  echo iisreset
  iisreset

 卸載批處理文件UnInstallFeature.bat

@rem======================================================================
@rem
@rem  UnInstallFeature.bat
@rem
@rem======================================================================
@echo off
setlocal
pushd .
goto UnInstallFeature
@rem----------------------------------------------------------------------
@rem  UnInstallFeature
@rem----------------------------------------------------------------------
:InstallFeature
  set SPAdminTool=%CommonProgramFiles%Microsoft Sharedweb server extensions12BINstsadm.exe
  set TargetUrl=http://huijianming
  set FeaturePath=menuFeature.xml
  echo InstallFeature %FeaturePath%
  "%SPAdminTool%" -o UnInstallFeature-filename %FeaturePath% -force
  echo iisreset
  iisreset

  將以上的兩個XML放到Menu的文件夾中,然后將文件夾拷貝到C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES

  運行部署批處理文件

?

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

  效果圖如下:

  文檔庫新建菜單

?

MOSS 2007 應用隨筆系列:自定義moss菜單匯總 ?

  文檔庫操作菜單

?

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

  網站操作菜單

?

MOSS 2007 應用隨筆系列:自定義moss菜單匯總

  運行卸載批處理文件

? MOSS 2007 應用隨筆系列:自定義moss菜單匯總

MOSS 2007 應用隨筆系列:自定義moss菜單匯總


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 日韩国产无矿砖一线二线图 | 免费一级欧美性大片 | 久久xxx| 中国大陆高清aⅴ毛片 | 欧美激情一区二区三级高清视频 | 大香一本蕉伊线亚洲网 | 黄色aaa视频 | 日干夜干天天干 | 在线播放一区 | 久热精品视频在线播放 | 国产午夜精品视频免费不卡69堂 | 日韩一区二区三区在线观看 | 久久成人久久爱 | 国产精品影视 | 久草新视频 | 日韩视频在线观看免费视频 | 亚洲国产天堂久久综合9999 | 91免费视频版| 国产在线精品成人一区二区三区 | 亚洲国产专区 | 成人毛片100免费观看 | 日韩综合区 | 日本激情在线视频 | 黄色在线免费看 | www伊人网 | 久久成人国产精品 | 亚洲精品综合一区二区三 | 国产成人精品一区二区三在线观看 | 国产合集福利视频在线视频 | 亚洲毛片无码专区亚洲A片 日本高清www午色夜黄 | 欧美1区 | 亚洲人人 | 色婷婷六月丁香在线观看 | 中文字幕在线观看av | 一区二区三区四区五区中文字幕 | 99精品国产高清在线观看 | 99久久网 | 日韩免费网站 | 日韩欧美精品综合一区二区三区 | 爱婷婷网站在线观看 | 日韩精品一区二 |