put the following into your layer. then insert $e->print_metadata();
into print_entry()
where you want to print the metadata. don't worry about any logic, it's all in here.function Entry::print_metadata() {
var string tags_header = "Current Tags";
var string tags_joiner = ":";
var Color header = $*header_bgcolor;
var Color headerMinus5 = $header->darker(50);
var Color headerPlus3 = $header->lighter(30);
var Color ltLineColor = $*header_bgcolor->lighter(30);
var Color dkLineColor = $*header_bgcolor->darker(50);
var string ltLineString = $ltLineColor.as_string;
var string medLineString = $*header_bgcolor.as_string;
var string dkLineString = $dkLineColor.as_string;
var string corner_color = "/p0"+$headerPlus3->substr(1,6)+"1"+$headerMinus5->substr(1,6)+"2"+$header->substr(1,6);
var string k1_flatbox_open = """<tr><td colspan=7><table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-top-left.gif$corner_color" width="5" height="5" alt="" border="0" /></td><td class="dkLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-top-right.gif$corner_color" width="5" height="5" alt="" border="0" /></td></tr><tr><td class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="tabBg" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="tabBg" width="100%"><div class="compFont">""";
var string k1_flatbox_close = """</div><td class="tabBg" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="ltLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-bottom-left.gif$corner_color" width="5" height="5" alt="" border="0" /></td><td class="tabBg"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-bottom-right.gif$corner_color" width="5" height="5" alt="" border="0" /></td></tr><tr><td class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr></table></td></tr><tr><td colspan=5><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr>""";
var Link edit_tags = $this->get_link("edit_tags");
if ((size $.metadata > 0) or ((size $.tags > 0) and ($*tags_aware))){
var string currents = "";
$currents = """<div class="currents"><table>$k1_flatbox_open""";
foreach var string k ($.metadata){
var string text = $k;
var string val = $.metadata{$k};
if ($k == "mood"){
$text = $*text_meta_mood;
}
elseif ($k == "music") {
$text = $*text_meta_music;
}
if ($k == "mood" and defined $.mood_icon){
var Image i = $.mood_icon;
$val = "<img src='$i.url' width='$i.width' height='$i.height' align='middle' alt='' /> $val";
}
$currents = $currents + """<div class="current$k"><strong>$text</strong> $val</div>""";
}
if ((size $.tags > 0) and $*tags_aware) {
var int tcount = 0;
if($edit_tags.url != "") {
$tags_header = """<a href="$edit_tags.url">$tags_header</a>""";
}
$currents = $currents + """<strong>$tags_header$tags_joiner</strong> """;
foreach var Tag t ($.tags) {
$currents = $currents + """<a rel="tag" href="$t.url">$t.name</a>""";
$tcount++;
if ($tcount != size $.tags) { $currents = $currents + ", "; }
}
}
$currents = $currents + "$k1_flatbox_close</table></div>";
println "$currents";
}
}