Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/02/2019 in all areas

  1. Here's a basic example of how you could save files to a PW page via a front-end page using tus-php and Uppy. 1. Install tus-php via Composer. 2. Create a PW template that will provide the tus-php server endpoint - in this example the template is named "uppy". In the template Files tab, disable any automatically appended template file. In the template URLs tab, allow URL segments. If using Tracy Debugger, disable the debug bar in the front-end for this template because we don't want any output from Tracy being included in the response. The contents of the uppy.php template file: <?php namespace ProcessWire; // Create PW temp directory $td = $files->tempDir('uppy'); $td_path = (string) $td; // Create TusPhp server $server = new \TusPhp\Tus\Server(); // Set path to endpoint - no trailing slash here $server->setApiPath('/uppy'); // Set upload directory $server->setUploadDir($td_path); // Listener function for when an upload is completed $server->event()->addListener('tus-server.upload.complete', function(\TusPhp\Events\TusEvent $event) { // Get path of uploaded file $file_path = $event->getFile()->getFilePath(); // Add uploaded file to "files" field on Home page $p = wire('pages')->get(1); $p->of(false); $p->files->add($file_path); $p->save('files'); }); // Send response $response = $server->serve(); $response->send(); // Exit from current PHP process // Could probably use PW halt here as an alternative // return $this->halt(); exit(0); 3. Create a page using the template - in this example the page is at url http://1testing.oo/uppy/ 4. Add the Uppy assets, JS and markup to the template of the front-end page that you will upload files from. Markup Regions are used in this example. <pw-region id="scripts"> <script src="https://transloadit.edgly.net/releases/uppy/v1.4.0/uppy.min.js"></script> <script> const uppy = Uppy.Core({debug: true, autoProceed: false}) .use(Uppy.Dashboard, {target: '#uppy-box', inline: true}) .use(Uppy.Tus, {endpoint: 'http://1testing.oo/uppy/', limit:10}); </script> </pw-region><!--#scripts--> <pw-region id="stylesheets"> <link href="https://transloadit.edgly.net/releases/uppy/v1.4.0/uppy.min.css" rel="stylesheet"> </pw-region><!--#stylesheets--> <div id="body"> <div id="uppy-box"></div> </div><!--#body--> 5. Upload files via the front-end and see that they are added to the "files" field on the Home page.
    4 points
  2. @Robin S - brilliant! Your code works like a charm on my site after adjusting a bit of my own code to suit. Can't thank you enough ?
    3 points
  3. There are some modules that have their own configurations/settings that are displayed on this page, which are applied using this submit button.
    3 points
  4. I forgot to mention that you must enable URL segments on the uppy template. I've updated my previous post to include this step. Although I'm not sure why you would get a 403 because of that - rather you should get a 404.
    3 points
  5. In addition to it, there are modules with no config but some sort of "action" which can optionally be applied, like in the case of the core Page Reference module. Either way, there should be a cog icon next to module names like these, which are the "Configurable Modules". You can list them by clicking on the Configure tab. Note that in the case of updating configureable modules it is a good idea to perform a module refresh first then click the submit button so that possible configuration changes are applied. Non-configurable modules are the ones you ask about. No, it doesn't. It's just a bit of a neglected UX design that the submit button is there to click even though the only option – which is the Uninstall checkbox – is not selected.
    2 points
  6. --- Please use RockFinder3 ---
    1 point
  7. What is the Submit button for after installing a Module. I am not entirely sure, if the Green Submit Button is part of the installation process, or only there as part of the uninstall process. IF it is part of the uninstall process, it might be better served to be contained in the Uninstall Div that pops open, when you check the Uninstall Checkbox Does it have anything to do with finalizing the Installation process of the module? Thanks.
    1 point
  8. @flydev In my version, BasicAuth is the preferred way to request a jwt-token. After that, you have to add the token to each request.
    1 point
  9. This part is optional - it's exists in case you want your server endpoint to be something pretty like http://yourdomain.com/files/ But if it's causing you a problem you can leave out the tus-php .htaccess and set your endpoint to http://yourdomain.com/server.php or whatever with no rewrite needed.
    1 point
  10. You can simplify that a bit to this... $classname = $event->arguments[0]; if($classname !== $this->className) return; // Only continue if settings of this module are being saved.
    1 point
  11. Ryan's ProcessExportProfile module includes ready.php in the exported files. Based on your other comment, I think there may have been an error during the export process because I frequently install profiles exported by this module without any problems.
    1 point
  12. You are right. I've tested a lot of solutions in last few hours. It seems to be the fastest, most user-friendly and most flexible way to get it done without any third-party module or core manipulation.
    1 point
  13. Normally I create more than that under home anyway, such as custom assets, tags, categories, etc... Normally I create a page under home called something like "Internal" – and move it to be the last one – to signal that pages under that do not directly map to public pages, and I explain it to the client. As it is a simple concept, even the less technically minded had no issues understanding it so far.
    1 point
  14. SearchEngine 0.10.0 was just released. Not a whole lot of stuff in this release – basically just one new feature, one minor addition to the default theme CSS, and some PHPDoc improvements. ### Added - New Renderer::___renderResultsJSON() method for rendering search results as a JSON string. - Additional CSS rules to make sure that visited links appear correctly in the default output. While building an AJAX suggest search feature it occurred to me that it would be nice if SearchEngine could return search results as JSON out of the box. Newly added renderResultsJSON() method provides this capability, and new settings results_json_fields and results_json_options allow customising what gets returned, and how. More details (and an example of using this feature) in the README: https://github.com/teppokoivula/SearchEngine#json-output.
    1 point
  15. Well, feel free to write your own module then. It ain't so hard, really.
    1 point
  16. https://processwire.com/talk/topic/14112-general-site-settings-module/ https://processwire.com/talk/topic/17536-settings-factory/ https://modules.processwire.com/modules/textformatter-multi-value/ https://processwire.com/store/pro-fields/textareas/
    1 point
  17. I have started to familiarize myself with the codebase and later on I will take a closer look at all the issues mentioned here and at GitHub. I am not planning to update nor fork the module in any way though, I am thinking of refactoring it completely, and in the end release it under a new name. The first version of this "new" module should be "compatible" with MarkupActivityLog, meaing it is going to rely on the very same database table in the very same manner. However, this first version should tackle the most important issues and it will be PW 3+ and PHP 7.1+ only. Also, being refactored, it is going to use more up-to-date PW features under the hood. In short, I will be working on a successor module to MarkupActivityLog. Note: there is no time-frame for this project at the moment ?
    1 point
  18. After a quick look into some projects I took more care about files: assets (/site/templates/assets) brand brand-company-logo.ext brand-company-og-image.ext favicon.ico (just a backup - the .ico always sits in the document root) favicon.png ... fonts plex proxima icons* (icons often end in my .css files - a ProCache option, therefore names don't matter here) whatever-123123.svg the-file-912321.svg was-named-or-4572.svg helps-me-to.svg find-the-icon.svg i-need.svg vendor jquery jquery-3.x.x.js slick z (storing things I don't need anymore without deleting them - just in case) * icons are in 99% of all cases just decoration elements so I use them very often as backgrounds and not as images. Every image that's not content on its own or part of the content will not end in an <img .../> tag. In case of gallery arrows I try to use text links/span-elements and re-style them with CSS. The icon itself will be in my CSS most of the time.
    1 point
  19. Good morning! AdminBar 2.3.0 was just released. Here's the changelog for this version: ## [2.3.0] - 2019-08-29 ### Added - Gravatar image support for the "user" item in Admin Bar. - Support for sorting Admin Bar items manually with the AsmSelect field in module config. - A changelog file. ### Changed - Protect logout link from accidental clicks (script or otherwise) by converting simple link to a logout form. - When modal window is opened, hide children and view tabs with CSS first in order to prevent flashing content. Due to the manual sorting feature mentioned above there was a change in the data structure, so note that if you're already running AdminBar and have modified the visible items in the bar, you'll need to reconfigure those. This was the easiest way I could figure out to achieve free sorting feature: Minor note: currently it's possible to add the same item to both left and right columns. I didn't see a reason to specifically prevent this, so it's kind of a feature – though not sure if that's something you should ever do from a UI/UX perspective ?
    1 point
  20. $page->template->altFilename; $page->template->filename;
    1 point
  21. @bernhard Making it hookable should be fine. But I'd like to better understand what you mean about it not working in the admin, and the url and filename methods never getting called? Are you using the core files/images field? Those methods/properties are the ones used for anything asking for the filename or url of a file, whether on the front-end or in the admin. For me at least, it works the same in the admin/page editor as it does on the front-end, just tested again to confirm—editing a page downloads the images, and they appear in the images field in the page editor. So I'm not sure I understand what you mean? Also, hooking setFilename() would make it less on-demand, as it would download any images in the field rather than only those that were specifically requested. Can you think of anything different about your environment that might account for it not working?
    1 point
×
×
  • Create New...