Commit 4294cdd6 by Urvil Shah

WrapUnSubScribeUrl and add option to select WrapUrl

parent 3c62d8bf
Pipeline #7319 passed with stages
in 22 minutes 51 seconds
......@@ -143,7 +143,7 @@ namespace Mobile.Search.Web.Controllers
// POST: Template/Edit/5
[HttpPost, ValidateInput(false)]
public ActionResult FroalaIndex(string key, string value, string EmailId, bool isSendEmail = false)
public ActionResult FroalaIndex(string key, string value, string EmailId, bool isSendEmail = false,bool WrapUrl=false, bool AdvertiserHasUnSub=true)
{
try
{
......@@ -156,11 +156,21 @@ namespace Mobile.Search.Web.Controllers
m = Regex.Match(value, HRefPattern,
RegexOptions.IgnoreCase | RegexOptions.Compiled,
TimeSpan.FromSeconds(1));
while (m.Success)
int count = Regex.Matches(value, HRefPattern).Count;
if (!isSendEmail)
WrapUrl = true;
while (m.Success && WrapUrl)
{
if(!m.Value.Contains("Wrap"))
count=count-1;
if (!m.Value.Contains("Wrap"))
{
string to_replace = String.Format("{{{{WrapUrl('{0}')}}}}", m.Groups[1]);
if(count==0 && AdvertiserHasUnSub)
{
to_replace= String.Format("{{{{WrapAdvertiserUnsubscribeUrl('{0}')}}}}", m.Groups[1]);
}
value = value.Replace(m.Groups[1].Value, to_replace);
}
m = m.NextMatch();
......
......@@ -134,6 +134,18 @@
</div>
</div>
<!-- <iframe width="375" height="650" src="/search/template?templateKey=@Model.Key&keyword=audi+a4&debug=true" style="border: solid 1px black; margin: auto"></iframe>-->
<div id="wrap_url_cb">
<div>
<h3>Wrap Url :</h3>@Html.CheckBox("WrapUrl", false,new { id = "WrapUrl" })
</div>
<div>
<h3>Advertiser has Unsubscribed Url :</h3>
@Html.CheckBox("WrapAdvertiserUrl", false,new {id = "WrapAdvertiserUrl"})
</div>
</div>
</div>
</div>
......@@ -272,12 +284,17 @@
var EmailId = document.getElementById("EmailId").value;
var key = document.getElementById("KeyValue").value;
var WrapUrl = document.getElementById("WrapUrl").checked;
var WrapAdvertiserUrl = document.getElementById("WrapAdvertiserUrl").checked;
alert(WrapAdvertiserUrl);
alert(WrapUrl);
$.ajax({
url: "/Template/FroalaIndex",
type: "POST",
data: JSON.stringify({ 'key': key, 'value': Content, 'EmailId': EmailId, 'isSendEmail':true}),
data: JSON.stringify({ 'key': key, 'value': Content, 'EmailId': EmailId, 'isSendEmail': true, 'WrapUrl': WrapUrl, 'AdvertiserHasUnSub':WrapAdvertiserUrl}),
dataType: "json",
traditional: true,
contentType: "application/json; charset=utf-8",
......
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 sign in to comment