Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentEditorWebPart.cs URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentEditorWebPart.cs?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentEditorWebPart.cs (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentEditorWebPart.cs Fri Nov 28 08:44:28 2014 @@ -0,0 +1,246 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web.UI; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.WebControls; +using System.Configuration; +using Microsoft.SharePoint; + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +namespace CMIS.Sharepoint2010.WebParts.Documents +{ + class DocumentEditorWebPart : EditorPart + { + + //private string _cmisInitialObjectID = ""; + //private string _cmisInitialPath = ""; + //private string _cmisInitialQuery = ""; + //private string _cmisInitialMaxItems = ""; + //private string _cmisOnlyCheckedOutDocuments = ""; + + protected Documents ParentWebPart { get; set; } + private DropDownList CMISConnectionChoices { get; set; } + //protected ConnectionStringSettingsCollection cs = new ConnectionStringSettingsCollection(); + private TextBox CMISInitialObjectID { get; set; } + private TextBox CMISInitialPath { get; set; } + private TextBox CMISInitialQuery { get; set; } + private TextBox CMISInitialMaxItems { get; set; } + private CheckBox CMISOnlyCheckedOutDocuments { get; set; } + //private Panel m_editorPanel; + + public DocumentEditorWebPart() + { + Title = "CMIS Connections"; + } + + /// <summary> + /// Creates the controls + /// </summary> + protected override void CreateChildControls() + { + Utility.msg("CMIS.Documents:CreateChildControls", Microsoft.SharePoint.Administration.TraceSeverity.High); + + + + CMISConnectionChoices = new DropDownList(); + CMISInitialObjectID = new TextBox(); + CMISInitialPath = new TextBox(); + CMISInitialQuery = new TextBox(); + CMISInitialMaxItems = new TextBox(); + CMISOnlyCheckedOutDocuments = new CheckBox(); + + //CMISConnectionChoices.Items.Add(new ListItem("AAA", "1")); + + //cs.Clear(); + //foreach (ConnectionStringSettings c in System.Configuration.ConfigurationManager.ConnectionStrings) + //{ + // if (c.ProviderName!=null && c.ProviderName.ToUpper().Equals("CMIS")) + // { + // cs.Add(c); + // CMISConnectionChoices.Items.Add(new ListItem(c.Name, c.Name)); + // } + //} + loadConnections(); + + + //m_editorPanel = new Panel(); + //m_editorPanel.CssClass = "ms-ToolPartSpacing"; + //m_editorPanel.Visible = true; + //m_editorPanel.Width = 200; + //m_editorPanel.Height = 300; + //m_editorPanel.ID = "MyPanel"; + //m_editorPanel.Controls.Add(new LiteralControl("<div class='UserSectionHead'>CMIS Library</div>")); + //m_editorPanel.Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + //m_editorPanel.Controls.Add(CMISConnectionChoices); + //m_editorPanel.Controls.Add(new LiteralControl("</nobr></div></div>")); + //Controls.Add(m_editorPanel); + Controls.Add(new LiteralControl("<div class='UserSectionHead'>CMIS Library</div>")); + Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + Controls.Add(CMISConnectionChoices); + Controls.Add(new LiteralControl("</nobr></div></div>")); + Controls.Add(new LiteralControl("<div class='UserSectionHead'>Initial Object ID</div>")); + Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + Controls.Add(CMISInitialObjectID); + Controls.Add(new LiteralControl("</nobr></div></div>")); + Controls.Add(new LiteralControl("<div class='UserSectionHead'>Initial Path</div>")); + Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + Controls.Add(CMISInitialPath); + Controls.Add(new LiteralControl("</nobr></div></div>")); + Controls.Add(new LiteralControl("<div class='UserSectionHead'>Initial Query</div>")); + Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + Controls.Add(CMISInitialQuery); + Controls.Add(new LiteralControl("</nobr></div></div>")); + Controls.Add(new LiteralControl("<div class='UserSectionHead'>Initial Max Items</div>")); + Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + Controls.Add(CMISInitialMaxItems); + Controls.Add(new LiteralControl("</nobr></div></div>")); + Controls.Add(new LiteralControl("<div class='UserSectionHead'>Only Checked Out Documents</div>")); + Controls.Add(new LiteralControl("<div class='UserSectionBody'><div class='UserControlGroup'><nobr>")); + Controls.Add(CMISOnlyCheckedOutDocuments); + Controls.Add(new LiteralControl("</nobr></div></div>")); + + base.CreateChildControls(); + + ChildControlsCreated = true; + } + + + protected override void Render(HtmlTextWriter writer) + { + Utility.msg("CMIS.Documents:Render", Microsoft.SharePoint.Administration.TraceSeverity.High); + EnsureChildControls(); + base.Render(writer); + } + + /// <summary> + /// Reads current value from parent web part and show that in the ddl + /// </summary> + public override void SyncChanges() + { + //Utility.msg("CMIS.Documents:SyncChanges", Microsoft.SharePoint.Administration.TraceSeverity.High); + EnsureChildControls(); + ParentWebPart = WebPartToEdit as Documents; + + if (ParentWebPart != null && WebPartManager.Personalization.Scope == PersonalizationScope.Shared) + { + ListItem item = CMISConnectionChoices.Items.FindByValue(ParentWebPart.CMISConnectionName); + if (item != null) item.Selected = true; + CMISInitialObjectID.Text = (ParentWebPart.CMISInitialObjectID == null ? "" : ParentWebPart.CMISInitialObjectID); + CMISInitialPath.Text = (ParentWebPart.CMISInitialPath == null ? "" : ParentWebPart.CMISInitialPath); + CMISInitialQuery.Text = (ParentWebPart.CMISInitialQuery == null ? "" : ParentWebPart.CMISInitialQuery); + CMISInitialMaxItems.Text = (ParentWebPart.CMISInitialMaxItems == null ? "" : ParentWebPart.CMISInitialMaxItems); + CMISOnlyCheckedOutDocuments.Checked = ParentWebPart.CMISOnlyCheckedOutDocuments; + } + } + + /// <summary> + /// Applies change in editor part ddl to the parent web part + /// </summary> + /// <returns></returns> + public override bool ApplyChanges() + { + //Utility.msg("CMIS.Documents:ApplyChanges", Microsoft.SharePoint.Administration.TraceSeverity.High); + try + { + EnsureChildControls(); + ParentWebPart = WebPartToEdit as Documents; + + if (ParentWebPart != null && WebPartManager.Personalization.Scope == PersonalizationScope.Shared) + { + ParentWebPart.CMISConnectionName = CMISConnectionChoices.SelectedValue; + ParentWebPart.CMISInitialObjectID = CMISInitialObjectID.Text; + ParentWebPart.CMISInitialPath = CMISInitialPath.Text; + ParentWebPart.CMISInitialQuery = CMISInitialQuery.Text; + ParentWebPart.CMISInitialMaxItems = CMISInitialMaxItems.Text; + ParentWebPart.CMISOnlyCheckedOutDocuments = CMISOnlyCheckedOutDocuments.Checked; + //Utility.msg("CMID:ParentWebPart.CMISConnectionName = " + ParentWebPart.CMISConnectionName, Microsoft.SharePoint.Administration.TraceSeverity.High); + //Utility.msg("CMID:cs.length = " + cs.Count, Microsoft.SharePoint.Administration.TraceSeverity.High); + //foreach (ConnectionStringSettings c in cs) + //{ + // Utility.msg("CMID:c.Name = " + c.Name, Microsoft.SharePoint.Administration.TraceSeverity.High); + // if (c.Name.Equals(ParentWebPart.CMISConnectionName)) + // { + // string[] a = c.ConnectionString.Split(';'); + // Utility.msg("CMID:a.Length = " + a.Length, Microsoft.SharePoint.Administration.TraceSeverity.High); + // ParentWebPart.CMISConnectionUrl = ""; + // ParentWebPart.CMISConnectionUser = ""; + // ParentWebPart.CMISConnectionPassword = ""; + // foreach (string s in a) + // { + // Utility.msg("CMID:s = " + s, Microsoft.SharePoint.Administration.TraceSeverity.High); + // if (s.Contains("=")) + // { + // Utility.msg("CMID:contains=", Microsoft.SharePoint.Administration.TraceSeverity.High); + // string key = s.Trim().Split('=')[0].Trim(); + // string value = s.Trim().Split('=')[1].Trim(); + // Utility.msg("CMID:key = " + value, Microsoft.SharePoint.Administration.TraceSeverity.High); + // Utility.msg("CMID:value = " + value, Microsoft.SharePoint.Administration.TraceSeverity.High); + // if (key.ToUpper().Equals("URL")) ParentWebPart.CMISConnectionUrl = value; + // if (key.ToUpper().Equals("USERNAME")) ParentWebPart.CMISConnectionUser = value; + // if (key.ToUpper().Equals("PASSWORD")) ParentWebPart.CMISConnectionPassword = value; + // } + // } + // break; + // } + //} + } + // The operation was succesful + return true; + } + catch (Exception e) + { + //Utility.msg("CMIS.Documents:Exeption: " + e.Message, Microsoft.SharePoint.Administration.TraceSeverity.High); + System.Diagnostics.Debug.WriteLine("Exeption: " + e.Message); + // Because an error has occurred, the SyncChanges() method wonât be invoked. + return false; + } + } + + protected void loadConnections() + { + try + { + + StringBuilder s = new StringBuilder(); + int i = 0; + using (SPSite siteCollection = new SPSite(SPContext.Current.Web.Url)) + { + using (SPWeb web = siteCollection.OpenWeb()) + { + SPListItemCollection iColl = web.Lists["CMIS Connections"].Items; + foreach (SPListItem item in iColl) + { + CMISConnectionChoices.Items.Add(new ListItem(item["Title"].ToString(), item["Title"].ToString())); + } + } + } + } + catch (Exception ex) + { + //Utility.msg("CMIS.BrowserEditorWebPart.LoadConnection:Exception: " + ex.Message, Microsoft.SharePoint.Administration.TraceSeverity.High); + throw new Exception("CMIS.BrowserEditorWebPart.LoadConnection:Exception: " + ex.Message); + } + } + + } +}
Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.cs URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.cs?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.cs (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.cs Fri Nov 28 08:44:28 2014 @@ -0,0 +1,268 @@ +using System; +using System.ComponentModel; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using Microsoft.SharePoint; +using Microsoft.SharePoint.WebControls; +using System.Linq; +using System.Collections.Generic; +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +namespace CMIS.Sharepoint2010.WebParts.Documents +{ + [ToolboxItemAttribute(false)] + public partial class Documents : WebPart, IWebEditable + { + // Visual Studio might automatically update this path when you change the Visual Web Part project item. + private const string _ascxPath = @"~/_CONTROLTEMPLATES/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx"; + + private string _pageTitle; + private string _cmisConnectionName = ""; + private string _cmisConnectionUrl = ""; + private string _cmisConnectionUser = ""; + private string _cmisConnectionPassword = ""; + + private string _cmisInitialObjectID = ""; + private string _cmisInitialPath = ""; + private string _cmisInitialQuery = ""; + private string _cmisInitialMaxItems = ""; + private bool _cmisOnlyCheckedOutDocuments = false; + + [WebBrowsable(true), + WebDisplayName("My TextBox"), + WebDescription("TextBox Description"), + Category("My Category"), + Personalizable(PersonalizationScope.Shared), + DefaultValue("Default")] + public string PageTitle + { + get + { + return _pageTitle; + } + set + { + _pageTitle = value; + } + } + + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISConnectionName + { + get + { + return _cmisConnectionName; + } + set + { + _cmisConnectionName = value; + } + } + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISConnectionUrl + { + get + { + return _cmisConnectionUrl; + } + set + { + _cmisConnectionUrl = value; + } + } + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISConnectionUser + { + get + { + return _cmisConnectionUser; + } + set + { + _cmisConnectionUser = value; + } + } + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISConnectionPassword + { + get + { + return _cmisConnectionPassword; + } + set + { + _cmisConnectionPassword = value; + } + } + + + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISInitialObjectID + { + get + { + return _cmisInitialObjectID; + } + set + { + _cmisInitialObjectID = value; + } + } + + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISInitialPath + { + get + { + return _cmisInitialPath; + } + set + { + _cmisInitialPath = value; + } + } + + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISInitialQuery + { + get + { + return _cmisInitialQuery; + } + set + { + _cmisInitialQuery = value; + } + } + + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue("")] + public string CMISInitialMaxItems + { + get + { + return _cmisInitialMaxItems; + } + set + { + _cmisInitialMaxItems = value; + } + } + + // Hide the property so it will not show in toolpane + [WebBrowsable(false), + Personalizable(PersonalizationScope.Shared), + DefaultValue(false)] + public bool CMISOnlyCheckedOutDocuments + { + get + { + return _cmisOnlyCheckedOutDocuments; + } + set + { + _cmisOnlyCheckedOutDocuments = value; + } + } + private DocumentsUserControl control; + + protected override void CreateChildControls() + { + control = (DocumentsUserControl) Page.LoadControl(_ascxPath); + control.ParentWebPart = this; + Controls.Add(control); + } + protected override void OnPreRender(EventArgs e) + { + base.OnPreRender(e); + Utility.msg("CMIS Documents.OnPreRender:CMISConnectionName = " + CMISConnectionName, Microsoft.SharePoint.Administration.TraceSeverity.High); + + string webPartPropertiesJSON = string.Empty; + if (CMISConnectionName != null && CMISConnectionName.Length > 0) + { + + using (SPSite siteCollection = new SPSite(SPContext.Current.Web.Url)) + { + using (SPWeb web = siteCollection.OpenWeb()) + { + Utility.msg("CMIS Documents.OnPreRender:web = " + web.Url, Microsoft.SharePoint.Administration.TraceSeverity.High); + SPListItemCollection iColl = web.Lists["CMIS Connections"].Items; + foreach (SPListItem item in iColl) + { + if (item["Title"].ToString().Equals(CMISConnectionName)) + { + CMISConnectionUrl = (item["Url"] != null ? item["Url"].ToString() : ""); + CMISConnectionUser = (item["UserName"] != null ? item["UserName"].ToString() : ""); + CMISConnectionPassword = (item["Password"] != null ? item["Password"].ToString() : ""); + } + } + } + } + + webPartPropertiesJSON = "{ 'ConnectionName': '" + CMISConnectionName + "', 'Url': '" + CMISConnectionUrl + "', 'Username': '" + CMISConnectionUser + "', 'Password': '" + CMISConnectionPassword + "', 'InitialObjectID': '" + (CMISInitialObjectID == null ? "" : CMISInitialObjectID) + "', 'InitialPath': '" + (CMISInitialPath == null ? "" : CMISInitialPath) + "', 'InitialQuery': '" + (CMISInitialQuery == null ? "" : CMISInitialQuery) + "', 'InitialMaxItems': '" + (CMISInitialMaxItems == null ? "" : CMISInitialMaxItems) + "', 'OnlyCheckedOutDocuments': '" + CMISOnlyCheckedOutDocuments + "' }"; + + } + else + { + webPartPropertiesJSON = "{ 'ConnectionName': '', 'Url': '', 'Username': '', 'Password': '', 'InitialObjectID': '" + (CMISInitialObjectID == null ? "" : CMISInitialObjectID) + "', 'InitialPath': '" + (CMISInitialPath == null ? "" : CMISInitialPath) + "', 'InitialQuery': '" + (CMISInitialQuery == null ? "" : CMISInitialQuery) + "', 'InitialMaxItems': '" + (CMISInitialMaxItems == null ? "" : CMISInitialMaxItems) + "', 'OnlyCheckedOutDocuments': '" + CMISOnlyCheckedOutDocuments + "' }"; + } + ((HiddenField)control.FindControl("DocumentWebPartProperties")).Value = webPartPropertiesJSON; + //((HiddenField)this.FindControl("DocumentsUserControl").FindControl("DocumentWebPartProperties")).Value = webPartPropertiesJSON; + } + + EditorPartCollection IWebEditable.CreateEditorParts() + { + var editors = new List<EditorPart>(); + DocumentEditorWebPart editorPart = new DocumentEditorWebPart(); + editorPart.ID = ID + "_editorPart"; + editors.Add(editorPart); + return new EditorPartCollection(editors); + } + + object IWebEditable.WebBrowsableObject + { + get { return this; } + } + } +} Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.webpart URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.webpart?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.webpart (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Documents.webpart Fri Nov 28 08:44:28 2014 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<webParts> + <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> + <metaData> + <type name="CMIS.Sharepoint2010.WebParts.Documents.Documents, $SharePoint.Project.AssemblyFullName$" /> + <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage> + </metaData> + <data> + <properties> + <property name="Title" type="string">Documents</property> + <property name="Description" type="string">This component can be used to display documents stored in a CMIS 1.1 compliant repository. It includes features to view properties and versions, to download, upload, check-in/check-out or delete documents. A previewer is also included for PDF documents.</property> + </properties> + </data> + </webPart> +</webParts> Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx Fri Nov 28 08:44:28 2014 @@ -0,0 +1,106 @@ +<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %> +<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> +<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> +<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> +<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> +<%@ Import Namespace="Microsoft.SharePoint" %> +<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DocumentsUserControl.ascx.cs" Inherits="CMIS.Sharepoint2010.WebParts.Documents.DocumentsUserControl" %> +<html> +<head> +<meta charset="utf-8"> +<title>Documents</title> + +<!-- CMIS Dependencies --> +<SharePoint:ScriptLink ID="JQueryLib" runat="server" Name="~SiteCollection/SiteAssets/dependencies/jquery-1.11.1.min.js" /> +<SharePoint:ScriptLink ID="CMISLib" runat="server" Name="~SiteCollection/SiteAssets/lib/cmis.js" /> +<SharePoint:ScriptLink ID="LibraryJS" runat="server" Name="~SiteCollection/SiteAssets/library/library.js" /> +<asp:literal ID="LibraryCSS" runat="server" Text="<link href='"/><SharePoint:ProjectProperty ID="ProjectProperty2" Property="SiteUrl" runat="server" /><asp:literal ID="Literal4" runat="server" Text="/SiteAssets/library/library.css' rel='stylesheet' type='text/css'/>"/> +<SharePoint:ScriptLink ID="CMISWebPartsLib" runat="server" Name="~SiteCollection/SiteAssets/dependencies/cmiswebparts.js" /> + + +<!-- Secured Storage Dependencies --> +<SharePoint:ScriptLink ID="AES" runat="server" Name="~SiteCollection/SiteAssets/credentials/aes.js" /> +<SharePoint:ScriptLink ID="SPServices" runat="server" Name="~SiteCollection/SiteAssets/credentials/jquery.SPServices-2014.01.min.js" /> +<SharePoint:ScriptLink ID="MicrosoftAjax" runat="server" Name="~SiteCollection/SiteAssets/credentials/MicrosoftAjax.js" /> +<SharePoint:ScriptLink ID="SiteUserCredentials" runat="server" Name="~SiteCollection/SiteAssets/credentials/siteusercredentials.js" /> + +</head> +<body> + + <div id="library" class="cmislibrary"></div> + <asp:HiddenField ID="DocumentWebPartProperties" Value="" runat="server" /> + + <script type="text/javascript"> + + var hiddenField = document.getElementById("<%=DocumentWebPartProperties.ClientID%>"); + if (hiddenField != undefined && hiddenField != null) { + webpartProperies = eval("(" + hiddenField.value + ")"); + } + + var maxItems = parseInt(webpartProperies.InitialMaxItems); + if (maxItems == NaN) + maxItems = 20; + + var query = null; + if (webpartProperies.InitialQuery.length > 0) + query = webpartProperies.InitialQuery; + + var initPath = null; + if (webpartProperies.InitialPath.length > 0) + initPath = webpartProperies.InitialPath; + + var initObjectId = null; + if (webpartProperies.InitialObjectID.length > 0) + initObjectId = webpartProperies.InitialObjectID; + + var autoLoad = false; + if (webpartProperies.InitialPath.length > 0 || webpartProperies.InitialObjectID.length > 0 || webpartProperies.InitialQuery.length > 0 || webpartProperies.OnlyCheckedOutDocuments == "True") + autoLoad = true; + + var documentsOptions = { + cmis: { + serverUrl: webpartProperies.Url, + username: webpartProperies.Username, + password: webpartProperies.Password, + initObjectId: initObjectId, + initPath: initPath, + initQuery: query + }, + autoLoad: autoLoad, + maxItems: maxItems, + showOnlyCheckedOutDocs: webpartProperies.OnlyCheckedOutDocuments == "True", + }; + + // Override if an object has been created in the windows + if (typeof cmisDocumentsOptions !== 'undefined') + $.extend(true, documentsOptions, cmisDocumentsOptions); + + ExecuteOrDelayUntilScriptLoaded(function() { + var library = $("#library").cmislibrary(documentsOptions); + }, "sp.js"); + + </script> + <!-- + /** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + --> +</body> + +</html> \ No newline at end of file Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.cs URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.cs?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.cs (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.cs Fri Nov 28 08:44:28 2014 @@ -0,0 +1,19 @@ +using System; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; + +namespace CMIS.Sharepoint2010.WebParts.Documents +{ + public partial class DocumentsUserControl : UserControl + { + public Documents ParentWebPart + { + get; + set; + } + protected void Page_Load(object sender, EventArgs e) + { + } + } +} Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.designer.cs URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.designer.cs?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.designer.cs (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/DocumentsUserControl.ascx.designer.cs Fri Nov 28 08:44:28 2014 @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace CMIS.Sharepoint2010.WebParts.Documents { + + + public partial class DocumentsUserControl { + + /// <summary> + /// JQueryLib control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink JQueryLib; + + /// <summary> + /// CMISLib control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink CMISLib; + + /// <summary> + /// LibraryJS control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink LibraryJS; + + /// <summary> + /// LibraryCSS control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::System.Web.UI.WebControls.Literal LibraryCSS; + + /// <summary> + /// ProjectProperty2 control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ProjectProperty ProjectProperty2; + + /// <summary> + /// Literal4 control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::System.Web.UI.WebControls.Literal Literal4; + + /// <summary> + /// CMISWebPartsLib control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink CMISWebPartsLib; + + /// <summary> + /// AES control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink AES; + + /// <summary> + /// SPServices control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink SPServices; + + /// <summary> + /// MicrosoftAjax control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink MicrosoftAjax; + + /// <summary> + /// SiteUserCredentials control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::Microsoft.SharePoint.WebControls.ScriptLink SiteUserCredentials; + + /// <summary> + /// DocumentWebPartProperties control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::System.Web.UI.WebControls.HiddenField DocumentWebPartProperties; + } +} Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Elements.xml URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Elements.xml?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Elements.xml (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Elements.xml Fri Nov 28 08:44:28 2014 @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Elements xmlns="http://schemas.microsoft.com/sharepoint/" > + <Module Name="Documents" List="113" Url="_catalogs/wp"> + <File Path="Documents\Documents.webpart" Url="CMIS.Sharepoint2010.WebParts_Documents.webpart" Type="GhostableInLibrary" > + <Property Name="Group" Value="CMIS WebParts" /> + </File> + </Module> +</Elements> Propchange: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/Elements.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/SharePointProjectItem.spdata URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/SharePointProjectItem.spdata?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/SharePointProjectItem.spdata (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Documents/SharePointProjectItem.spdata Fri Nov 28 08:44:28 2014 @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<ProjectItem Type="Microsoft.VisualStudio.SharePoint.VisualWebPart" DefaultFile="DocumentsUserControl.ascx" SupportedTrustLevels="FullTrust" SupportedDeploymentScopes="Site" xmlns="http://schemas.microsoft.com/VisualStudio/2010/SharePointTools/SharePointProjectItemModel"> + <Files> + <ProjectItemFile Source="Elements.xml" Target="Documents\" Type="ElementManifest" /> + <ProjectItemFile Source="Documents.webpart" Target="Documents\" Type="ElementFile" /> + <ProjectItemFile Source="DocumentsUserControl.ascx" Target="CONTROLTEMPLATES\CMIS.Sharepoint2010.WebParts\Documents\" Type="TemplateFile" /> + </Files> + <SafeControls> + <SafeControl Name="SafeControlEntry1" Assembly="$SharePoint.Project.AssemblyFullName$" Namespace="CMIS.Sharepoint2010.WebParts.Documents" TypeName="*" IsSafe="true" IsSafeAgainstScript="false" /> + </SafeControls> +</ProjectItem> \ No newline at end of file Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.Template.xml URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.Template.xml?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.Template.xml (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.Template.xml Fri Nov 28 08:44:28 2014 @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8" ?> +<Feature xmlns="http://schemas.microsoft.com/sharepoint/"> +</Feature> \ No newline at end of file Propchange: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.Template.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.feature URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.feature?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.feature (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Features/Components/Components.feature Fri Nov 28 08:44:28 2014 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<feature xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="6ef4dfed-9473-4737-b103-e998985aeaef" description="Provisions webparts and assets for CMIS integration" featureId="6ef4dfed-9473-4737-b103-e998985aeaef" imageUrl="" scope="Site" solutionId="00000000-0000-0000-0000-000000000000" title="CMIS.Sharepoint2010.WebParts Components" version="" deploymentPath="$SharePoint.Project.FileNameWithoutExtension$_$SharePoint.Feature.FileNameWithoutExtension$" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/FeatureModel"> + <projectItems> + <projectItemReference itemId="516c0792-c283-45d2-bbbb-7daee316b20b" /> + <projectItemReference itemId="7cf4cad4-d3c4-4850-9b98-9229f603e815" /> + <projectItemReference itemId="b8a2b1ab-659a-4dc8-8554-af3920182b36" projectPath="..\..\CMIS.Sharepoint2010.SiteAssets\CMIS.Sharepoint2010.SiteAssets\CMIS.Sharepoint2010.SiteAssets.csproj" /> + <projectItemReference itemId="766c0d35-171c-46df-a03f-98202c65eb82" /> + <projectItemReference itemId="350c8a7a-cacb-42ac-b38a-2e7c67726cc9" /> + </projectItems> +</feature> \ No newline at end of file Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.Template.xml URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.Template.xml?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.Template.xml (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.Template.xml Fri Nov 28 08:44:28 2014 @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?> +<Solution xmlns="http://schemas.microsoft.com/sharepoint/"> +</Solution> \ No newline at end of file Propchange: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.Template.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.package URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.package?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.package (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Package/Package.package Fri Nov 28 08:44:28 2014 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<package xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="9618152f-8148-4c90-9ced-92d6f5a7c786" solutionId="9618152f-8148-4c90-9ced-92d6f5a7c786" resetWebServer="false" name="CMIS.Sharepoint2010.WebParts" xmlns="http://schemas.microsoft.com/VisualStudio/2008/SharePointTools/PackageModel"> + <features> + <featureReference itemId="ce1a608a-df79-45e6-80fa-ba0088584a0e" /> + </features> +</package> \ No newline at end of file Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Properties/AssemblyInfo.cs URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Properties/AssemblyInfo.cs?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Properties/AssemblyInfo.cs (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Properties/AssemblyInfo.cs Fri Nov 28 08:44:28 2014 @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CMIS.Sharepoint2010.WebParts")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Amazon.com")] +[assembly: AssemblyProduct("CMIS.Sharepoint2010.WebParts")] +[assembly: AssemblyCopyright("Copyright © Amazon.com 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b8916234-5193-4085-85af-2288688d446c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Utility.cs URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Utility.cs?rev=1642272&view=auto ============================================================================== --- chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Utility.cs (added) +++ chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/Utility.cs Fri Nov 28 08:44:28 2014 @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.SharePoint.Administration; +using Microsoft.SharePoint; +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +namespace CMIS.Sharepoint2010.WebParts +{ + public static class Utility + { + /// <summary> + /// static method to send a message to the Sharepoint logs of a farm server + /// </summary> + public static void msg(string message, TraceSeverity severity) + { + // This will write a message to sharepoint logs + SPDiagnosticsService diagnosticsService = SPDiagnosticsService.Local; + SPDiagnosticsCategory cat = diagnosticsService.Areas["SharePoint Foundation"].Categories["General"]; + diagnosticsService.WriteTrace(1, cat, TraceSeverity.High, message, cat.Name, cat.Area.Name); + // This will write to the event log on window server...not every user can do this + //diagSvc.WriteEvent(0, new SPDiagnosticsCategory("KNRequirements", + // TraceSeverity.Monitorable, + // EventSeverity.Error), + // EventSeverity.Error, + // message); + } + /// <summary> + /// static method to send a message to the LogMessage list + /// </summary> + public static void logmsg(SPWeb web, string title, string category, string message) + { + try + { + web.AllowUnsafeUpdates = true; + // send to sharepoint logs + msg(title + "." + category + "." + message, TraceSeverity.Medium); + // send to LogMessage list on site + SPList list = web.Lists["CMIS Logs"]; + SPListItem item = list.AddItem(); + item["Title"] = title; + item["Category"] = category; + item["Message"] = message; + item.Update(); + web.AllowUnsafeUpdates = false; + } + catch (Exception e) + { + throw new SPException("EXCEPTION: " + e.Message); + // ignore exception if logging fails + } + finally + { + // ignore exception if logging fails + } + } + } +} Added: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/key.snk URL: http://svn.apache.org/viewvc/chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/key.snk?rev=1642272&view=auto ============================================================================== Binary file - no diff available. Propchange: chemistry/parts/trunk/sharepoint-projects/CMIS.Sharepoint2010.WebParts/CMIS.Sharepoint2010.WebParts/key.snk ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
