java EmailDirect注册/ Mvt:call / API / Fancyshmancy || II构建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java EmailDirect注册/ Mvt:call / API / Fancyshmancy || II构建相关的知识,希望对你有一定的参考价值。

<mvt:if expr="g.signup">
  <mvt:if expr="ISNULL g.email_address OR ISNULL g.fname OR ISNULL g.lname">
	<mvt:assign name="g.errors" value="'Please make sure you fill out the required fields.'" />
  <mvt:else>
	<mvt:do name="l.validEmail" file="g.Module_Root $ g.Library_Utilities" value="Email_Validate( g.email_address )" />
	<mvt:if expr="l.validEmail">
	  <mvt:assign name="g.data" value="'{
	  \"EmailAddress\":\"' $ g.email_address $ '\",
	  \"Force\":true,
	  \"CustomFields\":[
		{\"FieldName\":\"FirstName\",\"Value\":\"' $ encodejavascriptstring(g.fname) $ '\"},
		{\"FieldName\":\"LastName\",\"Value\":\"' $ encodejavascriptstring(g.lname) $ '\"},
		{\"FieldName\":\"independentironUser\",\"Value\":1},
		{\"FieldName\":\"Country\",\"Value\":\"United States\"}'" />
	  <mvt:if expr="g.gender">
		<mvt:assign name="g.data" value="g.data $ ',{\"FieldName\":\"Gender\",\"Value\":\"' $ g.gender $ '\"}'" />
	  </mvt:if>
	  <mvt:if expr="g.month GT 0 AND g.day GT 0 AND g.year GT 0">
		<mvt:assign name="g.data" value="g.data $ ',{\"FieldName\":\"Birthday\",\"Value\":\"' $ g.month $ '\/' $ g.day $ '\/' $ g.year $'\"}'" />
	  </mvt:if>
	  <mvt:if expr="g.zipcode">
		<mvt:assign name="g.data" value="g.data $ ',{\"FieldName\":\"Zip\",\"Value\":\"' $ encodejavascriptstring(g.zipcode) $ '\"}'" />
	  </mvt:if>
	  <mvt:if expr="g.riding_year AND g.riding_model">
	  	<mvt:do file="g.Module_Library_DB" name="l.success" value="Category_Load_Code( g.riding_model, l.settings:riding_cat)" />
		<mvt:assign name="g.riding" value="l.settings:riding_cat:name" />
		<mvt:assign name="g.data" value="g.data $ ',{\"FieldName\":\"Riding\",\"Value\":\"' $ encodejavascriptstring(g.riding) $ '\"}'" />
	  </mvt:if>
	  <mvt:assign name="g.data" value="g.data $ ']}'" />
	  <mvt:assign name="g.listURL" value="'https://rest.emaildirect.com/v1/Subscribers'" />
	  <mvt:call action="g.listURL" method="'RAW'" headers="'ApiKey: xxxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxxxxxxx' $ asciichar( 13 ) $ asciichar( 10 )" content-type="'application/json'" fields="'data'">
		<mvt:assign name="l.null" value="miva_json_decode(s.callvalue, l.listurlReturn)" />
	  </mvt:call>
	  <mvt:assign name="g.email_address" value="''" />
	  <mvt:assign name="g.fname" value="''" />
	  <mvt:assign name="g.lname" value="''" />
	  <mvt:assign name="g.gender" value="''" />
	  <mvt:assign name="g.month" value="''" />
	  <mvt:assign name="g.day" value="''" />
	  <mvt:assign name="g.year" value="''" />
	  <mvt:assign name="g.zipcode" value="''" />
	  <mvt:assign name="g.riding_year" value="''" />
	  <mvt:assign name="g.riding_model" value="''" />
	  <mvt:assign name="g.success" value="1" />
	<mvt:else>
	  <mvt:assign name="g.errors" value="'Please enter a Valid Email.'" />
	</mvt:if>
  </mvt:if>
</mvt:if>
<mvt:if expr="g.errors">
  <div class="column whole">
	<p class="message message-error" style="margin-top:0;">
	  &mvt:global:errors;
	</p>
  </div>
</mvt:if>
<mvt:if expr="g.success">
  <div class="column whole">
	<p class="message message-success" style="margin-top:0;">
	  Thank you for signing up!
	</p>
  </div>
</mvt:if>
<div class="column whole">
  <h3>Set your Email Preferences</h3>
</div>
<form action="&mvt:urls:_self:auto;" method="post">
  <input type="hidden" name="signup" value="1" />

  <div class="column medium-half email-newsletter-box">
  	<mvt:if expr="g.errors AND ISNULL g.email_address">
		<label class="bold required newsletter-label error red">Email Address*</label>
	<mvt:else>
		<label class="bold required newsletter-label">Email Address*</label>
	</mvt:if>
	<input type="email" name="email_address" value="&mvt:global:email_address;" />
  </div>

  <div class="column medium-half email-newsletter-box">
	<label class="newsletter-label">Zip Code</label>
	<input type="tel" value="&mvt:global:zipcode;" name="zipcode" />
  </div>

  <div class="column medium-half email-newsletter-box">
  	<mvt:if expr="g.errors AND ISNULL g.fname">
		<label class="bold required newsletter-label error red">First Name*</label>
	<mvt:else>
		<label class="bold required newsletter-label">First Name*</label>
	</mvt:if>
	<input type="text" value="&mvt:global:fname;" name="fname" />
  </div>

  <div class="column medium-half email-newsletter-box">
  	<mvt:if expr="g.errors AND ISNULL g.fname">
		<label class="bold required newsletter-label error red">Last Name*</label>
	<mvt:else>
		<label class="bold required newsletter-label">Last Name*</label>
	</mvt:if>
	<input type="text" value="&mvt:global:lname;" name="lname" />
  </div>

  <div class="form-row">
	<div class="column whole">
	  <label class="newsletter-label">Birthday</label>
	</div>
	<div class="column small-one-third email-newsletter-box">
	  <select name="month">
		<mvt:if expr="ISNULL g.month">
		  <option value="0" disabled selected>Month</option>
		<mvt:else>
		  <option value="0" disabled>Month</option>
		</mvt:if>
		<mvt:while expr="l.settings:curr_m LT 12">
		  <mvt:assign name="l.settings:curr_m" value="l.settings:curr_m +1 " />
		  <mvt:if expr="l.settings:curr_m EQ g.month">
			<option value="&mvt:curr_m;" selected>&mvt:curr_m;</option>
		  <mvt:else>
			<option value="&mvt:curr_m;">&mvt:curr_m;</option>
		  </mvt:if>
		</mvt:while>
	  </select>
	</div>

	<div class="column small-one-third email-newsletter-box">
	  <select name="day">
		<mvt:if expr="ISNULL g.day">
		  <option value="0" disabled selected>Day</option>
		<mvt:else>
		  <option value="0" disabled>Day</option>
		</mvt:if>
		<mvt:while expr="l.settings:curr_d LT 31">
		  <mvt:assign name="l.settings:curr_d" value="l.settings:curr_d +1 " />
		  <mvt:if expr="l.settings:curr_d EQ g.day">
			<option value="&mvt:curr_d;" selected>&mvt:curr_d;</option>
		  <mvt:else>
			<option value="&mvt:curr_d;">&mvt:curr_d;</option>
		  </mvt:if>
		</mvt:while>
	  </select>
	</div>

	<div class="column small-one-third email-newsletter-box">
	  <select name="year">
		<mvt:if expr="ISNULL g.year">
		  <option value="0" disabled selected>Year</option>
		<mvt:else>
		  <option value="0" disabled>Year</option>
		</mvt:if>
		<mvt:assign name="l.settings:curr_y" value="s.dyn_tm_year" />
		<mvt:while expr="l.settings:curr_y GE 1900">
		  <mvt:if expr="l.settings:curr_y EQ g.year">
			<option value="&mvt:curr_y;" selected>&mvt:curr_y;</option>
		  <mvt:else>
			<option value="&mvt:curr_y;">&mvt:curr_y;</option>
		  </mvt:if>
		  <mvt:assign name="l.settings:curr_y" value="l.settings:curr_y - 1 " />
		</mvt:while>
	  </select>
	</div>

	<div class="column medium-half email-newsletter-box">
	  <label class="newsletter-label">What are you Riding?</label>
		<mvt:comment>
		|
		| Shop for your Bike
		| Year & Model Dropdown -- Look at scripts.js under email-newsletter
		|
		</mvt:comment>
		<mvt:assign name="l.settings:shopForBikeYear:code" value="'year'" />
		<mvt:item name="toolkit" param="subcat|ccount|l.all_settings:shopForBikeYear:code" />
		<mvt:if expr="ccount GT 0">
		  <div id="what-are-your-riding-wrap">
			<div class="row">
			  <div class="column medium-half whole">
				<select name="riding_year" id="riding_year" class="oswald">
				  <option value="">Year</option>
				  <mvt:foreach iterator="sub_category" array="sub_categories">
					<mvt:if expr="l.settings:sub_category:code EQ g.riding_year">
					  <option value="&mvt:sub_category:code;" selected>&mvt:sub_category:name;</option>
					<mvt:else>
					  <option value="&mvt:sub_category:code;">&mvt:sub_category:name;</option>
					</mvt:if>
				  </mvt:foreach>
				</select>
			  </div>
			  <div class="column medium-half whole">
				<mvt:if expr="g.riding_year OR g.riding_model">
					<mvt:assign name="l.settings:getfilters" value="g.domain:mm_url $ 'Screen=forthebike&Category_Code=' $ g.riding_year $ '&email_newsletter=' $ g.riding_model $ '&fornewsletter=1'" />
					<select name="riding_model" id="riding_model" class="oswald">
						<mvt:call action="l.settings:getfilters" method="'GET'">
								<mvt:eval expr="s.callvalue" />
						</mvt:call>
					</select>
				<mvt:else>
					<select name="riding_model" id="riding_model" class="oswald" disabled>
						  <option value="">Model</option>
					</select>
				</mvt:if>
			  </div>
			</div>
		  </div>
		</mvt:if>
	</div>

	<div class="column medium-half email-newsletter-box">
	  <label class="newsletter-label">Gender</label>
	  <div class="clear"></div>
	  <mvt:if expr="g.gender EQ 'F'">
		<label class="en-gender-label" for="gender_m"><input type="radio" value="M" name="gender" id="gender_m"> Male</label>
		<label class="en-gender-label" for="gender_f"><input type="radio" value="F" name="gender" checked="checked" id="gender_f"> Female</label>
	  <mvt:else>
		<label class="en-gender-label" for="gender_m"><input type="radio" value="M" name="gender" id="gender_m" checked="checked"> Male</label>
		<label class="en-gender-label" for="gender_f"><input type="radio" value="F" name="gender" id="gender_f"> Female</label>
	  </mvt:if>
	</div>
	<div class="clear clearfix"></div>
	<div class="column large-one-fifth medium-one-fourth small-half medium-align-right align-center">
	  <input type="submit" class="sec-button button-block button uppercase bg-gold white" title="Signup" value="Signup" id="e-newsletter-btn">
	</div>

  </div>
</form> 

以上是关于java EmailDirect注册/ Mvt:call / API / Fancyshmancy || II构建的主要内容,如果未能解决你的问题,请参考以下文章

#yyds干货盘点#完善 Django 的 MVT 框架开发,记得添加路由哦~

Python:MVC和MVT开发模式

python框架面试题联系

MVC与MVT框架原理介绍

MVC与MVT框架原理介绍

xml mvt:assign&mvt:eval示例