Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/22/2018 in all areas

  1. ProcessWire 3.0.114 is a relatively minor core version update. Most of the ProcessWire stuff I've been working on this week isn't quite ready to commit/release, so will save for later. This version adds a $database->supportsTransaction() method that returns a true or false as to whether or not the current DB engine supports transactions. Or if you give it (as an argument) the name of a table in the database, it'll return a true/false specific to that table. This version also adds importFiles() and replaceFiles() methods to $page->filesManager, which is what manages all the files for a page. These methods aren't likely to be useful in site development, but are useful for a module I'm working on, and maybe useful to other modules, so I went ahead and added them. Finally, probably the most interesting update in this version is that modules can now specify autoload order. This is something that Adrian requested, as TracyDebugger needs to load before other modules, so this update simplifies that. If you develop a module that has a similar need, be sure to see the notes for the autoload getModuleInfo() property in the Module class. That's all there is this week, so I'm not going to do a blog post this week, but stay tuned for more next week! Have a great weekend.
    7 points
  2. Update: RockGrid is now translateable via the pw backend ? To be more precise: RockGrid has always been multilanguage, just aggrid's labels for Page 1 of X and "loading..." etc. where not translateable until now. The translation file is attached to the first post of this thread:
    4 points
  3. Another idea that is probably taking something that is currently simple and effective and overly complicating it - I have a habit of that ?, but what about: About | basic-page Contact | contact History | basic-page People | people John Smith | person Jane Doe | person Blog | blogs Events | events as a way of specifying the template to be assigned to each page? There could even be a selected default template so only when one is specified will that default be overridden. Maybe it is too much, but I just wanted to throw it out there ?
    4 points
  4. Awesome! I really need to get some time to test it! This topic should be marked as [almost solved], eh? ;-). Read @bernhard tutorial on Process Modules and use his RockGrid module ?
    3 points
  5. Here's something to chew on. Start with this tutorial: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ Some code to play with. This creates a paginated ProcessWire-rendered HTML table. Create a module as per above tutorial. Use the following code in your Process module's execute() method. You need to create some people pages. In this example, they use the template 'people'. Edit functionality not included. Have a look at Blog module for that, here. For CSV upload (not included), have a look at Matrix module here for uploading CSV file and here for reading CSV file. /** * Display, Add and Edit People. * * Called when the URL is peoples's page URL + "/people/" i.e. URL Segment. * Renders a table with People information. People can be edited via modal. * * @access protected * @return mixed $form rendered form * */ public function ___execute() { $modules = $this->wire('modules'); $input = $this->wire('input')->post; $pages = $this->wire('pages'); // CREATE A NEW FORM $form = $modules->get('InputfieldForm'); $form->attr('id', 'people'); $form->action = './'; $form->method = 'post'; // CREATE AN INPUTFIELD MARKUP: Will hold list of people table $m = $modules->get('InputfieldMarkup'); $m->textFormat = Inputfield::textFormatNone;// make sure ProcessWire renders custom HTML // $m->label = $this->_('Edit'); // $m->description = $this->_('Click on a title to edit the item.'); // CREATE A NEW TABLE: for people $t = $modules->get('MarkupAdminDataTable'); $t->setEncodeEntities(false); $t->setClass('peopleTable'); // set header rows $peopleTableHeaders = array( '<input type="checkbox" class="toggle_all">', $this->_('Title'), $this->_('Name'), $this->_('Surname'), $this->_('Another Column'), $this->_('One More Column'), $this->_('Published'), #$this->_('Date'), ); $t->headerRow($peopleTableHeaders); // grab a limited number of people to show in people dashboard. Limit is hardcoded in this example $people = $pages->find("template=people, include=all, sort=-created, parent!=7, limit=10"); foreach ($people as $p) { if (!count($people)) break;// if no people found, break early // check if person page is published or not $p->is(Page::statusUnpublished) ? $status = '<span class="unpublished">' . $this->_('No') . '</span>' : $status = $this->_('Yes'); // set table rows $peopleTable = array( "<input type='checkbox' name='posts_action[]' value='{$p->id}' class='toggle'>",// disabled sorting on this in .js file "<a href='{$this->wire('config')->urls->admin}page/edit/?id={$p->id}&modal=1' class='editPeople pw-modal pw-modal-medium'>$p->title</a>", $p->title, $p->person_name, $p->person_surname, $p->another_column, $p->one_more_column, $status ); // render the table rows with variables set above $t->row($peopleTable); }// end foreach $people as $p // display a headline indicating quantities. We'll add this to people dashboard $start = $people->getStart()+1; $end = $start + count($people)-1; $total = $people->getTotal(); if($total) $peopleCount = "<h4>" . sprintf(__('People %1$d to %2$d of %3$d'), $start, $end, $total) . "</h4>"; // add a description to people dashboard {postsCount, limitSelect and instruction OR no people found status} $m->description = $total == 0 ? $this->_('No items found.') : $peopleCount . $this->_('Click on a title to edit the item.'); $m->notes = "People table notes"; $currentUrl = $this->wire('page')->url . $this->wire('input')->urlSegmentsStr."/";// get the url segment string. In this case it is "people" $pagination = $people->renderPager(array('baseUrl' => $currentUrl)); $m->attr('value', $pagination . $t->render() . $pagination);// wrap our table with pagination $form->add($m); $post = $this->wire('input')->post; // render the final form return $form->render(); }
    3 points
  6. I would go with a custom module to give ability to your administrators to insert/remove/update the potentials users which ares stored in the pages tree. If the people pages list is very large, it is not a problem, you will end up with a paginated pages tree, and you will have the ability to find easily those users (pages) from the search case or even the Pages > Find menu. You can also write a small Process module to manage those pages with a datatable, rockgrid or whatever you would like to use. - Reading @kongondo's answer after writing I see that he already explained the idea. Check this thread. Simply build a template for "people" and import them as a pages. This make things a lot easier. Just build your Process module to manage those pages. You can have a working prototype at the end of the day with all the information found on this forum.
    3 points
  7. Nice! Glad to hear it's already proving useful ?
    3 points
  8. Some time ago I created a site profile for creation of a REST API with ProcessWire. Since I kept struggeling with updating stuff between different projects which use this, I decided to convert it into a module. It is now ready for testing: https://github.com/thomasaull/RestApi Additionally I added a few small features: automatic creation of JWT Secret at module install routes can be flagged as auth: false, which makes them publicly accessible even though JWT Auth is activated in module settings To check things out, download and install the module and check the folder /site/api for examples. If you find any bugs or can think of improvements, please let me know!
    2 points
  9. What is "very very large" ? RockGrid, RockGrid, RockGrid! It's a perfect szenario for it and it was mentioned several times already by @kongondo and @flydev - it seems you didn't have a look yet? There are several modules to help you with CSV import: https://www.google.com/search?q=site:processwire.com+import+csv
    2 points
  10. Luke, the reason am asking particular questions is so that we can offer a tailored response. Without more information, it is difficult to offer a specific answer. For instance, I asked, how many columns in the database? But it seems to me you now want to go with pages, as per our suggestion, right? Assuming you are going with pages. Display Your process module, in its execute function (I am assuming you've read about this?) will render your HTML table. You can either render a ProcessWire table, or your own custom HTML table, or use Process Lister or RockGrid. All of this can be paginated so that only a limited number of people are loaded at a time. See Process Blog module for displaying pages in a HTML table. In the HTML table, do you want to display all data columns (e.g. name, surname, fiscal thingy, etc) OR do you want to display only full name (i.e. Steve Job?) Modal Then when client clicks on Steve Job, it opens a modal to the Steve Job page. The Steve Job page has several fields for name, surname, fiscal thing, etc. The client edits the fields he wants and closes the modal The page reloads (or if using ajax, only the data reloads) See Blog module (Process blog for opening pages in modal for editing) Note: Since the pages are in admin, we will have to by-pass user access check in order for client to edit the page Uploading new 'people' We have a button or file field for uploading new people data as CSV (see my FieldtypeMatrix module for example) When the csv file is uploaded, a script loops through it and creates people pages on the fly, mapping csv columns data to the ProcessWire page's fields. Before creating a page we check if there is already a people page with similar data {same email, same name, same surname, etc} You then decide what you need to do; update if duplicate found or skip creation of that people page? People page reloads (or ajax refresh) These are ideas, but very doable. But we need specific answers to our questions. You never know; someone might just create a draft module for you ?
    2 points
  11. Ok I found how to do it: On php template: <script type="text/javascript">var coupons = <?php $coupons = $pages->find("template=paddiscount, title!='', pad_percentage!=''"); echo "{"; foreach($coupons as $coupon) { if ($coupon->pad_valid_until) { echo " '" . $coupon->title . "' : " . "'" . date("Y-m-d", $coupon->pad_valid_until) . "'" . ","; } else { echo " '" . $coupon->title . "' : " . "'" . "" . "'" . ","; } } echo "};"; ?></script> Outputs something like this: <script type="text/javascript">var coupons = { 'CODE1' : '', 'CODE2' : '2018-09-30',};</script> And the related code on main.js: var discount = $form.find('input[name=pad_discount_code]').val(); var today = new Date(); var dd = today.getDate(); var mm = today.getMonth() + 1; var yyyy = today.getFullYear(); if (dd < 10) { dd = '0' + dd; } if (mm < 10) { mm = '0' + mm; } today = yyyy + '-' + mm + '-' + dd; if (discount != '' && (!coupons.hasOwnProperty(discount))) { alert('Discount code not found'); } else if (discount != '' && coupons[discount] != '' && coupons[discount] <= today) { alert('Discount code expired'); }
    2 points
  12. Yeah, you might be right about the XML sitemap idea. I think for some sites it could be ok to convert slugs to titles etc, but obviously some would be less useful. I might still have a play on a rainy day though ? I really love the idea of using the PW modules directory as a way to install these action pseudo modules. I'll make the adjustments to AdminActions to support this. Thanks for a great idea!
    2 points
  13. Is the client going to type in the data one by one or are you importing from a file, .e.g a CSV or JSON file? How many people potentially in the datasheet? Will this be done once or will the people be regularly updated? Can the people be saved as pages (hidden in admin) or you'd rather have them in a table external to ProcessWire? Manage People Datasheet You might need to create a simple Process Module, maybe even a one pager that lists the 'people'. You can include some simple actions like delete or edit people. To add people, a click on some button could open a modal window for you to add a person (depends on whether you are importing a file of people or typing manually). There's also the module RockGrid that you can use for listing the 'people'. I don't know if it can do data imports though. I think it works with ProcessWire pages only, but am not sure. User registration Since creating users is a manual process, you have a lot of control here. How you check if a user is on the allowed people list depends on the approach you take above, i.e. whether people are pages or are in a custom database. If they are pages, you can use $pages API, e.g. $newUser = $pages->get("template=people, first_name=$firstName,last_name=$lastName"); Then check if that returned something. If yes, register this user. If you are using a custom table, you'd need to use SQL to fetch, insert, update, etc, people. ProcessWire has a $database API that you can use Your other option is a custom Fieldtype but that is a bit more technical, going by how you've described your current skill set. Depending on your timescales, you might be able to get some help in the forums. If this is needed fairly soon, you might want to consider hiring an experienced ProcessWire developer to carry out the work for you.
    2 points
  14. I think authors maintaining actions in their own repos is the way to go. I know from past experience that when tinkering around I often do several commits after I think I've done my "final commit" for a version as I spot little errors or think of new ideas. I wouldn't want to have to bother you or me with pull requests for these. Having a list of third-party actions in the readme sounds like a good idea, but I have another idea too. I think it would be cool if we could leverage the power of the modules directory and ProcessWireUpgrade for actions, so users can see when updates are available and easily pull those updates in. So the idea is that each third-party action that extends ProcessAdminActions would have its own "pseudo-module" - a module file containing just the required getModuleInfo() method. So for my action above the module folder would look like this: And ActionUnorderedListToPages.module would consist of this: <?php namespace ProcessWire; class ActionUnorderedListToPages extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Unordered List to Pages', 'description' => 'Creates a structure of new pages from an unordered list.', 'version' => '0.1.0', 'author' => 'Robin Sallis', 'href' => 'https://github.com/Toutouwai/ActionUnorderedListToPages', 'extends' => 'ProcessAdminActions' ); } } ProcessAdminActions would look for third-party actions like this... $third_party_actions = $this->wire('modules')->findByInfo('extends=ProcessAdminActions'); ...and then get the action by looking for an ".action.php" file in the module directory. ProcessAdminActions could hopefully grab the action title/description from getModuleInfo() rather than this needing to be duplicated inside the action file (but no big deal if that wont fly). So this would require coding some extra features in ProcessAdminActions but I think being able to use the modules directory would be really cool. And the exact details of how all this would work is up for discussion of course - this is just me brainstorming here. What do you think? I might be wrong but this sounds like it wouldn't work very reliably. Sitemaps generally just have the URL to the resource and that seems like it would problematic to parse into the desired page structure in many cases: There is no page title in an XML sitemap so pages would have to use the slug name as page title, which may not be that close to the desired title - so potentially requiring a lot of manual fixes later and not making the action much of a time-saver. Many sites don't have the tidy connection between URL and page structure that PW has - worst are ones like /index.php?id=1234&view=detail&foo=bar. I'm not sure what the action would be able to do with this. XML sitemaps often include entries for non-page resources such as PDF files. If you think the XML sitemap idea can work I'm happy to be proved wrong. ? Maybe you want to have a play around with it?
    2 points
  15. An action that I made for my own convenience but that others might find useful too: Unordered List to Pages An action for the Admin Actions module for ProcessWire CMS/CMF. Creates a structure of new pages from an unordered list entered into a CKEditor field. The nesting of further unordered lists within the list will determine the nesting of the created pages. This can be useful to quickly create a page structure; especially so if you are rebuilding an existing non-ProcessWire site that has a Sitemap page that you can copy and paste from. All the created pages get the same template - for any pages that should use a different template you can easily change this as you edit the page to add content, or use the Page Manipulator action for bulk template changes. Usage Install the action by copying the "UnorderedListToPages" folder to /site/templates/AdminActions/, and then visiting the Admin Actions config screen and enabling the "Unordered List to Pages" action for the roles who are allowed to use it. Navigate to Admin Actions > Unordered List to Pages and fill out the config fields: Enter/paste an unordered list in the Source field. Select a parent page that the new pages will be created under. Select the template to use for the new pages. Execute the action. Screenshots Action config: Result: https://github.com/Toutouwai/UnorderedListToPages Update: https://github.com/Toutouwai/AdminActionsUnorderedListToPages This action module now has its own support topic:
    2 points
  16. http://tonsky.me/blog/disenchantment/ regards mr-fan
    1 point
  17. I've heard WordPress has a plugin for that ?
    1 point
  18. You should really do that as soon as possible ? I'm using it on all my projects and it's an absolutely awesome listing tool. Much better than the core listing in most of the cases IMHO (not praising my own work here, most of the awesomeness comes from agGrid). I decided to make it free (MIT) so that others can use it in their modules (batch child editor, the new padloper, etc. - really a lot of possibilities here). I really think that it opens up a new world for processwire regarding how users can manage their content (GUI). Great, good luck and have fun ?
    1 point
  19. Forgot one: One click with RockGrid, already built in - and they can even filter the grid before exporting ?
    1 point
  20. If you want to build a JSON object with PHP, you should have a look at json_encode. That it is easier and cleaner than building it yourself. ? Regards, Andreas
    1 point
  21. They pick up the phone and call me. I have sent them the admin account details but I' sure they have never been there ? (not just this one but many others) Of course if they would REALLY like to edit their site I could not use an SSG. Often the case is that they do like the idea to be able to manage the content. But when the time comes they realize it's work and it would require effort.
    1 point
  22. How does your client edit content with a static site generator like this? I mean: adding end editing images, adding new "posts" an editing them, etc... Does Eleventy supports these? I am asking this, because I have never used a static site generator. Is it only for developers or for clients too?
    1 point
  23. Yeah, what @flydev said. Pages is the easier route in your case. We are not saying it cannot be done by using your custom database and querying it directly. That's possible, but in your case, a lot more technical work. Your client does not have to see the tree of people pages. You can have those hidden under a single parent whose parent is /admin/ rather than home (/). This way, only superusers can see the people tree. With a Process Module, you don't have to be visiting the page tree even as a superuser. You only need to know that they are there and the evidence is that you can see them in your Process Module :-). The 'each person is a page' approach means that ProcessWire does all the heavy lifting, dealing with databases operations. Heck, your Process Module will allow you to filter users or sort them according to some column. Your database columns, depending on the data, can either be stored as single ProcessWire fields - name=text;surname=text,other_data=integer, etc OR as one blob of JSON text in a single text field, which can be retrieved and turned into an array. We need to see the column names and how many you got, to give a definite answer. How has your client been updating the database in the old website? You still haven't told us how soon you need this ?
    1 point
  24. Thank you @teppo A configurable endpoint ist not really difficult, so I just did it – 0.0.2 has a field in the module settings for that ?
    1 point
  25. Hey Thomas, Thanks for this module, looks really interesting, and I'm looking forward to giving it a go. Just a quick comment on this part of the README: I think that a configurable endpoint name would definitely be a worthwhile option – or if that turns out to be difficult, perhaps you might want to consider something slightly more descriptive, such as /rest-api/ or something? To be completely honest I'm being a bit selfish here: I've got the bad habit of using /api/ for any site-specific API implementations I might need, and that would pose an issue for this particular module ? Reminds me of the "two hard things in computer science" thing. This thread already covers both: cache (well, token...) invalidation and naming things ?
    1 point
  26. 1- the idea was that the client update this list. The option that imports from a csv is an option but can be very handy. What I know is that the interest is to export in a csv registered user and other lists. So I a do people as pages, I can export an hidden category with lots of pages in a csv? 2- The people's list are very very large. Actually there's a database in the old website that I need to import in the first place. 3- will be regularly updated once or twice a year, maybe more. 4- No the people can be pages. The peoples are gonna store in the same database, so the important thing is to have a tab in the admin, so can be easy to the client to see only the people, and not all the pages etc.. I want to create a tab because I think that the page tree, with all the names, are gonna be very large, and not very easy to read.
    1 point
  27. This module is great, very useful and i'm using it on a project; I guess my PHP version (7.2.10 ) doesn't like this: (FieldtypeConfigForm, line 69) if(count($values)){ but this works if(wireCount($values)){
    1 point
  28. Hi @adrian thanks for the latest update to add autoload support (and to Ryan for putting it into the core this week) as I can now use Tracy in the preview tab in FormBuilder to do a little StreetAddress work. Much appreciated!
    1 point
  29. Use the API :-). Log in as a super user and throw the following code in some template file and visit a page that uses that template. Delete the code from the template file when done. if($user->isSuperuser()) { $p = $pages->get(1029); // delete some images based on some condition foreach ($p->images as $img) { if($someCondition) continue;# if some condition met, skip deleting this image $p->images->delete($img); } // if deleting all #$p->images->deleteAll(); } Alternatively, use the API to create thumbs in the size ProcessWire would have generated.
    1 point
  30. Given that no-one else has submitted any actions yet, I wonder whether you guys would prefer to maintain themselves in your own repos. Perhaps the best approach might be to add a list of 3rd party actions to the AdminActions Readme. Would you guys prefer that?
    1 point
  31. I freaking love this! It is like the Add mode from BatchChildEditor, but on steroids! I'd be keen to include this as a core action if you're ok with that and you'd like to submit a PR. I can see using this for kickstarting many new sites. If you do want to include, maybe move simple_html_dom.php into the libraries folder under actions, unless you feel like removing this need and coming up with a DOMDocument solution?
    1 point
  32. Reminds me of MorphOS: http://www.morphos.de/ which is still a 250MG disk image full of all sorts of GUI apps we are used to today and runs quite fast on a G4 PPC processor (more info: http://www.morphos.de/hardware). Last year I installed the demo of MorphOS on my G4 PPC and I really liked what I saw. I want to buy a silent power supply for he G4 so that its noise drops to a level where using it becomes enjoyable. I plan doing it next year, together with my son, just for fun. After all, he wants to become a programmer, so he needs be aware of efficient pieces of software out there. BTW, the author mentioned how shoddy browser based apps can be. Talented and dedicated programmers can do a lot better than that, of course, a very good example is: https://editor.construct.net/
    1 point
  33. well you can always read the database directly or use the wordpress rest api ?
    1 point
  34. Great read! A bit off topic (hey, this is the pub) but this is part of the reason why I love reading about old-school software development, and game development in particular. You know, when folks had to figure out how to run complex software while dealing with various limitations – such as being limited to something between 32 and 64 KB of memory in total. Good times. For the record, there are some awesome videos about old school development and hardware at YouTube by user The 8-Bit Guy. Not only does he clearly know his "old-school" computers inside out, he has also released amazingly polished new games for old hardware ?
    1 point
  35. I got it to work like this! https://jsfiddle.net/elabx/vysjwp01/
    1 point
  36. The focus this week was on covering the queue of issue reports, and a whole lot of progress was made. Plus some other useful additions can be found ProcessWire 3.0.113. This post covers all the details— https://processwire.com/blog/posts/processwire-3.0.113-core-updates/
    1 point
  37. A friend wrote his own OS from scratch back 15 years ago. He was way ahead of competition and was telling the same things about how bloated and inefficient softwar3 and specially os's are. He's dad run a software company he also worked in but only got doubted and ignored somehow. He kept at it for almost 7 years until he proved everybody wrong. He could do things even seniored software guys got blown away. He's system was so small and efficient and only was about a couple Mb in size that would extract to some gb of data (ofc the apps) . He could install a whole computer network with 50 laptops in about 1m and boot them up all at the same time im 5s from his laptop. He was into clustering and had big things in mind. He's system they used for a central payment system that did run for +3 years without one single restart or outtage or problem. They were so impressed that they ordered more. Sadly he got fired by his own dad because of he work philosophie and had his problems. Unfortunately he died of cancer 11 years ago. His work kinda lost. Makes me sad and not a single day pass by without thinking of him. Yet 10 years later sadly nothing has changed in the industry. I'm so happy there's still people around who care.
    0 points
×
×
  • Create New...