Commit 1eac4c00 authored by everykittysdaydream's avatar everykittysdaydream

mapping_ change / redir

parent b0753406
...@@ -71,6 +71,9 @@ class CRM_Osdi_Page_OSDIJob extends CRM_Core_Page { ...@@ -71,6 +71,9 @@ class CRM_Osdi_Page_OSDIJob extends CRM_Core_Page {
} }
} }
} }
if ($params[0] == "endpoint") {
$metadata["endpointname"] = $params[1];
}
} }
// load the export value // load the export value
......
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
// query string param parsing
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
if(typeof(String.prototype.trim) === "undefined") if(typeof(String.prototype.trim) === "undefined")
{ {
String.prototype.trim = function() String.prototype.trim = function()
...@@ -45,6 +53,7 @@ ...@@ -45,6 +53,7 @@
preexisting["endpoint"] = ""; preexisting["endpoint"] = "";
preexisting["civiendpoint"] = ""; preexisting["civiendpoint"] = "";
CRM.$(document).ready(function() { CRM.$(document).ready(function() {
var formResults = CRM.$("#MappingForm").serializeArray().map(function(x){ var formResults = CRM.$("#MappingForm").serializeArray().map(function(x){
preexisting[x.name] = x.value; preexisting[x.name] = x.value;
...@@ -181,6 +190,18 @@ ...@@ -181,6 +190,18 @@
} }
}) })
}) })
endpointvar = getUrlParameter("endpoint");
CRM.$("#EndpointInputter").val(endpointvar);
if (endpointvar != "") {
if (endpointvar.indexOf("actionnetwork.org") !== -1) {
CRM.$("#EndpointSelector").val(1);
} else {
CRM.$("#EndpointSelector").val(2);
}
}
</script> </script>
{/literal} {/literal}
......
...@@ -103,7 +103,8 @@ ...@@ -103,7 +103,8 @@
<p>Group: {$job.group_id}, Name: {$job.group_name}</p> <p>Group: {$job.group_id}, Name: {$job.group_name}</p>
<p>Rule: {$job.rule_id}, Fields: {$job.rule_fields}</p> <p>Rule: {$job.rule_id}, Fields: {$job.rule_fields}</p>
<button id="edit_{$job.name}" name="{$job.id_import}_{$job.id_export}">edit</button> <button id="edit_{$job.name}" name="{$job.id_import}_{$job.id_export}">edit</button>
<button id="delete_{$job.name}" name="{$job.id_import}_{$job.id_export}">delete</button> <button id="delete_{$job.name}" name="{$job.id_import}_{$job.id_export}">delete</button>
<button id="mapping_{$job.endpointname}" name="mapping_{$job.endpointname}">edit mapping</button>
</div> </div>
{/foreach} {/foreach}
</div> </div>
...@@ -208,6 +209,8 @@ ...@@ -208,6 +209,8 @@
if (!edit) { if (!edit) {
// redirect to mapping // redirect to mapping
alert("A default mapping was configured for your remote endpoint.\n Visit /civicrm/osdi/mapping to change it."); alert("A default mapping was configured for your remote endpoint.\n Visit /civicrm/osdi/mapping to change it.");
window.location.href = "/civicrm/osdi/mapping?endpoint=" + rootendpoint.val();
} }
dialog.dialog( "close" ); dialog.dialog( "close" );
...@@ -320,5 +323,12 @@ ...@@ -320,5 +323,12 @@
// delete should refresh the page // delete should refresh the page
}); });
CRM.$('[id^="mapping_"]').click(function() {
endpoints = CRM.$(this).attr("name").split("_");
window.location.href = "/civicrm/osdi/mapping?endpoint=" + endpoints[1];
// delete should refresh the page
});
</script> </script>
{/literal} {/literal}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment