Affichage des articles dont le libellé est Design. Afficher tous les articles
Affichage des articles dont le libellé est Design. Afficher tous les articles

mardi 29 mars 2016

Use SharePoint icons in design/development


In my previous post we saw how to change default image used by sharepoint into standard masterpage or ribbon for example  (http://larry-microsoft-techno.blogspot.fr/2016/03/change-icons-used-for-sharepoint-2016.html)

In order to map icons to your design I just found this post by Eric :
http://ericoverfield.com/sharepoint-2013-spcommon-png-sprite-breakdown/

Thanks to him you can easily find which css code to use in order to include sharepoint icons into your masterpage or webparts.


vendredi 25 mars 2016

Change icons used for SharePoint 2016 and SharePoint 2016 (spcommon.png and fgimg.jpg)

Designer can easily change icons used for site by modifying the following sprite, one example if you want to have the ribbon in a dark colour the icons "share" "follow" are nearly invisible because they are gray. 
custom spcommon.png 
Once you've changed the image you can use the following css to override the image where they are used : 
img[src*="fgimg.png"]{ 
background-image:url("/_layouts/15/[YOUR-PROJECT]/fgimg-project.png"); 
width:0; 
height:0; 
padding:346.5px 90px; 
}

img[src*="spcommon.png"]{ 
background-image:url("/_layouts/15/[YOUR-PROJECT]/spcommon-project.png"); 
width:0; 
height:0;
padding:134px 135.5px;

jeudi 10 janvier 2013

Modifier les pages SharePoint par défaut. (AccessDenied.aspx, Confirmation.aspx, Error.aspx, Login.aspx, RequestAccess.aspx, Signout.aspx, WebDeleted.aspx)

Il est possible d'avoir de modifier l'url des pages suivantes et de les surcharger pour intégrer le design de l'entreprise :
  •  AccessDenied (Specifies AccessDenied.aspx)
  •  Confirmation (Specifies Confirmation.aspx)
  •  Error (Specifies Error.aspx)
  •  Login (Specifies Login.aspx)
  •  RequestAccess (Specifies ReqAcc.aspx)
  •  Signout (Specifies SignOut.aspx)
  •  WebDeleted (Specifies WebDeleted.aspx)
Avec les classes correspondantes se trouvant dans le namespace : 


Microsoft.SharePoint.ApplicationPages



Il est aussi nécéssaire de modifier la masterpage de votre page d'application par :

MasterPageFile="~/_layouts/simple.master"

Et d'hériter la classe correspondante 

UnsecuredLayoutsPageBase pour AccessDenied.aspx par exemple.




La modification de ces pages peut ensuite se faire de deux manières, soit par code C# :

SPWebApplication.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, 

"_layouts/MyAccessDenied.aspx);


Soit via powershell : 


Set-SPCustomLayoutsPage -Identity "AccessDenied" -RelativePath 

"/_layouts/MyAccessDenied.aspx" -WebApplication http://serveur 

Get-SPCustomLayoutsPage –Identity "AccessDenied" -WebApplication http://serveur 

iisreset


Voici une page complète d'une customisation simple de la page AccessDenied.aspx avec changement du lien 'Retour au site' par défaut : 



<%@ Assembly Name="Name, Version=1.0.0.0, Culture=neutral,PublicKeyToken=092c1c010b5e2820" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ 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" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AccessDenied.aspx.cs" Inherits="AccessDenied" MasterPageFile="~/_layouts/simple.master" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.Publishing" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (SPContext.Current != null && SPContext.Current.Web != null && SPContext.Current.Web.CurrentUser != null)
        {
            LabelUserName.Text = SPContext.Current.Web.CurrentUser.LoginName;
        }
     
        if (SPContext.Current != null && SPContext.Current.Web != null && SPContext.Current.Web.Site != null
            && SPContext.Current.Web.Site.WebApplication != null)
        {
         
            Page.ClientScript.RegisterStartupScript(this.GetType(), "click",
        "modifierRetour('" + SPContext.Current.Web.Site.WebApplication.Sites[0].Url + "');", true);
        }


   //     HLinkLoginAsAnother.Attributes.Add("onclick", "LoginAsAnother('\u002fsites\u002factuariat\u002f_layouts\u002fcloseConnection.aspx?loginasanotheruser=true', 1)");
    //    HLinkLoginAsAnother.NavigateUrl = "http://www.google.com/";
    }
    </script>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <style type="text/css"></style>
    <script type="text/javascript">
        function modifierRetour() {
            var backbutton = document.getElementById('ctl00_PlaceHolderGoBackLink_idSimpleGoBackToHome');

            if (backbutton != null) {
                backbutton.href = "javascript:history.back()"; // cacherBackToSite.arguments[0];
            }
        }
</script>
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
 
   <table border="0" cellpadding="0">
         <asp:Panel id="PanelUserName" runat="server">
         <tr>
       <td class="ms-sectionheader">
       <%--<img src="/_layouts/images/ListSet.gif" alt="" />--%>
       <SharePoint:EncodedLiteral ID="EncodedLiteral3" runat="server" text="<%$Resources:wss,accessDenied_currentuser%>" EncodeMethod='HtmlEncode'/>
       </td>
         </tr>
         <tr>
       <td valign="top" class="ms-descriptiontext"><SharePoint:EncodedLiteral ID="EncodedLiteral4" runat="server" text="<%$Resources:wss,accessDenied_loggedInAs%>" EncodeMethod='HtmlEncode'/>
       &#160;<b><asp:Label id="LabelUserName" runat="server"/></b>
       </td>
         </tr>
         </asp:Panel>
    </table>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
 <SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="Accès refusé au site demandé" EncodeMethod='HtmlEncode'/>
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
    <SharePoint:EncodedLiteral ID="EncodedLiteral2" runat="server" text="Vous n'avez pas le droit de visualiser ce site." EncodeMethod='HtmlEncode'/>
</asp:Content>