.id
3326
.gutitle
qi_messages
.title
qi_messages
.file
.extension
.name
|/routinetype-page|
.user_id
7
.notes
.body
<!--- >
iqtpi messaging tab: makes use of tag.m.

note the simplicity: my immediate goal is just to provide a simple inbox/sent interface.
< --->

<style type="text/css">
.m_message { position:relative; overflow:auto; overflow-x:hidden; overflow-y:hidden; margin-bottom:1.2em; }
.m_message .left { width:48px; max-height:64px; overflow:hidden; float:left; }
.m_message .right { margin-left:56px; border-top:1px solid ##ccc; }
.m_message_head { position:relative; padding:3px; background:##eee; }
.m_message_body { position:relative; padding:3px; display:none; min-height:1.5em; }
.m_message_controls { position:relative; padding:3px; text-align:right; }
/* unread messages */
.m_message.unread .m_message_head { font-weight:bold; }
.m_message.unread .m_message_controls { display:none; }
/* read messages */
.m_message.read .m_message_head { font-weight:normal; }
.m_message.read .m_message_controls { display:block; }
</style>



<var _count = GLOBAL.Def.unread_messages>


<ensure variable="get.folder" value="inbox">


<tag.m task="count" type="all" folder="#get.folder#">
<var _total = return>
<if get.folder EQ "sent">
<var _count = _total>
</if>


<tag.m task="get" folder="#get.folder#">
<var M = return>


<div class="noverflow">

<!--- filters --->
<div style="float:right; width:180px;">

<div class="side_links switches">
<a class="<if get.folder NEQ 'sent'>selected</if>" href="http://#this_domain#/Messages">Inbox</a>
<a class="<if get.folder EQ 'sent'>selected</if>" href="http://#this_domain#/Messages?&folder=sent">Sent</a>
<a href="http://#this_domain#/People">New Message</a>
</div>

</div>

<!--- messages --->
<div style="margin-right:212px;">

<div style="border:1px solid ##999; margin-bottom:11px; padding:7px; overflow:hidden;<if M.recordcount LT 7> display:none;</if>">
<input title="Message Search" type="text" class="filter" style="padding:0px; border:0px solid white; width:100%; font-size:1em;">
</div>

<var set = M>
<setempty>

<small><p>
(There are no messages in this folder.)
</p></small>

</setempty>
<setcrawl>

<!--- each message --->
<var _u_href = "http://iqtpi.com/#set.from_unsignedint#">
<div id="m-#set.id#" class="m_message filter_parent <if set.read_unsignedint NEQ 1>unread<else>read</if>">
<div class="left">
<a title="#escapeDoubleQuotes(escapeMarkup(set.from_name))#" href="#_u_href#"><img src="http://#this_domain#/file:/user-#set.from_unsignedint#?&f2=icon-2&picwidth=48" border="0"></a>
</div>
<div class="right">
<div class="m_message_head">
<div style="float:right; z-index:2;">
<a id="delete:m-#set.id#" class="delete_link" href="##">Delete</a>
</div>
<var _subject = "(no subject)">
<if trim(set.title) NEQ "">
<var _subject = escapeMarkup(set.title)>
</if>
<a href="##" class="m_read_link filter_child">#_subject#</a>
</div>
<div class="m_message_body"><small>
<var _output = escapeMarkupPseudo(set.body)>
<var _output = replaceNoCase(_output,'#CHR(10)#--- Original Message ---','<span style="color:##999;">#CHR(10)#--- Original Message ---') & '</span>'>
<var _output = escapeWhiteSpace(_output)>
#_output#
</small></div>
<div class="m_message_controls"><small><small>
<span style="color:##999;">
Sent from <a href="http://#this_domain#/#set.from_unsignedint#">#escapeMarkup(set.from_name)#</a>
to <a href="http://#this_domain#/#set.to_unsignedint#">#escapeMarkup(set.to_name)#</a>,
#timeAgo(set.sent_datetime)#
</span>
&nbsp; &nbsp;
<a href="##" class="m_read_link">Open</a>
|
<a href="http://#this_domain#/Compose?&u=#set.from_unsignedint#&m=#set.id#" class="m_reply_link">Reply</a>
|
<a href="##" class="m_mark_unread_link">Mark Unread</a>
</small></small></div>
</div>
</div>

</setcrawl>

</div>

</div>


<tag.jquery>
<script type="text/javascript">
$(document).ready(function() {

$('.filter_child').each(function() {
this.orig_html = $(this).html();
this.orig_text = $(this).text();
});

$('.filter').keyup(function(e) {
var _txt = jQuery.trim($(this).val().toLowerCase());
if (_txt == '') {
$('.filter_child').each(function() {
$(this).html(this.orig_html);
});
$('.filter_parent').show();
}
else {
$('.filter_parent').each(function() {
var c = $(this).find('.filter_child')[0];
if (c !== null) {
var _t = jQuery.trim($(c).text().toLowerCase());
if (_t.indexOf(_txt) > -1) {
$(this).show();
var _reg = new RegExp('(' + _txt + ')',"gi");
var _new_txt = c.orig_text.replace(_reg,'<b>$1</b>');
$(this).find('.filter_child').each(function() {
$(this).html(_new_txt);
});
}
else {
$(this).hide();
}
}
});
}
});

$('.m_message').each(function() {

this.is_open = 0;
this.idnum = 0;
var _s = this.id.split('-');
this.idnum = _s[_s.length-1];

this.open = function() { // open the message body, so you can read it
$(this).find('.m_message_body').slideDown(320);
this.is_open = 1;
this.mark_read();
}
this.close = function() { // close the message body
$(this).find('.m_message_body').slideUp(180);
this.is_open = 0;
}

this.mark_read = function() {
if ($(this).hasClass('unread')) {
$.post('http://' + document.domain + '/?&siteformat=xml&elId=' + this.id, {
"1_posttype": "update",
"1_orb": "m",
"1_where": "m.id = " + this.idnum,
"1_read_unsignedint": 1
}, function(data) {
var _s = this.url.split('=');
var elId = _s[_s.length-1];
var that = $('##' + elId)[0];
/*
do something with that?
*/
});
$(this).removeClass('unread');
$(this).addClass('read');
}
}
this.mark_unread = function() {
if ($(this).hasClass('read')) {
$.post('http://' + document.domain + '/?&siteformat=xml&elId=' + this.id, {
"1_posttype": "update",
"1_orb": "m",
"1_where": "m.id = " + this.idnum,
"1_read_unsignedint": 0
}, function(data) {
var _s = this.url.split('=');
var elId = _s[_s.length-1];
var that = $('##' + elId)[0];
/*
do something with that?
*/
});
$(this).removeClass('read');
$(this).addClass('unread');
}
}

$(this).find('.m_read_link').click(function() {
var that = $(this).parents('.m_message')[0];
if (that.is_open == 1) {
that.close();
$(that).find('.m_read_link').each(function() {
if ($(this).html() == 'Close') {
$(this).html('Open');
}
});
}
else {
that.open();
$(that).find('.m_read_link').each(function() {
if ($(this).html() == 'Open') {
$(this).html('Close');
}
});
}
return false;
});

$(this).find('.m_mark_unread_link').click(function() {
var that = $(this).parents('.m_message')[0];
that.mark_unread();
return false;
});

});

});
</script>
 
.sum_double
0.00
.producttype
.productincludes
.physical_unsignedint
0
.isprotected_unsignedint
0
.overridesiteheader_unsignedint
0