2

Background for Understanding the Problem I Need to Solve:

  1. My new, senior client doesn't deal well with receiving form submissions through email, so adding more to his 24,000+ unread emails won't work.
  2. A database-driven CMS is out of the question for this client as well, as is setting him up with a FTP login to read and delete files on the server (Yikes, the thought).
  3. I don't yet see how I can create IDs for these individual form-submitted text files without a db; IDs, of course, would make it simple to delete the buggers.

What I've Got Going On So Far:

  1. Each form's generated files list with content links on a UI page, and each listed file has a fancy but alas non-functioning button I made for its respective row.
  2. I've tried to delete the files for days by referencing them by name using various combinations of the base url and their routes to no avail.
  3. I've search for and read through similar questions here and elsewhere on the Internet, the closest one that still didn't work was this PHP example which I will revisit if advised to do so.
  4. The flat-file CMS uses data remodals with "uri.addNonce" to delete just about everything else in the admin panel, so silly me thought this would be easy to emulate.

My Current Non-Working Spanned Button Code:

<ul class="pages-list depth-0">
       {% for item in grav.twig.items %}
           <li class="page-item">
               <div class="row page-item__row">
                    <div class="page-item__content">
                        <a href="{{ type }}/{{ item.route }}" class="page-edit item-read">{{ item.route|e }}</a>
                    </div>
                    <span class="page-item__tools">
                        <a href="{{ uri.addNonce(item_url ~ id  ~ '/action' ~ separator ~ 'delete', 'admin-form', 'admin-nonce') }}"><i class="fa fa-close"></i></a>
                    </span>
               </div>
           </li>
       {% endfor %}
    </ul>

No Actual ID Produces This Broken Link:

<a href="#delete" class="page-delete delete-action" title="Delete contact-2018-02-23-053425-135837" data-remodal-target="delete" data-delete-url="/admin-panel/plugin-name/actiondelete/admin-nonce:9g641e7102c9cde7eab9924ef05cddd7"><i class="fa fa-close"></i></a>

An ID-Based Span As Seen In A Different Plugin Produces This Working Link:

<a href="#delete" class="page-delete delete-action" title="Delete 'Record Name'" data-remodal-target="delete" data-delete-url="/admin-panel/plugin-name/entries/id:mz2gc6jwmnfw6ytm/action:delete/admin-nonce:9g641e7102c9cde7eab9924ef05cddd7"><i class="fa fa-close"></i></a>

What I Don't Want to Do:

  1. Rewriting the entire plugin to make the form submissions append to a single JSON entries db seems overkill and would ruin the current plugin's optimal data rendering structure.

The Solution If Not a Crazy, Never-Gonna-Work Idea:

  1. I'd like to make a button-generated lonely array of one for each listed file that would assign it a key/ID, reference its route, and finally make the file able to be deleted.

Is my idea even possible? I'll try any Twig/PHP suggestion and do whatever it takes to make this UI data management solution work for my client. So please advise and point me in the right direction. In the end, I'd like to make a good report here, as being able assign on-the-fly IDs to flat files would open up a lot of creative possibilities.

bgjessop
  • 21
  • 4

0 Answers0