Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. var $v_8 = this.$E_0.getElementsByTagName('a');
  2.  
  3. <input id="Submit1" type="submit" class="ms-ButtonHeightWidth" style="width: 120px;" onclick="javascript:ShowDialog(MyProject.Utilities.FormMode.NewForm, $('#FCChoice').val(), null, siteUrl, WidgetRequestTrackerListId, null);" value="Create New Request" />
  4.  
  5. var fullSiteUrl = '<%= SPContext.Current.Web.Url %>';
  6.  
  7. function ShowDialog(mode, contentType, id, siteUrl, listId, parentId, parentFy, parentOC) {
  8. var url = fullSiteUrl + '/_layouts/ABCCo/Widget/' + mode + 'Form.aspx?ListId=' + listId + '&';
  9. var options = SP.UI.$create_DialogOptions();
  10. options.width = 700;
  11. options.height = 600;
  12. options.dialogReturnValueCallback = ModalCallback;
  13.  
  14. if (parentId !== null && parentId !== undefined)
  15. url += 'ParentID=' + parentId.toString() + '&';
  16.  
  17. if (mode !== MyProject.Utilities.FormMode.NewForm)
  18. url += 'ID=' + id.toString() + '&';
  19.  
  20. if (contentType === MyProject.Constants.ContentTypes.WidgetRequest.Id) {
  21. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetRequest.Id + '&';
  22. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetRequest.Name;
  23. }
  24. else if (contentType === MyProject.Constants.ContentTypes.WidgetFactoryRequest.Id) {
  25. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetFactoryRequest.Id + '&';
  26. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetFactoryRequest.Name;
  27. }
  28. else if (contentType === MyProject.Constants.ContentTypes.WidgetOrder.Id) {
  29. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetOrder.Id + "&ParentFY=" + parentFy + "&ParentOC=" + parentOC;
  30. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetOrder.Name;
  31. }
  32. else if (contentType === MyProject.Constants.ContentTypes.WidgetManufactured.Id) {
  33. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetManufactured.Id + "&ParentFY=" + parentFy + "&ParentOC=" + parentOC;
  34. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetManufactured.Name;
  35. }
  36. else if (contentType === MyProject.Constants.ContentTypes.WidgetTransaction.Id) {
  37. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetTransaction.Id + "&ParentFY=" + parentFy + "&ParentOC=" + parentOC;
  38. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetTransaction.Name;
  39. }
  40. else if (contentType === MyProject.Constants.ContentTypes.WidgetTransactionOrder.Id) {
  41. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetTransactionOrder.Id + "&ParentFY=" + parentFy + "&ParentOC=" + parentOC;
  42. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetTransactionOrder.Name;
  43. }
  44. else if (contentType === MyProject.Constants.ContentTypes.WidgetTransactionManufactured.Id) {
  45. url += 'ContentTypeId=' + MyProject.Constants.ContentTypes.WidgetTransactionManufactured.Id + "&ParentFY=" + parentFy + "&ParentOC=" + parentOC;
  46. options.title = mode + " " + MyProject.Constants.ContentTypes.WidgetTransactionManufactured.Name;
  47. }
  48.  
  49. //SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
  50. SP.UI.ModalDialog.showModalDialog(options);
  51. }
  52.  
  53. function ModalCallback(result, returnValue) {
  54. if (result == SP.UI.DialogResult.OK && returnValue != null) {
  55. var itemOptions = JSON.parse(returnValue);
  56.  
  57. if (itemOptions.FormMode !== MyProject.Utilities.FormMode.DisplayForm) {
  58. BindViewModel();
  59.  
  60. if (itemOptions.ContentType === MyProject.ContentTypes.WidgetFactoryRequest.Name || itemOptions.ContentType === MyProject.ContentTypes.WidgetRequest.Name) {
  61. // Expand none
  62. }
  63. else if (itemOptions.ContentType === MyProject.ContentTypes.WidgetOrder.Name || itemOptions.ContentType === MyProject.ContentTypes.WidgetManufactured.Name || itemOptions.ContentType === MyProject.ContentTypes.WidgetTransaction.Name) {
  64. // Expand Request
  65. }
  66. else if (itemOptions.ContentType === MyProject.ContentTypes.WidgetTransactionOrder.Name || itemOptions.ContentType === MyProject.ContentTypes.WidgetTransactionManufactured.Name) {
  67. // Expand Transaction
  68. }
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement