mellie (nimble_lil_minx) wrote in component_help,
mellie
nimble_lil_minx
component_help

  • Mood:

scrollbar in entry {might be the possible problem}...

i think i kinda screwed up something with adding scroll bar to entries. here's the errors i've gotten

S2 Compiler Output at Fri Feb 10 22:59:55 2006

Error compiling layer: Compile error: line 527, column 19: Can't finish parsing NodeTerm

S2::NodeTerm, S2/NodeTerm.pm, 463
S2::NodeIncExpr, S2/NodeIncExpr.pm, 41
S2::NodeTypeCastOp, S2/NodeTypeCastOp.pm, 29
S2::NodeInstanceOf, S2/NodeInstanceOf.pm, 29
S2::NodeUnaryExpr, S2/NodeUnaryExpr.pm, 40
S2::NodeProduct, S2/NodeProduct.pm, 28
S2::NodeSum, S2/NodeSum.pm, 31
S2::NodeRelExpr, S2/NodeRelExpr.pm, 41
S2::NodeEqExpr, S2/NodeEqExpr.pm, 29
S2::NodeLogAndExpr, S2/NodeLogAndExpr.pm, 29
S2::NodeLogOrExpr, S2/NodeLogOrExpr.pm, 29
S2::NodeRange, S2/NodeRange.pm, 29
S2::NodeCondExpr, S2/NodeCondExpr.pm, 29
S2::NodeAssignExpr, S2/NodeAssignExpr.pm, 29
S2::NodeExpr, S2/NodeExpr.pm, 29
S2::NodePrintStmt, S2/NodePrintStmt.pm, 48
S2::NodeStmt, S2/NodeStmt.pm, 35
S2::NodeStmtBlock, S2/NodeStmtBlock.pm, 42
S2::NodeFunction, S2/NodeFunction.pm, 104
S2::Layer, S2/Layer.pm, 58
S2::Compiler, S2/Compiler.pm, 27
Context
523:
524: """;
525: }"""
526:
527: </div>
528: </td>
529: </tr>
530: </table></div> """;
531:




layerinfo "type" = "theme";
layerinfo "name" = "testin";

function Page::print_custom_head()
{
   var Color header = $*header_bgcolor;
   var Color headerMinus5  = $header->darker(50);
   var Color headerPlus3   = $header->lighter(30);
   """
   <style media="screen" type="text/css">
    html
    {

     scrollbar-base-color: #8498C6;
     scrollbar-track-color: #6FA6E5;
     scrollbar-darkshadow-color: #314273;
     scrollbar-shadow-color: #00397B;
     scrollbar-highlight-color: #C6DEFF;
     scrollbar-3dlight-color: #B1D3FE;
     scrollbar-arrow-color: #10184A;
     }
   
#commenttext { width: 90%; }

.compBg {background-image:
url("");} 

.entryHolderBg { background-image: url(""); }

.entry { background-image: url(""); }

table.fixed {
 table-layout:fixed;     
}
div.scrollentry {
 width:100%;
 overflow:auto;
 overflow-y:hidden;
 padding-bottom:17px;
}
</style>
""";
}


function page_layout(Page p) {
  # 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      = "80%";
  var string k1Sheader_url = "http://img.photobucket.com/albums/0903/InADream/hpdreams1.gif"; # 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 border="0" cellpadding="0" cellspacing="0" 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) {
      print """<span class="header-item"><a href="$view_url{$v}" class="headerLinks">$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" class="headerLinks">memories</a></span>""";
#    print """<span class="header-item"><a href="http://www.yahoo.com/" class="headerLinks">yahoo!</a></span>""";

    if ($p.journal.website_url != "") {
        print "<span class=\"header-item\"><a href=\"$p.journal.website_url\" class=\"headerLinks\">$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 print_free_text(Page p) {
  if ($*free_text_text and $*free_text) { 
      print_comp_header($*free_text_text);
      """$*free_text""";
      print_comp_footer();
  }

 



print_comp_header("Explore");
"""
<table border="1" bordercolor="#6F88B9" cellspacing="0" frame="void" width="100%">
  <tr>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/customize/">
  customize
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/customize/advanced/">
  <i>advanced</i>
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/customize/advanced/layers.bml">
  <i>layers</i>
</a>
    </td>
  </tr>

  <tr>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/customize/advanced/styles.bml">
  <i>styles</i>
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/manage/links.bml">
  <i>link lists</i>
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/update.bml?mode=full">
  update
</a>
    </td>
  </tr>

  <tr>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/editjournal.bml">
  edit entries
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/friends/">
  edit friends
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/editinfo.bml">
  edit info
</a>
    </td>
  </tr>

  <tr>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/changepassword.bml">
  edit pass
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/editpics.bml">
  edit pics
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/memories.bml">
  memories
</a>
    </td>
  </tr>

  <tr>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/misc/whereami.bml">
  my cluster
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/portal/">
  my portal
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/site/">
  site map
</a>
    </td>
  </tr>

  <tr>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/stats.bml">
  site stats
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/birthdays.bml">
  birthdays
</a>
    </td>
    <td align="center" width="30%">
<a href="http://www.livejournal.com/logout.bml">
  logout
</a>
    </td>
  </tr>

</table>


  """;
print_comp_footer();
}
### Override the printing of entries. This affects the Recent/Day pages, Friends pages, and Entry pages.
function print_entry(Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text) {



var string noscroll ;
if ($p.view == "recent" or $p.view == "friends") {
 $noscroll = "class=\"fixed\"" ;
}  

var string content_top = """<td class="entryHolderBg" width="100%" valign="top"><table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td width="100%"><table cellspacing="0" cellpadding="0" border="0" width="100%" $noscroll><tr><td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="entry">""";

  # Print the header for the entry. It prints in the default form "[<icon> ]<time> <date>" where:
  #   <icon> is the security icon (ie. lock if protected, eye if private, or none if public)
  #   <time> is in the default time format (eg: 03:46 am)
  #   <date> is bold and in the "long" format (eg: November 25th, 2003)
  # The ordering can be adjusted however needed, and you can also modify the formats that date and time print in.
  # This can all be done in the red section below. For specifications of available formats or how to construct
  #   your own formats, you can see: http://www.livejournal.com/doc/s2/siteapi.core1.html#siteapi.core1.dateformats
      
print_entry_header((defined $e.security_icon?"$e.security_icon   ":"")+" "+$e.time->date_format("long")+" "+$e.time->time_format());


  # This is where we begin the main section of the entry, ie. the "entry background"
  # I was trying to use print_system_box_top(), but the code it generated didn't seem to match up with the page source. 
  # I was having some problems with the usericon being displayed as well, so I just decided to write my own.
  """
  <table cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
      <td width="1" colspan="3" class="dkLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    </tr><tr>
      <td width="1" class="dkLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  """;


  # Check to see if we need to display a usericon and/or journal names, and if so, then print them
  # Cases - 1. We are viewing a friends page, so we need to display icons if they exist and journal/poster names
  #         2. We are viewing a recent/day/entry page, so we display only the icon if it exists and 
  #            the user has set recent userpics on.
  # The code in red is the logic to decide whether or not to show the userpics. You can modify it as you see fit.
  if ($p.view=="friends" or ($*show_entry_userpic and defined $e.userpic) or $e.journal.journal_type=="C") { 
     # Start the table that will hold the icon and/or names
     """
     <td class="entryHolderBg" valign="top">
     <table cellspacing="0" cellpadding="0" border="0" align="center">
       <tr>
         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
       </tr>
     """;
     # Display the icon if it exists
     if (defined $e.userpic) { """
       <tr>
         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="2" alt="" border="0" /></td>
         """;
         # If we are on the friends view, then we want to print the extra border around the image that have the colors
         # which are custom defined. If you don't like the colors or the border on the friends view, then you can just

 

         # remove the blue segments. By default the recent/day/entry pages have a border around the usericons. If a user
         # has a non-rectangular image, this may look strange, so you can replace the 1 with a 0 to remove the border.
         # 
         if ($p.view=="friends") { 
            """ <div style="padding-top: 3px; padding-left: 3px; padding-right: 3px; padding-bottom: 3px; background-color: """; print $bgcolor.as_string; """ ;" align="center">
            <img border="1" src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" alt="" style="border-color: """; print $fgcolor.as_string; """ ;" />
            </div> """;
         }else{
            """ <td align="center" class="userpic"><img border="1" src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" alt="" /></td> """;
         }
         """
       </tr>
     """; }
     # Display the journal and possibly poster name if we are viewing the friends page or any page on a community
     # This code will print the journal the entry was made on, and if the poster is different, will print the poster under it.
     # I made the names centered under the image, but if you want to keep them left aligned as in the original, then
     # remove the blue segments
     if ($p.view=="friends" or $e.journal.journal_type=="C") { """
       <tr>
         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="2" alt="" border="0" /></td>
         <td align="center" class="ljuser">$e.journal""";
         if ($e.journal.username!=$e.poster.username) {"""
           <div align="center" class="ljuser">$e.poster</div>""";
         } """
         </td>
       </tr>""";
     }
     """
     </table>
  """; }

  # Start the main entry text area
  #   The first line is needed because I did not use print_system_box_top() as stated above
#  """<td class="entryHolderBg" width="100%" valign="top">""";
#  print_content_top();
print $content_top;

  # If the subject is not empty, then print it followed by the line to seperate it from the entry text
  if ($e.subject!="") { """
        <div class="entryHeader">$e.subject</div>
        <div class="entryDash"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    </tr>
    <tr>
      <td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
      <td class="entry">
  """; }

if ($e.text->length() > 600) { 
 """<div style="height: 200px; width: 100%; overflow: auto;">""";
} else {
 """<div class="scrollentry">""";
}

  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 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 align="center" class="compFont">""";
  var string 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>""";

 
  # Print the entry text.
  # If you want the entry text to be after the mood and music, then you need to do two things:
  #  - decomment the pink lines by removing the #'s from in front of them
  #  - comment out the blue lines by putting a # in front of them

  """ $e.text """;

# Print Mood and/or Music Fields:
  # If we have a mood to print

  if ($e.metadata{"mood"}!="") { 
    # first we need a spacer after the entry text
    """<br/><br/>""";

   if($e.metadata{"mood"} != "" or $e.metadata{"music"} != "") {   """<table>$flatbox_open""";
  
   # and then we print the mood label and the mood
   """<b> $*text_meta_mood: </b>""";     
 # followed by the mood icon if one exists. If you don't want the mood icons to show, remove the line below
    if (defined $e.mood_icon) { """ $e.mood_icon """; }
    print $e.metadata{"mood"};  
    """<br/>""";


     #if ($e.metadata{"music"}=="") { """<br/>"""; }


  }
  # If we have music to print
  if ($e.metadata{"music"}!="") { 
    # If we didn't print a spacer because the mood was empty, then print one
    if ($e.metadata{"mood"}=="") { """<br/><br/>"""; }
    # then print the actual music label and the music
    """<b> $*text_meta_music: </b>"""; print $e.metadata{"music"};
    # """<br/><br/>""";

  }

   """$flatbox_close</table>""";}

   #""" $e.text """;
  
  # Close off the entry text area
  """</div>""";
  print_content_bottom();


  # This is where the fun stuff is!
  # Now we begin the area underneath the entry that holds the comments, link, and entry related buttons.
  """
  <table width="100%">
    </tr>
      <td width="100%" align="left" valign="bottom">
        <div class="entryComments">
        """;
        # First we print the comment links if the entry allows comments
        if ($e.comments.enabled) {
          $e.comments->print();
        }
        """
        </div>
      </td>
      <td width=20%" align ="center" valign="center">""";
        # Then print a permanent link to the entry. 
        # I have this because I have my journal set to display comment links with "?nc=XX" tacked onto the end,
        # and when I'm copying and pasting links, it's annoying to have there. Also, if you want a link to
        # an entry that has no comments yet, the only link that's shown by default is the reply to link, and that
        # that includes "?mode=reply" which is also annoying to have to remove.
        # Essentially this is here for convenience. If you don't want it, remove the blue segment.
        """
 </div>
      </td>
        <td width="50%" align="right" valign="center" nowrap>""";
        # Then the entry related buttons
        """<div class="entryComments">
          """;
          # The easiest way to do this, which will work for all account types, is as follows, and will display actual buttons. 
          # I used to use the code following it, but ran into problems trying to figure out the logic to show the edit button on a community properly. 
          # If you'd like text instead of buttons, then you can remove the following line in blue, decomment the lines in pink,
          # and edit as you see fit. Note that using the print_linkbar function will also add next and previous buttons when viewing using the EntryPage. 
          #$e->print_linkbar();
          
          # Edit button : Only put up if the person viewing this entry wrote the entry
          # I check that by checking whether the person looking at the page is the owner of the page, and the entry's poster is the page's owner.
          # It puts Edit buttons on my entries, and entries that I post to communities that show on my friends page.
      

   if (defined $editlink and $editlink.url!="") { """<a href="$editlink.url"><img border='0' width="$editlink.icon.width" height="$editlink.icon.height" alt="" src="$editlink.icon.url" /></a>"""; }

     if (defined $memlink and $memlink.url!="") { """<a href="$memlink.url"><img border='0' width="$memlink.icon.width" height="$memlink.icon.height" alt="" src="$memlink.icon.url" /></a>"""; } 



           """;
          }"""
                 
         </div>
      </td>
    </tr>
  </table></div>  """;


  # End the entry component and put a spacer after it so that entry components are seperated.
  print_system_box_bottom();
  """ <div><img src="http://www.livejournal.com/palimg/component/clear.gif" width="3" height="3" alt="" border="0"></div> """;

} # end of Function print_entry

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 1 comment