Showing posts with label javascript:;. Show all posts
Showing posts with label javascript:;. Show all posts

Tuesday, March 29, 2016

How to open a calendar item in a modal dialog?

In this below script, open a calendar item in a modal dialog

open a calendar item in a modal dialog In SharePoint
function openDialog(pageUrl) {
  var options = {
      title : "calender",
      width : 500,
      height : 400,
      url : pageUrl
  };

  SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}

$('.ms-acal-month').ready(function () {
   setTimeout(function() {
       $('a[href*="DispForm.aspx"]').each(function() {
           $(this).attr('onclick', 'openDialog("' +  $(this).attr('href') + '")');
           $(this).attr('href','javascript:void(0)');
       });
   }, 1000);
});

Friday, March 25, 2016

Print Angular JS

http://jsfiddle.net/BlinkSun/tcVhN/235/

a factory that you can call and a directive, two way: by htmls from variable scope or by extern template, if the template have a css linked in, it must print de style too !

Thursday, March 24, 2016

Error in "Pause for" Action - Nintex Workflows

In this below script, "Pause for" Action - Nintex Workflow

Pause for Action - Nintex Workflow In SharePoint

·        Email triggered says Workflow Terminated unexpectedly for item.

·        Error message logged was “Error POC 1” failed to run.

·        I got below information when I discussed this issue with nintex support

 

SharePoint dictates which Workflow Timer Service will run the workflow - so this could occur on any server on which the "Microsoft SharePoint Foundation Workflow Timer Service" is enabled.

 

When Nintex is deployed it install’s some DLL’s required for workflows on the WFE’s where

 Microsoft SharePoint Foundation Web Application service is enabled.

So when Workflow Timer Service attempts to run a workflow where Microsoft SharePoint Foundation Web Application is disabled it throws error.

 

Solution:

·        Disable Workflow Timer Service to all the WFE’s where Microsoft SharePoint Foundation Web Application service is disabled.

·        Or Enable Microsoft SharePoint Foundation Web Application Service on all WFE’s.

 

1)               Related Issues: So due to the above reasons not only “Pause for” action throws error but some below mentioned actions also throws error.

 

2)               Change State: Since while changing state in a State Machine Workflow, a hidden delay is involved. So in that case also, it may throw error in case after delay it got caught by WFE where Microsoft SharePoint Foundation Web Service is disabled but Workflow Timer Service is enabled.

 

3)               Pause Until: This action also throws error while in a paused state until some date is passed.

 

4)               Assign Flexi Task: Due to the delay involved before sending reminders, it may error out.

 

Similarly Task Reminder Action, Request Data, or any other action where delay is involved may throw errors if occupied by wrongly configured WFE’s.

 

Tuesday, March 22, 2016

@media print remove url href values when printing in Chrome

In this below script, remove url href values when printing in Chrome using javascript

remove url href values when printing in Chrome using javascript In SharePoint
your printed webpages you will need to use your CSS styles to override it.

 Customize the print CSS, and finding that it prints links out with the href value as well as the link.


}@media print {
  a[href]:after {
    content: none !important;
  }
}

STSNavigate in SharePoint

In this below script,STSNavigate in SharePoint

STSNavigate in SharePoint
In this article menu item uses createNewDocumentWithRedirect function in core.js file

<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
       <SharePoint:RssLink runat="server"/>
      
       <Script>
       function STSNavigate(Url){
              window.open(STSPageUrlValidation(Url),"_blank");
       }
       </Script>
</asp:content>

STSNavigate in turn calls STSPageUrlvalidation: 
function STSPageUrlValidation(url)
{ULSxSy:;
    return PageUrlValidation(url);
}
It then calls PageUrlValidation - THIS IS THE KEY PART:
function PageUrlValidation(url)
{ULSxSy:;
    if ((url.substr(0, 4)=="http") ||
        (url.substr(0, 1)=="/")     ||
        (url.indexOf(":")==-1))
    {
        return url;
    }
    else
    {
        var L_InvalidPageUrl_Text="Invalid page URL: ";
        alert(L_InvalidPageUrl_Text);
        return "";
    }
}