Jump to content

msavard

Members
  • Posts

    48
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by msavard

  1. On 10/4/2024 at 5:06 PM, Robin S said:

    Not sure what you mean here. The ProcessWire admin for non-superusers is the most minimal CMS back-end I've seen. It's just the page tree, which is easily understood even by beginners because it corresponds to the front-end structure. And from the page tree editors can only edit the pages that have the templates you allow for them.

    I agree with you on it being simple, but when you are managing 1800 books, those books stored at 15 different locations, and over 100 library users, the page tree isn't really very practical. Though the search in processwire helps, I guess I'm looking for something a little easier for the tasks the 'librarians' have to do on the back end. 

    On 10/5/2024 at 6:07 AM, bernhard said:

    Create custom admin pages. This is still very easy and you stay in the "safe" PW backend, which means you don't have to take care of everything on your own and you can build on top of proven and battle-tested concepts and code.

    I'm wondering if the suggestion to use CustomAdminPages would be the way to go. I suppose I could make a page so when a librarian logs in, they would just see their books in a nice table (using datatables with filtering/sorting?) with clear buttons for their various tasks. Can these be set as the default page the admin opens to if the users isn't an administrator? And when they complete a task (check in a book for example), have it go back to this page? Almost like a dashboard for each librarian I suppose.

  2. Maybe a simple question here, but what is the common practice for allowing users to interact with the back end? Do you just let them into the administrator interface with some access control set? Do you build special pages that they can use to manage content?

    I have a library site I built for a local group where I live. I would like to allow the 'librarians' to see what books are checked out, check books back in, send canned emails out to people who have overdue books, add new books, etc. But seeing all the back end of Processwire will be way too intimidating to them. 

    In this case, would it be worth creating pages that allow the librarian to interact with the data, but shield them from the admin sections of Processwire? Or is that too much of a chore and should I just show them how to use the backend and tell them to get used to it? 

  3. Thanks for the feedback. I agree on the slider criticism. I designed the internal pages first and then was struggling on what to do on the homepage. The slider was more of a 'fill the space' decision than anything else and I was never happy with it. I will revisit that soon and see what improvements can be made. Feel free to suggest anything if you have any ideas. 

  4. You all are such professional designers that I hesitate sharing my site here, but it might show what Processwire can do even for 'average' users.

    I created this site with Processwire for the County of Ventura's Assessor's Office. It is a redo of the previous site done in ASP that was showing it's age. The goal was to provide a more modern design that would work with desktop or mobile while at the same time providing more features for the taxpayers to access data and communicate with us. While most of the County Government sites use WordPress (or similar) they graciously allowed me to give Processwire a try. I think it performs admirably, is easy to maintain, very fast, and actually fun to work with (most of the time....?).

    http://assessor.countyofventura.org

    Most of the site is handled by two main templates, one for the summary pages, and one for the detail pages. I also created a 'dummy' template to act as a folder to hold the pages for each category (to make a manageable hierarchy) . This made it easier for me to find things on the back end and mimics the front end nicely.

    On the back end there are several templates that hold things like forms (pdf downloads), links, glossary terms, frequently asked questions, form responses, and more. All of these are dynamically included into the front facing pages based on their content and how they relate to the individual pages. 

    Fillable forms were the hardest part for me. I tried working with some of the free modules for this sort of thing but I could never wrap my head around them. In the end, I just did it by hand with standard PHP forms combined with using the Processwire API to save the results to the database. It works fairly well but I'm sure there is a better way.

    A big thank you to everyone on this forum for their help and tips both directly and indirectly, and to Ryan who makes this fabulous software available to us.

    Any suggestions on the site are welcome.

     

    Homepage.JPG

    SummaryPage.JPG

    detailPage.JPG

    Backend.JPG

    • Like 12
  5. I just upgraded to the new master and TinyMCE wasn't installed. Isn't it supposed to be part of the master now? I looked in the modules directory on my server and it isn't there. 

    Any suggestions?

    NEVERMIND: its working now. I had to hit refresh several times in various places. Strange. I never had to do that before.

  6. Could you give a more complete example of how to use this on the front end? Do I have to format the input field in a certain way? Does it have to be of type text? number? Do I have to put certain classes on the field to make it do it's magic?

    Matt

  7. Thank you. That is very helpful. I can see there is a lot of power in using hooks. I'll have to look into those more. 

    I think I will eventually do this as a batch (find all the ones that aren't checked, process them, send an email, etc) but I want to make sure everything is working before I set it loose on it's own (and what type of errors might crop up). I trust processwire, but I don't trust me driving processwire! ☺️

    Thanks again.

  8. Oops...I just came across an answer in this post. I spent all day yesterday trying to figure this out and then I find the answer a couple minutes after finally asking the question. ?‍♂️

    If I use the $page->setAndSave() method then it works. 

    I would still be interested to hear if there is a better way to accomplish this task.

  9. I've spent way too much time trying to figure this out so now I just have to ask.

    I added an option to the save button when editing a page. What I want it to do is, when clicked, send an email out to the appropriate person, change a field on the page, then save. I have everything working up until the change a value on the page and save. I can't seem to figure out how to do this. I really don't understand what I'm doing. So far the email part works because I just smashed together various bits and pieces from the forums.

    Here is the hook that adds the button

    $wire->addHookAfter('ProcessPageEdit::getSubmitActions', function($event) {
      $actions = $event->return; // array of actions indexed by name
      $page = $event->object->getPage(); // page being edited
    
      // add a new action to process the Change of Address request if
      // this page uses the change of address template
      if ($page->template == 'Change_Of_Address' && $page->yes_no == false){
      $actions['Process Form'] = [ 
        'value' => 'process', 
        'icon' => 'address-card', 
        'label' => '%s + Process', 
        'class' => '', 
      ]; 
      $event->return = $actions;
    }
    }); 

    And here is the modified code that attempts to change a field value and save the page. I removed all the part that creates/sends the email.

    $wire->addHookAfter('ProcessPageEdit::processSubmitAction', function($event) {
      $action = $event->arguments(0); // action name, i.e. 'hello'
      $page = $event->object->getPage(); // Page that was edited/saved
    
      if($action === 'process') { 
          $page->yes_no = true;
          $pages->saveField($page, 'yes_no');
          $notice = new NoticeWarning("This address change has been sent to the appropriate crew.");
          $notice->icon = 'address-card';
          $event->notices->add($notice);
          $event->object->setRedirectUrl('../');
        }
    });

    I get an error on the $pages->saveField line saying:

    Call to a member function saveField() on null

    Can anyone offer some help on this? If there is an easier way to do this other than using hooks and adding buttons I would welcome that as well.

  10. Is it possible to hide the URL to the various files in the site/assets/files directory from being indexed?

    For example, say I have a site at somesite.com. I have a PDF file that someone can download at somesite.com/site/assets/files/1376/mypdf.pdf. Is there a way to hide all that and just have the link be something like somesite.com/pdfs/mypdf.pdf?

    I guess it doesn't really matter, it just looks messy having all those site/assets/files/1075/etc/etc in there.  

  11. I attempted to upgrade to the newest master version and once it did so there were a bunch of errors at the bottom of the screen regarding renaming folders (I believe it said access denied errors). It looks like the upgrade was done in a folder called wire-3.0.210 and then it was trying to rename folders to make that the 'real' wire folder. Needless to say, the folder never got renamed and when I go and check for upgrades, it still says an upgrade to 3.0.210 is available. 

    Should I be concerned about this? I've never had this trouble before. It was on my local box.

     

  12. I'm trying to do something I thought was really simple but I'm obviously having a brain freeze on it.

    I have a form defined using HannaCode. I want the user to be able to fill out the form and have it be submitted to a PHP processing page for emailing results, etc. I had to put that response page in the root directory of the web server for this to work as Processwire won't let you use any PHP file without getting an error. 

    The processing page is very simple, just for testing. No matter what I use on that page ($mail, WireMail, $pages->find, etc, etc). I get an error about an undefined variable. 

    Am I doing something wrong here? The method for the form is post, the action is the processing PHP page.

  13. 8 hours ago, zoeck said:

    i think you can use $files->find() 

    "Find all files in the given $path recursively, and return a flat array of all found filenames"

    Thank you, I was trying this but I was having a hard time giving it a $path that worked. If I give it a path from the root of the server (c:/temp in the case of running on my local machine) it seems to work. I don't want that though as I can't serve that up for someone to download. How can I get a accessible path? Something like /site/templates/files/maps/etc/?

  14. I have a need for users to be able to put in a search term and for Processwire to return a PDF file matching that term. It isn't complicated, if they put in 088 then I need to return a PDF named 088.pdf. 

    My question is, how do I do that in Processwire without having to make a page for every PDF? There will be hundreds of them and they will all be updated each year. Ideally I would like for the file to be served from the file system, not the database. 

    Do I just bypass Processwire for this and use straight PHP? If so, how do I use a processwire template for the look of the site, but use PHP for filesystem access and returning file paths? 

    Thanks.

  15. I may be misunderstanding how CKEdit fields are supposed to be used in processwire, but maybe someone can clear this up.

    I have a standard CKEdit field used for typing in body copy for the pages of the website. Doing headings, paragraphs, bold, table, etc is fine. But what if I want something a little different? For example, what if I want to be able to choose whether I wanted a standard bulleted list, or one that uses an image as the bullet points? Or maybe I want to be able to insert a 2 column CSS grid with items in it making it look like a two column bulleted list.

    Do I just dip into the CKEdit fields source dialog at that point? Do I use multiple fields almost like a page builder type of approach (rich text block, then a special list block, then another rich text block, etc)?

    I'm wondering what you all do. (Not just for bulleted lists, that was just an example)

    The image shows three types of bullet points I may want to be able to choose from depending on the situation. 

    Capture.thumb.JPG.057f88f3b2d1579ae1d7890aae2a84a5.JPG

  16. I'm trying to do a simple task of rendering pagetable fields. Everything works fine except it won't render HTML from one of those fields. Here is what I have set up.

    I want to have a section where I can create custom list items (using a SVG for the bullet instead of the normal one). I created a text area field where I type in one line for each bullet point. I then have this rendered on the back end with all the other HTML included to give me my nice list. If I put HTML in any of the list items (like <strong></strong>) it doesn't not get rendered as HTML, just plain text. I would like it rendered as HTML.

    The text area field has the HTML Entity Encoder set and the Markup/HTML option set (I've tried it with Unknown/Text as well). 

    The code on the pagetable item rendering template is:

     <?php
     echo '<div class="grid grid-cols-2 gap-3 mt-6">';
     $array = preg_split("/[\n\r]+/", $page->pt_list);
     foreach ($array as $listitem){
      echo '<span class="list-none text-blue-600 ml-4 pl-10"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5 inline align-text-bottom   -ml-10 mr-4">
        <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /></svg>'.$listitem.'</span>';
     }
      echo '</div>';
    ?>

    On the main template I am rendering the item with a simple 

    <?php foreach($page->listsection as $section) echo $section->render(); ?>  

    Does anyone have any ideas why the HTML would not be rendering correctly?

    Thanks.

  17. This might be an obvious one but I can't find it. How can I limit, or expand, the number of results that are pulled back in the find portion of the admin interface (the lister?)? Right now it seems limited to 25 records at a time. I would like to increase this. Is there any way to do that? I'm not talking about the hierarchal list of pages but the list you can get if you go to the Pages>Find menu option.

    Thanks.

     

  18. I have created a small library site. Each book in the library is entered using a book template. I have the need to keep track of when these books were checked out. In the future I would need to be able to find out how often the various books have been checked out. 

    Would the best way to do this be to create a separate document for each time the book is checked out? Or is there a field type that would store a list of dates that could later be queried? I haven't been able to come up with a good solution yet so any help would be appreciated.

     

×
×
  • Create New...