.id
3201
.gutitle
j
.title
J
.file
.extension
.name
|/routinetype-utility|
.user_id
7
.notes
Output good-looking, flexible, ajax-ified sets of data in one (short) line of code.

|/site-fentriss|
.body
<!--- >
Turns a jparse string into idiot-proof web output! Less code, more results.
< --->


<!--- ensure dependencies: style and script. --->
<ensure variable="GLOBAL.did_j_include_already" value="0">
<if isdefined("att.naked") AND att.naked EQ 1><var GLOBAL.did_j_include_already = 1></if>
<if GLOBAL.did_j_include_already NEQ 1>
<link rel="stylesheet" type="text/css" href="http://#this_domain#/j_service?&service=style"/>
<tag.jquery>
<script type="text/javascript" src="http://#this_domain#/j_service?&service=script"></script>
<var GLOBAL.did_j_include_already = 1>
</if>

<!--- prevent excessive recursion --->
<ensure variable="GLOBAL.j_depth" value="0">
<ensure variable="GLOBAL.j_limit" value="3">
<if NOT isNumeric(GLOBAL.j_limit)><var GLOBAL.j_limit = 0><elseif GLOBAL.j_limit GT 7><var GLOBAL.j_limit = 7></if>
<if NOT isNumeric(GLOBAL.j_depth)><var GLOBAL.j_depth = 0><elseif GLOBAL.j_depth LT 0><var GLOBAL.j_depth = 0></if>
<if GLOBAL.j_depth GTE GLOBAL.j_limit>
<BREAK>
</if>
<var GLOBAL.j_depth = GLOBAL.j_depth + 1>





<ensure variable="att.j"><!--- jparse string --->
<ensure variable="att.set"><!--- pre-fetched data for that string --->

<if att.j EQ "j_service"> <BREAK> </if>

<ensure variable="get.j_orderby" value="">
<ensure variable="att.orderby" value="#get.j_orderby#"><!--- very dumb - only a few options here. --->
<var att.orderby = trim(lcase(att.orderby))>
<if listFind("update,insert",att.orderby) EQ 0>
<var att.orderby = "update">
</if>


<var _per = 10>
<var _start = 1>
<var _single = 0>
<var _picwidth = 180>
<!--- pagination --->
<ensure variable="get.per" value="10">
<if isDefined("att.per")>
<var _per = att.per>
<else>
<var _per = get.per>
</if>
<ensure variable="get.start" value="1">
<if isDefined("att.start")>
<var _start = att.start>
<else>
<var _start = get.start>
</if>
<!--- is it a single? --->
<var _single = 0>
<if isdefined("att.force_set") AND att.force_set EQ 1>
<var _single = 0>
<elseif reFind("^/?([a-z]+(_[a-z]+)*)-([0-9]+|[a-z]+(_[a-z]+)*)(\.([a-z]+(_[a-z]+)*))*$",att.j) EQ 1>
<var _single = 1>
</if>
<!--- how wide should the picture be? --->
<var _picwidth = listFirst(180/GLOBAL.j_depth,".")>

<!--- string filters --->
<ensure variable="get.j_filter" value="">
<ensure variable="att.highlight" value="">

<ensure variable="get.j_ajax_num" value="0"><!--- an arbitrary number used to prevent some ajax moves from getting mixed up --->
<if not (isNumeric(get.j_ajax_num))><var get.j_ajax_num = 0></if>

<!--- what options should the output contain? --->
<if isdefined("att.is_j_service") AND att.is_j_service EQ 1>
<ensure variable="get.j_options" value="">
<ensure variable="att.options" value="#get.j_options#">
<else>
<if find("@",att.j) GT 0>
<!--- special case: no need for options if this is a particular
user's set of data. --->
<ensure variable="att.options" value="none">
<else>
<ensure variable="att.options" value="">
</if>
</if>


<if NOT isQuery(att.set) OR (_single EQ 0 AND get.j_filter NEQ "")>
<!--- get the records --->
<var _extra = "">
<if trim(get.j_filter) NEQ "">
<if find('"',get.j_filter) GT 0>
<var _extra = _extra & ":'" & get.j_filter & "'">
<else>
<var _extra = _extra & ':"' & get.j_filter & '"'>
</if>
</if>
<var _jparse = jParse("#att.j##_extra#")>
<var _orderby = "#_jparse.orb#.so_lastupdated DESC">
<if att.orderby EQ "insert">
<var _orderby = "#_jparse.orb#.so_dateinserted DESC">
</if>
<var _where = "">
<if _jparse.where NEQ "">
<var _where = "(#_jparse.where#)">
</if>
<if _jparse.orb NEQ "site" AND site_id NEQ 593 AND site_id NEQ 528>
<!--- only ccsd and joelie can show ccs data --->
<if _where NEQ "">
<var _where = _where & " AND ">
</if>
<var _where = _where & "#_jparse.orb#.site_id NOT IN(593,334,222)">
</if>
<set orb="#_jparse.orb#"
select="#_jparse.select#"
where="#_where#"
tbl="#_jparse.otype#"
id="#_jparse.idnum#"
orderby="#_orderby#"
maxrows="#get.start+get.per#">
<var att.set = set>
</set>
</if>



<ensure variable="get.j_single_routine" value="">
<ensure variable="att.single_routine" value="#get.j_single_routine#">


<var set = att.set>
<IF _single NEQ 1>
<!---
Output set
--->
<tag.j_set single_routine="#att.single_routine#" orderby="#att.orderby#" options="#att.options#">

<ELSE>
<!---
Output single
--->
<tag.j_single single_routine="#att.single_routine#" orderby="#att.orderby#">

</IF>

<var GLOBAL.j_depth = GLOBAL.j_depth - 1>


<RETURN att.set>
 
.sum_double
0.00
.producttype
.productincludes
.physical_unsignedint
0
.isprotected_unsignedint
0
.overridesiteheader_unsignedint
0