Leaderboard
Popular Content
Showing content with the highest reputation on 05/09/2015 in all areas
-
Heads up for everyone, I just now updated the “stable” German language pack for 2.6.0, which – as usual by now – means a lot of work, mostly by Manfred, (translating all the things) followed by a little work by me (including a manual merge this time ). As usual, thanks to all the contributors, especially Manfred for his relentless efforts. Everyone, enjoy and please report anything you may find wrong or worth improving, ideally in a pull request at Edit: Yeah, URL would have been good, right? Report at https://github.com/yellowled/pw-lang-de, please.3 points
-
This module creates a per-page activity log. It's not version control, but it is a history of changes made to all core field types. See the screenshots below for further explanation. It consists of 2 modules: MarkupActivityLog ProcessActivityLogService (handles ajax calls for show old/new values of textareas) More information on github Non-Superusers add an 'activity-log' permission. Thanks Nico, Netcarver, Ryan. MarkupSEO, Field Change Notifier, and FormBuilder where heavily referenced (*cough* copied) at points. Activity Log Tab Changes to textareas show in modal Module configuration2 points
-
Page Field Edit Links GitHub: https://github.com/thetuningspoon/AdminPageFieldEditLinks Direct Download: https://github.com/thetuningspoon/AdminPageFieldEditLinks/archive/master.zip This module is based on--and is the successor to--Macrura's AdminPageSelectEditLinks (https://processwire.com/talk/topic/8477-adminpageselecteditlinks-module-for-enabling-edit-links-on-multipage-selects/) Page Field Edit Links adds modal editing capability to ProcessWire's Page fields in the admin editor, allowing editors to easily view and edit the content of any page(s) that have been selected, as well as create new pages without leaving the current screen. Edit links are updated in real time when new pages are added to the field. Compatible with all available types of Inputfields including Select, SelectMultiple, Checkboxes, Radios, AsmSelect, PageListSelect, PageListSelectMultiple, and PageAutocomplete.2 points
-
Earlier this week i noticed one of our sites (tools) had the following URL while working in the manager /processwire/page/edit/?id=1257390 Then i realized there where already more then 1.2 million pages, and processwire still running smoothly like a charm. I just wanted to share it here, and that i'm realy happy with ProcessWire. Thanks go to Ryan and all contributers for creating and maintaining this wonderfull piece of software!2 points
-
Building on LostKobrakai's suggestion, you could do it like this: #1 Enable urlSegments on the home template https://processwire.com/docs/tutorials/how-to-use-url-segments/ Then, on the home template, you'll want to find the user by the provided segment: if ($input->urlSegment1) { $cleanUser = $sanitizer->pageName($input->urlSegment1); // sanitize user input $foundUser = $pages->get("parent=/users/, name=$cleanUser"); // find the requested user page if (!$foundUser->id) throw new Wire404Exception(); // throw a 404 if there isn't that user echo $foundUser->render(); // render the user page } else { // code for the homepage } The problem here is that if you have a page that is children of home with the same name as a user, that page will be called and the segment will be ignored. Make sure to check the best practices for working with url segments here: https://processwire.com/docs/tutorials/how-to-use-url-segments/page3 #2 You could still keep the products under /products/ and have a second urlSegment on the homepage. The logic would be the same as in #1. So, all together (written in the browser, don't trust the code too much): if($input->urlSegment3) throw new Wire404Exception(); // we don't care for a third segment, so throw a 404 if it exists if ($input->urlSegment1) { // first check the user $cleanUser = $sanitizer->pageName($input->urlSegment1); // sanitize input $foundUser = $pages->get("parent=/users/, name=$cleanUser"); // find the requested user page if (!$foundUser->id) throw new Wire404Exception(); // throw a 404 if there isn't that user if ($input->urlSegment2) { // check the product $cleanProduct = $sanitizer->pageName($input->urlSegment2); // sanitize input $foundProduct = $pages->get("parent=/products/, name=$cleanProduct"); // find the requested product page if (!$foundProduct->id) throw new Wire404Exception(); // throw a 404 if there isn't that Product echo $foundProduct->render(array('mobile' => $foundUser->id)); // render the user page telling the product template which user to use } else { echo $foundUser->render(); // render the user page } } else { // code for the homepage } I used render, but you can write the code directly of course. On the second render, I'm passing the user as an option so you can use it on the products template. Ryan explains options in render here https://processwire.com/talk/topic/3145-multiple-views-for-templates/?p=328762 points
-
True, it is the current visit - not what I was getting at, but it does make it rather useless for you If you add "LIMIT 1,1" at the end of the query you should get the last login. Only catch is that you won't get anything if there has only been the one login for that user, but that is actually probably what you want anyway in this case. PS I've updated my post above to include the LIMIT so others will have a working solution.2 points
-
You could just alter this to your needs. This adds a second button to the pageEdit, which then triggers an action if clicked. <?php class HookPageEdit extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hook PageEdit', 'version' => 1, 'summary' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); $this->addHookBefore('ProcessPageEdit::processInput', $this, 'addButtonsMethods'); } /** * Add a button besides "Save", which lets the user accept the application * */ public function addButtons($event) { $page = $event->object->getPage(); if($page->template == "application"){ $form = $event->return; $accept = $this->modules->get('InputfieldSubmit'); $accept->attr('id+name', 'hook_accept_application'); $accept->class .= ' ui-priority-secondary head_button_clone'; $accept->attr('value', $this->_('Accept Application')); $form->insertBefore($accept, $form->get("id")); } } /** * Triggers the pageAction of "PageActionAcceptApplication" if the page was * submitted via the added button. This won't save the page, because that only * happens if the button is named "submit_save" or "submit_published" * */ public function addButtonsMethods($event) { if($this->input->post->hook_accept_application){ $page = $event->object->getPage(); $event->replace = true; if(!$page->id){ $this->error("Invalid application to be accepted."); return; } $accept = $this->modules->get("PageActionAcceptApplication"); $accept->action($page); } } }2 points
-
Hello, I created a simple REST helper in order to create REST APIs with Processwire, without depending on external routers Here you go!. https://gist.github.com/clsource/dc7be74afcbfc5fe752c1 point
-
It seems ready for CKEditor: http://sisyphus-js.herokuapp.com/#interaction Interaction with other plugins Let's add some fanciness to our form's textareas via CKEditor // What's going on here? // Here we'll persist the form's data into localStorage on // every keystroke $( function() { $( "#ckeditor_form" ).sisyphus() } );1 point
-
@tpr, thanks, that leads me down the path to diogo's old post about Sisyphus.js, which I can integrate into my version of the default Admin template code. I do feel like Sisyphus today. But this trip up the hill, I'm learning, I'm learning...1 point
-
yes, it seems undeniable that AIOM+, which is otherwise a godsend plugin, has the possible side effect of tanking an entire website, front and backend, without warning. The cause is probably some change in the permissions, or who knows what; in my case the css minify was timing out in php, but had worked fine for a year before that. The module would seem to leave no recourse in the event that it fails and the developer has not taken steps as described above and in use by @muzzer and myself to provide an alternate way of outputting the assets. I think the module should come with instructions and warnings about these possible consequences, and that function i posted or one that does the same thing, should be part of the module so that if the user sets emergency shut off, it just lists the files in the arrays that have been passed into the class as single assets... it would also make sense for there to be a simple api for the module in the event that a site has tanked, to enable emergency shutoff; the api could also possibly allow for cache clearing, enable/disable dev mode and enable/disable html minify (this could also allow one to minify html or not on a per template basis, per horst's request..)1 point
-
Sorry to hear that There's nothing like writing in a offline editor and pasting it to the textarea for publishing. Or a browser extension like Horst said.1 point
-
Had a strange and horrific experience on Thursday when a site i was working on suddenly could no longer create the new cache files...; i made a change to 1 line of a CSS file on the live site, and then that's when things went sideways. The CSS minify script started to fail and causing PHP timeouts, and then this took the whole site down, every page, and the admin. this is the error: 2015-05-09 18:49:28 guest **site-name** Error: Maximum execution time of 60 seconds exceeded (line 87 of /home/public_html/site/modules/AllInOneMinify/lib/cssmin.php) How I fixed it (for the moment): 1.) uninstall AIOM+ 2.) Replace with new copy 3.) Re-install it, and set on dev mode, no HTML minify. this thankfully fixed the issue, but all in all the site was down for quite a while during this, and it made me realize that this part of the chain in my websites is a weak link, especially if it can fail, in that the site cannot run without the css and js files. Typically I would always have $minifyCSS and $minifyJS vars in my _init.php which in this case i could have simply set to false and then no problem, i could have gone and fixed the AIOM+ issue while the site ran. But for this site I hadn't set that up yet and also I am using conditional loading and hadn't worked out the script to load the individual assets if one of those vars is false. After looking a bit at the module, i came up with this solution for disabling AIOM+ based on a boolean var in your init: if($minifyJS == true) { echo '<script type="text/javascript" src="' . AIOM::JS($jsfiles) . '"></script>'; } else { listAssets($jsfiles); } // END IF this is the function (may not be 100% perfect, still testing, but works ok so far): // use this to echo the assets in the AOIM+ array function listAssets($asset_files) { $templates = wire('config')->urls->templates; $current_page = wire('page'); // testing //$current_page = wire('pages')->get(1023); foreach ($asset_files as $asset_file) { if ( is_array($asset_file) AND isset($asset_file['loadOn']) AND isset($asset_file['files']) ) { $selector = $asset_file['loadOn']; if(!$current_page->is($selector)) continue; if(is_array($asset_file['files'])) { foreach ($asset_file['files'] as $_asset_file) { echo "<script src='{$templates}{$_asset_file}'></script>\n"; } } else { echo "<script src='{$templates}{$asset_file}'></script>\n"; } } else { echo "<script src='{$templates}{$asset_file}'></script>\n"; } } } In summary, i think that maybe there should be an emergency shut off in AIOM+, because without the method described above, how would you keep a site online say if AIOM+ was just totally failing?1 point
-
Try using this instead of "fua_fe_item_antwort.name=fua-form-slider" fua_fe_item_antwort=1023 Seems to work here but don't ask me why (trial and error)1 point
-
Played with your siteprofile but I couldn't spot anything. I can confirm that the issue exists. If I remove the ShowOnlyIf condition then the min-max-step values are saved properly. Putting back ShowOnlyIf and re-saving the page doesn't remove previous min-max-step values, so it seems that saving the page completely ignores these fields. POST parameters contains all the values though.1 point
-
Hi, everyone started somewhere. It's really easy once you have done it a few times. Check out this legendary post. Or use FormBuilder.1 point
-
The CMS of the future!! http://www.algoritma.it/blog/processwire-il-cms-del-futuro/ Thanks to @enricob A Softaculous installation tutorial video:1 point
-
Nice, although I would suggest using PDO - I know teppo's module doesn't use it yet, but I am sure he will update sometime soon. Try this: $query = $database->prepare("SELECT login_timestamp FROM process_login_history WHERE user_id = :userid AND login_was_successful=1 ORDER BY login_timestamp DESC LIMIT 1,1"); $query->execute(array(':userid' => $user->id)); $lastvisit = $query->fetchColumn(); echo $lastvisit; Note that I also went with the user id - always better to look up an integer than a text field. PS - Just remember (and I know I already said it above), but this really isn't the "last visit" - you can go forever without needing to login if you visit a site regularly before the session has expired.1 point
-
thanks. Included in the repo: https://processwire.com/talk/topic/925-german-de-de/page-8#entry917181 point
-
Crosslink for translated Blog module and ScheduledPages module... https://processwire.com/talk/topic/7403-module-blog/page-22#entry94588 best regards mr-fan1 point
-
CPU GenuineIntel, Intel® Xeon®CPU L5506 @ 2.13GHz OS CentOS Linux 7.1.1503 (Core) Memory 16GB Disk 120GB SSD RIAD1 Its running Parallels Plesk v12.0.18_build1200140811.16 os_CentOS 7 with ngix caching turned on1 point
-
In the specific case of the checkbox to send the email I think the best is to add a note instructing people to save the page. Something like "send email after saving this page. Don't forget to save the page or the email will not be sent". A quick hack would be to use Admin custom files module to add some JS magic (read "hack") to do this instantly. You could for instance capture the change event on the checkbox to trigger the save button: $(".checkbox").change(function() { if(this.checked) { $(".save-button").trigger("click"); } }); ...or even replace the checkbox by a copy of the save button and change the text to "send email". The possibilities are infinite. -- PS: notice my first sentence. I still would prefer the simple informative solution.1 point
-
I've encountered an interesting problem when using AIOM recently - but also have a potential fix, so it's not all bad. Here's the information! I am using separate IE and non-IE stylesheets, with each loaded via conditional comments in the markup. There are two arrays for the files: $config->css->all = array( 'css/pure-min.css', 'css/grids-responsive-min.css', 'css/fa/css/font-awesome.min.css', 'css/cds-all.css', ); $config->css->oldie = array( 'css/pure-min.css', 'css/grids-responsive-old-ie-min.css', 'css/fa/css/font-awesome.min.css', 'css/cds-oldie.css', ); These get minified in the template: <!--[if lte IE 8]> <link rel="stylesheet" type="text/css" href="<?php echo AIOM::CSS($config->css->oldie); ?>"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--> <link rel="stylesheet" type="text/css" href="<?php echo AIOM::CSS($config->css->all); ?>"> <!--<![endif]-->That is all great. The problem arises when the source files all have the same modification time - which it does on the live environment of this website, and when using an automated deployment service.Because each list of files has the same number of files, and the files have the same modification time, the generated cache name is always the same, and one overwrites the other. My fix was to include the file's paths when generating the cache name in _getCacheName: foreach ($files as $file) { $_timestamp .= $file['absolute_path'] . $file['last_modified']; } I'm more than happy to create a pull request on GitHub for this, but thought it'd be worth mentioning/discussing first1 point
-
Well basically when you follow the RESTful approach when creating systems, you use resources rather than actions. you can know more here http://restcookbook.com/ http://restpatterns.org/ http://www.restapitutorial.com/ and this books https://leanpub.com/build-apis-you-wont-hate http://www.soa-in-practice.com/ Example if you want to make an admin for the users resource. you can have this URL http://api.example.com/users In the traditional CRUD aproach, the verb is inside the URL like http://api.example.com/users/create but in REST you must use only HTTP Verbs to interact, so the same endpoint url makes different actions depending on the verb used to call it. In our system that could be http://api.example.com/users GET - result in a list of users POST - creates a new user ------------------------------------- http://api.example.com/users/clsource GET - result in the user data PUT - updates the all the data of a specific user PATCH - updates a specific data field of a specific user DELETE - deletes the user Using the HTTP response codes and mime types you can notify the result of an operation, usually with a JSON or XML body for information. The Web services Approach, specially REST web services, enables us to separate complex systems in smaller ones, easier to mantain and test. Basically you can have multiple backend systems that just are APIs and one frontend system that glue them all. this add a layer of security and robustness, because you can separate your systems in different servers. A possible attack can not affect all the system, just small parts of it.1 point
-
slightly ot but whenever i get a chance i like to hotlink this xkcd classic1 point
-
Maybe someone coud write a "soft save" module which creates a second save button that does ajax saving1 point