<!--- expects POST.blabber_text to be a nonempty string. --->
<var POST.blabber_text = trim(POST.blabber_text)>
<ensure variable="POST.blabber_jstr" value="">
<tag.bn_media_def>
<var GLOBAL.Media_Def = return>
<if len(POST.blabber_text) GT 280>
<tag.bn_layout title="This Post is Too Long | Balloon">
<h3>Please Shorten This Post</h3>
<p>
Posts on Balloon may not contain more than 280 characters.
<b>This post has #len(POST.blabber_text)# characters.</b>
</p>
<div style="margin-left:1em;">
<postform>
<div>
<textarea name="blabber_text" style="width:80%; height:8em;">#escapeMarkup(POST.blabber_text)#</textarea>
</div>
<div> </div>
<div class="pagebtn" style="margin-right:2em;" align="right">
<input type="submit" value="Retry This Post" style="cursor:pointer;" class="submit">
</div>
<input type="hidden" style="display:none;" name="blabber_jstr" value="#escapeDoubleQuotes(POST.blabber_jstr)#">
</postform>
</div>
<div> </div>
<div> </div>
</tag.bn_layout>
<BREAK>
</if>
<!--- yay! post it. --->
<var _write_to_you_idnum = 0>
<if POST.blabber_jstr EQ "" OR POST.blabber_jstr EQ "/user-#client_id#">
<!--- post an update --->
<var _bullgiveto_unsignedint = 0>
<var _bulltitle = "#escapeMarkup(client_name)# - Update">
<var _bulltype = "update">
<var _bulljstr = "">
<var _bulltext = "#escapeMarkup(POST.blabber_text)#">
<var _bullmessage_ping = "#escapeMarkup(client_name)# posted an update on Balloon">
<var _pinghref = "http://#this_domain#/#client_id#">
<var _pingjstr = "/user-#client_id#">
<var _bulluballoon_b = "">
<var _bulluname_b = "">
<else>
<tag.jparse_parse str="j:#POST.blabber_jstr#">
<var Jp = return>
<if Jp.status NEQ 1>
<!--- error: invalid jstr --->
<tag.bn_layout title="Cannot Post About #escapeMarkup(POST.blabber_jstr)# | Balloon">
<h3>Cannot Post About #escapeMarkup(POST.blabber_jstr)#</h3>
<p>
The selector is invalid.
</p>
<tag.bn_btn val="Back to Balloon" slash="">
<div> </div>
</tag.bn_layout>
<BREAK>
<elseif Jp.single NEQ 1>
<!--- error: too complex --->
<tag.bn_layout title="Cannot Post About #escapeMarkup(POST.blabber_jstr)# | Balloon">
<h3>Cannot Post About #escapeMarkup(POST.blabber_jstr)#</h3>
<p>
This is a complex data set. Balloon does not currently
support posts about sets containing more than one record.
</p>
<tag.bn_btn val="Back to Balloon" slash="">
<div> </div>
</tag.bn_layout>
<BREAK>
<elseif NOT isNumeric(Jp.id)>
<!--- error: non-numeric identifier --->
<tag.bn_layout title="Cannot Post About #escapeMarkup(POST.blabber_jstr)# | Balloon">
<h3>Cannot Post About #escapeMarkup(POST.blabber_jstr)#</h3>
<p>
This selector does not use a numeric identifier, ex. "/user-123".
Balloon currently does not support posts that utilize alphabetic
selectors, ex. "/user-fentriss".
</p>
<tag.bn_btn val="Back to Balloon" slash="">
<div> </div>
</tag.bn_layout>
<BREAK>
<else>
<if Jp.tbl EQ "user">
<!--- write on your friend's profile --->
<set j="#Jp.jStr_resolved#.balloon">
<setcrawl>
<if listFind(GLOBAL.Def.Friends.intList,set.id) EQ 0>
<!--- not actually friends! --->
<goto url="http://#this_domain#/">
<BREAK>
</if>
<var _uname = "/user-#set.id#">
<if trim(set.name) NEQ "">
<var _uname = escapeMarkup(set.name)>
</if>
<var _bullgiveto_unsignedint = set.id>
<var _bulltitle = "#escapeMarkup(client_name)# - writing to #_uname#">
<var _bulltype = "write_to_friend">
<var _bulljstr = "">
<var _bulltext = "#escapeMarkup(POST.blabber_text)#">
<var _bullmessage_ping = "#escapeMarkup(client_name)# wrote to #_uname# on Balloon">
<var _pinghref = "http://#this_domain#/#set.id#">
<var _pingjstr = "/user-#client_id#">
<var _bulluballoon_b = "#set.balloon#">
<var _bulluname_b = _uname>
<var _write_to_you_idnum = set.id>
</setcrawl>
</set>
<elseif listFindNoCase(GLOBAL.Media_Def._tbls,Jp.tbl) GT 0>
<!--- media comment --->
<set j="#Jp.jStr_resolved#">
<setcrawl>
<var _media_ping_desc = "">
<if set.title NEQ "">
<var _media_ping_desc = " (#escapeMarkup(set.title)#)">
</if>
<var _media_jstr = "/#set.tbl#-#set.id#">
<set j="/user-#set.user_id#.balloon">
<setcrawl>
<if set.id NEQ client_id AND listFind(GLOBAL.Def.Friends.intList,set.id) EQ 0>
<!--- not actually friends! --->
<goto url="http://#this_domain#/">
<BREAK>
</if>
<var Model = GLOBAL.Media_Def.Tbls[Jp.Tbl]>
<var _uname = "/user-#set.id#">
<var _ufnames = "/user-#set.id#'s">
<if trim(set.name) NEQ "">
<var _uname = escapeMarkup(set.name)>
<var _ufnames = trim(listFirst(set.name,' '))>
<if right(_ufnames,1) EQ "s">
<var _ufnames = _ufnames & "'">
<else>
<var _ufnames = _ufnames & "'s">
</if>
<if set.id EQ client_id>
<var _ufnames = "their">
</if>
</if>
<var _bullgiveto_unsignedint = set.id>
<var _bulltitle = "#escapeMarkup(client_name)# - media comment to #_uname#">
<if set.id EQ client_id>
<var _bulltitle = "#escapeMarkup(client_name)# - media comment to self">
</if>
<var _bulltype = "media_comment">
<var _bulljstr = _media_jstr>
<var _bulltext = "#escapeMarkup(POST.blabber_text)#">
<var _bullmessage_ping = "#escapeMarkup(client_name)# wrote on #_ufnames# #Model.singular##_media_ping_desc#">
<var _pinghref = "http://#this_domain#/j:#_media_jstr#">
<var _pingjstr = "#_media_jstr#">
<var _bulluballoon_b = "#set.balloon#">
<var _bulluname_b = _uname>
<if set.id NEQ client_id>
<var _write_to_you_idnum = set.id>
<var _bullmessage_ping_thou = "#escapeMarkup(client_name)# wrote on your #Model.singular##_media_ping_desc#">
</if>
</setcrawl>
</set>
</setcrawl>
</set>
<else>
<!--- error: unsupported table --->
<tag.bn_layout title="Cannot Post About #escapeMarkup(POST.blabber_jstr)# | Balloon">
<h3>Cannot Post About #escapeMarkup(POST.blabber_jstr)#</h3>
<p>
Balloon does not currently
support posts that refer to the <b>/#Jp.tbl#</b> table.
</p>
<tag.bn_btn val="Back to Balloon" slash="">
<div> </div>
</tag.bn_layout>
<BREAK>
</if>
</if>
</if>
<tag.bn_bull
j='#_bulljstr#'
title='#_bulltitle#'
body='#_bulltext#'
type='#_bulltype#'
giveto_unsignedint='#_bullgiveto_unsignedint#'
uballoon_b='#_bulluballoon_b#'
uname_b='#_bulluname_b#'>
<var _idnum = return>
<!--- ping! --->
<var _friends_intList = GLOBAL.Def.Friends.intList>
<if _write_to_you_idnum NEQ 0>
<!--- exclude target from friends intList --->
<var _new_friends_intList = "0">
<loop list="#_friends_intList#" index="x">
<if x NEQ _write_to_you_idnum>
<var _new_friends_intList = _new_friends_intList & "," & x>
</if>
</loop>
<var _friends_intList = _new_friends_intList>
<!--- ping that dude --->
<if isDefined("_bullmessage_ping_thou")>
<tag.ping function="post"
type="#_bulltype#"
jstr="/user-#client_id#"
users_intList="#client_id#"
message="#_bullmessage_ping_thou#"
send_email="1"
user_whereclause_append="user.balloon <> '' AND user.balloon IS NOT null"
email_href="#_pinghref#"
email_from="balloon@thisisballoon.com"
age_bypass="1"
emailoptout_tag="#_bulltype#">
<else>
<tag.ping function="post"
type="write_to_you"
jstr="/user-#client_id#"
users_intList="#_write_to_you_idnum#"
message="#escapeMarkup(client_name)# wrote to you (on your Balloon profile)"
send_email="1"
user_whereclause_append="user.balloon <> '' AND user.balloon IS NOT null"
email_href="http://#this_domain#/#_write_to_you_idnum#"
email_from="balloon@thisisballoon.com"
age_bypass="1"
emailoptout_tag="write_to_you"
published_override="1">
</if>
</if>
<if GLOBAL.Def.Friends.total GT 0>
<var _cidstr = client_id>
<tag.ping function="post"
type="#_bulltype#"
jstr="#_pingjstr#"
users_intList="#_friends_intList#"
message="#_bullmessage_ping#"
send_email="1"
user_whereclause_append="user.balloon <> '' AND user.balloon IS NOT null"
email_href="#_pinghref#"
email_from="balloon@thisisballoon.com"
age_bypass="1"
emailoptout_tag="#_bulltype#">
</if>
<if return NEQ "pants">
<if left(so_slash_string,2) EQ "j:">
<goto url="http://#this_domain#/#so_slash_string#?&function=comments">
<else>
<goto url="http://#this_domain#/#client_id#/posts">
</if>
<BREAK>
</if>