# This config file is bash code that is loaded in the main script
# see their use in the bin/koalaskin-generate if you want to override them
# in themes.
# DO NOT MODIFY THIS FILE
# modify for theme XXX templates/_koalathemes/XXX/ks_config
# or templates/ks_config-XXX

# theme writers should add to KSTEMPLATES (initialized here) the list of
# their supplemental templates files, via _KSDECLARE_TEMPLATES,
# e.g: _KSDECLARE_TEMPLATES attachagain attachnew ...
KSTEMPLATES="$expansed_files"

########### the TWiki Forms in view mode
export FORM_LM=;FORM_TL=;FORM_TR=;FORM_BL=;FORM_BR=;FORMEDIT_T=;FORMEDIT_B=
export FORM_LM_ON='<span class=ks_form>%META{"form"}%</span>'
export FORM_TL_ON='<table class=ks_form align=left><tr><td>%META{"form"}%</table>'
export FORM_TO_ON='<span class=ks_form>%META{"form"}%</span>'
export FORM_TR_ON='<table class=ks_form align=right><tr><td>%META{"form"}%</table>'
export FORM_BL_ON='<span class=ks_form>%META{"form"}%</span>'
export FORM_BR_ON='<table class=ks_form align=right><tr><td>%META{"form"}%</table>'
export FORMEDIT_ON='%FORMFIELDS%'

########### navbar code
export _KSNAVBARHN=''
export _KSNAVBARFN=''
export _KSNAVBARH='%NAVBAR{prefix="" suffix="<br>"}%'
export _KSNAVBARF='%NAVBAR{prefix="<div class=ks_navbar align=right>" suffix="</div>"}%'
export _KSNAVBARHG='%NAVBAR{prefix="" suffix="<br>" graphics="on"}%'
export _KSNAVBARFG='%NAVBAR{prefix="<div class=ks_navbar align=right>" suffix="</div>" graphics="on"}%'

########### sitemap
export _KSWEBMAP="<table class=ks_sitemap border=0 cellspacing=1 cellpadding=1 width='100%'><tr><th><table width='100%'><tr><th align=left>Web Name<th align=right><small>map/news</small></table><th>Description"
export _KSWEBMAP_maplinks="<table width='100%'><td>"
export _KSWEBMAP_maplinks_none="<table class=ks_sitemap border=0 cellspacing=1 cellpadding=1 width='100%'><tr><th>Web Name<th>Description"
export _KSWEBMAP_end="</table>"

function _KSWEBMAP_maplink () {
 maplink="<td align=right><a href='%SCRIPTURL%/view%SCRIPTSUFFIX%/$web/$KSWEBMAPTOPIC' title='Map of web <nop>$web'><img src='%PUBURLPATH%/_ks/sitemap.gif' width=16 height=16 border=0></a><a href='%SCRIPTURL%/view%SCRIPTSUFFIX%/$web/WebChanges' title='Newest changed topics of web <nop>$web'><img src='%PUBURLPATH%/%TWIKIWEB%/TWikiDocGraphics/changes.gif' width=16 height=16 border=0></a></table>"
}

function _KSWEBMAP_maplink_none () {
 maplink="<td align=right></table>"
}
function _KSWEBMAP_newgroup () {
 echo "<tr><td class=topicTitleCell valign=top bgcolor='#${colors1[nweb]}'>$maplinks"
}
function _KSWEBMAP_newweb () {
  echo -n "<tr><td class=topicTitleCell valign=top bgcolor='#${colors1[nweb]}'>$maplinks$margin"
}
function _KSWEBMAP_awn () {
  awn="<small>(actual web name: <tt>${webnames[nweb]}</tt>)</small>"
}
# $1=url $2=name $3=selectedWeb or web, $4 tooltip, $5=maplink
function _KSWEBMAP_entry () {
  echo "<span class=topicTitle><a href='$1' class=$3 title=\"$4\">$2</a></span>$5</td>
      <td class=topicItemCell valign=top align=left bgcolor='#${colors2[nweb]}'>
      <span class='topicItem'>${comments[nweb]} $awn
      </span></td></tr>"
}

function _KSGROUP_legend () {
  echo "<h1>${group[curgroup]}</h1>
${comments[gn]}
<p>This web is just a group of sub-webs:"
}

export _KSGROUP_empty_header="%TMPL:INCLUDE{\"groupmap\"}%"
export _KSGROUP_nonempty_header=""

########### search
function _KSSEARCH_option () {
  echo "<option value=group $groupsel>web group</option><option value=web $websel>this web</option>"
}
########### left box links
# decorate a set of links in the left bar
function _KSLEFTBOX_link () { for i in "$@"; do echo -n "$i<br>";done; }

########### webs bar
###### related
## functions called to draw group bar or webs bar if we use the style RELATED
## will call the 
# $1=web $2=group $3=webs $4=nweb
function _KSBAR_related_group () {
relatedwebs_bar '%SCRIPTURL%/view%SCRIPTSUFFIX%/'"${tabnames[$4]}"'/%HOMETOPIC%' "${tabnames[$4]}" "title=\"`quote_attval \"${comments[$4]}\"`\""
}
# $1=web $2=group $3=webs $4=nweb
function _KSBAR_related () {
  relatedwebs_bar '%SCRIPTURL%/view%SCRIPTSUFFIX%/'"${tabnames[$4]}"'/%HOMETOPIC%' "${tabnames[$4]}" "title=\"`quote_attval \"${comments[$4]}\"`\"" $KSTABWIDTH "$2"
}

relatedwebs_bar () { # $1=url $2=name, $3 tooltip, opt. $4=width [$5 parentweb]
  if [ -n "$5" ]; then 
    local pg np ptt
    np="${N[num_$5]}"
    ptt="title='`quote_attval \"${comments[$np]}\"`'"
    pg="<a href='%SCRIPTURL%/view%SCRIPTSUFFIX%/${tabnames[$np]}/%HOMETOPIC%' class=unselectedGroup \" $ptt>$5</a>&nbsp;&gt;&nbsp;"
  fi
  echo "<table border=0 cellspacing=0 cellpadding=2  width='100%'><tr><td align=left width=${4:-$KSTABWIDTH} class=selectedGroupCell>$pg<a href='$1' class=selectedGroup $3>$2</a></td><td class=groupCell align=right> %RELATEDWEBS% </td></tr></table>"
}

###### empty
## function called when the websbar is totally empty (groups & webs)
function _KSBARgroup_empty () {
    echo "$webs_start"
    echo "$webs_end"
}
## function called when the (sub) websbar is empty
function _KSBAR_empty () {
  echo "$ws_print<td></td>$webs_end"
}

###### classic
# fixed part
export _KSSEP='|'
group_start="<table border=0 cellspacing=0 cellpadding=2 align=center class=groupsbar><tr>"
group_end="</tr></table>"
group_sep="<td class=groupCell>$_KSSEP</td>"
webs_start="<table border=0 cellspacing=0 cellpadding=2  width='100%' class=websbar><tr class=webCell><td class=webCell width=$KSTABWIDTH>$emptybar<td><table border=0 cellspacing=0 cellpadding=2><tr>"
webs_start_break="<table border=0 cellspacing=0 cellpadding=2  width='100%'><tr class=webCell><td class=webCell width=10>$emptybar<td><table border=0 cellspacing=0 cellpadding=2><tr>"
webs_end="</tr></table></table>"
webs_sep="<td class=webCell>$_KSSEP</td>"
webs_break="</tr></table><table border=0 cellspacing=0 cellpadding=2><tr>"

# variable part
group_tab () { # $1=url $2=name $3=selected or "", $4 tooltip, opt. $5=width
  echo "<td align=center width=${5:-$KSTABWIDTH} class=${3:-g}${3:+G}roupCell><a href='$1' class=${3:-g}${3:+G}roup $4>$2</a></td>"
}
webs_tab () { # $1=url $2=name $3=selected or "", $4 tooltip, opt. $5=width
  echo "<td align=center width=${5:-$KSTABWIDTH} class=${3:-w}${3:+W}ebCell><a href='$1' class=${3:-w}${3:+W}eb $4>$2</a></td>"
}

### EMACS MODES
### Local Variables: ***
### mode:ksh ***
### End: ***
