Search the Community
Showing results for tags 'process'.
-
Process Render File A Process module that renders markup from files in /site/templates/ProcessRenderFile/. This provides an easy way to create simple admin screens where it might be overkill to create a dedicated Process module for the purpose. Process page When you install the module a page with the name "render-file" and the title "Render File" is created under Setup. To change the page name or title, expand Page List to Admin > Setup > Render File and open the page for editing. Tip: if you create a new text field with the name "page_icon" and add it to the core "admin" template you can set a custom menu icon for the page by entering the icon name into the field. E.g. enter "smile-o" to use a smiley icon for the page. If you want to use ProcessRenderFile for more than one Process page you can create a new page under Setup. Select "admin" for the template, enter a title for the page, and in the next step choose ProcessRenderFile in the Process dropdown. Render files for URL segments On install the module will create a "ProcessRenderFile" folder in /site/templates/. Any .php files you save to this folder will be rendered as the output of a matching URL segment for Process pages using ProcessRenderFile. For example, if you create a file foo.php containing code... echo "This is the output of foo.php"; ...then you'll see this output when you visit /processwire/setup/render-file/foo/ (assuming the default ProcessWire admin page name and the default ProcessRenderFile page name). In the render file you can use all the ProcessWire API variables like $pages, $input, etc, as you would in a template file. If you create foo.js and foo.css (or foo.scss if you have ProCache installed) then those assets will be automatically loaded when you visit /processwire/setup/render-file/foo/. When a file is rendered the filename will be converted into a capitalised format that's used as a browser title and a headline. If you want to set a custom browser title and/or headline you can do this in your render file: $this->wire('processBrowserTitle', 'Custom browser title'); $this->wire('processHeadline', 'Custom headline'); Render file for the Process page If you create a render file that has the same name as the ProcessRenderFile Process page then this file will be rendered when the Process page is viewed without any URL segment. So for the default ProcessRenderFile page name you would create render-file.php. Note that this will override the default list output described below. Configuration The module configuration screen lets you select URL segment render files to appear as menu items. The selected render files will appear in the flyout menu for the Process page, and also as a list when the Process page is viewed without any URL segment. The list is only shown if you haven't created a render file for the Process page as described above. If you've created more than one ProcessRenderFile Process page then you'll see menu options for each page in the module configuration. https://github.com/Toutouwai/ProcessRenderFile https://processwire.com/modules/process-render-file/
-
Hi Everyone! So I've been working with PW for over ten years now!!! Big thanks to @ryan and everyone in the community (genuinely such a warm community). I've made a few modules in my time as well as tutorials and this was the first that I thought might work as a commercial module: MembersMessaging This module enables you to easily setup a messaging system for your users through your site. Allow your website users to message other users on the site given a user name or similar information. Module uses the notions of threads, messages and users to describe the message relationship -> A thread is a page storing n messages including: time posted, created by user and message text, the user ids in that thread, which users have unread messages in that thread, whether messages are encrypted (and it's salt). User pages have a list of all threads they are apart. In your templates you can add: a compose message form, threads and their messages, thread reply forms, message and threads counts, as well as delete and delete all messages. You can view messages in the admin (unless encrypted set to True) and view message stats and module usage in admin page Members. Purchase here How to install? - Install Processwire - Add MembersMessagingModule folder to modules folder in processwire: /site/modules/ - Login to your site admin and navigate to Modules: yoursite.com/[admin]/module - Configure the module settings: yoursite.com/[admin]/module/edit?name=MembersMessaging` - Follow the instructions below to add messaging to your templates How to use Example usage: $mm = $modules->getModule("MembersMessaging"); echo $mm->execute(); echo $mm->js(); echo $mm->css(); Full api here. Configuration Module allows you to configure whether: to allow new threads to yourself to allow new threads to guest user role to trash or unpublish threads deleted from frontend to use select or textinput for username input to allow an All keyword to signal thread should include all users to change all keyword to something else to notify a user via email they have been sent a new message to set email sender address to change username output from user name field to some other field specified to change default max threads and messages to display to encrypt messages (using basic encrypt strategy that encrypts each message on server before DB save, and is decrypted on request) Roadmap: Available here. ------- I'm not really sure how much interest there would be in this module so I've posted it to GumRoad for now, but will be looking to work on a PW store front if theres any interest in it and other modules - I've got ideas for other modules such as deffered page publishing, image folder GUI, protected field, field dependencies, pages contraits. I'm also available for hire currently to work on sites or modules https://www.benbyford.com
-
This is the new topic for the Settings Factory module (formerly known as Settings Train). Repo: https://github.com/outflux3/SettingsFactory I'm not sure what versions this is compatible with, it has only been tested on 3.x branch; it is not namespaced, and i'm not sure if namespacing is necessary or a benefit for this module; if any namespace or module gurus can weigh in on this, let me know. I'm also not sure if there needs to be a minimum php version; I have one live site using this now and it's working great; But before submitting to mods directory, would be better if there was some additional testing by other users.
- 138 replies
-
- 13
-
Template Access A Process module that provides an editable overview of roles that can access each template. The module makes it quick and easy to see which templates have access control enabled (personally I like to ensure I've enabled it for every template) and to set the appropriate access per template. Usage The Template Access page under the Access menu shows access information for all non-system templates in a table. You can filter the table rows by template name if needed. Click an icon in the table to toggle its state. The changes are applied once you click the "Save" button. Sometimes icons cannot be toggled because of logical rules described below. When an icon cannot be toggled the cursor changes to "not-allowed" when the icon is hovered and if the icon is clicked an explanatory alert appears. A role must have edit access before it can be granted create access. If the guest role has view access for a template then all roles have view access for that template. https://github.com/Toutouwai/ProcessTemplateAccess https://processwire.com/modules/process-template-access/
-
module Cache Control - Clear all your caches in one place
MoritzLost posted a topic in Modules/Plugins
Process Cache Control This module provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions. The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu: Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Clear the ProCache page render cache (if your site is using ProCache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides: An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README. Plans for improvements If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind: Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions! Links https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory CHANGELOG in the repository Screenshots -
Hi all, we made a small module for sending SMS via Sms77.io. It supports sending to one and multiple users. You can download it from GitHub and follow the instructions on how to install it - it is quite easy. An API key is required for sending, get yours for free @ Sms77 and receive 0,50 €. Hope this helps somebody and we are open for improvement suggestions! Best regards André
-
I see old posts saying that repeaters are not the way to go in Custom Process Modules. If that is the case, when using forms (as I am trying to do) how would one tackle things like repeat contact fields where there can be multiple requirements for contact details with different parameters? (Like point of contact, director, etc) or even telephone numbers that have different uses? Just for background I am creating a process module that allows me to create types of financial applications in the admin area (no need to publish any of this, pure admin) that require a lot of personal or company information. Maybe I am thinking about this incorrectly?
-
So... I thought (for some stupid reason I can't even recall now no wait now I remember.. I wanted to hide the "Trash" for "editor" role users) that it'd be super duper smart to "Enable access control" for the field "process" on the admin template.... Really really stupid.... Now all I get is: – when I go to mywebsitedomain.com/admin but.... my website domain.com and all its subpages works perfectly fine! So it's ONLY the /admin (processwire) which throws a 503 at me. ??☠️??? S.O.S.
- 11 replies
-
- process
- process field
-
(and 3 more)
Tagged with:
-
Sorry for the convoluted title. I have a problem with Process modules that define a custom page using the page key through getModuleInfo (as demonstrated in this excellent tutorial by @bernhard). Those pages are created automatically when the module is installed. The problem is that the title of the page only gets set in the current language. That's not a problem if the current language (language of the superuser who is installing the module) is the default language; if it isn't, the Process page is missing a title in the default language. This has the very awkward effect that a user using the backend in the default language (or any other language) will see an empty entry in the setup menu: This screenshot comes from my Cache Control module which includes a Process page. Now I realize the description sounds obscure, but for us it's a common setup: We a multiple bilingual sites where the default language is German and the second language is English. While the clients use the CMS in German, as a developer I prefer the English interface, so whenever I install a Process module I get this problem. As a module author, is there a way to handle this situation? I guess it would be possible to use post-installation hooks or create the pages manually, but I very much prefer the declarative approach. The page title is already translatable (through the __ function), but of course at the time of installation there is no translation, and as far as I'm aware it's not possible to ship translations with a module so they are used automatically. Could this situation be handled better in the core? I would prefer if the module installation process would always set the title of the Process page in the default language, instead of the language of the current user.
-
Output pure JSON for ajax calls in process module
gebeer posted a topic in Module/Plugin Development
Hello all, I'm pretty new to Process module development and couldn't find much related to my scenario. In my custom process module I have an execute function that returns data for AJAX requests. I would like to output pure JSON. Thus I need to alter the header to be 'Content-Type: application/json' and also not render all the admin theme output. How would I achieve that from within a process module? Or do I need to take care of that on the admin theme level? I have a custom admin theme running. Thank you. -
Hi all, PW: 3.0.42 I'm trying to have responsive images in the body field. First I need to stop the image tag generated by CKEditor adding the width attribute to the image tag on insertion. I found the 'Skip width attributes on image tags?' in the settings of ProcessPageEditImage and that suggests it does exactly what I'm after. Sadly, even when this checkbox is checked and a new image is inserted the width attribute is still added. Am I missing something? TIA.
-
Hello! I'm trying to use the data I create in Processwire as much as possible. So for a form, I try to use the fields description, name and also its built-in validation rules I defined in ProcessWire on the front-end. (minlength, ranges, patterns, etc) I already looked into this tutorial, but it is using external resources to validate the form. Since ProcessWire does all the heavy lifting, when processing data, I don't have to sanitize anything - ___processInput should do the job just fine. However, it is not actually working correctly. $fields = $templates->get('user')->fields; $submission = $input->post; foreach ($submission as $key => $value) { $field = $fields->{$key}; if ($field instanceof Field) { $field = $field->getInputfield($user); $field->___processInput(new WireInputData([$key => $value])); var_dump($field->getErrors(true)); // retrieve validation error } } This works for some constraints, but the values are not correctly validated. Example: All the fields are required and zip is an integer field. Yet, I get no validation error for zip, although it was entered as a string, and not an integer. Funny enough: if I provide a number outside the range, I get "Specified value 2 removed because it is out of bounds (min=1000, max=99999)". firstname will not return any error for being a required field. From what I have looked through the source code, there is no check for "required". Some fields only validate on setAttribute. Am I missing anything or am I doomed to build my own validation process? Thank you in advance! Best, Martin
-
I've created a Process Module, and its execute() function renders the HTML response to an AJAX request. The AJAX request is being made outside of the admin panel, and in all likelihood will be made by "guest" users. Within my ModuleName.info.json file, I have added these lines: "permission": "generate-thumbnails", "permissions": { "generate-thumbnails": "Generate Thumbnails" }, Then within the Admin panel, I gave guests access to run that module. Unless logged in, the response to the AJAX request is always the login form's HTML, rather than the HTML my execute() function creates. So two questions: Is it possible to give non-logged-in users the ability to run that function via the AJAX request, or Is there a better ProcessWire way to create HTML to use as an AJAX response? Thank you!
-
Hi guys, I created a custom ProcessModule to manage children of an admin page. The children are always in hidden state and have a template assigned. I can render the page edit form by template and use ajax upload for images. After submitting the form I can see that all images are stored in the assets folder but they aren't saved in the database. All the other inputfields (text, textarea, checkbox...) were saved correctly. Could you please help me? Here is the code is use for the form: public function ___executeEdit() { $page = $this->pages->get($this->input->get->id); if($this->config->ajax && (isset($_SERVER['HTTP_X_FIELDNAME']) || count($_POST))) { $this->ajaxSave($page); return ''; } $this->headline(__('Edit')); $this->breadcrumb('../', $this->page->title); $form = $this->modules->get("InputfieldForm"); $form->attr('id', 'PageIDIndicator'); $form->attr('action', './?id='.$page->id); $form->attr('method', 'post'); $form->attr('enctype', 'multipart/form-data'); $form->attr('autocomplete', 'off'); $form->attr('data-uploading', $this->_('Are you sure? An upload is currently in progress and it may be lost if you proceed.')); // fields $inputfields = $page->getInputfields(); $form->append($inputfields); // save $field = $this->modules->get("InputfieldButton"); $field->type = 'submit'; $field->name = 'submit_save'; $field->value = $this->_("Save"); $form->add($field); // delete $field = $this->modules->get("InputfieldButton"); $field->type = 'submit'; $field->name = 'submit_delete'; $field->value = $this->_("Delete"); $form->add($field); if($this->input->post->submit_save) { $form->processInput($this->input->post); $errors = $form->getErrors(); if(count($errors)) { // show errors return $form->render(); } else { // save values foreach($page->fields as $field) { $fieldName = $field->name; $page->$fieldName = $this->input->post->$fieldName; } $page->save(); $this->session->redirect($this->page->url); } } else if($this->input->post->submit_delete) { $page->delete(); $this->session->redirect($this->page->url); return true; } else { return $form->render(); } }
-
I have a process module like so: public function execute() { $output = 'mad music archive/bulk uploadability management'; $form = $this->makeForm(); if($this->input->post->import) $output .= $this->bulkup($form); else $output .= $form->render(); return $output; } public function ___install() { $mkr = new ImportShorthand(); $p = [[ 'template' => 'admin', 'parent_id' => 2, 'name' => self::PGNAME, 'title' => '[Blaudio] Mgmt', ],[ 'process' => $this, ]]; $mkr->newPage($p); } public function ___uninstall() { $wp = wire('pages'); $pg = $wp->get('template.id=2, parent.id=2, name='.self::PGNAME); if($pg->id) $wp->delete($pg, true); } private function bulkup($form) { if($this->input->post->import) { $form->processInput($this->input->post); return; if(!$form->getErrors()) { $files = $form->get("bla_upload")->value; if(count($files)) { return count($files);/* $bulkload = $bulk_upload->first(); //$bulkload->rename("address-import.csv"); $bulkloadname = $bulkload->filename;*/ }else{ return "No files were found"; } //$this->session->redirect("../edit/?id=$list_id"); } } } private function makeForm() { So far, returning early in the bulkup() function, submitting the form with an acceptable file results in this error message: Upon reloading the page (afresh, without the submitted data; i.e., clicking its link in the nav) this error is displayed within the upload field: I'm assuming this is due to the fact that this is a process page. How do I ensure temporary storage? My goal ultimately is to insert a new page for each valid file. Thanks much in advance.
- 1 reply
-
- inputfield
- process
-
(and 1 more)
Tagged with:
-
class ImportUpdateUltimate extends Process { public static function getModuleInfo() { return array( 'title' => 'Import & Update', 'autoload' => 'template=admin', 'singular' => false, ); } public function execute() { $addnew = wire('config')->urls->admin . '/page/add/?parent_id=' . wire('page')->id . '&template_id=' . wire('templates')->get('name=importupdate')->id; $output = ' <style>th,td { padding: 2px; } tr { border: 1px solid; } th { font-weight: bold; }</style> <p>Nulla laoreet tristique tristique. Sed elementum justo a nisl elementum sit amet accumsan nisi tempor. Nulla quis eros et massa dignissim imperdiet a vitae purus.</p>'; $rows = ''; foreach(wire('page')->children('include=all') as $iu) { $runnable = '<i class="fa fa-exchange"></i>'; if($iu->is(Page::statusUnpublished)) $runnable = ''; $rows .= '<tr><td><a href="' . $iu->editUrl . '">' . $iu->title . '</a></td><td></td><td><a href="' . $iu->url . '" target="#ajaxiframe">' . $runnable . '</a></td></tr>'; } $output .= '<table><tr><th>Title</th><th>LazyCron</th><th>Run</th></tr>' . $rows . '</table>'; $output .= '<a href="' . $addnew . '">+ New Import/Updater</a>'; return $output; } public function install() { $pg = new Page(); $pg->template = "admin"; $pg->name = "importupdate"; $pg->title = "Import/Update"; $pg->save(); $pg->process = "ImportUpdateUltimate"; $admin = $this->pages->get(2); $pg->set("parent", $admin)->save(); } } That same code used to effectively assign the process module above itself as the page's process upon installing the module. Now it doesn't. How can I make it do so?
-
Hello, I am building a dynamic frontend form from fields of a page, following Soma's great gist example. The form is working fine, except for multi language values. After this part of the code $form->processInput($this->input->post) when I loop over the form fields, I don't know how to access the multi language values of a field foreach($form as $field) { // how to get multi lang values here } What I tried is not working foreach($form as $field) { if($field->type instanceof FieldtypeLanguageInterface) { foreach ($languages as $lang) { $langval = $editpage->$field->getLanguageValue($lang); $editpage->$field->setLanguageValue($lang, $langval); } } else { $editpage->set($field->name, $field->value); } } Actually the $field->type returns just "text" for a PageTitleLanguage field. var_dumping the $field reveals that the language values are stored deep inside the object like 'value1023' => string 'Testworkshop2' (length=13) 'value1032' => string 'Testworkshop2 Englisch' (length=22) So how would I access those other than pulling them directly from $this->input->post?
- 4 replies
-
- forms
- multi language
-
(and 3 more)
Tagged with:
-
I want a settings page under /Admin/Setup for admins and an interface for the CMS user under Admin/ directly. Would I have to have two ProcessModules for that, or is it somehow possible to manage that logic in only one ProcessModule? Thanks.
-
I think there is a bug in ProcessPageAdd Module. PW 2.4.0 If I try to add an Page by selecting a template with the big button on the right side in Admin 'Add New' and no parent site is given as GET Parameter like: http://example.org/admin/page/add/?template_id=37 the form will appear not complete and without submit button. EDIT: 10 min later .... Ah, its not the module its the Javascript ProcessPageAdd.js. If there is only one page in the list to select, the selection cannot be changed, and the submit button doesn't appear.
-
I have a serious problem with understanding the process field and how the process catches actions like "add" or "edit" from the url path (e.g. …languages/add/, languages/edit?id=xy) to execute the right method (executeAdd() etc.). I’m currently working on a more comfortable solution for select fields with preset options. For each select field created through setup/field/ a child page is created below having the name of the field. The child page’s template has a process field set to call a process extending ProcessPageType like it's the case with setup/languages/. Each option of the select field will be stored as an own page with title and a value field as a child of the select field page. Now I want to act the whole thing like the language admin interface. I got the list rendering working on setup/field/select_field_name/ but I get a 'Page Not Found' on calling setup/field/select_field_name/add/ as well on calling edit?id=xy. Any hints? Thanks in advance.
-
How do I go about adding the process field to a new template? I created a new template and placed it under the admin page (I also set it to use the admin template) - however, I don't see the "process" field as an option to be added to it. Thanks in advance for any pointers! Edit: To clarify, I assigned "admin" as the alternative template filename for this new template because I need to add other fields to it.