Merge pull request #1032 from ravishnair/CRM-12823
authordeepak-srivastava <deepak.srivastava@webaccess.co.in>
Tue, 2 Jul 2013 13:04:36 +0000 (06:04 -0700)
committerdeepak-srivastava <deepak.srivastava@webaccess.co.in>
Tue, 2 Jul 2013 13:04:36 +0000 (06:04 -0700)
-- CRM-12823 created a popup for "Add New Record"

1  2 
templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl

index 667c4bba2524f4b1a489208c08247a9167d812e9,9e4027d95a88b86ae5413be5d866d7460c58ff90..0592263ea8a7174e934390a3928a40c5b4a6146f
      <div class="messages status no-popup">
        <div class="icon inform-icon"></div>
        &nbsp;
 -      {ts}No multi-record entries found. Note: check is Include in multi-record listing property of the fields you want to display in listings{/ts}
 +      {if $tabDisplay}
 +        {ts 1=$customGroupTitle}No records of type '%1' found.{/ts}
 +      {else}
 +        {ts}No multi-record entries found. Note: check is Include in multi-record listing property of the fields you want to display in listings{/ts}
 +      {/if}
      </div>
+     <div id='profile-dialog' class="hiddenElement"></div>
    {/if}
  
    {if !$reachedMax}
-     <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="id=`$contactId`&multiRecord=add&gid=`$gid`"}"
-        class="button"><span><div class="icon add-icon"></div>{ts}Add New Record{/ts}</span></a>
+     <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="id=`$contactId`&multiRecord=add&gid=`$gid`&snippet=1&context=multiProfileDialog"}"
+        class="button action-item"><span><div class="icon add-icon"></div>{ts}Add New Record{/ts}</span></a>
    {/if}
  {/if}
 -  {/literal}
+ {literal}
+   <script type='text/javascript'>
+     cj(function () {
+       function formDialog(dataURL, dialogTitle) {
+         cj.ajax({
+           url: dataURL,
+           success: function (content) {
+             cj('#profile-dialog').show().html(content).dialog({
+               title: dialogTitle,
+               modal: true,
+               width: 680,
+               overlay: {
+                 opacity: 0.5,
+                 background: "black"
+               },
+             close: function (event, ui) {
+               cj('#profile-dialog').html('');
+             }
+           });
+           cj('.action-link').hide();
+           cj('#profile-dialog #crm-profile-block .edit-value label').css('display', 'inline');
+         }});
+       }
+       cj('.action-item').each(function () {
+         cj(this).attr('jshref', cj(this).attr('href'));
+         cj(this).attr('href', '#browseValues');
+       });
+       cj(".action-item").click(function () {
+         dataURL = cj(this).attr('jshref');
+         dialogTitle = cj(this).attr('title');
+         formDialog(dataURL, dialogTitle);
+       });
+     });
+     </script>
++  {/literal}