Advertisement
wiring

tabular indent port to dw

Jul 30th, 2017
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 33.91 KB | None | 0 0
  1. # -*-s2-*-
  2.  
  3. layerinfo type = "layout";
  4. layerinfo name = "Tabular Indent";
  5. layerinfo redist_uniq = "tabularindent/layout";
  6. layerinfo previews = "tabularindent/tabularindent.jpg";
  7. layerinfo des = "Two information and navigation boxes at the top and bottom of the page surround entries indented slightly from the left.";
  8.  
  9. propgroup presentation {
  10.   property string content_width {
  11.       des = "Content area width";
  12.       note = "Don't forget to include units; e.g. px, %";
  13.   }
  14.   property string content_alignment {
  15.       des = "Alignment of the content area";
  16.       values = "left|Left|center|Center|right|Right";
  17.   }
  18.   property string content_top_margin {
  19.       des = "Margin size on the top of the content area";
  20.       note = "You can use this to shift your journal contents down in order to display a background image at the top of your journal.  Don't forget to include units; e.g. px, %";
  21.   }
  22.   property string entryborder_size {
  23.       des = "Size of borders around entries";
  24.       note = "Don't forget to include the units, e.g. px";
  25.   }
  26.   property string entryborder_style {
  27.       des = "Style of borders around entries";
  28.       values = "solid|Solid|dashed|Dashed|dotted|Dotted|double|Double|hidden|Invisible";
  29.   }
  30.   property bool transparent {
  31.       des = "Make journal content transparent instead of using given background colors";
  32.   }
  33.   property bool show_entry_userpic {
  34.       des = "Display your userpic with your entries";
  35.   }
  36.   property use page_recent_items;
  37.   property use page_friends_items;
  38.   property use use_shared_pic;
  39.   property use view_entry_disabled;
  40.   property use linklist_support;
  41.   property use external_stylesheet;
  42.   property string counter_code {
  43.       des = "If you have an external web counter, you can enter the HTML for it here";
  44.       note = "Your counter will appear at the bottom of the header at the top of your journal.";
  45.       maxlength = 2000;
  46.       string_mode = "html-oneline";
  47.   }
  48.   property use custom_control_strip_colors;
  49. }
  50. set content_width = "100%";
  51. set content_alignment = "left";
  52. set content_top_margin = "0";
  53. set entryborder_size = "";
  54. set entryborder_style = "hidden";
  55. set transparent = false;
  56. set show_entry_userpic = true;
  57. set page_recent_items = 20;
  58. set page_friends_items = 20;
  59. set view_entry_disabled = false;
  60. set counter_code = "";
  61.  
  62. propgroup colors {
  63.   property Color body_bgcolor {
  64.       des = "Body background color";
  65.       s1color = "page_back";
  66.   }
  67.   property Color main_bgcolor {
  68.       des = "Background of main text areas";
  69.       s1color = "page_back";
  70.   }
  71.   property Color main_fgcolor {
  72.       des = "Main text color";
  73.       s1color = "page_text";
  74.   }
  75.   property Color border_color {
  76.       des = "Color of borders";
  77.       # No s1color equivalent
  78.   }
  79.   property Color border_color_entries {
  80.       des = "Color of borders around entries";
  81.   }
  82.   property Color headerbar_bgcolor {
  83.       des = "Background color of header bar(s)";
  84.       s1color = "stronger_back";
  85.   }
  86.   property Color headerbar_fgcolor {
  87.       des = "Header bar text color";
  88.       s1color = "stronger_text";
  89.   }
  90.   property Color captionbar_mainbox_bgcolor {
  91.       des = "Main background color of caption bar";
  92.       s1color = "page_back";
  93.   }
  94.   property Color captionbar_mainbox_fgcolor {
  95.       des = "Text color of caption bar";
  96.       s1color = "page_text";
  97.   }
  98.   property Color captionbar_userpicbox_color {
  99.       des = "User picture background color of caption bar";
  100.       s1color = "strong_back";
  101.   }
  102.   property Color accent_bgcolor {
  103.       des = "Background color of accented areas";
  104.       s1color = "weak_back";
  105.   }
  106.   property Color accent_fgcolor {
  107.       des = "Accented area text color";
  108.       s1color = "weak_text";
  109.   }
  110.   property Color link_color {
  111.       des = "Link color";
  112.       s1color = "page_link";
  113.   }
  114.   property Color vlink_color {
  115.       des = "Visited link color";
  116.       s1color = "page_vlink";
  117.   }
  118.   property Color alink_color {
  119.       des = "Active link color";
  120.       s1color = "page_alink";
  121.   }
  122.   property Color comment_bar_one_bgcolor {
  123.       des = "Alternating background color for comment bars (one)";
  124.   }
  125.   property Color comment_bar_two_fgcolor {
  126.       des = "Text color on alternating comment bars (one)";
  127.   }
  128.   property Color comment_bar_two_bgcolor {
  129.       des = "Alternating background color for comment bars (two)";
  130.   }
  131.   property Color comment_bar_one_fgcolor {
  132.       des = "Text color on alternating comment bars (two)";
  133.   }
  134.   property Color comment_bar_screened_bgcolor {
  135.       des = "Background bar color for screened comments";
  136.   }
  137.   property Color comment_bar_screened_fgcolor {
  138.       des = "Text color on background bar for screened comments";
  139.   }
  140.   property use control_strip_bgcolor;
  141.   property use control_strip_fgcolor;
  142.   property use control_strip_bordercolor;
  143.   property use control_strip_linkcolor;
  144. }
  145. set body_bgcolor = "#ffffff";
  146. set main_bgcolor = "#ffffff";
  147. set main_fgcolor = "#000000";
  148. set border_color = "#000000";
  149. set border_color_entries = "#000000";
  150. set headerbar_bgcolor = "#6666cc";
  151. set headerbar_fgcolor = "#ffffff";
  152. set captionbar_mainbox_bgcolor = "#ffffff";
  153. set captionbar_mainbox_fgcolor = "#000000";
  154. set captionbar_userpicbox_color = "#c0c0ff";
  155. set accent_bgcolor = "#eeeeff";
  156. set accent_fgcolor = "#000000";
  157. set link_color = "#000050";
  158. set vlink_color = "#500050";
  159. set alink_color = "#ff00c0";
  160. set comment_bar_one_bgcolor = "#c0c0ff";
  161. set comment_bar_one_fgcolor = "#000000";
  162. set comment_bar_two_bgcolor = "#eeeeff";
  163. set comment_bar_two_fgcolor = "#000000";
  164. set comment_bar_screened_bgcolor = "#dddddd";
  165. set comment_bar_screened_fgcolor = "#000000";
  166.  
  167. propgroup images {
  168.   property string page_background_image {
  169.       des = "Background image URL";
  170.   }
  171.  
  172.   property string page_background_repeat {
  173.       des = "Background image repeat";
  174.       values = "repeat|Repeat|no-repeat|Don't repeat|repeat-x|Repeat across only|repeat-y|Repeat down only";
  175.   }
  176.  
  177.   property string page_background_position {
  178.       des = "Background image position";
  179.       note = "Does not apply if Background Image Repeat is set to 'Repeat'.";
  180.       values = "top|Top|top left|Top-left|top right|Top-right|center|Center|center left|Center-left|center right|Center-right|bottom|Bottom|bottom left|Bottom-left|bottom right|Bottom-right|left|Left|right|Right";
  181.   }
  182.  
  183.   property string page_background_scrolling {
  184.       des = "Background image scrolling";
  185.       note = "Not supported in all browsers, but allows for the background image to be in a fixed position when scrolling.";
  186.       values = "scroll|Scroll|fixed|Fixed";
  187.   }
  188.   property string img_btwn_comments {
  189.       des = "URL to an image to be used between your comment links";
  190.       note = "If you specify an image to use, it will replace any text between the comment links.";
  191.   }
  192. }
  193. set page_background_image = "";
  194. set page_background_repeat = "repeat";
  195. set page_background_position = "center";
  196. set page_background_scrolling = "scroll";
  197. set img_btwn_comments = "";
  198.  
  199. propgroup text {
  200.   property use text_post_comment;
  201.   property use text_read_comments;
  202.   property use text_post_comment_friends;
  203.   property use text_read_comments_friends;
  204.   property string text_left_comments {
  205.         des = "Text to be used in front of your comment links";
  206.   }
  207.   property string text_btwn_comments {
  208.         des = "Text to be used between your comment links";
  209.         note = "If you specified an image to be used between your comments links in the \"Images\" section, then this option will not have any effect.";
  210.   }
  211.   property string text_right_comments {
  212.         des = "Text to be used at the end of your comment links";
  213.   }
  214.   property string text_nosubject {
  215.         des = "Text to be used for entries and comments without subjects";
  216.   }
  217.   property string date_format {
  218.         des = "Date format for entries";
  219.   }
  220.   property string time_format {
  221.         des = "Time format for entries";
  222.   }
  223.   property string datetime_comments_format {
  224.         des = "Date and time format for comments";
  225.   }
  226.   property string date_monthpage_format {
  227.         des = "Month format for the month page";
  228.   }
  229. }
  230. set text_left_comments = "comments: ";
  231. set text_btwn_comments = " or ";
  232. set text_right_comments = "";
  233. set text_nosubject = "(no subject)";
  234. set date_format = "%%month%% %%dayord%%, %%yyyy%%";
  235. set time_format = "%%hh%%:%%min%% %%a%%m";
  236. set datetime_comments_format = "%%yyyy%%-%%mm%%-%%dd%% %%hh%%:%%min%% %%a%%m";
  237. set date_monthpage_format = "%%month%% %%yyyy%%";
  238.  
  239. propgroup customcss {
  240.   property use include_default_stylesheet;
  241.   property use linked_stylesheet;
  242.   property use custom_css;
  243. }
  244.  
  245. set tags_aware = true;
  246.  
  247. function prop_init () {
  248.     if ($*control_strip_bgcolor.as_string == "") {
  249.         $*control_strip_bgcolor = $*main_bgcolor;
  250.     }
  251.     if ($*control_strip_fgcolor.as_string == "") {
  252.         $*control_strip_fgcolor = $*main_fgcolor;
  253.     }
  254.     if ($*control_strip_bordercolor.as_string == "") {
  255.         $*control_strip_bordercolor = $*border_color;
  256.     }
  257.     if ($*control_strip_linkcolor.as_string == "") {
  258.         $*control_strip_linkcolor = $*link_color;
  259.     }
  260.  
  261.     $*theme_bgcolor = $*main_bgcolor;
  262.     $*theme_fgcolor = $*main_fgcolor;
  263.     $*theme_bordercolor = $*border_color;
  264.     $*theme_linkcolor = $*link_color;
  265. }
  266.  
  267. function Page::lay_captionbar_navigation () { }
  268.  
  269. function Page::print_linklist() {
  270.     if (size $.linklist <= 0) {
  271.         return;
  272.     } elseif (not $*linklist_support) {
  273.         return;
  274.     }
  275.  
  276.     var string linklist = "";
  277.     var string link = "";
  278.     var bool section_open = false;
  279.     var bool first = true;
  280.  
  281.     foreach var UserLink l ($.linklist) {
  282.         if ($l.title) {
  283.             if ($l.is_heading or $first) {
  284.                 if ($section_open) {
  285.                     $linklist = $linklist + "</td></tr>";
  286.                 }
  287.                 if ($l.is_heading) {
  288.                     $link = "<tr><td>$l.title:</td><td>";
  289.                 } else {
  290.                     $link = "<tr><td>View:</td><td><a href='$l.url'>$l.title</a>. ";
  291.                 }
  292.                 $section_open = true;
  293.                 $first = false;
  294.             } else {
  295.                 $link = "<a href='$l.url'>$l.title</a>. ";
  296.             }
  297.         } else {
  298.             $link = """<tr><td>&nbsp;</td></tr>""";
  299.         }
  300.         $linklist = $linklist + $link;
  301.     }
  302.     if ($linklist != "") {
  303.         "$linklist" + "</td></tr>";
  304.     }
  305. }
  306.  
  307. function captionbar (Page p, bool top) {
  308.     var string title = $p->title();
  309.  
  310.     var string userpic;
  311.     var Image up_img = $p.journal.default_pic;
  312.     if (defined $up_img) {
  313.         $userpic = """<img src="$up_img.url" height="$up_img.height" width="$up_img.width" alt="[icon]" />""";
  314.     }
  315.  
  316.     var string website_name = $p.journal.website_name ? $p.journal.website_name : $*text_website_default_name;
  317.     var string website;
  318.     if ($p.journal.website_url != "") {
  319.         $website = """<tr><td>View:</td><td><a href="$p.journal.website_url">Website ($website_name)</a>.</td></tr>""";
  320.     }
  321.  
  322.     var string links;
  323.     foreach var string v ($p.views_order) {
  324.         $links = "$links<tr><td>View:</td><td>" + ($p.view == $v ?
  325.                            lang_viewname($v) :
  326.                            "<a href='$p.view_url{$v}'>"+lang_viewname($v)+"</a>") + ".</td></tr>\n";
  327.     }
  328.  
  329.     var string captionbar_userpicbox_style = "background-color: $*captionbar_userpicbox_color";
  330.     """
  331. <table height='100' class='captionbar' cellpadding='5' cellspacing='1'><tr>
  332.  <td class="captionbar-userpicbox" align='center' valign='center' width='100' style='$captionbar_userpicbox_style'>$userpic</td>
  333.    """;
  334.     print safe "<td><b>$title</b><br />";
  335.     """
  336.    <table border='0'>
  337.      $links
  338.      $website""";
  339.       $p->print_linklist();
  340.       """
  341.      <tr>
  342.        <td colspan='2'>""";
  343.  
  344.     $p->lay_captionbar_navigation();
  345.     if ($top and $*counter_code != "") {
  346.         """<br />$*counter_code""";
  347.     }
  348.     "
  349.        </td>
  350.      </tr>
  351.    </table>
  352.  </td>
  353. </tr></table>";
  354. }
  355.  
  356. function captionbar (Page p) {
  357.     captionbar($p, false);
  358. }
  359.  
  360. function print_stylesheet ()
  361. {
  362.     if(clean_url($*page_background_image) != "") {
  363.       """body {
  364.    background-image: url("$*page_background_image");
  365.    background-position: $*page_background_position;
  366.    background-repeat: $*page_background_repeat;
  367.    background-attachment: $*page_background_scrolling;
  368. }""";
  369.     }
  370.     """/* Tabular Indent Stylesheet */
  371. body {
  372.    background-color:  $*body_bgcolor;
  373. }
  374. .captionbar {
  375.    width:             100%;
  376.    border:            1px solid $*border_color;
  377. }
  378. .captionbar, .captionbar td {
  379.    background-color:  $*captionbar_mainbox_bgcolor;
  380.    color:             $*captionbar_mainbox_fgcolor;
  381. }
  382. .captionbar-userpicbox {
  383.    border-right:      1px solid $*border_color;
  384.    background-color:  $*captionbar_userpicbox_color;
  385.    color:             $*captionbar_mainbox_fgcolor;
  386. }
  387. body,td,p {
  388.    font-family:       verdana, arial, helvetica, sans-serif;
  389.    font-size:         8pt;
  390. }
  391. a {
  392.    color:             $*link_color;
  393.    font-family:       verdana, arial, helvetica, sans-serif;
  394.    font-size:         8pt;
  395.    text-decoration:   none;
  396. }
  397. a:visited {
  398.    color:             $*vlink_color;
  399.    font-family:       verdana, arial, helvetica, sans-serif;
  400.    font-size:         8pt;
  401.    text-decoration:   none;
  402. }
  403. a:active {
  404.    color:             $*alink_color;
  405.    font-family:       verdana, arial, helvetica, sans-serif;
  406.    font-size:         8pt;
  407.    text-decoration:   none;
  408. }
  409. a:hover {
  410.    color:             $*alink_color;
  411.    font-family:       verdana, arial, helvetica, sans-serif;
  412.    font-size:         8pt;
  413.    text-decoration:   underline;
  414. }
  415. h3.page-header {
  416.    font-size:         8pt;
  417.    font-family:       verdana, arial, helvetica, sans-serif;
  418.    font-weight:       normal;
  419.    background-color:  $*headerbar_bgcolor;
  420.    color:             $*headerbar_fgcolor;
  421.    padding: 6px;
  422.    border:            1px solid $*border_color;
  423. }
  424. """;
  425. if ($*transparent) {
  426. """
  427. table table, tr, td, h3.page-header, .captionbar {
  428.    background: transparent !important;
  429.    border: 0 !important;
  430. }
  431. """;
  432. }
  433.  
  434. print_custom_control_strip_css();
  435. }
  436.  
  437. function Page::print ()
  438. {
  439.     var string margin = "";
  440.     if ($*content_top_margin != "0") {
  441.         $margin = """<table style="width: $*content_width; margin-top: $*content_top_margin;" align="$*content_alignment">""";
  442.     }
  443.  
  444.     var string title = $this->title();
  445.     println "<html>\n<head>\n";
  446.  
  447.     $this->print_head();
  448.     $this->print_stylesheets();
  449.     print safe """<title>$title</title>
  450. </head>
  451. <body>
  452.    """;
  453.  
  454.     $this->print_control_strip();
  455.     if ($margin == "") {
  456.         print safe """<table style="width: $*content_width;" align="$*content_alignment">""";
  457.     } else {
  458.         print safe $margin;
  459.     }
  460.     "<tr><td>";
  461.     "<p>"; captionbar($this, true); "</p>";
  462.  
  463.     if (viewer_sees_vbox()) {
  464.         """<table width="100%" height="100%">""";
  465.         """<tr><td valign="top">""";
  466.     }
  467.     if (viewer_sees_hbox_top()) {
  468.         """<div style="text-align: center;">""";
  469.         $this->print_hbox_top();
  470.         "</div>";
  471.     }
  472.  
  473.     "<p>"; $this->print_body(); "</p>";
  474.  
  475.     if (viewer_sees_vbox()) {
  476.         "</td>";
  477.         "<td valign=\"top\" align=\"center\" width=\"20%\">";
  478.         $this->print_vbox();
  479.         "</td></tr></table>\n";
  480.     }
  481.     if (viewer_sees_hbox_bottom()) {
  482.         """<div style="text-align: center;">""";
  483.         $this->print_hbox_bottom();
  484.         "</div>";
  485.     }
  486.  
  487.     "<p>"; captionbar($this); "</p>";
  488.     "</td></tr></table>";
  489.  
  490.     """
  491.  </body>
  492. </html>
  493.    """;
  494. }
  495.  
  496. function print_box_open (string{} colors, string metapic, string{} meta, string domid) {
  497.     var string bgcolor = $colors{"bgcolor"};
  498.     var string fgcolor = $colors{"fgcolor"};
  499.     if ($domid != "") { $domid = "id='"+ehtml($domid)+"'"; }
  500.  
  501.     var string style = "background-color: "+ehtml($bgcolor)+"; color: "+ehtml($fgcolor)+";";
  502.     var string border = " border: $*entryborder_size $*entryborder_style $*border_color_entries;";
  503.     print safe "<div align='right'><table $domid width='95%' cellpadding='5' cellspacing='1' style='$style$border'>";
  504.     print safe "<tr><td><table border='0' width='100%' style='$style'><tr>";
  505.  
  506.     if ($metapic) {
  507.         print safe "<td width='100' valign='top' align='center'>$metapic</td>";
  508.     }
  509.  
  510.     print safe "<td valign='top'><table border='0' style='$style'>";
  511.  
  512.     foreach var string k ($meta) {
  513.         var string key = $k;
  514.         var string val = $meta{$k};
  515.         print safe "<tr><td align='right'>$key</td><td>$val</td></tr>";
  516.     }
  517.  
  518.     "</table></td></tr></table></td></tr>";
  519.     print safe "<tr><td style='background-color: $*main_bgcolor; color: $*main_fgcolor'>";
  520. }
  521.  
  522. function print_box_close (string footer) {
  523.     "</td></tr>";
  524.  
  525.     if ($footer) {
  526.         print safe "<tr><td style='white-space: nowrap'>$footer</td></tr>";
  527.     }
  528.  
  529.     "</table></div><br />";
  530. }
  531. function print_box (string{} colors, string metapic, string{} meta, string content, string footer, string domid) {
  532.     print_box_open($colors, $metapic, $meta, $domid);
  533.     print safe $content;
  534.     print_box_close($footer);
  535. }
  536.  
  537. function print_header (string header)
  538. {
  539.     print safe "<h3 class='page-header'>$header</h3>";
  540. }
  541.  
  542. function print_genericbox_open () {
  543.     print safe "<div align='right'><table border='0' width='95%' cellpadding='5' cellspacing='1' bgcolor='$*accent_bgcolor'>";
  544.     print safe "<tr><td style='background-color: $*main_bgcolor; color: $*main_fgcolor'>";
  545. }
  546.  
  547. function print_genericbox_close ()
  548. {
  549.     "</td></tr></table></div><br />";
  550. }
  551.  
  552. function print_entry (Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text)
  553. {
  554.     var string{} colors; var string{} meta; var string footer = "";
  555.     $colors{"bgcolor"} = "$*accent_bgcolor";
  556.     $colors{"fgcolor"} = "$*accent_fgcolor";
  557.     if ($p.view == "recent") {
  558.         if ($e.new_day) {
  559.             print_header($e.time->date_format($*date_format));
  560.         }
  561.     } else {
  562.         print_header($e.time->date_format($*date_format));
  563.     }
  564.     # Userpic
  565.     var string metapic = "";
  566.     if ($p.view == "friends" or
  567.         $*show_entry_userpic == true or
  568.         $e.journal.username != $e.poster.username)
  569.     {
  570.         var string userpic = defined $e.userpic ? "<img src='$e.userpic.url' style='border: 0' />" : "";
  571.         var string url = $e.journal->base_url() + "/";
  572.         $metapic = "<div style='background-color: $bgcolor; color: $fgcolor;'>";
  573.         $metapic = "$metapic <a href='$url'>$userpic</a>";
  574.         if ($e.journal.username != $e.poster.username) {
  575.             var string purl = $e.poster->base_url() + "/";
  576.             $metapic = "$metapic<br />[<a href='$purl' style='color: $fgcolor;'>$e.poster.username</a>]";
  577.         }
  578.         if ($p.view == "friends") { $metapic = "$metapic<br /><a href='$url' style='color: $fgcolor;'>$e.journal.username</a>"; }
  579.         $metapic = "$metapic</div>";
  580.     }
  581.     # Security Icon
  582.     if ($e.security) {
  583.         $meta{"Security:"} = "$e.security_icon $e.security";
  584.     }
  585.     # Subject
  586.     var string entrysubject = $e.subject != "" ? $e.subject : $*text_nosubject;
  587.     $meta{"Subject:"} = "<a href='$e.permalink_url'>$entrysubject</a>";
  588.     # Time posted
  589.     var string time = $e.time->time_format($*time_format);
  590.     $meta{"Time:"} = $time;
  591.     # Current
  592.     if (size $e.metadata) {
  593.         foreach var string k ($e.metadata) {
  594.             var string key = $k; var string val = $e.metadata{$k};
  595.             if ($k == "mood") {
  596.                 $key = $*text_meta_mood;
  597.             } elseif ($k == "music") {
  598.                 $key = $*text_meta_music;
  599.             } elseif ($k == "location") {
  600.                 $key = $*text_meta_location;
  601.             }
  602.             if ($k == "mood" and defined $e.mood_icon) {
  603.                 var Image i = $e.mood_icon;
  604.                 $val = "<img src='$i.url' width='$i.width' height='$i.height' align='absmiddle' alt='[mood icon]' /> $val";
  605.             }
  606.             $meta{"$key:"} = $val;
  607.         }
  608.     }
  609.     # Tags
  610.     if ($e.tags) {
  611.         var int tcount = 0;
  612.         var string tag;
  613.         foreach var Tag t ($e.tags) {
  614.             $tag = $tag + """<a rel="tag" href="$t.url">$t.name</a>""";
  615.             $tcount++;
  616.             if ($tcount != size $e.tags) { $tag = $tag + ", "; }
  617.         }
  618.         $meta{"Tags:"} = $tag;
  619.     }
  620.  
  621.     if ($e.comments.show_readlink or $e.comments.show_postlink) {
  622.         $footer = $footer + "$*text_left_comments";
  623.         if ($e.comments.show_readlink) {
  624.             $footer = $footer +
  625.                       "<a href=\"$e.comments.read_url\">" +
  626.                       get_plural_phrase($e.comments.count, $p.view == "friends" ? "text_read_comments_friends" : "text_read_comments") +
  627.                       "</a>";
  628.         }
  629.         if ($e.comments.show_postlink and $e.comments.show_readlink) {
  630.             if (clean_url($*img_btwn_comments) != "") {
  631.                 $footer = $footer + """ <img src="$*img_btwn_comments" alt="" /> """;
  632.             } else {
  633.                 $footer = $footer + "$*text_btwn_comments";
  634.             }
  635.         }
  636.         if ($e.comments.show_postlink) {
  637.             if ($e.comments.maxcomments) {
  638.                 $footer = $footer + "$*text_max_comments";
  639.             } else {
  640.                 $footer = $footer +
  641.                           "<a href=\"$e.comments.post_url\">" +
  642.                           ($p.view == "friends" ? $*text_post_comment_friends : $*text_post_comment) +
  643.                           "</a>";
  644.             }
  645.         }
  646.         $footer = $footer + "$*text_right_comments";
  647.     }
  648.  
  649.     # Misc Links
  650.     var Link link;
  651.     if ($p.view == "entry")
  652.     {
  653.         $link = $e->get_link("nav_prev"); $footer = "$footer $link";
  654.     }
  655.     foreach var string link_key ($e.link_keyseq) {
  656.         $link = $e->get_link($link_key);
  657.         if(defined $link) {
  658.             $footer = "$footer $link";
  659.         }
  660.     }
  661.     if ($p.view == "entry")
  662.     {
  663.         $link = $e->get_link("nav_next"); $footer = "$footer $link";
  664.     }
  665.  
  666.     # Print
  667.     print_box_open($colors, $metapic, $meta, "");
  668.     if (not $hide_text) { $e->print_text(); }
  669.     print_box_close($footer);
  670. }
  671.  
  672. function Page::print_entry (Entry e)
  673. {
  674.     print_entry($this, $e, null Color, null Color, false);
  675. }
  676.  
  677. function FriendsPage::print_entry (Entry e) {
  678.     var Friend f = $.friends{$e.journal.username};
  679.     print_entry($this, $e, $f.bgcolor, $f.fgcolor, false);
  680. }
  681.  
  682. function RecentPage::lay_captionbar_navigation()
  683. {
  684.     var string nav = "";
  685.     if ($.nav.backward_url != "") {
  686.         $nav = """<a href="$.nav.backward_url">back $.nav.backward_count entries</a>""";
  687.     }
  688.     if ($.nav.forward_url != "" and $.nav.backward_url != "") {
  689.         $nav = "$nav or ";
  690.     }
  691.     if ($.nav.forward_url != "") {
  692.         $nav = """$nav<a href="$.nav.forward_url">forward $.nav.forward_count entries</a>""";
  693.     }
  694.     print "You're looking at the latest ";
  695.     print size $.entries;
  696.     print ($.nav.skip > 0) ? " entries, after skipping $.nav.skip newer ones." :" entries.";
  697.     if ($nav != "") { print "<br />Missed some entries?  Then simply jump $nav"; }
  698. }
  699.  
  700. function RecentPage::print_body {
  701.     foreach var Entry e ($.entries) {
  702.         $this->print_entry($e);
  703.         if ($e->viewer_sees_ebox()) {
  704.             """<div align="center" style="margin-bottom: 10px;">""";
  705.             $e->print_ebox();
  706.             "</div>";
  707.         }
  708.     }
  709. }
  710.  
  711. function FriendsPage::print_body {
  712.     foreach var Entry e ($.entries) {
  713.         $this->print_entry($e);
  714.         if ($e->viewer_sees_ebox()) {
  715.             """<div align="center" style="margin-bottom: 10px;">""";
  716.             $e->print_ebox();
  717.             "</div>";
  718.         }
  719.     }
  720. }
  721.  
  722. function YearPage::print_body {
  723.     print_header(string($.year));
  724.     print_genericbox_open();
  725.     foreach var YearMonth m ($.months) {
  726.         $this->print_month($m);
  727.     }
  728.     print_genericbox_close();
  729. }
  730.  
  731. function YearPage::lay_captionbar_navigation()
  732. {
  733.     $this->print_year_links();
  734. }
  735.  
  736. function YearPage::print_year_links ()
  737. {
  738.     foreach var YearYear y ($.years) {
  739.         if ($y.displayed) {
  740.             "$y.year&nbsp;";
  741.         } else {
  742.             "<a href=\"$y.url\">$y.year</a>&nbsp;";
  743.         }
  744.     }
  745. }
  746.  
  747. function YearPage::print_month(YearMonth m)
  748. {
  749.     if (not $m.has_entries) { return; }
  750.     "<center><table border='1' cellpadding='4' width='80%'>";
  751.     # Month header
  752.     "<tr align='center'><td colspan='7' bgcolor='$*headerbar_bgcolor'>";
  753.     "<font color='$*headerbar_fgcolor'><b>"; print $m->month_format(); "</b></font></td></tr>";
  754.     # Weekdays
  755.     "<tr align='center' bgcolor='$*accent_bgcolor'>";
  756.     foreach var int d (weekdays()) {
  757.         "<td><font color='$*accent_fgcolor'>"+$*lang_dayname_short[$d]+"</font></td>\n";
  758.     }
  759.     "</tr>";
  760.     foreach var YearWeek w ($m.weeks) {
  761.         $w->print();
  762.     }
  763.     "<tr align='center'><td colspan='7'><a href='$m.url'>View Subjects</a>";
  764.     "</td></tr></table></center>";
  765. }
  766.  
  767. function YearWeek::print () {
  768.     "<tr>";
  769.     if ($.pre_empty) { "<td colspan='$.pre_empty' bgcolor='$*accent_bgcolor'>&nbsp;</td>"; }
  770.     foreach var YearDay d ($.days) {
  771.         "<td valign='top'><b>$d.day</b>";
  772.         "<div align='center'>";
  773.         if ($d.num_entries) {
  774.             """<a href="$d.url">$d.num_entries</a>""";
  775.         } else {
  776.             "&nbsp;";
  777.         }
  778.         "</div></td>";
  779.     }
  780.     if ($.post_empty) { "<td colspan='$.post_empty' bgcolor='$*accent_bgcolor'>&nbsp;</td>"; }
  781.     "</tr>";
  782. }
  783.  
  784. function DayPage::lay_captionbar_navigation()
  785. {
  786.     print "Missed some entries? Then simply jump to the <a href='$.prev_url'>previous day</a> or the <a href='$.next_url'>next day</a>.";
  787. }
  788.  
  789. function DayPage::print_body ()
  790. {
  791.     if (not $.has_entries) {
  792.         "<table border='0' width='100%' cellpadding='5' cellspacing='1' bgcolor='$*border_color'>";
  793.         "<tr><td bgcolor='$*headerbar_bgcolor'><font color='$*headerbar_fgcolor'>";
  794.         print $.date->date_format($*date_format);
  795.         "</font></td></tr></table><br />";
  796.         print "No journal entries for this day.";
  797.     } else {
  798.         foreach var Entry e ($.entries) {
  799.             $this->print_entry($e);
  800.             if ($e->viewer_sees_ebox()) {
  801.                 """<div align="center" style="margin-bottom: 10px;">""";
  802.                 $e->print_ebox();
  803.                 "</div>";
  804.             }
  805.         }
  806.     }
  807. }
  808.  
  809. function MonthPage::print_body {
  810.     print_header($.date->date_format($*date_monthpage_format));
  811.     print_genericbox_open();
  812.     "<form method='post' action='$.redir.url'><center>";
  813.     $.redir->print_hiddens();
  814.     if ($.prev_url != "") { "[<a href='$.prev_url'>&lt;&lt;&lt;</a>]\n"; }
  815.     if (size $.months > 1) {
  816.         "<select name='redir_key'>\n";
  817.         foreach var MonthEntryInfo mei ($.months) {
  818.             var string sel;
  819.             if ($mei.date.year == $.date.year and $mei.date.month == $.date.month) {
  820.                 $sel = " selected='selected'";
  821.             }
  822.             "<option value='$mei.redir_key'$sel>" + $mei.date->date_format($*lang_fmt_month_long) + "</option>";
  823.         }
  824.         "</select>\n<input type='submit' value='View' />";
  825.     }
  826.     if ($.next_url != "") { "\n[<a href='$.next_url'>&gt;&gt;&gt;</a>]\n"; }
  827.     "</center></form>\n<dl>";
  828.     foreach var MonthDay d ($.days) {
  829.         if ($d.has_entries) {
  830.             "<dt><a href=\"$d.url\"><b>";
  831.             print lang_ordinal($d.day);
  832.             "</b></a></dt>\n<dd>";
  833.             $d->print_subjectlist();
  834.             "</dd>\n";
  835.         }
  836.     }
  837.     "</dl>\n";
  838.     print_genericbox_close();
  839. }
  840.  
  841. function EntryPage::print_body () {
  842.         set_handler("unscreen_comment_#", [
  843.                                            [ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
  844.                                            [ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
  845.                                            ]);
  846.         set_handler("screen_comment_#", [
  847.                                          [ "style_bgcolor", "cmtbar#", "$*comment_bar_screened_bgcolor", ],
  848.                                          [ "style_color", "cmtbar#", "$*comment_bar_screened_fgcolor", ],
  849.                                          ]);
  850.  
  851.     print_entry($this, $.entry, null Color, null Color, $.viewing_thread);
  852.     if ($.entry.comments.enabled and $.comment_pages.total_subitems > 0)
  853.     {
  854.         $this->print_multiform_start();
  855.  
  856.         print_header("Comments:");
  857.         if ($.comment_pages.total_subitems > 0) {
  858.             $.comment_pages->print();
  859.             $this->print_comments($.comments);
  860.         }
  861.         if ($this.multiform_on) {
  862.             print_header("Mass Action:");
  863.  
  864.             print_genericbox_open();
  865.             $this->print_multiform_actionline();
  866.             print_genericbox_close();
  867.  
  868.             $this->print_multiform_end();
  869.         }
  870.     }
  871. }
  872.  
  873. function EntryPage::print_comment_partial (Comment c) {
  874.     var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
  875.     var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
  876.     print_genericbox_open();
  877.     print "<a href='$c.permalink_url'>$subj</a> - $poster";
  878.     print_genericbox_close();
  879. }
  880.  
  881. function EntryPage::print_comment (Comment c) {
  882.     var string{} colors; var string{} meta; var string footer = "";
  883.  
  884.     if ($c.screened) {
  885.         $colors{"bgcolor"} = "$*comment_bar_screened_bgcolor";
  886.         $colors{"fgcolor"} = "$*comment_bar_screened_fgcolor";
  887.     } elseif ($c.depth % 2) {
  888.         $colors{"bgcolor"} = "$*comment_bar_one_bgcolor";
  889.         $colors{"fgcolor"} = "$*comment_bar_one_fgcolor";
  890.     } else {
  891.         $colors{"bgcolor"} = "$*comment_bar_two_bgcolor";
  892.         $colors{"fgcolor"} = "$*comment_bar_two_fgcolor";
  893.     }
  894.  
  895.     # Userpic
  896.     var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
  897.     var string metapic = "";
  898.     if (defined $c.userpic and $*comment_userpic_style != "off")
  899.     {
  900.         var string userpic = defined $c.userpic ? "<img src='$c.userpic.url' style='border: 0' />" : "";
  901.         $metapic = "$userpic<br />$poster";
  902.     } else {
  903.         $metapic = $poster;
  904.     }
  905.  
  906.     # Subject
  907.     var string sub_icon;
  908.     if (defined $c.subject_icon) {
  909.         $sub_icon = $c.subject_icon->as_string();
  910.     }
  911.     if ($c.subject or $sub_icon) {
  912.         $meta{"Subject:"} = "$c.subject $sub_icon";
  913.     }
  914.  
  915.     # Time posted
  916.     $meta{"Time:"} = $c->time_display($*datetime_comments_format, "none");
  917.  
  918.     # Link
  919.     $meta{"Link:"} = "(<a href='$c.permalink_url'>Link</a>)";
  920.  
  921.     # IP Address:
  922.     if ($c.metadata{"poster_ip"}) {
  923.         $meta{"IP Address:"} = $c.metadata{"poster_ip"};
  924.     }
  925.  
  926.     if ($c.frozen) {
  927.         $footer = "(Replies frozen) ";
  928.     } else {
  929.         $footer = "(<a href='$c.reply_url'>Reply to this</a>) ";
  930.     }
  931.     if ($c.parent_url != "") { $footer = "$footer (<a href='$c.parent_url'>Parent</a>) "; }
  932.     if ($c.thread_url != "") { $footer = "$footer (<a href='$c.thread_url'>Thread</a>) "; }
  933.  
  934.     var Link link = new Link;
  935.     foreach var string k ($c.link_keyseq) {
  936.         $link = $c->get_link($k);
  937.         if (defined $link) {
  938.             $footer = "$footer $link";
  939.         }
  940.     }
  941.     println "<a name='$c.anchor'></a>";
  942.     print_box_open($colors, $metapic, $meta, "cmtbar$c.talkid");
  943.     $c->print_text();
  944.     print_box_close($footer);
  945. }
  946.  
  947. function ReplyPage::print_body () {
  948.     if (not $.entry.comments.enabled)
  949.     {
  950.         print_header($*text_reply_nocomments_header);
  951.         print "<p>$*text_reply_nocomments</p>";
  952.         return;
  953.     }
  954.  
  955.     var string{} meta; var string metapic;
  956.  
  957.     print_header($.replyto.time->date_format($*date_format));
  958.  
  959.     # Userpic
  960.     if (defined $.replyto.userpic and $*comment_userpic_style != "off")
  961.     {
  962.         $metapic = "<img src='$.replyto.userpic.url' />";
  963.     }
  964.  
  965.     # Subject
  966.     if ($.replyto.subject) {
  967.         $meta{"Subject:"} = $.replyto.subject;
  968.     }
  969.  
  970.     # Time posted
  971.     $meta{"Time:"} = $.replyto.time->time_format($*time_format);
  972.  
  973.     print_box_open({ "bgcolor" => "$*accent_bgcolor", "fgcolor" => "$*accent_fgcolor" },
  974.               $metapic, $meta, "");
  975.     $.replyto->print_text();
  976.     print_box_close("");
  977.  
  978.     print_header("Reply:");
  979.  
  980.     print_genericbox_open();
  981.     $.form->print();
  982.     print_genericbox_close();
  983.  
  984. }
  985.  
  986. function TagsPage::print_body() {
  987.     print_header($*text_tags_page_header);
  988.  
  989.     print_genericbox_open();
  990.     print "<ul class='ljtaglist'>";
  991.  
  992.     foreach var TagDetail td ($.tags) {
  993.         var string uses = get_plural_phrase($td.use_count, "text_tag_uses");
  994.         print """<li><a href="$td.url">$td.name</a> - $uses</li>""";
  995.     }
  996.  
  997.     print "</ul>";
  998.     print_genericbox_close();
  999. }
  1000.  
  1001. function print_theme_preview()
  1002. {
  1003.     "<table width='100%' bgcolor='$*body_bgcolor' cellpadding=10><tr><td>";
  1004.     "<table border='0' width='100%' cellpadding='5' cellspacing='1' bgcolor='$*border_color'>";
  1005.     "<tr><td bgcolor='$*headerbar_bgcolor'><font color='$*headerbar_fgcolor'>October 29th, 2003";
  1006.     "</font></td></tr></table><br />";
  1007.     "<div align='right'><table border='0' width='95%' cellpadding='5' cellspacing='1' bgcolor='$*accent_bgcolor'>";
  1008.     "<tr><td align='left' bgcolor='$*accent_bgcolor'>";
  1009.     "<table border='0' width='100%'><tr>";
  1010.     "<td valign='top'><table border='0'>";
  1011.     "<tr><td align='right'><font color='$*accent_fgcolor'>Subject:</font>";
  1012.     "</td><td><font color='$*accent_fgcolor'>Words Words Words</font></td></tr>";
  1013.     "<tr><td align='right'><font color='$*accent_fgcolor'>Time:</font></td>";
  1014.     "<td><font color='$*accent_fgcolor'>1:37 pm</font></td></tr>";
  1015.     "</table></td></tr></table></td></tr>";
  1016.     "<tr><td align='left' bgcolor='$*main_bgcolor'><font color='$*main_fgcolor'>Preview text, preview text, etc, etc..... words, words and more words.</font></td></tr>";
  1017.     """<tr><td align='left' bgcolor='$*accent_bgcolor'><font color='$*accent_fgcolor'><nobr>comments: <a href="#">20 comments</a> or <a href="#">Leave a comment</a></nobr></font></td></tr>""";
  1018.     "</table></div><br />";
  1019.     "</td></tr></table>";
  1020. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement