Leaderboard
Popular Content
Showing content with the highest reputation on 07/17/2014 in all areas
-
Hi folks, I have refactored the module and a new version is available on the dev branch here: https://github.com/wanze/Pages2Pdf/tree/dev The module now uses mpdf in the background which has superior HTML/CSS support compared to TCPDF, but the library is slightly heavier. What's new? Creating PDFs is handled by a separate module "WirePDF". This module is just a wrapper around mpdf and you could also use it independently from Pages2Pdf as a Service to create/save/download PDF files from ProcessWire templates All the configuration options related to configure mpdf (margins, document orientation...) are now defined in the module WirePDF Some new config options in module pages2pdf. You can configure the PDF filename and the GET variable that is used when requesting a download You can download a PDF from any page The default templates have changed, with mpdf you now can use a separate stylesheet to separate CSS from HTML markup Triggering the creation/download of a PDF file is handled earlier: After the ProcessWire API is ready but before page rendering is initialized. This should improve the performance. Calling the render() method is technically no longer required, but it can still be used to output the download link. However, you could write the link by yourself if you prefer. If you'd like to test out the new version and upgrade the module: Please note down all the current settings Uninstall pages2pdf module, then replace it with the current one Install the new version Maybe add your previous settings in the WirePDF module. Some settings are no longer supported or have changed slightly If you created manual links to triggering the download in your templates, e.g. added ?pdf=1, you should change the GET variable in the module configs from 'pages2pdf' to 'pdf' Take a look at the default_templates in /site/modules/Pages2Pdf. With mpdf, it's better to separate CSS from HTML, so you can create a "styles.css" in /site/modules/templates/pages2pdf/ and define all CSS styles there. The styles are then availalble in your templates. I hope that's the most important stuff. I'm short in time today (going to a festival), so I can't support Cheers8 points
-
Thanks Ryan. Re your suggestions: (I've made some changes to the code) The data.sql file is already protected from web access by the default PW .htaccess file, and I've added a .htaccess file in the module directory to prevent access to the backup tarball. I've changed the shouldBackup check to be more specific (behaves the same as your suggestion, but simpler logic). I don't know what the issues around conditional autoloading in PW 2.4 are, so I'll leave that for now (?). I'll put IP whitelisting on the todo list, but I don't think it's essential right now, since it's unlikely anybody would be able to guess the secret token in the URL. The `wget` command for the cron job is displayed on the module config page (prefilled with URL). Would it be better to have the cron job run a PHP file directly rather than going through the web server? Not sure. I've added a little mention of the requirements in the readme. I've also adjusted the install method to check it can run tar and mysqldump. I'll submit it to the module directory shortly7 points
-
Hi everyone! It's been a little bit of time since the update - the last month was very busy, but we are on the track and planning to release the first public beta version of PassiveCron / cron.pw in the next week. Like the previous previews, I want to share with you two additional features of cron.pw. 1) Dashboard Just like minimize.pw, cron.pw comes with a Dashboard, on which you can control every background task and upgrade your plan. It looks a lot like minimize, although it's blue this time ;-) 2) Task Reports cron.pw lets you take a look at the history of every module's tasks and their executions. This allows you to check out - if necessary - if a certain task has been executed correctly. ... and to enhance your development abilities, cron.pw lets you also inspect every task in detail, including transmitted request parameters and response output. Thank you in advance for your feedback!4 points
-
Hi there, in need for a light knowledge base software and not happy with solutions such as MediaWiki, Dokuwiki or Confluence I decided to try to build such a tool based on ProcessWire. At the moment this profile is lacking of features, but doing well in the context it is created for - a somewhat protected simple knowledge base for internal use. It has some basic features but I'm aware that there's still way to go. So if anyone is interested, please find the code attached here or on GitHub: https://github.com/marcus-herrmann/ProcessWire-KnowledgeBase-SiteProfile I exported the data from a PW 2.4 installation, but not have tested it yet against older versions. Installation Before running the installer of ProcessWire copy/replace /site-default/install/ /site-default/templates/ /site-default/modules/ with the folders from this zip. Constraints It's not possible to export user roles with ProcessWire's Site Export Module this profiles templates are checking just whether they are accessed by an anonymous or logged in user. Features Tagging of wiki-articles Set articles to globally sticky ( = for all users) Personal bookmarking of articles for logged in users When using markdown to author wiki-articles, code highlighting via highlightjs Included modules Fredi MarkupSimpleNavigation Hopefully this profile is useful for you in any way. Best, marcus Edit: Forgot GitHub link... ProcessWire-KnowledgeBase-SiteProfile-master.zip2 points
-
Yep it does. If not installed, calling the MarkupCache like below will install it and function. $cache = $this->modules->get("MarkupCache"); // See the $this-> call if(!$data = $cache->get("something")) { $data = "test me"; $cache->save($data); } return $data; // contains "test me"2 points
-
You are right–I'd forgotten we had that in the htaccess. Yes, I'd leave it for now. I just wanted to point them out because I think these will be beneficial for this module once 2.5 is stable. I agree, you don't need it for now. My default is always to double up on security, but thinking through it more it's probably not necessary here. I mention it as a possible future addition though just because the URLs hitting a website aren't always confidential. The token is only as private as the logs. For most of us, that's a non issue. For some it's a potential ddos entry point, but only if the token gets in the wrong hands. I think what you've got is just right for the majority, and if someone needed something more, like an IP limiter, then probably better to leave it to them to add in rather than making everyone else fuss with it. Sorry, I missed that wget was already there. There may be some benefits to having the cron job run the PHP File directly, but it would be more difficult for the user to setup (creating executable PHP shell scripts and such). Also, having initialization of the job URL accessible makes it easier for people to use external CRON services. As a result, I think sticking to the method you are using is better. Thanks for adding to the modules directory!2 points
-
But Ivan is right - I could really publish it there: http://modules.processwire.com/categories/site-profile/ Will do it, but with a big "This! Is! Alpha!" warning sign The very rudimentary state actually kept me from putting it there until now. But thanks for the feedback2 points
-
Hello I've written a little module that backs up your ProcessWire site to Amazon S3 (might add support for other storage providers later, hence the generic name). Pete's ScheduleBackups was used as a starting point but has been overhauled somewhat. Still, it's far from perfect at the moment, but I guess you might find it useful. Essentially, you set up a cron job to load a page every day, and then the script creates a .tar.gz containing all of the site files and a dump of the database, then uploads it to an S3 bucket. Currently, only linux-based hosts are supported currently (hopefully, most of you). The module is available on github: https://github.com/DavidJRobertson/ProcessWire-ScheduleCloudBackups Zip download: https://github.com/DavidJRobertson/ProcessWire-ScheduleCloudBackups/archive/master.zip Let me know what you think EDIT: now available on the module directory @ http://modules.processwire.com/modules/schedule-cloud-backups1 point
-
1 point
-
Hi i just finished website that i build on processwire. Im a frontend developer and noob with php. But with processwire i managed to build this site, so i want to thank you for giving us such a great tool for building websites. Here is website in Polish, and in a month or so i will release english version of the site. http://hejtuje.com english version will be avaible in here : http://hate.it Some feedback would be nice . Thanks PW!.1 point
-
hi teppo - many thanks, will update the module soon - for now i gave that user superadmin to get through the project, and this issue wasn't happening on all pages, just certain ones; i will update module, reset the role and report back asap...1 point
-
@Macrura: I've just pushed 1.0.4 to GitHub. This version drops saveReady hook in favour of ___processInput() method. This actually eliminates the need to throw any exceptions, as the module can simply use current value and continue saving the page. Hope this helps -- and hope it doesn't cause any additional issues either. I've tested it in my own environment and everything seems to work just fine, but please let me know if anything goes wrong!1 point
-
Of course! Just have a look at how the admin works: .../processwire/page/edit/?id=1031 In that particular case, the query is handled by the ProcessPageEdit module with the following line: else if(isset($_GET['id'])) $this->id = (int) $_GET['id'];1 point
-
Ok, here is my forked version that lets you choose the images and body fields for each email category: https://github.com/adrianbj/ProcessEmailToPage Please let me know how it goes for you.1 point
-
Hey! Currently, my menubar gets all the pages and lists them (almost the same way it was by default). When I hide the page in my settings, it really messes up my non-hardcoded menubar. To hide the 'first' page in the children pages list, I just hid the first entry, since by default, it is the first one and shouldn't really screw things up. ... As I was writing this, I could also make a check that would compare the child page names against the parents name and hide if true. Great support on this forum, thanks a lot! Glad I found ProcessWire. I previously tried WordPress (didn't really match my requirements theming-wise and was too cluttered with stuff my page would never use). I also tried ForkCMS (also didn't have the flexibility of ProcessWire).1 point
-
Looks like you have no body field? You can set the default search fields in the admin search module settings. Modules -> Core -> Page Search1 point
-
I implemented a similar thing a while ago and ended up with the code below. I think it was pieced together base on some previous code we had lying around at the company, and I'm not sure why the distance value is so precise at 8.047. It's not a perfect circular distance either, but it seems to work for what was needed at the time. // $lat and $lng should be float values of the location to search $distance = 8.047; //in km $radius = 6371; // earth's radius in km = ~6371 // latitude boundaries $maxlat = $lat + rad2deg($distance / $radius); $minlat = $lat - rad2deg($distance / $radius); // longitude boundaries (longitude gets smaller when latitude increases) $maxlng = $lng + rad2deg($distance / $radius / cos(deg2rad($lat))); $minlng = $lng - rad2deg($distance / $radius / cos(deg2rad($lat))); $query = "coords.lat>=$minlat, coords.lat<=$maxlat, coords.lng>=$minlng, coords.lng<=$maxlng"; In that code, 'coords' is the mapmarker field.1 point
-
Here you go Macrura https://processwire.com/talk/topic/7025-how-to-create-pdfs-with-pw-and-mpdf/ Any tips are highly appreciated1 point
-
1 point
-
This looks fantastic djr! I've had a need for something exactly like this and will definitely look forward to using it. I took a quick look through the code and think it looks very well put together. I do have a few minor suggestions: Rather than backing up the DB to the root path (where it is temporarily web accessible) I'd recommend backing it up to a non web accessible directory, like /site/assets/cache/. Likewise for the tar/gz file. Beyond just looking for "runbackup" in the request URI, I recommend designating a page that it will only run on. For instance, if you wanted it to only run on the homepage: $shouldBackup = $page->path === '/' && (strpos($_SERVER['REQUEST_URI'], self::RUN_BACKUP_PATH) !== FALSE) && $this->wire('input')->get->token && $this->wire('input')->get->token === $this->token; This might be a good module to experiment with conditional autoloads. In your getModuleInfo, you can do this: 'autoload' => function() { return (strpos($_SERVER['REQUEST_URI'], self::RUN_BACKUP_PATH) !== FALSE); } In truth, conditional autoloads are more reliable in PW 2.5 (a few minor issues have been fixed) so this may be a v2 kind of thing as well. In PW 2.5, you can also isolate the entire getModuleInfo() to a separate ModuleName.info.php file. Beyond just the token, it might be worthwhile to have an IP address limiter since there's a good chance one's CRON job is always going to be coming from the same IP. Though not sure it's totally necessary. In your docs file, I would mention if possible what command you recommend for the CRON job, for instance: wget quiet no-cache -O - http://www.your-site.com/runbackup?token=abc123 > /dev/null Lastly, might be good to mention that it requires exec/system access for executing commands (many hosts have these disabled by default, but there's usually a way to enable them). Please add to the modules directory when ready! Thanks for putting this together!1 point
-
@benbyf it worked for me, but I had to change the field in the settings everytime I changed any setting. once set it works. By the way I just changed to mpdf without any module and it's working really great really easy to set up file caching is the only thing missing at the moment. but that shouldn't be too hard, maybe I'll can dig into pages2pdf and "copy" this part or something1 point
-
may have found a bug: the module settings doesnt seem to allow L instead of P for the orientation, I ended up changing the module defaults to do it - all other fields seem to validate fine.1 point
-
1 point
-
Or do you mean on the same server? In which case: https://processwire.com/api/include/1 point
-
1 point
-
I'll set this option on my To-Do. After my vacation.1 point
-
Ok, I have just added support for images that are embedded into the text within an email. These images are now added to the page's images field and then embedded into the body RTE field, just as they appeared in the email. Minimal testing so far, but seems to work great even with multiple images. Would appreciate some testing of the attached version before I submit to Pete. My forked version ProcessEmailToPage.zip1 point
-
Something like that would be fine. If i understand correctly you want clients who create a page to be able to choose some predefined options for the way the content is displayed on the front-end. I think you envision about the same but anyway: Create a template called 'layouts'. This is only a container so only the title field needed and no template file. Create a template called 'layout'. This is only for other pages to reference, so only the title field needed and no template file. Create a page with template 'layouts'. Title can be anything, but layouts would probably make sense. Create children pages with template 'layout' for each layout you want. Fill in some descriptive titles: 2 Columns, 3 Columns, 5 Columns Add a page reference field to each template you'd like to add layout choices to. The parent setting to 'layouts'. Call the field 'layout' or whatever works for the clients. Now everytime a user who creates a page based on a template that has the page reference field, they can select wich layout they want. On the corresponding templates files you can use $page->layout to choose the file to include. About template vs template file: We've had discussions about this before but i must say i think that once you've taken a couple of moments to work with the system it's really quite obvious how the pieces fit together and what they do, or can do in PW.1 point
-
That's a tough question to answer, because usually we're trying to prevent this sort of thing from a security standpoint. So I think that the solution will involve creating your own template to perform the login. Something like this: <?php if($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); if($session->login($username, $input->post->pass)) { $session->redirect('/path/to/page/'); } else echo "Login failed"; } Then have your OpenCart page POST the 'user' and 'pass' to the page using that template, when they click a "go to ProcessWire" button, or something like that.1 point