kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

[theme] - [component] - [sticky skins]

it ain't complete, but, here ya go.
class MyUtils {
  function lay_string_appendarg (string url, string arg) : string;
  function lay_string_appends2id(string url)             : string;
}

function MyUtils::lay_string_appendarg(string url, string arg) : string
{
  var string anchor = "";
  var string temp   = "";
  var string joiner = "";

  # use ? or & to append the argument
  $joiner = $url->contains("?") ? "&" : "?";

  # check for anchor link
  if ($url->contains("#")) { 
    foreach var int a (0 .. $url->length() - 1) {
      $temp = $url->substr($a, $url->length() - $a);
      if ($temp->starts_with("#")) {
        # pull anchor string off the end of the url
        $anchor = $temp;
        $url = $url->substr(0, $a);
      }
    }
  }
  # return the url with argument inserted
  return $url+$joiner+$arg+$anchor;
}

function MyUtils::lay_string_appends2id(string url) : string {
  var Page   p      = get_page();
  var string return = "";
  if($p.args{"s2id"} != "") {
    $return = $this->lay_string_appendarg($url, "s2id=$p.args{"s2id"}&.s2id=$p.args{"s2id"}");
  } else {
    $return = $url;
  }
  return $return;
}

function print_free_text(Page p) {
print_comp_header("skins");
var bool     stickys2ids = true;                            # append .s2id=$s2id to make it stick

var int[]    s2ids       = [1, 2, 3, 4];                    # s2ids found on /customize/advanced/styles.bml
var string[] names       = ["one", "two", "three", "four"]; # names to use as link text for each style

var string   url         = "";
foreach var int i (0 .. size($s2ids) - 1) {
  $url = "?s2id=$s2ids[$i]" + (($stickys2ids == true) ? "&.s2id=$s2ids[$i]" : "");
  """<a href="$url">$names[$i]</a><br />""";
}
print_comp_footer();
}

###################################
#     SHRINKING AND CENTERING     #
# kunzite1, component-help/248593 #
# overrides page_layout(Page p)   #
###################################
function page_layout(Page p) {
  var MyUtils mu   = new MyUtils;
  # Set this to the width that you want both the navbar (if it exists) and the whole journal to be
  # may be percentage (70%) or number of pixels (700px).
  var string k1Swidth      = "100%";
  var string k1Sheader_url = ""; # optional header image url
  var string k1Sheader_alt = ""; # optional header image alt text

  # Start the html document and print the head section which controls the page title, stylesheet information,
  # server supplied head content, and custom header informtion from the print_custom_head function.
  var string title = $p->title();
  """
  <html>
  <head>
    <link rel="stylesheet" href="$p.stylesheet_url" type="text/css"/>
  """;
  $p->print_head();
  """
    <title>$title</title>
  </head>
  """;
  
  # Start the body section of the html document which controls the visible parts of the page.
  """<body style="text-align:center;">""";

  if($k1Sheader_url != "") {
    """<div align="center"><img src="$k1Sheader_url" alt="$k1Sheader_alt" title="$k1Sheader_alt" /></div>""";
  }

  if($k1Swidth != "") {
    """<table style="border: 0px; margin: auto; padding: 0px; width:$k1Swidth;"><tr><td>""";
  }

  # Print the navigation bar if it is needed. This can be incorporated into any other tutorials which override
  # the page_layout() function, and should be placed immediately after the <body> tag above.
  if (not $*comp_navbar or $*comp_state=="none") {
    """<div class="header">""";
    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) {
      $view_url{$v} = $mu->lay_string_appends2id($view_url{$v});
      print """<span class="header-item"><a href="$view_url{$v}">$view_text{$v}</a></span>""";
    }

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

    if ($p.journal.website_url != "") {
        print "<span class=\"header-item\"><a href=\"$p.journal.website_url\">$p.journal.website_name</a></span>";
    }
    $p->lay_viewspec_nav();  # prints previous / next links including arrow images
    """	
    </div>
    """;
  }

  # Print a spacer at the top of the page above the components and main area.
  """<div><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></div>""";

  # Start the table which lays out the components and main area in side-by-side layout
  """
  <table cellspacing="0" cellpadding="0" valign="top">
    <tr valign="top" width="100%">
      <td width="3">
        <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />
      </td>
  """;
  
  # If the components are supposed to be on the left side of the page, then print them, followed by a column
  # with a spacer which is to seperate the components and the main area.
  if ($*comp_state == "left") {
    print_my_components($p);
    """
    <td width="3">
      <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />
    </td>
    """;
  }

  # Print the main area of the page.
  print_my_entries($p, $title);

  # If the components are supposed to be on the right side of the page, then first print a column with a spacer 
  # and then print the components after the spacer. 
  if ($*comp_state == "right") {
    """
    <td width="3">
      <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />
    </td>
    """;
    print_my_components($p);
  }

  # Finish off the table for the body
  """
      <td width="3">
        <img src="$*PALIMGROOT/component/clear.gif" width="3" height="1" alt="" border="0" />
      </td>
    </tr>
  </table>
  """;

  if($k1Swidth != "") {
    """</td></tr></table>""";
  }

  # End the body section and end the html document
  """
  </body>
  </html>
  """;
}

function CommentInfo::print_readlink() {
  var Page    p    = get_page();
  var MyUtils mu   = new MyUtils;
  var string  url  = $mu->lay_string_appends2id($.read_url);
  var string  text = get_plural_phrase($.count, "text_read_comments" + (($p.view == "friends") ? "_friends" : ""));
  """<a href="$url">$text</a>""";
}

function CommentInfo::print_postlink() {
  var Page    p    = get_page();
  var MyUtils mu   = new MyUtils;
  var string  url  = $mu->lay_string_appends2id($.post_url);
  var string  text = get_plural_phrase($.count, "text_post_comment" + (($p.view == "friends") ? "_friends" : ""));
  """<a href="$url">$text</a>""";
}

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

  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);

  var string corner_color = "/p0"+$ltLineString->substr(1,6)+"1"+$dkLineString->substr(1,6)+"2"+$medLineString->substr(1,6);

  var string bottom_nav_box_open  = """<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" 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="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>""";

  if($p.nav.backward_url != "") {
    var string prev_url = $mu->lay_string_appends2id($p.nav.backward_url);
    $prev = """<span class="header-item"><a href="$prev_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 != "") {
    var string fore_url = $mu->lay_string_appends2id($p.nav.forward_url);
    $next = """<span class="header-item"><a href="$fore_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 navigation component have square corners
function print_nav_comp(Page p) {
  var MyUtils mu = new MyUtils;

  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"+$ltLineString->substr(1,6)+"1"+$dkLineString->substr(1,6)+"2"+$medLineString->substr(1,6);
  var string nav_box_open  = """<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" style="position:relative; top:-3px;">""";
  var string nav_box_close = """</td><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>""";
  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;
    }
    $view_url{$v} = $mu->lay_string_appends2id($view_url{$v});
    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>""";
  #    print $compBR + """<div class="compList"><a href="http://www.yahoo.com/" class="headerLinks">yahoo!</a></span>""";

  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;
}

function Page::lay_viewspec_nav() {
# do nothing
}

function RecentPage::lay_viewspec_nav() {
  var MyUtils mu   = new MyUtils;
  var Color     header        = $*header_bgcolor;
  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 RecentNav n             = $.nav;
  var string    prev          = $n.backward_url;
  var string    fore          = $n.forward_url;
  var bool      both          = false;
  var string    prevPalimg    = "/p1" + $ltLineString->substr(1,6) + "0" + $dkLineString->substr(1,6);
  var string    forePalimg    = "/p0" + $ltLineString->substr(1,6) + "1" + $dkLineString->substr(1,6) + "2" + $medLineString->substr(1,6);
  var string    previous      = get_plural_phrase($.nav.backward_count, "text_skiplinks_back");
  var string    forward       = get_plural_phrase($.nav.backward_count, "text_skiplinks_forward");
  var string{}  nav;

  if($prev != "") {
    $prev = $mu->lay_string_appends2id($prev);
    $prev = """<a href="$prev"><img src="$*PALIMGROOT/component/back.gif$prevPalimg" border="0" alt="$previous" title="$previous" /> $previous</a>""";
  }

  if($prev != "" and $fore != "") {
    $both = true;
  }

  if($fore != "") {
    $fore = $mu->lay_string_appends2id($fore);
    $fore = """<a href="$fore">$forward <img src="$*PALIMGROOT/component/forward.gif$forePalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /></a>""";
  }

  $nav{"prev"} = $prev;
  $nav{"fore"} = $fore;

  if($*comp_navbar) {
    # div
    if($nav{"prev"} != "" or $nav{"fore"} != "") {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"fore"} != "") {
      """<div class="compList">""";
      print $nav{"fore"};
      "</div>";
    }
    if($both) {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"prev"} != "") {
      """<div class="compList">""";
      print $nav{"prev"};
      "</div>";
    }
  } else {
    # span
    if($nav{"prev"} != "") {
      "<span class=\"header-item\">";
      print $nav{"prev"};
      "</span>";
    }
    if($nav{"fore"} != "") {
      "<span class=\"header-item\">";
      print $nav{"fore"};
      "</span>";
    }
  }
}

function YearPage::lay_viewspec_nav() {
  var MyUtils mu   = new MyUtils;
  var Color  header        = $*header_bgcolor;
  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 int index        = 0;
var int currentYearIndex;
var string prev      = "";
var int    prev_year;
var string fore      = "";
var int    fore_year;
foreach var YearYear y ($.years) {
  if ($y.displayed) {
    $currentYearIndex = $index;
  }
  $index = $index + 1;
}
if($currentYearIndex > 0){
  $prev      = $mu->lay_string_appends2id($.journal->base_url() + "/$.years[$currentYearIndex - 1].year");
  $prev_year = $.years[$currentYearIndex - 1].year;
}
if($currentYearIndex < (size $.years) - 1){
  $fore      = $mu->lay_string_appends2id($.journal->base_url() + "/$.years[$currentYearIndex + 1].year");
  $fore_year = $.years[$currentYearIndex + 1].year;
}
  var bool      both       = false;
  var string    prevPalimg = "/p1" + $ltLineString->substr(1,6) + "0" + $dkLineString->substr(1,6);
  var string    forePalimg = "/p0" + $ltLineString->substr(1,6) + "1" + $dkLineString->substr(1,6) + "2" + $medLineString->substr(1,6);
  var string{}  nav;

  if($prev != "") {
    $prev = """<a href="$prev"><img src="$*PALIMGROOT/component/back.gif$prevPalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /> $prev_year</a>""";
  }

  if($prev != "" and $fore != "") {
    $both = true;
  }

  if($fore != "") {
    $fore = """<a href="$fore">$fore_year <img src="$*PALIMGROOT/component/forward.gif$forePalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /></a>""";
  }

  $nav{"prev"} = $prev;
  $nav{"fore"} = $fore;

  if($*comp_navbar) {
    # div
    if($nav{"prev"} != "" or $nav{"fore"} != "") {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"fore"} != "") {
      """<div class="compList">""";
      print $nav{"fore"};
      "</div>";
    }
    if($both) {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"prev"} != "") {
      """<div class="compList">""";
      print $nav{"prev"};
      "</div>";
    }
  } else {
    # span

    if($nav{"prev"} != "") {
      "<span class=\"header-item\">";
      print $nav{"prev"};
      "</span>";
    }
    if($nav{"fore"} != "") {
      "<span class=\"header-item\">";
      print $nav{"fore"};
      "</span>";
    }
  }
}

function MonthPage::lay_viewspec_nav() {
  var MyUtils mu   = new MyUtils;
  var Color  header        = $*header_bgcolor;
  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    prev       = $.prev_url;
  var string    fore       = $.next_url;
  var bool      both       = false;
  var string    prevPalimg = "/p1" + $ltLineString->substr(1,6) + "0" + $dkLineString->substr(1,6);
  var string    forePalimg = "/p0" + $ltLineString->substr(1,6) + "1" + $dkLineString->substr(1,6) + "2" + $medLineString->substr(1,6);
  var string{}  nav;

  if($prev != "") {
    $prev = $mu->lay_string_appends2id($prev);
    $prev = """<a href="$prev"><img src="$*PALIMGROOT/component/back.gif$prevPalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /> """ + $.prev_date->date_format("%%month%% %%yyyy%%") + """</a>""";
  }

  if($prev != "" and $fore != "") {
    $both = true;
  }

  if($fore != "") {
    $fore = $mu->lay_string_appends2id($fore);
    $fore = """<a href="$fore">""" + $.next_date->date_format("%%month%% %%yyyy%%") + """ <img src="$*PALIMGROOT/component/forward.gif$forePalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /></a>""";
  }

  $nav{"prev"} = $prev;
  $nav{"fore"} = $fore;

  if($*comp_navbar) {
    # div
    if($nav{"prev"} != "" or $nav{"fore"} != "") {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"fore"} != "") {
      """<div class="compList">""";
      print $nav{"fore"};
      "</div>";
    }
    if($both) {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"prev"} != "") {
      """<div class="compList">""";
      print $nav{"prev"};
      "</div>";
    }
  } else {
    # span
    if($nav{"prev"} != "") {
      "<span class=\"header-item\">";
      print $nav{"prev"};
      "</span>";
    }
    if($nav{"fore"} != "") {
      "<span class=\"header-item\">";
      print $nav{"fore"};
      "</span>";
    }
  }
}

function DayPage::lay_viewspec_nav() {
  var MyUtils mu   = new MyUtils;
  var Color  header        = $*header_bgcolor;
  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    prev       = $.prev_url;
  var string    fore       = $.next_url;
  var bool      both       = false;
  var string    prevPalimg = "/p1" + $ltLineString->substr(1,6) + "0" + $dkLineString->substr(1,6);
  var string    forePalimg = "/p0" + $ltLineString->substr(1,6) + "1" + $dkLineString->substr(1,6) + "2" + $medLineString->substr(1,6);
  var string{}  nav;

  if($prev != "") {
    $prev = $mu->lay_string_appends2id($prev);
    $prev = """<a href="$prev"><img src="$*PALIMGROOT/component/back.gif$prevPalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /> $*text_skiplinks_back</a>""";
  }

  if($prev != "" and $fore != "") {
    $both = true;
  }

  if($fore != "") {
    $fore = $mu->lay_string_appends2id($fore);
    $fore = """<a href="$fore">$*text_skiplinks_forward <img src="$*PALIMGROOT/component/forward.gif$forePalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /></a>""";
  }

  $nav{"prev"} = $prev;
  $nav{"fore"} = $fore;

  if($*comp_navbar) {
    # div
    if($nav{"prev"} != "" or $nav{"fore"} != "") {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"fore"} != "") {
      """<div class="compList">""";
      print $nav{"fore"};
      "</div>";
    }
    if($both) {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"prev"} != "") {
      """<div class="compList">""";
      print $nav{"prev"};
      "</div>";
    }
  } else {
    # span
    if($nav{"prev"} != "") {
      "<span class=\"header-item\">";
      print $nav{"prev"};
      "</span>";
    }
    if($nav{"fore"} != "") {
      "<span class=\"header-item\">";
      print $nav{"fore"};
      "</span>";
    }
  }
}

function EntryPage::lay_viewspec_nav() {
  var MyUtils mu   = new MyUtils;
  var Color  header        = $*header_bgcolor;
  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 Link      prevLink   = $.entry->get_link("nav_prev");
  var Link      foreLink   = $.entry->get_link("nav_next");
  var string    prev       = $prevLink.url != "" ? $prevLink.url : "";
  var string    fore       = $foreLink.url != "" ? $foreLink.url : "";
  var bool      both       = false;
  var string    prevPalimg = "/p1" + $ltLineString->substr(1,6) + "0" + $dkLineString->substr(1,6);
  var string    forePalimg = "/p0" + $ltLineString->substr(1,6) + "1" + $dkLineString->substr(1,6) + "2" + $medLineString->substr(1,6);
  var string{}  nav;

  if($prev != "") {
    $prev = $mu->lay_string_appends2id($prev);
    $prev = """<a href="$prev"><img src="$*PALIMGROOT/component/back.gif$prevPalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /> $*text_skiplinks_back</a>""";
  }

  if($prev != "" and $fore != "") {
    $both = true;
  }

  if($fore != "") {
    $fore = $mu->lay_string_appends2id($fore);
    $fore = """<a href="$fore">$*text_skiplinks_forward <img src="$*PALIMGROOT/component/forward.gif$forePalimg" border="0" alt="$*text_skiplinks_back" title="$*text_skiplinks_back" /></a>""";
  }

  $nav{"prev"} = $prev;
  $nav{"fore"} = $fore;

  if($*comp_navbar) {
    # div
    if($nav{"prev"} != "" or $nav{"fore"} != "") {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"fore"} != "") {
      """<div class="compList">""";
      print $nav{"fore"};
      "</div>";
    }
    if($both) {
      """<div class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></div>""";
    }
    if($nav{"prev"} != "") {
      """<div class="compList">""";
      print $nav{"prev"};
      "</div>";
    }
  } else {
    # span
    if($nav{"prev"} != "") {

      "<span class=\"header-item\">";
      print $nav{"prev"};
      "</span>";
    }
    if($nav{"fore"} != "") {
      "<span class=\"header-item\">";
      print $nav{"fore"};
      "</span>";
    }
  }
}
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 27 comments