Sharepoint 2013 - adding code to the master page - sharepoint

I’m trying to add some code to a master page, either directly after the opening body tag or before the closing body tag. To do this, I’m editing the .html version of the master page.
All looks good in the .html file, but Sharepoint adds a lot of extra code when the master file is generated from the .html file and my code never ends up where I need it.
Is there a way to make Sharepoint render my code where I want it, without having to directly edit .master?

Related

Include Pre-Formatted content in ACUMATICA Report Writer

I have a simple one page report for quoting an opportunity from Acumatica ERP which is working fine.
However, my customer has a standard boilerplate page for terms and conditions. They would like that to be appended to all quotes being generated. But, I don't see a way of adding a pre-formatted page to a report at execution time.
I can do it in code. Create a button that calls the report, and then through .NET code add the conditions page that way. But it seems like this functionality might exist within the report writer itself.
Does it?
In the report footer section, this is the appropriate place to add the boilerplate page. Report footer prints as the last page. You could create a PNG file, in case your boilerplate page has graphics. Then embed the image file into the report footer section.
Be sure to set Page Break property as true

Create a system to edit texts of a website

Hello I'm making a website and I want that an user can edit some of the texts content in the website, clicking a button "Save" and the changes are permanent.
I suppose I have to put all the text in a database instead of keeping it in html code, but this will slow down the website loading performance.
Is there a library to easily achieve this functionality? Pheraps changing html code instead of acting on the database.
You have to read the file content and load it into a form in a textarea or WYSIWYG and after submitting the form, put the changed data back into the file. The codes for loading and saving data, depends on programming language. check the documentation for opening and saving the file in PHP here.
http://php.net/manual/en/function.file-put-contents.php

Kentico v9 javascript webpart and bottom load LinkedFile

In building on a previous question (Kentico v9 how can i detect when a user is in CMS desk with JavaScript), I have added a JavaScript webpart to load in my analytics.js file. Here's my code snippet:
<cms:JavaScript ID="js"
ViewMode="LiveSite"
LinkedFile="~/CMSPages/GetResource.ashx?scriptfile=/KFF/global/scripts/analytics.js"
LinkedFilePageLocation="beginning"
runat="server"></cms:JavaScript>
I can not figure out how to get this to load the JS file at the bottom of the page. What am i missing?
The Linked File Page Location is the key. There's one that renders it wherever the webpart is placed. You need to add a Web Part Zone at the bottom of the page and add them there, or if this is pure aspx then add this tag near the bottom, but the LInkedFilePageLocation should be Inline (i believe, see what the options are)
EDIT
The proper value is "startup" to make it render wherever you place it.

Any idea about inserting html to SharePoint?

I'm trying to insert piece of my html code(which is actually working in my local html file) in SharePoint. But it is not accepting all my tags which are there in the code, for eg: 'style' tag.
Any help is greatly appreciated. :)
Open page for edit. Then from "Media and Content" group choose "Script Editor" web part. And then click Edit Snipper and paste your html code there.
You can also use Content Editor web part and provide link to your html code.
If you want to change style for whole SharePoint you can modify Master Page or providing Alternate CSS for exiting one (this is possible in Central Administration).

Override downloading a file type with Chrome Extensions

I'm trying to build a chrome extension that overrides a download of a file and displays it in the browser. For example if you click on a link to a '.csv' file I'd like it to render in the browser instead of downloading it.
Chrome already does it for PDF's types and the Xml Tree extension also does exactly that for xml files.
So it should be possible, just not sure how to go about catching that event?
An implementation along the lines indicated by in the previous answers and specifically designed for CSV files can be found in this extension of mine on github:
https://github.com/rgrp/chrome-csv-viewer
Furthermore, with the new(ish) chrome webrequest API a direct approach is also now possible along the following lines:
Listen to onBeforeRequest (this has to be in a background script - see background.js)
Check if this is a CSV file (mimetype or file extension)
If so cancel the request and then display the data using xhr
A working version of this can be found in a branch of that extension: https://github.com/rgrp/chrome-csv-viewer/tree/4-webrequest-intercept
You could always look at the XML Tree code :).
If you only need to work with links, and not opening files from the address bar or File > Open, you could build a content script that adds a click event listener to every link.
In the event listener function:
Add e.preventDefault() in the first line to prevent the browser 'following' the link.
Using the link href value, get the data with XMLHttpRequest.
In the XMLHttpRequest callback, open a new tab and render content accordingly.
Obviously, in many ways, this is not a great solution:
you want 'normal' links to be handled as usual by the browser
how can you tell if a text file contains comma-separated values (for example) except by looking at the file extension which, of course, may not be reliable?
Are you specifically thinking of .csv files -- and/or other specific types of content?

Resources