Étiquette : Programmation

Hide a field into a form with JSLink based on field’s description [Sharepoint]

On Sharepoint 2013 I was trying to hide a field (the complete row) based on some elements into its description. To do so we will call our file using the JSLink (see my previous post about it). The JS file looks like that: (function() { // do some actions as soon as the fields are […]

Load a script once a DispForm is fully shown in Sharepoint 2013

Sharepoint 2013 introduced the JSLink. This is very useful to play with forms and views. My attempt here is to remove some rows from the DispForm. To do so I needed to trigger an action as soon as the fields rendering has been done. After different tries, I finally came up with the PostRender option. […]

Add a SharePointWebControls into a HTML version of a MasterPage [Sharepoint 2013]

In Sharepoint 2013 it’s now possible to create the MasterPage based on an HTML file. Here is the snippet you need to add into your HTML page to get a SharePointWebControls: <!–SPM<%@ Register Tagprefix= »SharePointWebControls » Namespace= »Microsoft.SharePoint.WebControls » Assembly= »Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c » %>–> <!–CS: Start Create Snippets From Custom ASP.NET Markup Snippet–> <!–SPM:<SharePointWebControls:TextField runat= »server » FieldName= »Title » />–> <!–CE: End […]

Get color_id from a Google Calendar using API [PHP]

For a project I needed to get the events from a Google Calendar, as well as the colors from it. It’s been a pain, but after a couple of days I’ve been able to create a PHP page to do so. It will use the server-to-server auth mechanism. I’ll try to provide the different steps […]

Play with ribbon on Sharepoint

In Sharepoint 2010 and 2013, there are some existing functions to deal with the ribbon. Below an example of what we can do: // we need the file « sp.ribbon.js » SP.SOD.executeOrDelayUntilScriptLoaded(function () { // use PageManager var pm = SP.Ribbon.PageManager.get_instance(); // define a function to call when the ribbon is loaded var DoSomethingWithRibbon=function(ribbon) { // For […]

Excel file as an HTML table and Date formatting

If you create an Excel file using an HTML Table, then it exists a way to format the cells based on some CSS rules. Some examples can be found on this blog post. I spent some time trying to figure out how to display correctly the dates, whatever your regional settings are ; for exemple […]

Pure Javascript Drag and Drop cross browser from IE8

I was looking for a simple JavaScript to drag a div element around, and that would work with IE8 and without any third party libraries (like jQuery). It’s been very difficult to find a simple code ! Finally http://news.qooxdoo.org/mouse-capturing saved me with some code… but there was still a problem with IE8 due to the […]

Transform pseudo currency to number in JavaScript

In JavaScript I want to change some formatted numbers to a regular number. The code might be look like that: var aNb=[ 1500, « 1,500 », « 15,00 », « 1,500,000 », « 1,500,000.25 », « 1000.25 », « 1 000 000 »]; for (var i=0; i < aNb.length; i++) { var nb = aNb[i] + «  »; if (nb.split(« , »).length <= 2) nb = nb.replace(/,(\d{2})$/, ».$1″); nb = nb.replace(/[^\d\.\-]/g, […]

Force CORS headers in Firefox to allow cross domain calls

This guy created a Firefox extension to force the CORS (access-control) headers from a call. This is very useful when you want to do a JavaScript/AJAX query over another website that doesn’t allow the cross domain calls. His code is on github. I’ve the XPI compiled version on my blog (into a ZIP file) found […]