From a79348ff0a8af6d59696ee31fd7a293707989a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 4 Jul 2021 18:52:14 +0800 Subject: Separated web code --- .gitignore | 3 + catalog.cfg | 750 ++++++++++++++++++++++++++++++++++++++++++++++++ html/css/product.css | 74 +++++ namatoko.scss | 6 + pages/flypage.html | 77 +++++ pages/ord/basket.html | 158 ++++++++++ pages/ord/checkout.html | 138 +++++++++ pages/results.html | 92 ++++++ templates/layout/noleft | 52 ++++ variables/BOTTOM | 16 ++ 10 files changed, 1366 insertions(+) create mode 100644 .gitignore create mode 100644 catalog.cfg create mode 100644 html/css/product.css create mode 100644 namatoko.scss create mode 100644 pages/flypage.html create mode 100644 pages/ord/basket.html create mode 100644 pages/ord/checkout.html create mode 100644 pages/results.html create mode 100644 templates/layout/noleft create mode 100644 variables/BOTTOM diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bea6b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +*.min.css +*.swp diff --git a/catalog.cfg b/catalog.cfg new file mode 100644 index 0000000..45ad3be --- /dev/null +++ b/catalog.cfg @@ -0,0 +1,750 @@ +#==========================================================================# + +# catalog.cfg + +#==========================================================================# + +## We want to hide the .gdbm, .autonumber, .numeric, .sql, .db files +## Needs to go before VariableDatabase +DatabaseDefault HIDE_AUTO_FILES 1 + +# Read in some initial default variables from a directory. These are +# larger ones -- they could conceivably be maintained in the +# VariableDatabase but might be easier to maintain in a file, especially +# for development. +# +# Notable settings: COMMON_MENU, COPYRIGHT +# +DirConfig Variable variables + +# Read in large variables or dynamic variables from a series +# of files in a directory +VariableDatabase variable + +# Read in site-specific variables from a database (if any). +# Used to create a information for a temporarily transferred +# catalog, i.e. for development. +# +# Ignored if file doesn't exist. +VariableDatabase site + +# Warn if any important modules or usertags are missing. + +Require module Digest::MD5 "Need %s %s for better cache keys." +Require module Safe::Hole "Need %s %s for embedded perl object access." + +# Encoding +Variable MV_UTF8 1 +Variable MV_HTTP_CHARSET utf-8 + +#==========================================================================# + +# Can send various files outside the catalog directory, for disk partition +# reasons, for example. + +ParseVariables Yes + +ifdef LOGDIR +ErrorFile __LOGDIR__/error.log +AsciiTrack __LOGDIR__/tracking.asc +#TrackFile __LOGDIR__/usertrack +endif + +ifndef LOGDIR +AsciiTrack logs/tracking.asc +#TrackFile logs/usertrack +endif + +ifdef CACHEDIR +SessionDatabase __CACHEDIR__/session +ScratchDir __CACHEDIR__/tmp +endif + +ifndef CACHEDIR +SessionDatabase session +ScratchDir tmp +endif + +ifdef RUNDIR +RunDir __RUNDIR__ +endif + +#==========================================================================# + +# Database setup + +ParseVariables Yes + +ifndef INDEV +DatabaseDefault LOG_ERROR_SESSION 0 +endif + +## Quote all identifiers to avoid name clash issues and SQL injection attacks +DatabaseDefault QUOTE_IDENTIFIERS 1 + +ifdef MYSQL +DatabaseDefault NO_ASCII_INDEX 1 +include dbconf/mysql/mysql.cfg +endif + +ifdef PGSQL +DatabaseDefault NO_ASCII_INDEX 1 +include dbconf/pgsql/pgsql.cfg +endif + +ifdef SQLITE +DatabaseDefault NO_ASCII_INDEX 1 +include dbconf/sqlite/sqlite.cfg +endif + +# Default DBM if nothing else defined +ifndef SOME_DATABASE +Require We_need_a_database "%s, must have either MySQL or Postgres" +endif + +### Uncomment these for DBI sessions +# SessionType DBI +# SessionDB sessions +# Database sessions sessions.txt __SQLDSN__ +# NoImport sessions + +### You can change the length of the session ID. Must be integer between +### 8 and 32. +# Limit session_id_length 8 + +#==========================================================================# + +# The URLs which are written to refer back to our catalog. + + + +VendURL http://__SERVER_NAME____CGI_URL__ +SecureURL __SECURE_SERVER____CGI_URL__ + +ifndef SECURE_ENABLE +SecureURL http://__SERVER_NAME____CGI_URL__ +endif + +# Set the image path for relative images +ImageDir __IMAGE_DIR__/ +ImageDirInternal http://__SERVER_NAME____IMAGE_DIR__/ + + + +#==========================================================================# + +# Here we set up the catalog theme. + + + +## +## Here we pick up the region variables like LEFTONLY_TOP and LEFTONLY_BOTTOM. +## +## Commenting; new variables TOP and BOTTOM will be defined in variable directory. +## No longer going to need multiple leftright_top, leftonly_top, etc; will be +## defined in "display_class" in each page. + +#DirConfig Variable templates/regions + +# TRAFFIC is defined system-wide in interchange.cfg. When in low-traffic +# mode, variables are dynamic -- i.e. when you change the region file +# the page changes. Otherwise a reconfig must be done to change the +# variable. +# +# Careful, this can change the way *other* variables are interpreted. +ifdef @TRAFFIC =~ /low/i +Pragma dynamic_variables +Pragma dynamic_variables_file_only +endif + +# Provide some links for the admin to edit pages if we have the UI in +ifdef @UI +Autoload admin_links +endif + +#==========================================================================# + +# Internationalization +LocaleDatabase locale + +# Default locale +ifdef DEFAULT_LOCALE +DefaultLocale __DEFAULT_LOCALE__ +endif + +ifdef DEFAULT_LOCALE +# Database definitions for localized databases +include dbconf/locales/{__LOCALES__}.cfg +endif + +Locale en_US currency_symbol Rp +Locale en_US mon_decimal_point "" +Locale en_US frac_digits 0 + +Locale id_ID currency_symbol Rp +Locale id_ID p_cs_precedes 1 +Locale id_ID mon_thousands_sep . +Locale id_ID mon_decimal_point "" +Locale id_ID frac_digits 0 + +#==========================================================================# + +# Various catalog settings. + +ScratchDefault mv_add_dot_html 0 +ScratchDefault mv_no_session_id 1 +ScratchDefault mv_no_count 1 + +ifdef DEFAULT_COUNTRY +ValuesDefault country __DEFAULT_COUNTRY__ +ValuesDefault b_country __DEFAULT_COUNTRY__ +endif + +ValuesDefault fname Pengguna lname Baru + +DirectoryIndex index.html +SpecialPage catalog index +SpecialPage violation ../special_pages/violation +SpecialPage put_handler admin_publish +SpecialPage report ../etc/report +SpecialPage receipt ../etc/receipt + +# Allow others in our group to read/write files by default +ReadPermission group +WritePermission group + +# Don't send X-Track HTTP response header +UserTrack no + +# If a specific user session accesses this catalog more than this many +# times with no pauses of 30 seconds or more, the LockoutCommand (if set) +# is executed. Set this to 0 if you're getting links to 127.0.0.1 +# during your testing. +RobotLimit 100 + +# We also count the number of accesses from the same IP address. More than +# RobotLimit accesses within a one hour period will cause a Forbidden result. +# Uncomment the following line to change the 1 hour period to 30 minutes. +# Limit ip_session_expire 30 + +# The default lockout time is one day. Uncomment the following line to change +# it to just under an hour. +# Limit robot_expire 0.04 + +# Strip whitespace from top of pages so you don't have to scroll down +# before the HTML starts when doing 'view source' in a browser. +Pragma strip_white + +# Don't allow +Pragma no_html_comment_embed + +## DATA INSERTION PRAGMAS for form database inserts or updates + +## Restricts inserts to insert-only, but allows the fall-through +## behavior from update to insert. No existing data will be clobbered. +# Pragma dml=preserve + +## Pragma 'dml=strict' forces update or insert to only perform the +## requested action. +# Pragma dml=strict + +## Pragma 'dml=upsert' (the default) preserves Interchange's original +## method of doing an update if the record exists, otherwise doing an +## insert. This can clobber an existing key. +# Pragma dml=upsert + +## END DATA INSERTION PRAGMAS + +#==========================================================================# + +# User session related settings. + +# Whether to encrypt passwords in UserDB +UserDB default crypt 1 +UserDB default bcrypt 1 + +# These 2 lines are needed for query/pw_reset +UserDB default promote 1 +UserDB default from_plain 1 + +# The pepper should be unique for your site, but note that if you change this, +# it will make previously-crypted passwords inaccessible -- +# so set this before you start adding users, or don't set at all. +UserDB default bcrypt_pepper __BCRYPT_PEPPER__ + +# Set to 1 to make the username and password case-insensitive +UserDB default ignore_case 1 + +# Change a field to something that doesn't conflict in MySQL +UserDB default time_field mod_time + +# Don't want people setting their credit limit or dealer status directly +UserDB default scratch "dealer price_level credit_limit usernick" +UserDB default expire_field expiration + +# Update the database with the date when creating a user +UserDB default created_date_iso created + +# Update the database with the date when updating a user via set_values +UserDB default updated_date_iso updated + +# Set some other things you want to retain but which don't deserve their +# own field -- stored in serial field preferences +UserDB default extra_fields <{state_cs_in} && !$CGI->{state}){ + $CGI->{state} = $CGI->{state_cs_in}; + } + return; + [/calc] + mv_same_billing=always_pass + fname=required + lname=required + address1=required + address2=always_pass + city=required + country=required + state=multistate + zip=multizip + phone_day=phone + [if !session logged_in]email=email_only[/if] +EOV +endif + +## Payment-related stuff + +EncryptKey __PGP_KEY__ + +## These routes are not order routes, but payment routes +Route authorizenet id "__MV_PAYMENT_ID__" +Route authorizenet secret "__MV_PAYMENT_SECRET__" +Route authorizenet host "__MV_PAYMENT_HOST__" +Route authorizenet referer "__MV_PAYMENT_REFERER__" + +Route itransact id "__MV_PAYMENT_ID__" + +Route netbilling id "__MV_PAYMENT_ID__" +Route netbilling secret "__MV_PAYMENT_SECRET__" + +Route signio id "__MV_PAYMENT_ID__" +Route signio secret "__MV_PAYMENT_SECRET__" +Route signio partner "__MV_PAYMENT_PARTNER__" +Route signio vendor "__MV_PAYMENT_VENDOR__" +Route signio host "__MV_PAYMENT_HOST__" + +Route skipjack id "__MV_PAYMENT_ID__" +Route skipjack partner "__MV_PAYMENT_PARTNER__" + +Route linkpoint id "__MV_PAYMENT_ID__" +Route linkpoint host "__MV_PAYMENT_HOST__" +Route linkpoint keyfile "__MV_PAYMENT_SECRET__" + +# This prevents a user from setting this value, you may want to unset +# this if you have user-selectable handling charges like insurance +FormIgnore mv_handling +# +# + +# Along these lines further, for better integrity and less chance of a +# user screwing up your order routes: +# Note that __ORDER_ROUTES__ is empty by default, default Route "default" +# is used with cascades +FormIgnore mv_order_route + +## This route places the order entry in the database. If you don't +## have an inventory table (or a userdb table for that matter) make +## sure you remove it from the list of "transactions" tables. + +Route log <{deliverable} = $CGI->{mv_arg}; + $CGI->{mv_nextpage} = 'deliver'; + if(! $Session->{username} and $CGI->{mv_username}) { + $Tag->userdb('login'); + } + return 1; +} +EOR + +# Pricing setup +# +# If the user is logged in and is marked as a "dealer" (1 in the dealer +# field in the userdb database) then they are given quantity discounts +# based on price groups. (All products are in price group 1 as +# distributed.) If the quantity is 1, then pricing comes from the +# "wholesale" field in the products database. + +AutoModifier pricing:price_group + +# +# If the user is not a dealer (or not logged in) then pricing just comes +# from "price". Any quantity discounts will be set in the qN fields in the +# database, and are separate from dealer quantity discounts. +# + +Profile dealer < < 'nontaxable', +} +EOR + +Profile distributor < < 'nontaxable', +} +EOR + +## This should match the default direct setting below this paragraph +Profile default CommonAdjust "pricing:q5,q10 ;:sale_price, ;:price, ;$, :related, ==:options" +Profile default NonTaxableField +Profile default PriceField 0 + +CommonAdjust pricing:q5,q10 ;:sale_price, ;:price, ;$, :related, ==:options +PriceField 0 + +## This sets the type of options pertaining to the product +OptionsEnable option_type + +## Finally, set which tables products can be ordered from +ProductFiles products variants + +#==========================================================================# + +## Tag which provides a CSS button-looking link +UserTag b-link Order href form +UserTag b-link HasEndTag +UserTag b-link addAttr +UserTag b-link Routine <{no_javascript}) { + $opt->{extra} ||= 'style="font-size: smaller"'; + return $Tag->page($opt) . $anchor . ''; + } + my $class = $opt->{class} || 'btn'; + my $url = $Tag->area($opt); + my $string = $Tag->filter('encode_entities', $anchor); + my @properties; + push @properties, "type=button"; + push @properties, qq{value="$string"}; + push @properties, qq{class="$class"}; + for(qw/style id name/) { + next unless $opt->{$_}; + push @properties, qq{$_="$opt->{$_}"}; + } + push @properties, qq{onClick="window.location='$url'"}; + push @properties, qq{onMouseOver="saveblink=window.status;window.status='$url'"}; + push @properties, qq{onMouseOut="window.status=saveblink"}; + if($opt->{title}) { + $opt->{title} = $Tag->filter('encode_entities', $opt->{title}); + } + else { + $opt->{title} = $string; + } + push @properties, qq{title="$opt->{title}"}; + push @properties, $opt->{extra} if $opt->{extra}; + + return qq{'; +} +EOR + +### Shipping setup. See Interchange docs -- you will want to change +### the origin postal code and default destination postal codes, for sure. +Shipping Postal default_geo 45056 +Shipping QueryUPS default_geo 45056 +Shipping default dir products/ship + +#Database 2ndDayAir ship/2ndDayAir.csv CSV +#Database 2ndDayAirAM ship/2ndDayAirAM.csv CSV +#Database 3DaySelect ship/3DaySelect.csv CSV +#Database Expedited ship/Expedited.csv CSV +#Database Express ship/Express.csv CSV +#Database Ground ship/Ground.csv CSV +#Database NextDayAir ship/NextDayAir.csv CSV +#Database NextDayAirSaver ship/NextDayAirSaver.csv CSV +#Database Xarea ship/Xarea.csv CSV +#Database Zone ship/Zone.csv CSV +#Database usps ship/usps.txt TAB +#Database Book ship/Book.txt TAB +#Database Priority ship/Priority.txt TAB +#Database air_pp ship/air_pp.txt TAB +#Database surf_pp ship/surf_pp.txt TAB +#Database ups_cache ship/ups_cache.txt __SQLDSN__ +#Database ups_cache AUTO_SEQUENCE ups_cache_seq +#Database ups_cache DEFAULT_TYPE varchar(12) +#Database ups_cache INDEX weight origin zip shipmode country + +include usertag/*.tag + +## Uncomment +MaxQuantityField inventory:quantity + +## Builds a series of hidden variables given an IC-style form +## specification, i.e. +## +## [hiddens] +## mv_action=refresh +## mv_nextpage=foo +## [/hiddens] +## +UserTag hiddens Interpolate 1 +UserTag hiddens HasEndTag +UserTag hiddens Routine <filter('encode_entities', $v); + push @out, qq{}; + } + return join "\n", @out; +} +EOR + +## When uncommented, delivers a redirect if we get a request for an image +## DeliverImage Yes + +## Map a subroutine to happen if the page is not there +SpecialSub missing ncheck_category + +UserTag edisplay Alias error auto=1 class="alert alert-danger list-unstyled" +UserTag wdisplay Alias warnings auto=1 list_class="alert alert-success list-unstyled" +UserTag ecgi Alias cgi keep=1 filter=encode_entities name= + +CodeDef string2uri Filter +CodeDef string2uri Description Sanitize a string for use in a URL +CodeDef string2uri Routine < * { + -ms-flex: 1; + flex: 1; +} +@media (min-width: 640px) { + .flex-md-equal > * { + -ms-flex: 1; + flex: 1; + } +} + +.overflow-hidden { overflow: hidden; } \ No newline at end of file diff --git a/namatoko.scss b/namatoko.scss new file mode 100644 index 0000000..701dc88 --- /dev/null +++ b/namatoko.scss @@ -0,0 +1,6 @@ +$thumbnail-border-width: 0; +$light: #fffffff6; +$grid-gutter-width: 0; +$font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Roboto Mono", monospace !default; + +@import "bootstrap/scss/bootstrap"; diff --git a/pages/flypage.html b/pages/flypage.html new file mode 100644 index 0000000..094e5f3 --- /dev/null +++ b/pages/flypage.html @@ -0,0 +1,77 @@ +@_TOP_@ +
+
+ [item-description] +
+ +
+

[item-description]

+
[item-price]
+

[item-field prod_group] • [item-field category]

+
[fly-list code="[data session arg]"] +
+ + + + [form-session-id][edisplay show_var=0][if-item-field option_type][seti check_opt] + &success=ord/checkout + [query + list=1 + sql="select o_group,o_label from options where sku='[item-code]'" + ]mv_order_[sql-code]=mandatory [L]Need to select[/L] [sql-param o_label] + [/query][/seti] + + +
+
[perl options] +my $elements = ''; +for my $option (@{$Tag->query({sql + => "SELECT o_group,o_label,o_value,o_widget FROM options WHERE sku='[item-code]' ORDER BY o_sort"})}) { + my $o_label = $Tag->loc('', $option->[1]); + $elements .= qq( +
+ + +
); + } + return $elements; + [/perl] +
+
[/if-item-field] + +
+
+
+ +
+
+ +
+
+
+
[/fly-list] + +
+

[L]Description[/L]

+

[item-field comment]

+
+
__BOTTOM__ diff --git a/pages/ord/basket.html b/pages/ord/basket.html new file mode 100644 index 0000000..4778d6a --- /dev/null +++ b/pages/ord/basket.html @@ -0,0 +1,158 @@ +[tmp page_title]__COMPANY__ -- [L]Shopping Cart[/L][/tmp] + +@_TOP_@ + +
+ +
+
+

[L]Shopping Cart[/L]

+
+
+ +
+
+
+ [edisplay] + + [calc] + my $cname = $Config->{CookieName} || 'MV_SESSION_ID'; + $Scratch->{have_cookie} = $Tag->read_cookie($cname) + and delete $Scratch->{tried}; + return; + [/calc] + [if scratch have_cookie] + [elsif scratch tried] + [L CART_MSG1]You must have cookies set to leave the basket. Check out now or forever lose your shopping cart.[/L] + [/elsif] + [else] + [set tried]1[/set] + [bounce href="[area ord/basket]"] + [/else] + [/if] + +
+ [form-session-id] + + + + + +
+
+
+
[L]Description[/L]
+
+
+
[L]Price[/L]
+
[L]Quantity[/L]
+
[L]Total[/L]
+
+
+
+
+
+
+ + [if items] + [then] + [item-list] + + [item-calc] + #Log("Checking master item $master"); + $row_class = ++$count % 2 ? 'cartnorm' : 'cartalt'; + my $item = '[item-increment]'; + my $up = q{[item-data merchandising upsell_to]}; + my $cr = q{[item-data merchandising cross_sell]}; + $upsell_remove{'[item-code]'} = 1; + $cross_remove{'[item-code]'} = 1; + my %seen = ( '' => 1 ); + + $Scratch->{upsell} .= " $up" if $up; + $Scratch->{cross_codes} .= " $cr" if $cr; + my @up = split /\s+/, $Scratch->{upsell}; + my @cr = split /\s+/, $Scratch->{cross_codes}; + @up = grep ( (!$seen{$_}++ && ! $upsell_remove{$_}), @up); + @cr = grep ( (!$seen{$_}++ && ! $cross_remove{$_}), @cr); + $Scratch->{upsell} = join " ", @up; + $Scratch->{cross_codes} = join " ", @cr; + return; + [/item-calc] + + +
+
+
+ +
+
+
+
+
[L]Price[/L]
+
[item-discount-price]
+
+
+
+
+
[L]Quantity[/L]
+
+
+
-
+ +
+
+
+
+
+
+
+
+
[L]Total price[/L]
+
[item-discount-subtotal]
+
+
+ +
+
+
+
+
+ [/item-list] + [/then] + [/if] + +
+
+
+
+
[L]Order Summary[/L]
+
+
+
+ [L]Subtotal[/L][subtotal] +
+
+ +
+ +
+
+
+
+
+ +@_BOTTOM_@ \ No newline at end of file diff --git a/pages/ord/checkout.html b/pages/ord/checkout.html new file mode 100644 index 0000000..53963ae --- /dev/null +++ b/pages/ord/checkout.html @@ -0,0 +1,138 @@ +[tmp page_title]__COMPANY__ -- [L]Checkout[/L][/tmp] +[tmp display_class]noleft[/tmp] +[tmpn onepage]1[/tmpn] + +[include include/checkout/initialization] + +@_TOP_@ + +
+ +
+

[L]Checkout form[/L]

+ [if session logged_in] +

[L]Please verify the information below and click the 'Place Order' button to process your order.[/L]

+ [include include/checkout/login_form][/else][/if][if !variable NO_TAX_POPUP] + [include include/checkout/tax_popup][/if] + [edisplay show_label=1 show_var=0 keep=1] +
+ +
+ +
+ [form-session-id] + +
+

[L]Order review[/L]

+
    + + [if items][then][item-list][item-calc] + #Log("Checking master item $master"); + $row_class = ++$count % 2 ? 'cartnorm' : 'cartalt'; + my $item = '[item-increment]'; + my $up = q{[item-data merchandising upsell_to]}; + my $cr = q{[item-data merchandising cross_sell]}; + $upsell_remove{'[item-code]'} = 1; + $cross_remove{'[item-code]'} = 1; + my %seen = ( '' => 1 ); + $Scratch->{upsell} .= " $up" if $up; + $Scratch->{cross_codes} .= " $cr" if $cr; + my @up = split /\s+/, $Scratch->{upsell}; + my @cr = split /\s+/, $Scratch->{cross_codes}; + @up = grep ( (!$seen{$_}++ && ! $upsell_remove{$_}), @up); + @cr = grep ( (!$seen{$_}++ && ! $cross_remove{$_}), @cr); + $Scratch->{upsell} = join " ", @up; + $Scratch->{cross_codes} = join " ", @cr; + return; + [/item-calc] +
  • +
    +
    [item-description]
    + [item-discount-price] + x [item-quantity] +
    + [item-discount-subtotal] +
  • + [/item-list] + +
  • + Subtotal + [subtotal] +
  • + [/then][/if] +
+
+ +
+

Shipping

+ [include include/checkout/shipping_address] +
+ + + [include include/checkout/billing_address] + + +
+

Delivery method

+ +
+
+ + +
+
+ +
+ + +
+

Payment method

+ +
+
+ + +
+
+ +
+ + +
+

Order Summary

+
+

Shipping and additional costs are calculated based on values you have entered.

+
    +
  • [L]Subtotal[/L][subtotal]
  • +
  • [L]Shipping[/L][shipping]
  • +
  • [L]Total[/L][total-cost]
  • +
+
+
+ + +
[if items] +    + [button + text="[L]Place Order[/L]" + wait-text="-- [L]Wait[/L] --" + class="btn btn-primary btn-lg btn-block" + ] mv_todo=submit + [/button][else] + [L]No items in your shopping cart![/L][/else][/if] +
+
+ +
+ [tmp clear_errors][error all=1 comment="Clear errors"][/tmp] +
+ +__BOTTOM__ diff --git a/pages/results.html b/pages/results.html new file mode 100644 index 0000000..aea3ff7 --- /dev/null +++ b/pages/results.html @@ -0,0 +1,92 @@ +@_TOP_@ + + +
+
[search-region][on-match][tmp meta_header][calcn] + return unless $Values->{more_link}; + (my $more_page = $Session->{last_url}) =~ s|^/.*/([^\..]+)(?:\.html)?|$1|; + if ($more_page =~ /^(Next|Prev)/) { + $Tag->tag({ op => 'header' }, qq{Cache-control: no-cache\nCache-control: no-store\nPragma: no-cache\nExpires: 0\nContent-type: text/html}); + } + ## $mc set above. + my $ml = $Values->{mv_matchlimit} || ''; + my $fm = $Values->{mv_first_match} || ''; + my ($canon, $rel_prev, $rel_next); + #Debug("more_page=$more_page, ml=$ml, fm=$fm, mc=$mc"); + my ($prev, $next); + REL: { + last REL if $mc < $ml; + if ($fm == 0 || $fm == 1) { # first page + $rel_next = $Values->{more_link} . '/2'; + } elsif (($mc - $fm - $ml) <= 0) { # last page + $prev = sprintf("%.0f", (($fm+$ml) / $ml) - 1); + $rel_prev = $Values->{more_link} . '/' . ($prev ? $prev : '1'); + } else { # page 2 to second-to-last + $prev = sprintf("%.0f", ($fm / $ml)); + $next = $prev + 2; + $rel_prev = $Values->{more_link} . "/$prev"; + $rel_next = $Values->{more_link} . "/$next"; + } + } + CANON: { + last CANON if $more_page !~ /^1|(Next|Prev)/; + if ($more_page eq '1') { + $canon = ''; + } else { + $canon = sprintf("%.0f", ($fm+$ml) / $ml); + $canon = '' if $canon == 1; + } + $canon = $Values->{more_link} . ($canon ? "/$canon" : ''); + } + my @out; + my $url = ($Variable->{SAMPLEURL} . $Variable->{CGI_URL}) || ''; + my $ext = $Scratch->{mv_add_dot_html} ? '.html' : ''; + $url !~ /\/$/ and $url .= '/'; + push @out, qq{} if $rel_prev; + push @out, qq{} if $rel_next; + $Tag->tmp('rel_next', 1) if $rel_next; + push @out, qq{} if $canon; + if ($prev || $next) { $Scratch->{page_title} = $Scratch->{page_title} . ' - Page ' . (($prev || $next)+1) }; + return "\t" . join "\n\t", @out; + [/calcn][/tmp][/on-match][tmp bw_more][more-list][first-anchor][/first-anchor][last-anchor][/last-anchor][link-template]
  • $ANCHOR$
  • [/link-template] + + [/more-list][/tmp][calc] + my $more = $Scratch->{bw_more}; + $more and $more =~ s,,
  • ,; + $more and $more =~ s, *,
  • ,g; + $Scratch->{bw_more} = $more; + return $Values->{more_link} ? $more : undef; + [/calc][search-list] +
    + + [item-description] + +
    [/search-list][no-match] +
    [comment] + Don't show the search string if it was empty, since it looks weird + and the user will see the error below anyway. + [/comment][tmp matchstring][value-extended name=mv_searchspec joiner=" | " filter=encode_entities][/tmp][if scratch matchstring] + [msg arg.0="[scratch matchstring]"]Sorry, no matches for %s.[/msg] + [/if][if value mv_search_error] + + [L]Errors[/L]: +
    [value-extended name=mv_search_error joiner="
    " filter=encode_entities] +
    + [/if] +
    + [/no-match][if value more_link][scratch bw_more][else][more-list] +
    + [msg arg.0="[matches]" arg.1="[match-count]"]Matches %s of %s found.[/msg] + [link-template]$ANCHOR$[/link-template] +
    [more]
    +
    + [/more-list] + [/else] + [/if][/search-region] +
    +
    + __BOTTOM__ diff --git a/templates/layout/noleft b/templates/layout/noleft new file mode 100644 index 0000000..9c5e712 --- /dev/null +++ b/templates/layout/noleft @@ -0,0 +1,52 @@ + + + + + + + + + __COMPANY__ + + + + + + + + + + + + {{:DEFAULT}} + + diff --git a/variables/BOTTOM b/variables/BOTTOM new file mode 100644 index 0000000..42a82a5 --- /dev/null +++ b/variables/BOTTOM @@ -0,0 +1,16 @@ +[output name=copyright] +__COPYRIGHT__ + +[output name=edit_controls] +__ADL_PAGE__ + +[unpack] +[include file="templates/layout/[either][scratch display_class][or]noleft[/either]"] +[/unpack] +[comment] Clear these puppies [/comment][calc] + for (qw/ + page_title + display_class + /) { delete $Scratch->{$_} } + return; +[/calc] -- cgit v1.2.3