Total Pageviews

29 May 2013

Detect Edit Mode with Javascript on SharePoint pages or SPListitem forms

This JavaScript function will tell you if we are in the List Edit form:

var isEditForm = function ()
{
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    if (sPage == "EditForm.aspx")
    return true;
    else return false;
}


And this one will tell you if we are in edit mode on publishing, web part or wiki pages
var isinEditMode = function() {
    var isEditMode = false;
    try {
        var inDesignMode = document.forms[window.MSOWebPartPageFormName].MSOLayout_InDesignMode.value;

        if (inDesignMode == "1") {
            isEditMode = true;

        }
    } catch(e) {
    }

    try {
        var wikiInEditMode = document.forms[window.MSOWebPartPageFormName]._wikiPageMode.value;
        if (wikiInEditMode == "Edit") {
            isEditMode = true;
        }
    } catch(e) {

    }

    return isEditMode;
};

14 May 2013

Applying custom page to all subsites

You've create a custom master page and want to apply it to all of your subsites. Use this link to do just that:

/_layouts/changesitemasterpage.aspx

Warning: Publishing Infrastructure Feature must be enabled on your site collection.

28 Apr 2013

SharePoint 2013. New JSLink property for SPField


This is a side note about the use of JSLink property in SPFields. I intend to use this later in my projects. Here are 2 simple steps.

1.Create and deploy JS Field with the script that looks like this:

2. Change the new JSLink property for you SPField like is show on the screenshot. Note that it may be even built-in field.

The result should look like this. I've added a simple "refresh" image inside the field as a test.

For more info you could check this nice article SP 2013: Using the JSLink property to change the way your field or views are rendered in SharePoint 2013

4 Apr 2013

Highlight Current Quick Launch Menu Item



1. Add a start-up script on your page
$(function () {
    $(".s4-ql li.selected").parents("li.static").find(":first-child").first().addClass("selected-menu-item");
 });

2. Take advantage of the added CSS class to highlight current menu item:

.s4-ql UL.root a.selected-menu-item {
    background-color: rgb(0,153,0);
}

Example of the highlighted menu item:


3 Apr 2013

SharePoint 2010 CSS Chart

On on the Marc's SharePoint Notes I've found a very informative table that looks like this:


.ms-cui-cg-gr .ms-cui-tt-a:hover{


border-color:#56c553;

border-top-color:#56c553;

background:red;

}

For the full table check the link above.

It's pretty self-explanatory, I think.


21 Feb 2013

Testing Mobile View in Chrome

1. In Chrome, open the Developer Tools  by clicking "Customize"(wrench icon) --> "Tools" --> "Developer Tools."


2. Click the "Settings" icon at the botom right corner.
3. Check "override user agent" and select one of the options (iPhone, iPad or Nexus S running Android 2.3). You can also select "other" and enter a custom user agent.

The result looks like that:

20 Feb 2013

Stopping Credentials Dialog from Popping Up

  • Add your sire to Local Intranet to stop it from asking for credentials. Note that if your site is in Trusted zone and not in Local Intranet it will still ask you to provide a password!
  • Add your  site to Trusted Zone to stop pop-up window from appearing when opening MS office documents from lybraries. It will actually stop DispEx Function from running when clicking on the document

Conclusion: add your SharePoint site either to Local Intranet or Trusted zone.