.id
4757
.gutitle
jx_run
.title
jx_run
.file
.extension
.name
|/routinetype-utility|
.user_id
7
.notes
.body
<!---
Runs a given record in the most realistic way possible.
- for sites, try to just go to the site
- for routines, try to launch the routine on its home site, or in sandbox
- for others, display error message?
--->

<var C = GLOBAL.Def.Style.color>

<var _jParse = GLOBAL.Def.jParse.jParse>
<var _is_single = GLOBAL.Def.jParse.single>

<if _is_single NEQ 1>
<!--- result must be single --->
<tag.jx_layout title="Single Required | Joelie">
<h3>Single Required</h3>

<p>
The Joelie string <b>#escapeMarkup(GLOBAL.Def.jParse.jStr_resolved)#</b> does not select a single record. Singles are like /table-id.
</p>

<p>
<a href="http://#this_domain#/">Home</a>
</p>
</tag.jx_layout>
<BREAK>
</if>



<var _count = 0>
<var _shown = 0>
<set orb="#_jParse.orb#" select="count(#_jParse.orb#.id) AS idcount" where="#_jParse.where#" tbl="#_jParse.otype#" id="#_jParse.idnum#">
<setcrawl><var _count = set.idcount></setcrawl>
</set>

<if _count NEQ 1>
<!--- result not found --->
<tag.jx_layout title="Not Found | Joelie">
<h3>Not Found</h3>

<p>
The Joelie string <b>#escapeMarkup(GLOBAL.Def.jParse.jStr_resolved)#</b> leads to a single that does not exist, or you do not have access.
</p>

<p>
<a href="http://#this_domain#/">Home</a>
</p>
</tag.jx_layout>
<BREAK>
</if>



<ensure variable="get.login" value="0">
<fake_person>
<if get.login EQ 1>
<!--- result not found --->
<tag.jk_layout title="Cannot Visit Logged In | Joelie">
<h3>Cannot Visit Logged In</h3>

<p>
You cannot visit <b>#escapeMarkup(GLOBAL.Def.jParse.jStr_resolved)#</b> while logged in.
</p>

<p>
<a href="http://#this_domain#/">Home</a>
</p>
</tag.jk_layout>
<BREAK>
</if>
</fake_person>

<if _jParse.otype EQ "site">
<set j="#_jParse.str#.id.gutitle.domain" maxrows="1">
<setcrawl>
<if trim(set.domain) NEQ "">
<var _url = "http://#trim(lcase(set.domain))#/">
<if get.login EQ 1><var _url = _url & "?" & "&soTransfer=#urlEncodedFormat(client_cookie)#"></if>
<elseif trim(set.gutitle) NEQ "">
<var _url = "http://#trim(lcase(set.gutitle))#.joelie.org/">
<if get.login EQ 1><var _url = _url & "?" & "&soTransfer=#urlEncodedFormat(client_cookie)#"></if>
<else>
<var _url = "http://joelie.org/?&o=#set.id#">
<if get.login EQ 1><var _url = _url & "&soTransfer=#urlEncodedFormat(client_cookie)#"></if>
</if>
<goto url="#_url#"> <break>
</setcrawl>
<setempty>
/site-#_jParse.idnum#.id.gutitle.domain
</setempty>
</set>
<elseif _jParse.otype EQ "routine">
<var _id = _jParse.idnum>
<var _gutitle = "">
<set j="#_jParse.str#.id.gutitle" maxrows="1">
<setcrawl>
<tag.set_format orb="#_jParse.orb#"> <var D = return>
<var _id = D.idnum>
<var _gutitle = set.gutitle>
</setcrawl>
</set>
<var _matching_sites = 0>
<!--- see if this routine is strongly affiliated with any particular site(s) --->
<set orb="site" select="count(site.id) AS idcount"
where="site.soloroutineid_unsignedint = #_id# OR site.routineid_unsignedint = #_id#">
<setcrawl> <var _matching_sites = set.idcount> </setcrawl>
</set>
<if _matching_sites GT 0>
<tag.jk_layout title="run: #GLOBAL.Joelie.Parse.str#">

<style type="text/css">
##opts { }
##opts p { margin-left:1em; color:#C.g5#; }
</style>

<div style="max-width:640px;">

<h2>Test your routine:</h2>

<div style="margin-left:1.5em;">

<set orb="site" select="site.id,site.gutitle,site.title,site.soloroutineid_unsignedint"
where="site.soloroutineid_unsignedint = #_id# OR site.routineid_unsignedint = #_id#">
<if set.recordcount EQ 1 AND set.soloroutineid_unsignedint EQ _id>
<setcrawl>
<tag.set_format> <var DD = return>
<if get.login EQ 1>
<goto url="http://#this_domain#/run:/site-#DD.idstr#?&login=1">
<else>
<goto url="http://#this_domain#/run:/site-#DD.idstr#">
</if>
<break>
</setcrawl>
<break>
<elseif set.recordcount GT 0>
<!---<h3 style="margin-bottom:0.2em;">Sites:</h3>--->
<div style="padding-bottom:2px; margin-bottom:5px; border-bottom:1px solid #C.pri#;"><small>
<b>Sites</b> - this routine is the home page of at least one
site. Choose a site to test the routine live on that site.
</small></div>
<div style="margin-left:1em;">
<setcrawl>
<tag.set_format orb="site"> <var DD = return>
<div>
<a href="http://#this_domain#/run:/site-#DD.idstr#<if get.login EQ 1>?&login=1</if>">#DD.title#</a>
</div><div style="height:5px;">&nbsp;</div>
</setcrawl>
</div>
<div>&nbsp;</div>
</if>
</set>

<if _gutitle NEQ "">
<var _url = "http://fentriss.net/#trim(lcase(_gutitle))#">
<else>
<var _url = "http://fentriss.net/routine-#_id#">
</if>
<!---<h3 style="margin-bottom:0.2em;">Sandbox:</h3>--->
<div style="padding-bottom:2px; margin-bottom:5px; border-bottom:1px solid #C.pri#;"><small>
<b>Sandbox</b> - any routine can be tested in an isolated environment
using the Sandbox at Fentriss.net. If you need to test
as a logged in user, you may also <a href="http://fentriss.net/">log into the sandbox</a>
at your own risk.
</small></div>
<div style="margin-left:1em;">
<a href="#_url#"><b>Use Sandbox</b> (default option)</a>
</div>

</div>

</div>

</tag.jk_layout>
<else>
<!--- nope. just use sandbox. --->
<if _gutitle NEQ "">
<var _url = "http://fentriss.net/#trim(lcase(_gutitle))#">
<else>
<var _url = "http://fentriss.net/routine-#_id#">
</if>
<goto url="#_url#"> <break>
</if>
<else>
</if>
 
.sum_double
0.00
.producttype
.productincludes
.physical_unsignedint
0
.isprotected_unsignedint
0
.overridesiteheader_unsignedint
0