在MOSS中后台管理的页面都是Application Page,比如网站设置的页面(settings.aspx)就是典型的Application Page,它不能被Sharepoint Desiger定制。如果我们要修改只能手动的使用其他工具来修改,我们也可以添加Application Page,必须放在C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS目录下,它对应的虚拟路径为_layouts。所有的Application Page都使用application.master这个母版页,我们自定义的Application Page也是一样,可以使用内嵌代码也可以使用后置代码。自定义的application page继承自LayoutsPageBase类,下面我们就来做两个自定义的Application Page,下面是项目的结构:
Feature.xml中代码如下:
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="86689158-7048-4421-AD21-E0DEF0D67C81"
Title="自定义ApplicationPage"
Description="使用SPTreeViw演示自定义ApplicationPage"
Version="1.0.0.0"
Scope="Web"
Hidden="FALSE"
ImageUrl="TPG\PithHelmet.gif"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml" />
</ElementManifests>
</Feature>
ApplicationPage1.aspx和ApplicationPage2.aspx就是我们自定义的Application Page,ApplicationPage1.aspx演示的是在一个列表库的列表项的编辑菜单里出现一个链接,统计该列表的信息,如下图:
要添加此菜单须在Elements.xml中填加如下代码:
<CustomAction Id="CustomApplicationPage1"
RegistrationType="List"
RegistrationId="101"
ImageUrl="/_layouts/images/GORTL.GIF"
Location="EditControlBlock"
Sequence="240"
Title="此文档库信息" >
<UrlAction Url="~site/_layouts/CustomApplicationPages/ApplicationPage1.aspx?ItemId={ItemId}&ListId={ListId}"/>
</CustomAction>
RegistrationType="List":代表注册的类型是列表.
Location="EditControlBlock":代表菜单将出现在控件编辑项当中.
UrlAction 是它的链接,URL中的ItemId 和ListId是通过 QueryString得到的。
ApplicationPage1.cs中代码如下:
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace CustomApplicationPages
{
public class ApplicationPage1 : LayoutsPageBase
{
protected Label lblSiteTitle;
protected Label lblSiteID;
protected Label lblSiteUrl;
protected Label lblListID;
protected Label lblListTile;
protected Label lblRootFolderUrl;
protected Label lblDocumentID;
protected Label lblDocumentName;
protected Label lblDocumentUrl;
protected Label lblDocumentTemplateUrl;
protected Label lblFileAuthor;
protected Label lblFileSize;
protected Label lblFileLastModified;
protected Label lblFileCheckOutStatus;
protected override void OnLoad(EventArgs e)
{
SPSite siteCollection = this.Site;
SPWeb site = this.Web;
lblSiteTitle.Text = site.Title;
lblSiteUrl.Text = site.Url.ToLower();
string ListId = Request.QueryString["ListId"];
lblListID.Text = ListId;
SPList list = site.Lists[new Guid(ListId)];
lblListTile.Text = list.Title;
lblRootFolderUrl.Text = list.RootFolder.Url;
string ItemId = Request.QueryString["ItemId"];
lblDocumentID.Text = ItemId;
SPListItem item = list.Items.GetItemById(Convert.ToInt32(ItemId));
lblDocumentName.Text = item.Name;
lblDocumentUrl.Text = item.Url;
if (list is SPDocumentLibrary)
{
SPDocumentLibrary documentLibrary = (SPDocumentLibrary)list;
lblDocumentTemplateUrl.Text = documentLibrary.DocumentTemplateUrl;
SPFile file = site.GetFile(item.Url);
lblFileAuthor.Text = file.Author.Name;
lblFileSize.Text = file.TotalLength.ToString("0,###") + " bits";
lblFileLastModified.Text = "By " + file.ModifiedBy.Name +
" on " + file.TimeLastModified.ToLocalTime().ToString();
lblFileCheckOutStatus.Text = file.CheckOutStatus.ToString();
}
}
}
}
结果如下图:
ApplicationPage2.aspx中我们使用控件SPTreeView来显示该站点的文件夹结构,我们将菜单添加到“网站操作“中,并且设置只有管理员权限才可以看到,如下图:
Elements.xml中填加如下代码:
<CustomAction Id="CustomApplicationPage2"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="2006"
Title="获取站点信息"
Description="使用SPTreeView获取站点信息"
RequireSiteAdministrator="True">
<UrlAction Url="~site/_layouts/CustomApplicationPages/ApplicationPage2.aspx"/>
</CustomAction>
RequireSiteAdministrator="True":改属性说明该项操作只有拥有管理员权限的用户才可以操作
ApplicationPage2.cs中代码如下:
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace CustomApplicationPages
{
public class ApplicationPage2 : LayoutsPageBase
{
protected SPTreeView treeSitesFiles;
const string siteImg = @"\_layouts\images\FPWEB16.GIF";
const string foloerImg = @"\_layouts\images\FOLDER16.GIF";
const string ghostedFileImg = @"\_layouts\images\NEWDOC.GIF";
const string unGhostedFileImg = @"\_layouts\images\RAT16.GIF";
protected override void OnLoad(EventArgs e)
{
SPWeb site = SPContext.Current.Web;
SPFolder rootFolder = site.RootFolder;
TreeNode rootNode = new TreeNode(site.Url, site.Url, siteImg);
LoadFolderNodes(rootFolder, rootNode);
treeSitesFiles.Nodes.Add(rootNode);
treeSitesFiles.ExpandDepth = 1;
}
protected void LoadFolderNodes(SPFolder folder, TreeNode folderNode)
{
foreach (SPFolder childFolder in folder.SubFolders)
{
TreeNode childFolderNode = new TreeNode(childFolder.Name, childFolder.Name, foloerImg);
childFolderNode.NavigateUrl = Site.MakeFullUrl(childFolder.Url);
LoadFolderNodes(childFolder, childFolderNode);
folderNode.ChildNodes.Add(childFolderNode);
}
foreach (SPFile file in folder.Files)
{
TreeNode fileNode;
if (file.CustomizedPageStatus == SPCustomizedPageStatus.Uncustomized)
{
fileNode = new TreeNode(file.Name, file.Name, ghostedFileImg);
}
else
{
fileNode = new TreeNode(file.Name, file.Name, unGhostedFileImg);
}
fileNode.NavigateUrl = Site.MakeFullUrl(file.Url);
folderNode.ChildNodes.Add(fileNode);
}
}
}
}
效果如下图:
如何调试:
1.修改当前web应用程序的配置文件如下:
<configuration>
<SharePoint>
<SafeMode CallStack="true" />
</SharePoint>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
2.然后附加w3wp进程,设置断点即可调试了。
发表评论
-
平淡的2007
2007-12-24 08:04 784早上起来,送女朋友去公交车站,然后回来赶紧打开电脑,先 ... -
DreamSpark发布,高校学生免费使用Visual Studio 2008 Professional Edition 等微软软件
2008-02-20 13:23 1380今天上网无意中搜索到学生可以免费使用VS2008专业版,后来又 ... -
坚持学习WF(1):从HelloWorld开始
2008-04-04 16:30 849[置顶]坚持学习WF文章索 ... -
坚持学习WF(2):WF创作模式和设计时工具
2008-04-05 17:19 599[置顶]坚持学习WF文章索 ... -
坚持学习WF(3):WF框架概览
2008-04-08 07:27 736[置顶]坚持学习WF文章索 ... -
坚持学习WF(4):活动(Activity)和依赖属性(DependencyProperty)
2008-04-12 00:01 1102[置顶]坚持学习WF文章索引 活动(Activity) 活动 ... -
坚持学习WF(5):自定义活动(CustomActivity)
2008-04-13 15:25 881当WF提供的标准活动不能满足我们的需求的时候,我们就需要定义自 ... -
MOSS点滴(1):如何开发和部署feature
2008-04-16 21:35 806Features 是MOSS 2007以开箱即用的一套新功能, ... -
坚持学习WF(6):开发可复用的宿主程序
2008-04-21 21:45 660我们之前写工作流宿主 ... -
MOSS点滴(3):说说MOSS中的母版页
2008-04-25 21:15 1135MOSS中有两种页面:Site P ... -
MOSS点滴(4):实现Form认证
2008-04-29 21:12 666本文主要参考了网上的一些文章,但有些文章有些地方说的不是很明确 ... -
坚持学习WF(7):流程控制(Flow Control)
2008-04-30 18:10 772本文主要说说WF中和流 ... -
坚持学习WF(8):本地服务之调用外部方法
2008-05-09 08:17 718WF提供了一组核心服务 ... -
MOSS中的WebPart开发
2008-05-10 13:53 1024由于在asp.net1.1的时候asp.net中还没有webp ... -
坚持学习WF(9):本地服务之事件处理
2008-05-28 07:49 764[置顶]坚持学习WF文章索引 一:先来介绍两个活动 Even ... -
坚持学习WF(10):在工作流中使用关联
2008-06-01 13:03 658[置顶]坚持学习WF文章索 ... -
坚持学习WF(11):工作流通信与队列
2008-06-07 15:45 692[置顶]坚持学习WF文章索引 WF 提供的通信模型是构建于 ... -
MOSS中创建自定义内容类型
2008-06-12 20:23 1068一:简要介绍 某类内容 ... -
.NET中IDisposable接口的基本使用
2008-06-15 12:01 908首先来看MSDN中关于这个接口的说明: [ComVisible ... -
坚持学习WF(12):使用EventHandlingScopeActivity活动
2008-06-18 22:46 639[置顶]坚持学习WF文章索引 EventHandlingSco ...
相关推荐
MOSS2010列表添加自定义下拉菜单 MOSS2010列表添加自定义下拉菜单
moss/sharpoint 2007 自定义web控件流程
Moss+自定义Feature Moss+自定义Feature Moss+自定义FeatureMoss+自定义FeatureMoss+自定义FeatureMoss+自定义FeatureMoss+自定义Feature
moss自定义登陆页面 微软的Sharepoint2007中允许使用表单认证,但是使用表单认证后默认的登录页面使用起来想当的无趣。如果你只是在内部使用 Sharepoint,那就无所谓登录页面了,因为这个时候你可能在使用windows...
我也是刚刚开始学习Moss,本实例是关于moss中自定义的左侧导航,里面的使用说明写的很清楚。对于初学者来说是个不错的东东。
moss.py 的Python客户端:用于检测软件相似性的系统介绍它是客户端的Python接口。 它是为编写的,用于处理Python作业提交中的相似性。 它是使用及其方言。安装pip install mosspy用法 import mosspyuserid = ...
||苔藓翻译Moss是一种动态编程语言。它的解释器内核是用Rust编写的。从Rust调用Moss代码的示例: use moss :: object :: Object;fn main () { let i = moss :: Interpreter :: new (); i.rte. set ( "a" ,Object :: ...
moss 自定义内容类型 转载的www.cnblogs.com/carysun
MOSS提交分析组件 此组件支持将课程库系统的提交发送到MOSS(软件相似性度量)系统,以检测不当复制。 有关使用cl / moss组件的更多详细信息,请参见。 MOSS组件取决于分类/课程,并向提交系统添加功能。 安装: ...
苔藓地区 处理翻译、格式和内容的基本工具。 语言环境 处理语言环境名称、时区和货币子单位的类。 $ locale = new Locale ( 'en_GB' , 'UTC' , 100 ); echo $ locale -> locale (); // will print "en_GB" ...
开发环境:moss2007 vs2008
但是,在使用示例的指定user_id的情况下,您可以毫无问题地访问MOSS服务器(MOSS对每个人都是公开的,但并非总是如此,也许这个要求实际上并不是更多要求)。 什么是苔藓? Moss(用于度量软件相似性)是一种用于...
它将打开一个示例数据文件Moss Results.html ,可以直接从网站保存该文件。 可视化 此标准节点链接图是使用实现的。 每个节点都是一个带有其文件名的提交。 一条边链接了两个提交,这些提交比所有提交对的马氏线的...
moss-monitor 项目设置 npm install 编译和热重装以进行开发 npm run serve 编译并最小化生产 npm run build 运行单元测试 npm run test:unit 运行端到端测试 npm run test:e2e 整理和修复文件 npm run lint 自定义...
通过自定义MOSS服务来指定网站及列表,自动生成infopath表单唤起工作流。
MOSS2007基础教程讲解,适用于入门级用户查看
moss 2007开发教程,moss 2007开发教程(1).MOSS2007之概述
Microsoft.SharePoint.Building.Office.2007.Solutions.in.C.Sharp.2005.精品MOSS2007学习资料.
为ChatGPT/ChatGLM/LLaMA/StableLM/MOSS等多种LLM提供了一个轻快好用的Web图形界面。 使用System Prompt可以很有效地设定前提条件。 使用Prompt模板功能时,选择Prompt模板集合文件,然后从下拉菜单中选择想要的...