var Projects = Projects || {};
(function () {
Projects.ribbonButtonClick = function (name) {
var projectIds = projectCenterComponent.get_GridSatellite().GetJsGridControlInstance().GetSelectedRecordKeys();
if (projectIds.length === 1 && projectIds[0].length === 36) {
var projectId = projectIds[0];
var url = '';
switch (name) {
case "项目报表":
url = "/sites/ppm/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/sites/ppm/Reports/Project%20Detail%20Report.rdl&RP:ProjectUID=" + projectId;
break;
case "吊装规划":
url = "/sites/ppm/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/sites/ppm/Reports/ProjectDemandReport.rdl&RP:ProjectUID=" + projectId
break;
case "项目资源":
url = '/sites/ppm/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/sites/ppm/Reports/ProjectResourceReport.rdl&RP:ProjectUID=' + projectId;
break;
case "项目问题":
url = '/sites/ppm/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/sites/ppm/Reports/ProjectIssueReport.rdl&RP:ProjectUID=' + projectId;
break;
case "项目风险":
url = '/sites/ppm/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/sites/ppm/Reports/ProjectRiskReport.rdl&RP:ProjectUID=' + projectId;
break;
}
window.open(url);
} else {
alert('请选择一个项目');
}
}; Projects.viewOrganization = function () {
ExecuteOrDelayUntilScriptLoaded(function () { //Wait for sp.ribbon.js to be loaded
var pm = SP.Ribbon.PageManager.get_instance();
SelectRibbonTab('Ribbon.ContextualTabs.ProjectCenter.Home', true);
pm.add_ribbonInited(ribbon_init);
}, 'sp.ribbon.js');
}; function ribbon_init() {
var ribbon = (SP.Ribbon.PageManager.get_instance()).get_ribbon();
var tab = ribbon.getChild('Ribbon.ContextualTabs.ProjectCenter.Home');
var group = new CUI.Group(ribbon, 'CustomReport.Group', '项目报表', '项目报表', 'ProjectCenterHomeTab', "CustomReport");
tab.addChild(group);
var layout = new CUI.Layout(ribbon, 'CustomReport.Layout', 'CustomReport.Layout');
group.addChild(layout);
group.selectLayout(layout.get_title());
var section = new CUI.Section(ribbon, 'CustomReport.Section', 2, 'Top'); //2==OneRow
layout.addChild(section);
var row1 = section.getRow(1); //项目立项
var create_controlProperties = new CUI.ControlProperties();
create_controlProperties.Command = 'ProjectCenterHomeTab';
create_controlProperties.TemplateAlias = 'o1';
create_controlProperties.ToolTipDescription = '项目报表';
create_controlProperties.Image32by32 = '/_layouts/15/2052/images/formatmap32x32.png';
create_controlProperties.Image32by32Top = '-204';
create_controlProperties.Image32by32Left = "-238";
create_controlProperties.ToolTipTitle = '项目报表';
create_controlProperties.LabelText = '项目报表';
var create_button = new CUI.Controls.Button(ribbon, 'BPM.Button.ViewOrg', create_controlProperties);
//create_button.set_enabled(true);
var create_controlComponent = create_button.createComponentForDisplayMode('Large');
row1.addChild(create_controlComponent); //暂停
var stop_controlProperties = new CUI.ControlProperties();
stop_controlProperties.Command = 'ProjectCenterHomeTab';
stop_controlProperties.TemplateAlias = 'o1';
stop_controlProperties.ToolTipDescription = '吊装规划';
stop_controlProperties.Image32by32 = '/_layouts/15/2052/images/formatmap32x32.png';
stop_controlProperties.Image32by32Top = '-272';
stop_controlProperties.Image32by32Left = "-442";
stop_controlProperties.ToolTipTitle = '吊装规划';
stop_controlProperties.LabelText = '吊装规划';
var stop_button = new CUI.Controls.Button(ribbon, 'BPM.Button.stop', stop_controlProperties);
//stop_button.set_enabled(true);
var stop_controlComponent = stop_button.createComponentForDisplayMode('Large');
row1.addChild(stop_controlComponent); //重启
var restart_controlProperties = new CUI.ControlProperties();
restart_controlProperties.Command = 'ProjectCenterHomeTab';
restart_controlProperties.TemplateAlias = 'o1';
restart_controlProperties.ToolTipDescription = '项目资源';
restart_controlProperties.Image32by32 = '/_layouts/15/2052/images/formatmap32x32.png';
restart_controlProperties.Image32by32Top = '-68';
restart_controlProperties.Image32by32Left = "-272";
restart_controlProperties.ToolTipTitle = '项目资源';
restart_controlProperties.LabelText = '项目资源';
var restart_button = new CUI.Controls.Button(ribbon, 'BPM.Button.restart', restart_controlProperties);
//restart_button.set_enabled(true);
var restart_controlComponent = restart_button.createComponentForDisplayMode('Large');
row1.addChild(restart_controlComponent); //变更
var change_controlProperties = new CUI.ControlProperties();
change_controlProperties.Command = 'ProjectCenterHomeTab';
change_controlProperties.TemplateAlias = 'o1';
change_controlProperties.ToolTipDescription = '项目问题';
change_controlProperties.Image32by32 = '/_layouts/15/2052/images/formatmap32x32.png';
change_controlProperties.Image32by32Top = '-170';
change_controlProperties.Image32by32Left = "-136";
change_controlProperties.ToolTipTitle = '项目问题';
change_controlProperties.LabelText = '项目问题';
var change_button = new CUI.Controls.Button(ribbon, 'BPM.Button.change', change_controlProperties);
//change_button.set_enabled(true);
var change_controlComponent = change_button.createComponentForDisplayMode('Large');
row1.addChild(change_controlComponent); //关闭
var close_controlProperties = new CUI.ControlProperties();
close_controlProperties.Command = 'ProjectCenterHomeTab';
close_controlProperties.TemplateAlias = 'o1';
close_controlProperties.ToolTipDescription = '项目风险';
close_controlProperties.Image32by32 = '/_layouts/15/2052/images/formatmap32x32.png';
close_controlProperties.Image32by32Top = '0';
close_controlProperties.Image32by32Left = "0";
close_controlProperties.ToolTipTitle = '项目风险';
close_controlProperties.LabelText = '项目风险';
var close_button = new CUI.Controls.Button(ribbon, 'BPM.Button.close', close_controlProperties);
//close_button.set_enabled(true);
var close_controlComponent = close_button.createComponentForDisplayMode('Large');
row1.addChild(close_controlComponent); create_button.getDOMElementForDisplayMode("Large").onclick = function () {
Projects.ribbonButtonClick("项目报表");
}; stop_button.getDOMElementForDisplayMode("Large").onclick = function () {
Projects.ribbonButtonClick("吊装规划");
}; restart_button.getDOMElementForDisplayMode("Large").onclick = function () {
Projects.ribbonButtonClick("项目资源");
}; change_button.getDOMElementForDisplayMode("Large").onclick = function () {
Projects.ribbonButtonClick("项目问题");
}; close_button.getDOMElementForDisplayMode("Large").onclick = function () {
Projects.ribbonButtonClick("项目风险");
};
}
})();

  

Project Online JS 添加Ribbon按钮的更多相关文章

  1. SharePoint 2013 添加Ribbon菜单

    原文:SharePoint 2013 添加Ribbon菜单 前言:今天,我们尝试一下添加SharePoint2013的Ribbon菜单,这个Ribbon菜单是由XML定义,JavaScript脚本来实 ...

  2. EasyUI 1.3.6 DateBox添加清空按钮

    EasyUI 1.3.6 DateBox添加清空按钮 效果如图: EasyUI datebox是没有清空按钮的,可通过如下方法加入: 打开jquery.easyui.min.js看到这样如此乱的代码, ...

  3. Dynamics CRM 2015-Form之添加Ribbon Button

    说到在CRM Form上添加Ribbon Button,那就不得不提到一个Tool:Ribbon Workbench,使用这个Tool,能为我们添加button带来不少便利. Ribbon Workb ...

  4. JS添加标签效果

    JS添加标签效果 在豆瓣网上添加自己的标签是一种常见的效果,今天也就做了一个简单的demo.由于时间的问题 我不多原理,大家可以试着操作几遍就能明白其中的原理了. JSFiddle的效果如下: 点击我 ...

  5. 史上最全的CSS hack方式一览 jQuery 图片轮播的代码分离 JQuery中的动画 C#中Trim()、TrimStart()、TrimEnd()的用法 marquee 标签的使用详情 js鼠标事件 js添加遮罩层 页面上通过地址栏传值时出现乱码的两种解决方法 ref和out的区别在c#中 总结

    史上最全的CSS hack方式一览 2013年09月28日 15:57:08 阅读数:175473 做前端多年,虽然不是经常需要hack,但是我们经常会遇到各浏览器表现不一致的情况.基于此,某些情况我 ...

  6. jquery weui日期选择控件添加取消按钮

    如图: 上图是jQuery weui的时间选择控件,红框处本来应该有个“取消”按钮的,可惜偏偏没有,当用户不想选择的时候就不好处理,虽然插件提供了点击其他区域关闭的功能,但过于隐晦,不容易发现,因此本 ...

  7. odoo添加顶部按钮实现自定义方法

    一.效果图 自定义添加顶部按钮,实现自定义方法. 二.实现过程 1.需要用到三个文件,tree_view_button.js.tree_view_odoo.xml.base.xml三个文件,文件目录如 ...

  8. iOS 为键盘添加隐藏按钮

    // 为键盘添加隐藏按钮 UIToolbar * backView = [[UIToolbar alloc]initWithFrame:CGRectMake(, , , )]; [backView s ...

  9. 原生js添加和删除类

    原生js添加和删除类: this.className +=" "; this.className = this.className.replace(" 原来的类" ...

随机推荐

  1. matlab 调用 python

    众所周知,Python凭借其众多的第三方模块,近年来被数据分析.机器学习.深度学习等爱好者所喜爱,最主要的是Python还是开源的.另一方面,MATLAB因其在仿真方面的独特优势也被众多人追捧.而在国 ...

  2. sql把字符数组转换成表

    需求:把字符串1,2,3变成表里的行数据 方法:用自定义函数实现 /* 获取字符串数组的 Table */ from sysobjects where id = object_id('Get_StrA ...

  3. 股票技术指标中的VOL,KDJ,MACD,OBV,VR,DMA分别代表什么意思?很关键,谢谢

    http://zhidao.baidu.com/link?url=glKK7n0JUgqgrvfx2Gzd937-5zZg1bC615MwAp0P_mrYDytnMUpjoOQgYU871ny8St1 ...

  4. MVC中不能使用ViewBag

    在工程文件中添加 <Reference Include="Microsoft.CSharp" /> <Reference Include="System ...

  5. iOS 屏幕原点坐标 && 导航栏风格的自定义

    其一 屏幕原点坐标 (x ,y) 受 self.navigationController. navigationBar 的 setTranslucent (BOOL) 属性控制 在 iOS7 以后   ...

  6. 第二十一篇 socket

    socket通常也称作"套接字",用于描述IP地址和端口,是一个通信链的句柄,应用程序通常通过"套接字"向网络发出请求或者应答网络请求 socket和file的 ...

  7. HDU 1533 Going home

    Going Home Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  8. 深入理解JVM - 晚期(运行期)优化

    在部分商用虚拟机中,Java程序最初是通过解释器(Interpreter)进行解释执行的,当虚拟机发现某个方法或者代码块的运行特别频繁时,就会把这些代码认定为“热点代码”(Hot Spot Code) ...

  9. BZOJ 1597 [Usaco2008 Mar]土地购买:斜率优化dp

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1597 题意: 有n块矩形土地,长为a[i],宽为b[i]. FJ想要将这n块土地全部买下来 ...

  10. JS多项选择删除

    $(document).ready(function(){ $("#batdel").click(function(){ var checkedLen = 0; var check ...