Guest User

Untitled

a guest
Oct 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. <apex:page id="subPage" standardController="Subscription__c" extensions="addSubscribersExtension" >
  2.  
  3. <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.3.2.min.js')}" />
  4. <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.16.custom.min.js')}" />
  5. <apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.16.custom.css')}" />
  6.  
  7. <script>
  8.  
  9. var j$ = jQuery.noConflict();
  10.  
  11. $(document).ready(function() {
  12. j$('#ProcessingReport').hide();
  13. });
  14.  
  15. function noenter(ev) {
  16. if (window.event && window.event.keyCode == 13 || ev.which == 13) {
  17. searchText();
  18. return false;
  19. } else {
  20. return true;
  21. }
  22. }
  23.  
  24. function closeDialog() {
  25. if(j$('#ProcessingReport').is(':data(dialog)')) {
  26. j$('#ProcessingReport').dialog('close').parent().appendTo(j$('#subPage\\:subForm'));
  27. j$('#ProcessingReport').hide();
  28. j$('#ProcessingReport').css({visibility: "hidden"});
  29. }
  30. }
  31.  
  32. function openDialog() {
  33. j$('#ProcessingReport').show();
  34. j$('#ProcessingReport').css({visibility: "visible"});
  35. j$('#ProcessingReport').dialog({modal: true, autoOpen: true, title: 'Generating Report'}).parent().appendTo(j$('#subPage\\:subForm'));
  36. }
  37. </script>
  38.  
  39. <apex:form id="subForm">
  40. <apex:actionFunction name="searchText" action="{!searchSubscribers}" rerender="messagePanel,subscriberPanel" status="status"/>
  41. <apex:sectionHeader title="Subscriber Mailing Reports"/>
  42.  
  43. <apex:outputpanel id="messagePanel">
  44. <apex:pageMessages />
  45. </apex:outputpanel>
  46.  
  47. <apex:pageBlock title="Mailing Reports">
  48. <apex:pageBlockTable value="{!reports}" var="report">
  49. <apex:column headerValue="Include" style="width:50px">
  50. <apex:inputCheckbox value="{!report.selected}" id="reportSelected" onchange="openDialog();">
  51. <apex:actionSupport event="onclick" action="{!reportSelected}" rerender="messagePanel,subscriberPanel" status="status"/>
  52. </apex:inputCheckbox>
  53. </apex:column>
  54. <apex:column headerValue="Report" value="{!report.report.Name}"/>
  55. </apex:pageBlockTable>
  56. <apex:actionStatus id="status" startText="" stopText="" onstop="closeDialog();"/>
  57. </apex:pageBlock>
  58.  
  59. <apex:outputPanel id="subscriberPanel" layout="block">
  60. <apex:pageBlock title="Subscribers">
  61. <apex:panelGrid columns="3">
  62. <apex:commandButton action="{!URLFOR($Action.Subscriber__c.new)}" value="Add Subscriber"/>
  63. <apex:inputText id="search" value="{!searchFilter}" onkeypress="return noenter(event);"/>
  64. <apex:commandButton id="searchBtn" value="Search" action="{!searchSubscribers}" rerender="messagePanel,subscriberPanel" status="status"/>
  65. </apex:panelGrid>
  66.  
  67. <apex:pageBlockTable value="{!subscribers}" var="subscriber">
  68. <apex:column headerValue="" style="width:25px">
  69. <apex:outputLink value="/{!subscriber.subscriber.id}" target="_blank" title="Edit the subscriber record.">Edit</apex:outputLink>
  70. </apex:column>
  71. <apex:column headerValue="" style="width:90px">
  72. <apex:selectList value="{!subscriber.subscriber.Status__c}" size="1">
  73. <apex:selectOptions value="{!subscription.subscriberStatuses}"/>
  74. <apex:actionSupport event="onchange" action="{!subscriberSelected}" rerender="messagePanel,subscriberPanel" status="status">
  75. <apex:param name="sid" value="{!subscriber.subscriber.id}"/>
  76. </apex:actionSupport>
  77. </apex:selectList>
  78. </apex:column>
  79. <apex:column headerValue="Quantity" style="width:60px">
  80. <apex:selectList value="{!subscriber.subscriber.Quantity__c}" size="1">
  81. <apex:selectOptions value="{!subscription.subscriberQuantities}"/>
  82. <apex:actionSupport event="onchange" action="{!subscriberSelected}" rerender="messagePanel,subscriberPanel" status="status">
  83. <apex:param name="sid" value="{!subscriber.subscriber.id}"/>
  84. </apex:actionSupport>
  85. </apex:selectList>
  86. </apex:column>
  87. <apex:column headerValue="Sticky" style="width:60px">
  88. <apex:inputCheckbox value="{!subscriber.subscriber.Sticky__c}" title="If a record is marked sticky then it will stay in a subscription even if it's not in any of the selected reports.">
  89. <apex:actionSupport event="onchange" action="{!subscriberSelected}" rerender="messagePanel,subscriberPanel" status="status">
  90. <apex:param name="sid" value="{!subscriber.subscriber.id}"/>
  91. <apex:param name="stickyclicked" value="1"/>
  92. </apex:actionSupport>
  93. </apex:inputCheckbox>
  94. </apex:column>
  95. <apex:column headerValue="Subscriber">
  96. <apex:outputLink value="/{!subscriber.linkRecordId}" target="_blank" title="View the subscriber">{!subscriber.linkRecordText}</apex:outputLink> - ({!subscriber.objectType})
  97. </apex:column>
  98. </apex:pageBlockTable>
  99.  
  100. <apex:panelGrid columns="5">
  101. <apex:commandLink action="{!subscription.first}" styleClass="pagination" rerender="subscriberPanel">first</apex:commandlink>
  102. <apex:commandLink action="{!subscription.previous}" styleClass="pagination" rerender="subscriberPanel" rendered="{!subscription.hasPrevious}">previous</apex:commandlink>
  103. <apex:commandLink action="{!subscription.next}" styleClass="pagination" rerender="subscriberPanel" rendered="{!subscription.hasNext}">next</apex:commandlink>
  104. <apex:commandLink action="{!subscription.last}" styleClass="pagination" rerender="subscriberPanel">last</apex:commandlink>
  105. </apex:panelGrid>
  106. </apex:pageBlock>
  107. </apex:outputPanel>
  108. <div id="ProcessingReport" style="visibility:hidden;">
  109. <apex:image url="{!$Resource.loading}" width="100%" height="20px" />
  110. <br />
  111. Depending on the number of subscribers in the selected reports this could take several minutes.
  112. </div>
  113. </apex:form>
  114.  
  115. </apex:page>
Add Comment
Please, Sign In to add comment