TopicAClassSheetX1

Last modified by Holger Dick on 2009/04/16 09:45

#set ($showattachments = "no")
#set ($showcomments = "no")

<style type="text/css">
#includeTopic('BBCode.Skin')
</style>

{pre}
<script type="text/javascript">
function quote(id) {
  $('BBCode.PostClass_postcontent').value = "-quote:"+id+"-" + $('BBCode.PostClass_postcontent').value;
}

function setquote() {
  var s = $('BBCode.PostClass_postcontent').value
  var matches = s.match(/-quote:message[0-9]*-/);
  for (var i=0; i < matches.length; i++) {
    var oldmatch = matches[i];
    var newmatch = matches[i].replace(/-quoteemoticon_unhappymessage[0-9]*)-/, "$1");
    s = s.replace(oldmatch, "<blockquote>" + $(newmatch).innerHTML + "</blockquote>");
  }
  $('BBCode.PostClass_postcontent').value = s;
  return false;
 return cancelCancelEdit();
}
</script>
{/pre}

#if($request.parent && $request.parent!="") #set($parent=$request.parent) #else #set($parent=$doc.parent) #end
<input type="hidden" name="parent" value="$parent" />

#set($class = $doc.getObject("BBCode.TopicClass").xWikiClass)

<input type="hidden" name="title" value="" />

<div class="bbbigbox">

#if ($context.action == 'inline')
$msg.bb_entertopictitle<br /> $doc.display('topictitle')

$msg.bb_entertopicdescription<br /> $doc.display('topicdescription')

#template('tagedit.vm')

#set($newtopictitle = $request.nicetopictitle)
#if($newtopictitle)
#set($newtopictitle = $newtopictitle.replaceAll('"',"'"))
<script type="text/javascript">
var nicetopictitle = "${newtopictitle}";
{pre}
document.forms.inline["BBCode.TopicClass_0_topictitle"].value = nicetopictitle;
document.forms.inline["title"].value = nicetopictitle;
{/pre}
</script>
#end

#if($doc.isNew() == 'false')
#set($title = $doc.getValue('topictitle', $doc.getObject('BBCode.TopicClass')))
<script type="text/javascript">
var nicetopictitle = "${title}";
{pre}
document.forms.inline["title"].value = nicetopictitle;
{/pre}
</script>
#end

#else

#set($postindex = 0)

<table class="topictable">

  <tr>
   <th> $msg.Author </th>
    <th> #if ($doc.getValue('topictitle', $doc.getObject('BBCode.TopicClass')) != "") $doc.display('topictitle') #else $doc.name #end #if ($doc.getValue('topicdescription', $doc.getObject('BBCode.TopicClass')) != "") - <span class="bbdatatext">$doc.display('topicdescription') </span> #end </th>
  </tr>

#set($postclass = $doc.getObjects('BBCode.PostClass'))

#set($tagClass = $xwiki.getClass("XWiki.TagClass"))
#set($tagsProp = $tagClass.tags)
#set($sep = $tagsProp.getProperty("separator").getValue())
#set ($tags = $doc.tags.split("${sep}"))
#set($existingTags = $xwiki.arrayList)
 #foreach($tag in $tags)
  #set($discard = $existingTags.add($tag))
 #end

  <tr>
   <td colspan="2">
<div class="tags">
#if ($existingTags.size()>0 && $existingTags.get(0).length()>0)
<span class="bbdatatext"> $msg.bb_topictags
#foreach ($tag in $existingTags)
<a href='$xwiki.getURL("WebHome")?tag=$tag'> $tag </a>
#end
</span>
#end
 </div>
<span class="bbdatatext"> $postclass.size() $msg.posts in topic </span>
   </td>
  </tr>

#foreach($item in $postclass)
#set ($postauthor = $xwiki.getUserName($doc.display('postauthor', $item), true))
#if ($doc.getValue('postcontent', $item) != '')
#set ($postindex = $postindex + 1)

  <tr class="#if($postindex % 2 == 0) evenpost #end">
   <td id="posttd">
#set ($localpostauthor = $doc.display('postauthor', $item))
#set ($index = $localpostauthor.indexOf(":"))
#set ($index = $index + 1)
#set ($localpostauthor = $localpostauthor.substring($index))
<div class="avatar">
<a href="$xwiki.getURL($localpostauthor)"> Failed to execute the [useravatar] macro </a><br />
$postauthor<br />
#if($context.user == $doc.display('postauthor', $item) || $xwiki.hasAdminRights() == 'true') <a class="red" href="$doc.getURL("objectremove", "classname=BBCode.PostClass&amp;classid=${item.number}&amp;xredirect=${request.getRequestURL()}")">$msg.Delete Post</a> #end #end
</div></td>
   <td id="posttd"> <div  id="message$item.number"> <span class="bbdatatext"> <a name=$postindex href="#$postindex">$postindex</a> - $msg.Posted on $doc.display('postdate', $item) $msg.by $postauthor </span>&nbsp;- <a href="#postmessage" onclick="quote('message$item.number')"> $msg.Quote this post </a>
<hr size="1" />
<div class="postcontent">
$doc.display('postcontent', $item)
</div></div>
   </td>
  </tr>

#end

  <tr>
   <td> &nbsp; </td>
    <td>
#if ($context.user == 'XWiki.XWikiGuest')
<span class="bbdatatext"> $msg.bb_needloginmessage </span>
#else
#set ($lastpostid = $postclass.size() + 1)
<span class="bbsmalltitle"> <a name=postmessage href="#postmessage"> $msg.Post Message </a> </span>
<form method="post" action="$doc.getURL("objectadd")" onsubmit="setquote();">
<input type="hidden" name="xredirect" value="$doc.getURL()#$lastpostid" />
<input type="hidden" name="classname" value="BBCode.PostClass" />
<input type="hidden" name="BBCode.PostClass_postauthor" value="$context.user" />
<textarea rows="10" cols="65" id="BBCode.PostClass_postcontent" name="BBCode.PostClass_postcontent" /></textarea><br />
<input type="submit" value="$msg.Post your message" />
</form>
#end
   </td>
  </tr>
</table>

#end

</div>

Tags:
Created by Administrator on 2008/02/11 14:24

My Recent Modifications


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 2.7.1.${buildNumber} - Documentation