Advice about how to use Kirby best as quality management system

Hello Kirby community, I already made a kirby based website for a facility. The management was totally in awe about simplicity of panel and ease of use. Now I got another job for same facility to build a kirby based intranet site.

Main goal of intranet would be delivering documents that are needed for day-to-day work in that facility.

I’d like to store all the documents in one folder, that folder would be invisible to ordinary users - lets call it master folder. The editors should have possibility to add documents from master folder to another (visible) sites and fetch document link, document title and document date from master folder.

Would that be possible? If yes, what would be best practice to do that. My first thought would be to fetch data via filterby tags, but I don’t know (yet) how to fetch multiple data at once via panel.

You can use roles to restrict access to the page. I think what you want is essentially described in this post., tweak it as required.

Setting the available documents is a little trickier. You could probably go with the MultiSelect Field, but adjust the Query part in the blueprint to read files rather then page IDs, however I am not 100% sure it can read form another page. You may have to feed it a JSON list via a route.

Not tested this but something along these lines in your config should do it:

<?php

c::set('routes', array(

// File Links
array(
  'pattern' => 'filelist.json',
  'action'  => function() {
    header('Content-type: application/json; charset=utf-8');
    $files = site()->index()->find('secretpage')->files();
    
    $json = array();

    foreach ($files as $file) {
        $json[$file->safeName()] = $file->filename();
    }

    echo json_encode($json);
  }
),

));

And in your blueprint, (assuming the multiselect can take JSON like the standard Select field)

fields:
  relevantfiles:
    label: File Downloads
    type: multiselect
    search: true
    options: url
    url: filelist.json

Thanks! I’m gonna try that :slight_smile:

I wouldn’t save the safename as key here, but either the filename, the diruri/dir or the url of the file, as that is what then gets stored in the content file, I think.