Stories
Slash Boxes
Comments

Dev.SN ♥ developers

posted by martyb on Thursday April 09 2020, @04:37PM   Printer-friendly

Loading the recent_subs page currently shows all subscriptions. Here is the template(default;admin;recent_subs) before making any changes.

NOTE: Slashcode converts tabs and runs of spaces into something like: "       "

[% PROCESS titlebar title="Recent Subscription Payments" %]
<div class="generalbody">
[% IF startat > 0;
    next_startat = startat - 30;
    IF next_startat < 0; next_startat = 0; END; %]
    <form action="[% gSkin.rootdir %]/admin.pl" method="get">
    <input type="hidden" name="op" value="recent_subs">
    <input type="hidden" name="startat" value="[% next_startat | strip_attribute %]">
    <input type="submit" value="<< Next Sub Payments">
    </form>
[% END %]

<table>
    <tr>
        <th>spid</th>
        <th>user</th>
        <th>email</th>
        <th>ts</th>
        <th>payment_net</th>
        <th>payment_gross</th>
        <th>pages</th>
        <th>trans_id</th>
        <th>method</th>
        <th>submethod</th>
    </tr>

    [% FOREACH sub = subs %]
    <tr>
        <td align="right">[% sub.spid %]</td>
        <td align="left"><a href="[% constants.real_rootdir
            %]/~[% sub.nickname | fixnickforlink | strip_paramattr %]">[%
            sub.nickname | strip_literal %] ([% sub.uid %])</a></td>
        <td align="left">[% sub.email | strip_literal %]</td>
        <td align="left">[% sub.ts | strip_literal %]</td>
        <td align="right" class="subs_net">[% sub.payment_net | strip_literal %]</td>
        <td align="right">[% sub.payment_gross | strip_literal %]</td>
        <td align="right">[% sub.pages | strip_literal %]</td>
        <td align="left">[% sub.transaction_id | strip_literal %]</td>
        <td align="left">[% sub.method | strip_literal %]</td>
        <td align="left">[% sub.submethod | strip_literal %]</td>
    </tr>
    [% END %]

</table>

[% prev_startat = startat + 30; %]
<form action="[% gSkin.rootdir %]/admin.pl" method="get">
<input type="hidden" name="op" value="recent_subs">
<input type="hidden" name="startat" value="[% prev_startat | strip_attribute %]">
<input type="submit" value="Prev Sub Payments >>">
</form>
</div>

link.


Original Submission

Partial solution:

    [% PROCESS titlebar title="Recent Subscription Payments" %]
    <div class="generalbody">
    [% IF startat > 0;
        next_startat = startat - 30;
        IF next_startat < 0; next_startat = 0; END; %]
        <form action="[% gSkin.rootdir %]/admin.pl" method="get">
        <input type="hidden" name="op" value="recent_subs">
        <input type="hidden" name="startat" value="[% next_startat | strip_attribute %]">
        <input type="submit" value="<< Next Sub Payments">
        </form>
    [% END %]

    <!-- We'll need a checkbox to toggle visibility: -->
    <input type="checkbox" id="show_grant" name="show_grant" value="checked">

   <!-- And styles for each column;  (should be moved into default.css) ->
   <!-- NB: the "align=" tag attribute is deprecated. -->
   <style type="text/css">
      .spid:      { align:   right; }
      .nick:      { align:   left;  }
      .email:     { align:   left;  }
      .ts:        { align:   left;  }
      .net:       { align:   right; }
      .gross:     { align:   right; }
      .pages:     { align:   right; }
      .transid:   { align:   left;  }
      .method:    { align:   left;  }
      .submethod: { align:   left;  }

      .paid:      { display: table-row; }
      .grant:     { display: none; }
      .grant:     { display: table-row; }

<!-- Need code in here, I think, to make use of  -->
<!-- checkbox value to set the  style for .grant -->

   </style>

    <table>
        <thead>
        <tr>
            <th>spid</th>
            <th>user</th>
            <th>email</th>
            <th>ts</th>
            <th>payment_net</th>
            <th>payment_gross</th>
            <th>pages</th>
            <th>trans_id</th>
            <th>method</th>
            <th>submethod</th>
        </tr>
        </thead>

        <tbody>
        [% FOREACH sub = subs %]

    [% gross_amount [% sub.payment_gross | strip_literal %];
        [% IF gross_amount > 0 subscribe_type = "paid"; ELSE; subscribe_type = "grant"; END;%]
        <tr class="[% subscribe_type %]">
            <td class="spid">[% sub.spid %]</td>
            <td class="nick"><a href="[% constants.real_rootdir
                %]/~[% sub.nickname | fixnickforlink | strip_paramattr %]">[%
                sub.nickname | strip_literal %] ([% sub.uid %])</a></td>
            <td class="email">[% sub.email | strip_literal %]</td>
            <td class="ts">[% sub.ts | strip_literal %]</td>
            <td class="net">[% sub.payment_net | strip_literal %]</td>
            <td class="gross">[% sub.payment_gross | strip_literal %]</td>
            <td class="pages">[% sub.pages | strip_literal %]</td>
            <td class="transid">[% sub.transaction_id | strip_literal %]</td>
            <td class="method">[% sub.method | strip_literal %]</td>
            <td class="submethod">[% sub.submethod | strip_literal %]</td>
        </tr>
        [% END %]
        </tbody>

    </table>

    [% prev_startat = startat + 30; %]
    <form action="[% gSkin.rootdir %]/admin.pl" method="get">
    <input type="hidden" name="op" value="recent_subs">
    <input type="hidden" name="startat" value="[% prev_startat | strip_attribute %]">
    <input type="submit" value="Prev Sub Payments >>">
    </form>
    </div>

This discussion has been archived. No new comments can be posted.
Display Options Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 2) by martyb on Thursday April 09 2020, @06:35PM

    by martyb (76) on Thursday April 09 2020, @06:35PM (#31598) Journal

    Revised Version:

        [% PROCESS titlebar title="Recent Subscription Payments" %]
        <div class="generalbody">
        [% IF startat > 0;
            next_startat = startat - 30;
            IF next_startat < 0; next_startat = 0; END; %]
            <form action="[% gSkin.rootdir %]/admin.pl" method="get">
            <input type="hidden" name="op" value="recent_subs">
            <input type="hidden" name="startat" value="[% next_startat | strip_attribute %]">
            <input type="submit" value="<< Next Sub Payments">
            </form>
        [% END %]

        <!-- We'll need a checkbox to toggle visibility: -->
        <input type="checkbox" id="show_grant" name="show_grant" value="checked">

       <!-- And styles for each column; the "align=" tag attribute is deprecated. -->
       <style type="text/css">
          subs_spid:      { align:   right; }
          subs_nick:      { align:   left;  }
          subs_email:     { align:   left;  }
          subs_ts:        { align:   left;  }
          subs_net:       { align:   right; }
          subs_gross:     { align:   right; }
          subs_pages:     { align:   right; }
          subs_transid:   { align:   left;  }
          subs_method:    { align:   left;  }
          subs_submethod: { align:   left;  }

          subscribe       { display: table-row; }
       </style>

        <table>
            <tr>
                <th>spid</th>
                <th>user</th>
                <th>email</th>
                <th>ts</th>
                <th>payment_net</th>
                <th>payment_gross</th>
                <th>pages</th>
                <th>trans_id</th>
                <th>method</th>
                <th>submethod</th>
            </tr>

            [% FOREACH sub = subs %]
            <tr class="subscribe">
                <td class="spid">[% sub.spid %]</td>
                <td class="nick"><a href="[% constants.real_rootdir
                    %]/~[% sub.nickname | fixnickforlink | strip_paramattr %]">[%
                    sub.nickname | strip_literal %] ([% sub.uid %])</a></td>
                <td class="email">[% sub.email | strip_literal %]</td>
                <td class="ts">[% sub.ts | strip_literal %]</td>
                <td class="subs_net">[% sub.payment_net | strip_literal %]</td>
                <td class="subs_gross">[% sub.payment_gross | strip_literal %]</td>
                <td class="pages">[% sub.pages | strip_literal %]</td>
                <td class="transid">[% sub.transaction_id | strip_literal %]</td>
                <td class="subs_method">[% sub.method | strip_literal %]</td>
                <td class="subs_submethod">[% sub.submethod | strip_literal %]</td>
            </tr>
            [% END %]

        </table>

        [% prev_startat = startat + 30; %]
        <form action="[% gSkin.rootdir %]/admin.pl" method="get">
        <input type="hidden" name="op" value="recent_subs">
        <input type="hidden" name="startat" value="[% prev_startat | strip_attribute %]">
        <input type="submit" value="Prev Sub Payments >>">
        </form>
        </div>

(1)