kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

Square Components

this advances upon xmirax's idea here, inspired by m_annalore.

this isnt perfect, so, it may screw up the output of your layout.

if you want a square top navbar as well, we have a thingy for that right here.
########################################
#          SQUARE COMPONENTS           #
# kunzite1, component-help/277527      #
# overrides:                           #
#   print_my_entries(Page p)           #
#   print_entry_header(string content) #
#   print_bottom_nav(RecentPage p)     #
#   print_comp_header(string content)  #
#   print_nav_comp(Page p)             #
#   print_free_text(Page p)            #
########################################

# Make Global Title/Subtitle box have square corners
### Override the print_my_entries so we can make a custom titles and/or title sub components
function print_my_entries(Page p, string title) {

    # Set to be your welcome note title, if you want one
    var string welcome_title = "Welcome Note Title";

    # Set to be your welcome note. HTML is taken, so make sure it's valid and is all properly closed tagged. 
    # Use "<br/><br/>" for line breaks with space between
    var string welcome_note = """Welcome Note Line 1<br /><br />Welcome Note Line 2 etc.""";

    # Because we are going to override the Page title, and there is no function to draw the component borders for such
    # a thing, we need to do it all by hand. For the curved corner pieces, we need to match the color to the rest of your
    # component. To do this, we need to set a variable to be used since it cannot be obtained from the stylesheet.
    var Color header        = $*header_bgcolor;
    var Color headerMinus5  = $header->darker(50);
    var Color headerPlus3   = $header->lighter(30);
    var string corner_color = "/p0"+$headerPlus3->substr(1,6)+"1"+$headerMinus5->substr(1,6)+"2"+$header->substr(1,6);

    var string header_box_open  = """<table cellspacing="0" cellpadding="0" border="0"><tr><td class="dkLine" colspan="7"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="tabBg" rowspan="1" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="tabBg" width="100%"><div class="compFont" style="position:relative; top:-3px; left:2px;">""";
    var string header_box_close = """</div></td><td class="tabBg" width="3" ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="medLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr></table>""";

    # Start the column for the body. Do not delete this line
    """<td valign="top" width="100%">""";
    
    if($p.global_title != "" or $p.global_subtitle != "") {
      # Start the new title component.
      print $header_box_open;

      # Now we put the actual title content in. You can put whatever you want here. As an example, I've the following lines
      # will insert the Title on all pages and Subtitle only on the recent page, and centered in the component. If you don't 
      # want something centered, remove the <center> and </center> tags surrounding it it.  
      # Also, as an example, the blue line shows how to add an image above your title, but it is commented since it is incomplete.
      # If you'd like to an an image above the title, decomment the line by removing the # in front it and complete the URL.
      # If you are curious, the different "views" for condition checking are {recent, friends, day, reply, entry, month, year}.
                        
                        #"""<center><img src="YOUR IMAGE URL" border="0" alt="" /></center>""";
                        # print the Full Title of the page [Journal title and Page specific title]:
                        """<div class="userTitle"><center>"""; print $p->title(); """</center></div>""";
                        # print the Journal Subtitle if it exists, and if we're on the recent page :
                        if ($p.global_subtitle!="" and $p.view=="recent") {
                           """<div class="userSubTitle"><center>"""; print $p.global_subtitle; """</center></div>""";
                        }

      # Close off the title component and place a spacer after it.
      print $header_box_close;
    }
    $p->print_body();
}

# Make default entry component headers and default comment component headers have square corners
function print_entry_header(string content) {
"""
<table cellspacing="0" cellpadding="0" border="0" width="100%">
  <tr>
    <td class="dkLine" colspan="7"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine"  colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine"  colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine"  colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine"  rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine"  rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="tabBg"   rowspan="1" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine"  rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
   <td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine"  width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine"  width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" width="3"            ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
    <td class="tabBg"   width="100%">
      <div class="entryDate" style="position:relative; top:-3px; left:2px;">$content</div>
    </td>
    <td class="tabBg"   width="3"            ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
    <td class="medLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine"  width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
</table>""";
}

# Make prev/next link component at bottom of RecentPage have square corners
function print_bottom_nav(RecentPage p) {
  var string prev = "";
  var string next = "";

  var string bottom_nav_box_open  = """<table cellspacing="0" cellpadding="0" border="0"><tr><td class="dkLine" colspan="7"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="tabBg" rowspan="1" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="tabBg" width="100%"><div class="compFont" style="position:relative; top:-3px; left:2px;">""";
  var string bottom_nav_box_close = """</div></td><td class="tabBg" width="3" ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="medLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr></table>""";

  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 prevPalImg = "p1" + $ltLineString->substr(1,6) + "0" + $dkLineString->substr(1,6);
  var string nextPalImg = "p0" + $ltLineString->substr(1,6) + "1" + $dkLineString->substr(1,6) + "2" + $medLineString->substr(1,6);

  if($p.nav.backward_url != "") {
    $prev = """<span class="header-item"><a href="$p.nav.backward_url" class="headerLinks"><img src="$*PALIMGROOT/component/back.gif/$prevPalImg" width="13" height="10" alt="$*nav_text_back" border="0" /> $*nav_text_back</a></span>""";
  }

  if($p.nav.backward_url != "" and $p.nav.forward_url != "") {
    $prev = $prev + " ";
  }

  if($p.nav.forward_url != "") {
    $next = """<span class="header-item"><a href="$p.nav.forward_url" class="headerLinks">$*nav_text_forward <img src="$*PALIMGROOT/component/forward.gif/$nextPalImg" width="13" height="10" alt="$*nav_text_forward" border="0"></a></span>""";
  }

  if($prev != "" or $next != "") {
    print $bottom_nav_box_open;
    """<div style="position:relative; top:-5px; text-align:center;">$prev$next</div>""";
    print $bottom_nav_box_close;
  }
}

# Make side components have square corners
function print_comp_header(string content) {
var string style = ($*comp_state == "right") ? " style='margin-right:3px;'" : "";
"""
  <tr$style>
    <td class="dkLine" colspan="7"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine"  colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine"  colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine"  colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine"  rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine"  rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="tabBg"   rowspan="1" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine"  rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine"  width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="ltLine"  width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="medLine" width="3"            ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
    <td class="tabBg"   width="100%">
      <div class="sideHeader" style="position:relative; top:-3px; left:2px;">$content</div>
    </td>
    <td class="tabBg"   width="3"            ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
    <td class="medLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    <td class="dkLine"  width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  </tr>
  <tr>
    <td class="dkLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" 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="compBg" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
    <td class="compBg" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td>
    <td class="compBg"><div class="compFont">""";
}

# Make navigation component have square corners
function print_nav_comp(Page p) {
  var string nav_box_open  = """<tr><td class="dkLine" colspan="7"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="tabBg" rowspan="1" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="tabBg" width="100%"><div class="compFont" style="position:relative; top:-3px;">""";
  var string nav_box_close = """</div></td><td class="tabBg" width="3" ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="medLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr>""";
  var string compBR = """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";

  print $nav_box_open;

  var string[] views_order = ["recent", "friends", "archive", "userinfo"]; # view order
                                                                           # "recent"   = recent   view
                                                                           # "friends"  = friends  view
                                                                           # "archive"  = calendar view
                                                                           # "userinfo" = userinfo link
  var string{} view_text   = { # build text hash
                              "recent"   => $*nav_entries_text,
                              "friends"  => $p.journal_type != "C" ? $*nav_friends_text : $*text_view_friends_comm,
                              "archive"  => $*nav_calendar_text,
                              "userinfo" => $*nav_info_text
                             };
  var string   base_url    = $p.journal->base_url(); # get base url
  var string{} view_url    = { # build url hash
                              "recent"   => "$base_url/",
                              "friends"  => "$base_url/friends/",
                              "archive"  => "$base_url/calendar/",
                              "userinfo" => "$*SITEROOT/userinfo.bml?user=$p.journal.username&mode=full"
                             };
  foreach var string v ($views_order) {
    if($v != "recent"){
      print $compBR;
    }
    print """<div class="compList"><a href="$view_url{$v}" class="headerLinks">$view_text{$v}</a></div>""";
  }

  # to add your own links you can use these as a templates
  #    print $compBR + """<div class="compList"><a href="$*SITEROOT/tools/memories.bml?user=$p.journal.username" class="headerLinks">memories</a></span></div>""";
  #    print $compBR + """<div class="compList"><a href="http://www.yahoo.com/" class="headerLinks">yahoo!</a></span></div>""";

  var string website_name = $p.journal.website_name ? $p.journal.website_name : $*text_website_default_name;
  if ($p.journal.website_url != "") {
    print $compBR;
    """<div class="compList"><a href="$p.journal.website_url">$website_name</a></div>""";
  }

  $p->lay_viewspec_nav();

  print $nav_box_close;
}

# New kinds of boxes that have square corners
function print_free_text(Page p){
var string free_text_header_box_open  = """<tr><td class="dkLine" colspan="7"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="tabBg" rowspan="1" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" rowspan="3" colspan="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg" colspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="tabBg" width="100%"><div class="sideHeader" style="position:relative; top:-3px; left:2px;">""";
var string free_text_header_box_close = """</div></td><td class="tabBg" width="3" ><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="medLine" width="1" rowspan="2"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" width="1" rowspan="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="medLine" colspan="4"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="5"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr>""";
var string free_text_box_open  = """<tr><td class="dkLine" colspan="7"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="compBg" width="1"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="compBg" width="1"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="compBg"><div class="compFont">""";
var string free_text_box_close = """</div></td><td class="compBg" width="1"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="compBg" width="1"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="dkLine" width="1"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine" colspan="8"><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td><img src="http://stat.livejournal.com/palimg/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr>""";

print_comp_header("moo"); # standard component with square corners
"""moo""";
print_comp_footer();

print $free_text_header_box_open;   # component header-like box
"""moo""";
print $free_text_header_box_close;

print $free_text_box_open;          # component box-like box
"""moo""";
print $free_text_box_close;
}
Tags: admin: deprecated, user: kunzite1
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 134 comments
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →
Previous
← Ctrl ← Alt
Next
Ctrl → Alt →