copyright and version fixes
[civicrm-core.git] / templates / CRM / Profile / Form / Dynamic.tpl
index 8ed3c3b7b77b02720604359b7613ac5e74292934..412813020753cc42185a02239e942f37ce9189a9 100644 (file)
@@ -46,7 +46,7 @@ function checkResponse(responseText, statusText, xhr, $form) {
   //if there is any form error show the dialog
   //else redirect to post url
   if (!cj(responseText).find('.crm-error').html()) {
-    window.location = '{/literal}{$postUrl}{literal}';
+    window.location.href = '{/literal}{$postUrl}{literal}';
   }
 } 
 </script>
@@ -159,9 +159,6 @@ function checkResponse(responseText, statusText, xhr, $form) {
                   {/foreach}
                 </tr>
                 </table>
-                {if $field.html_type eq 'Radio' and $form.formName eq 'Edit' and $field.is_view neq 1 }
-                  &nbsp;<span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}'); return false;">{ts}clear{/ts}</a>)</span>
-                {/if}
               {/strip}
             </div>
             <div class="clear"></div>
@@ -205,14 +202,9 @@ function checkResponse(responseText, statusText, xhr, $form) {
                 {else}
                   {$form.$n.html}
                 {/if}
-                {if (($n eq 'gender') or ($field.html_type eq 'Radio' and $form.formName eq 'Edit' and $field.is_required neq 1)) and
-                ($field.is_view neq 1)}
-                  &nbsp;<span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$form.formName}'); return false;">{ts}clear{/ts}</a>)</span>
-                  {elseif $field.html_type eq 'Autocomplete-Select'}
+                {if $field.html_type eq 'Autocomplete-Select'}
                   {if $field.data_type eq 'ContactReference'}
                     {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
-                  {else}
-                    {include file="CRM/Custom/Form/AutoComplete.tpl" element_name = $n}
                   {/if}
                 {/if}
               {/if}
@@ -303,58 +295,7 @@ cj(document).ready(function(){
   cj('#selector tr:odd ').addClass('even-row');
 });
 {/literal}
-{if $context eq 'dialog'}
-{literal}
-  var options = {
-      beforeSubmit:  showRequest
-  };
-
-  // bind form using 'ajaxForm'
-  cj('#Edit').ajaxForm( options );
-
-   // FIXME - this is improper use of jquery.form
-   // Do not use this code as an example
-  function showRequest(formData, jqForm, options) {
-    // formData is an array; here we use $.param to convert it to a string to display it
-    // but the form plugin does this for you automatically when it submits the data
-    var queryString = cj.param(formData);
-    queryString = queryString + '&snippet=5&gid=' + {/literal}"{$profileID}"{literal};
-    var postUrl = {/literal}"{crmURL p='civicrm/profile/create' h=0 }"{literal};
-    var blockNo = {/literal}{if $blockNo}{$blockNo}{else}null{/if}{literal};
-    var prefix  = {/literal}"{$prefix}"{literal};
-    var response = cj.ajax({
-      type: "POST",
-      url: postUrl,
-      async: false, // FIXME
-      data: queryString,
-      dataType: "json",
-      success: function( response ) {
-        if ( response.newContactSuccess ) {
-          cj('#' + prefix + 'contact_' + blockNo ).val( response.sortName ).focus( );
-          if ( typeof(allowMultiClient) != "undefined" ) {
-            if ( allowMultiClient ) {
-              cj('#' + prefix + 'contact_' + blockNo).tokenInput("add", {id: response.contactID, name: response.sortName });
-            }
-          }
-          cj('input[name="' + prefix + 'contact_select_id[' + blockNo +']"]').val( response.contactID );
-          CRM.alert(response.displayName + {/literal}'{ts escape="js"} has been created.{/ts}', '{ts escape="js"}Contact Saved{/ts}'{literal}, 'success');
-          cj('#contact-dialog-' + prefix + blockNo ).dialog('close');
-        }
-      }
-    }).responseText;
-
-    cj('#contact-dialog-' + prefix + blockNo).html( response );
-
-    // FIXME - we have used jquery.form very incorrectly
-    // and are now preventing it from doing what it's supposed to do
-    return false;
-  }
-
-{/literal}
-{/if}
-{literal}
 </script>
-{/literal}
 
 {/crmRegion}
 </div> {* end crm-profile-NAME *}