Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/30/2014 in all areas

  1. Interesting https://github.com/raphaelbastide/ofont http://usemodify.com/
    7 points
  2. Thanks for pointing me to these options. I use these already and tried many other kinds of similar services. But none of them are like the real thing. I also like http://www.responsinator.com/. The name is just too cool. Especially when it comes to iOS-Safari specific bugs, Chrome device emulation doesn't reproduce them, like this one. When using device detection scripts, Chrome emulator doesn't return the correct user agent strings, see for example here I do test things with Chrome Dev tools but always on the real device, too. This seems the only way to make sure it is really looking as expected. Too bad, there is no real emulation for iPAd/iPhone available on Linux/Windows. Cheers Gerhard
    2 points
  3. You can easily simulate an ipad with Respondr: http://respondr.webhoard.net/# Or use Chrome Dev Tools (see screenshot).
    2 points
  4. Values for page type fields that store multiple values are PageArrays. Since PageArray extends WireArray, you can use it's methods here -- such as removeAll(). Running $page->countries->removeAll() before adding new items should do the trick. It'll clear the PageArray and you can start from clean slate, so to speak. You should also take a look at other WireArray and PageArray methods, as those provide some nice ways to manage stored items etc.
    2 points
  5. Sorry to dive in late. Diogo's code would be equalent to: if($page->url == $page->url) throw .... Just looks cooler, but however I would simply not create the php template for those pages and create a separate template file. If your template would be "subpage", create a partial-subpage.php And render the subpages on home with echo $subpage->render("partial-subpage.php"); And since you don't have a subpage.php those won't be viewable anyway. Redirect: What you also could do is have the subpage.php redirect to the home with a hash /#yoo appended, so you could scroll to the panel and also use that url for indexing. $session->redirect("/#" . $page->name);
    2 points
  6. Hi, After reading this thread, I decided to make a module that helps generating PDF files of ProcessWire pages. GitHub: https://github.com/wanze/Pages2Pdf Modules Directory: http://modules.processwire.com/modules/pages2-pdf/ This module uses the mPDF library to generate the PDF files. It has fully UTF-8 and basic HTML/CSS support for rendering the PDF files. The output is customizable with ProcessWire templates. Example I've enabled generating PDF files for the skyscraper template of ryans Skyscrapers-profile with a template that outputs the data in a table along with the body text and the images: one-atlantic-center-pdf-4177.pdf Please take a look at the README on GitHub for instructions and further information/examples. Cheers
    1 point
  7. Hello, it's possible to access at response of login throttle module to show messages on custom login form?
    1 point
  8. You will get better answers but here are some examples...All these assume these code is being called in another page other than the one you are after...(pages..) $city = $pages->get("template=city, title=Doha");//get one specific city $cities = $pages->get("template=cities, title=Cities")->children("limit=10");//get 10 of all cities $cities = $pages->get("/path/to/cities/page/")->children("limit=10");//get 10 of all cities If you are able to follow, have a look at the code in the Blog Profile (maybe even the Skyscrapers profile)
    1 point
  9. @Jeff, No worries. ProcessWire has the API to create the markup that you see in modules or the admin (e.g. buttons, collapsible panels etc.) Whilst you can use some of these in the frontend as well, it is probably an overkill to recreate the delete button for your frontend needs using PW API. You don't need anything fancy; just create a normal button using HTML (either <input type="submit"> or <button></button>. The important things here are the name and value of the button, maybe an ID as well. This is normal HTML stuff. You can then style it (copy the PW CSS basically) to fit in with the rest of the PW page edit style...If you need more info let us know . When a HTML button is pressed (within a form), it will send it's name (e.g. name="delete") and the names and values of other relevant input types within than form, e.g. text fields, etc. In this case, since you want to delete the page, you are not interested in all that other information. What you want is the ID of the page that you want to delete. When requesting the page to be edited in the frontend (I don't know how you are doing it, Fredi? Custom form?). The id of that page is stored somewhere. Either in the URL...e.g. my-cool-page?id=2345 or it is stored probably in some hidden field. What you want is that ID. Use Dev tools in Chrome or similar to study how the delete button is structured. There is no magic really but I appreciate this might be difficult for a beginner. The other issue you will find if you read up on the subject of forms is whether values are sent via get or post. Using PW $input->get or $input->post covers both scenarios respectively. http://processwire.com/api/variables/input/ If using get to store the ID, the id is the id=2345 in my example above. $input->get->id will get you the 2345... Sorry, I realise I might have confused rather than informed but hope this helps Edited for mistake: the value of the page being edited is not the value of the submit button ...
    1 point
  10. The clue is in the array keys - see how there are lots of the same numbers? Your $days = array(); is inside the $programm loop so it is getting reset each time. Also you are outputting the results inside the $programm loop. Try this. Untested, but I think it should be right. $programm = $pages->find("template=event"); //find all pages with events $days = array(); // array for dates - defined once at the start foreach ($programm as $p) { $events = $p->time_loc; //find the repeater fields foreach ($events as $event) { $days[]= date("l, d. M Y",$event->getUnformatted("date")); //fill the dates array with the dates from the repeater } } //close programm loop $day = array_unique($days); // eliminate duplicate dates asort($day); foreach($day as $key => $d) { echo "<p>$key = $d</p>"; }
    1 point
  11. Friendly advice Jeff...posting the same question in different boards won't give you quicker answers ...One version should be enough .... Back to your question, see my suggestions in your other post. I also think that at this point your are not asking the more important question. Whilst the issue of whether to use a button or a input checkbox is a valid one, that's not the pressing question. Whichever way you want to signal the users intent (programmatically), at the end of the day, it's just an input in a form sent via a post. The more important questions are how do I safely capture what has been sent by the user (whether it's a button press, or a checkbox, etc.) and what do I do with that input? The answers to these questions are all here in the forums (IIRC, I have pointed you to some of them ). Check out $input and $sanitizer in the API docs and forums. I'd also suggest that you Google and thoroughly read about 'capturing, validating and processing form input php'. It will help you immensely rather than copy pasting code ....As to how best to signal the users intent? I would probably use a button clearly labelled delete this page! Oh, I forgot in the other post, how do you know what page the user wants to delete? At the very minimum, you must capture the ID of the page being edited....
    1 point
  12. Well it resizes exactly for iPad. Which is one of many possible resolutions. And above 1024 until 1280 I get an ugly horizontal scrollbar. Can't see a reason why to build it that way. If the iPad (and only in landscape format) is your only concern, better stick with a zoomable version instead of breaking it for all other devices. No offense, just want to point to possible problems.
    1 point
  13. That unused space isn't there for me most of time cause I use image field often on a column 30-40%.
    1 point
  14. Couldn't resist to give my tow cents too...
    1 point
  15. SALE ITEM Custom "welcome jingle" to go with your new processwire site - guaranteed to make your visitors toes curl!
    1 point
  16. Hey Ryan, Excellent idea! How about an item called "Good Karma" with an open price? Thanks, Matthew
    1 point
  17. small update: added separate inputfield for HTML signature into config page to solve an issue found by tuomassalo. https://github.com/horst-n/WireMailSmtp/issues/1 version now is 0.1.8
    1 point
  18. Hi. I have been working on a simple mailchimp integration module. It is probably pretty bad written as I don't fully know my way around the processmanager module creation process yet. Anyway this is basically what you need to do. Create a mailChimp account (free), get the API keys for your account. Add the API key to the config.inc.php file. Create a mail friendly template: Inline CSS with supported CSS tags so dont use floats or position for instance. Create a "root" page where you Newsletter will reside under. This case root is called "newsletter" want another name just change in the module. (Line 27) Install the module. Some screenshots: This is the admin section where Lists is being fetched from mailchimp and newsletters is being fetched from under the root page you set up earlier. Click send and your mail is on the way. Result page. So what have happened now, you have created and sent a new email campaign through mailchimp. For detailed reports regarding delivery status you need to log on to mailchimp. For subscription you can build your own form or use some of the one provided by mailchimp, if you want to skip the "verify subscription" mail you need to create your own subscribe form see example attached. ProcessMailChimp.zip subscribe.php I am not saying that this is a 100% completed module but it cover my needs and I have seen some questions regarding this kind of functionality roaming the forum.
    1 point
  19. Heh, now we got 3 mailchimp modules separately that do work differently. I'm holding mine back as it is a lot more complicated to create a good mailchimp module with remote managing lists and campaigns. Lists can't be created via API, reason being that you should work with segments and groups for a list instead of creating a list for every group. This is to avoid creating too many lists. But this get's a little more expensive in "recreating" the functionality Mailchimp already has done very very well. One thing that is different from your module for example is I don't use PW user but pages. I create campaigns for lists and submit them from a newsletter created from a special page the user can edit and select for submission. So far I haven't got the time to invest and list management is still missing, kinda what you got here but as said not for PW users. But it has a nice admin interface to create campaings and see part of statistics after sending. Thing is that to make it really efficient (as the requests are limited) it would need to have caching built in so it doesn't need to request all those informations everytime, kinda what they suggest in their API docs. We maybe should work all together I'm on holiday currently in Turkey this week, but maybe I can find some time to share module.
    1 point
  20. Session Login Throttle itself doesn't have hookable functions for this, as you can see from it's code. You could hook into login() method of Session, though, but even then only thing you'd be able to check is whether allowLogin($name) returns "true" or "false". There's no way to say why this happens, ie. whether it was caused by Session Login Throttle, just that this particular user isn't allowed to login right now. Session Login Throttle allowLogin() is the method you'd need to work with here, but that being non-hookable and private makes things a bit complicated.. Only way to achieve this at the moment, as far as I can see, is by a custom module hooking before login() method of Session and checking if local allowLogin() method returns "true" or "false".. and based on that either saving that value somewhere so you can use it in your form, redirecting user to another location (error page) or directly outputting an error message.
    1 point
  21. I've just discovered this app that should import web pages straight to photoshop files, and divide them by layers (following the DOM structure previously applied). I don't own a Mac (poor me..) but I think this is a great little tool to have, could be useful.
    1 point
  22. I recognize that this is probably great for security, but it's just not working for my client right now. I just upgraded the site, and one staff member got the wait time incremented to 90 seconds before she saw the message about waiting So then she said she was going to put off working on the site for a few days, because she couldn't deal with it for now. I can't have this mental block happen with other staff or other clients--how do I turn it off? Thanks
    1 point
  23. Thats cool, if it's in the core... I'll delete my (xtra) throttle functions in my module.... I'll hope I will find the time to continue with writing of it.
    1 point
  24. I've updated this with the suggested improvement, thanks for finding it.
    1 point
  25. SessionLogginthrottle.module counts the amounts of invalid login. & set the time when tried to login. If you you have a valid login, i think( not shure) that the login counter should be reset to 1. So nextime you login in wrong again you dont have to wait, 90 or 120 or 300 seconds for example.
    1 point
  26. I think you can simply deinstall Session Login Throttle module.
    1 point
  27. I recently had to setup front-end system to handle logins, password resets and changing passwords, so here's about how it was done. This should be functional code, but consider it pseudocode as you may need to make minor adjustments here and there. Please let me know if anything that doesn't compile and I'll correct it here. The template approach used here is the one I most often use, which is that the templates may generate output, but not echo it. Instead, they stuff any generated output into a variable ($page->body in this case). Then the main.php template is included at the end, and it handles sending the output. This 'main' template approach is preferable to separate head/foot includes when dealing with login stuff, because we can start sessions and do redirects before any output is actually sent. For a simple example of a main template, see the end of this post. 1. In Admin > Setup > Fields, create a new text field called 'tmp_pass' and add it to the 'user' template. This will enable us to keep track of a temporary, randomly generated password for the user, when they request a password reset. 2a. Create a new template file called reset-pass.php that has the following: /site/templates/reset-pass.php $showForm = true; $email = $sanitizer->email($input->post->email); if($email) { $u = $users->get("email=$email"); if($u->id) { // generate a random, temporary password $pass = ''; $chars = 'abcdefghjkmnopqrstuvwxyz23456789'; // add more as you see fit $length = mt_rand(9,12); // password between 9 and 12 characters for($n = 0; $n < $length; $n++) $pass .= $chars[mt_rand(0, strlen($chars)-1)]; $u->of(false); $u->tmp_pass = $pass; // populate a temporary pass to their profile $u->save(); $u->of(true); $message = "Your temporary password on our web site is: $pass\n"; $message .= "Please change it after you login."; mail($u->email, "Password reset", $message, "From: noreply@{$config->httpHost}"); $page->body = "<p>An email has been dispatched to you with further instructions.</p>"; $showForm = false; } else { $page->body = "<p>Sorry, account doesn't exist or doesn't have an email.</p>"; } } if($showForm) $page->body .= " <h2>Reset your password</h2> <form action='./' method='post'> <label>E-Mail <input type='email' name='email'></label> <input type='submit'> </form> "; // include the main HTML/markup template that outputs at least $page->body in an HTML document include('./main.php'); 2b. Create a page called /reset-pass/ that uses the above template. 3a. Create a login.php template. This is identical to other examples you may have seen, but with one major difference: it supports our password reset capability, where the user may login with a temporary password, when present. When successfully logging in with tmp_pass, the real password is changed to tmp_pass. Upon any successful authentication tmp_pass is cleared out for security. /site/templates/login.php if($user->isLoggedin()) $session->redirect('/profile/'); if($input->post->username && $input->post->pass) { $username = $sanitizer->username($input->post->username); $pass = $input->post->pass; $u = $users->get($username); if($u->id && $u->tmp_pass && $u->tmp_pass === $pass) { // user logging in with tmp_pass, so change it to be their real pass $u->of(false); $u->pass = $u->tmp_pass; $u->save(); $u->of(true); } $u = $session->login($username, $pass); if($u) { // user is logged in, get rid of tmp_pass $u->of(false); $u->tmp_pass = ''; $u->save(); // now redirect to the profile edit page $session->redirect('/profile/'); } } // present the login form $headline = $input->post->username ? "Login failed" : "Please login"; $page->body = " <h2>$headline</h2> <form action='./' method='post'> <p> <label>Username <input type='text' name='username'></label> <label>Password <input type='password' name='pass'></label> </p> <input type='submit'> </form> <p><a href='/reset-pass/'>Forgot your password?</a></p> "; include("./main.php"); // main markup template 3b. Create a /login/ page that uses the above template. 4a. Build a profile editing template that at least lets them change their password (but take it further if you want): /site/templates/profile.php // if user isn't logged in, then we pretend this page doesn't exist if(!$user->isLoggedin()) throw new Wire404Exception(); // check if they submitted a password change $pass = $input->post->pass; if($pass) { if(strlen($pass) < 6) { $page->body .= "<p>New password must be 6+ characters</p>"; } else if($pass !== $input->post->pass_confirm) { $page->body .= "<p>Passwords do not match</p>"; } else { $user->of(false); $user->pass = $pass; $user->save(); $user->of(true); $page->body .= "<p>Your password has been changed.</p>"; } } // display a password change form $page->body .= " <h2>Change password</h2> <form action='./' method='post'> <p> <label>New Password <input type='password' name='pass'></label><br> <label>New Password (confirm) <input type='password' name='pass_confirm'></label> </p> <input type='submit'> </form> <p><a href='/logout/'>Logout</a></p> "; include("./main.php"); 4b. Create a page called /profile/ that uses the template above. 5. Just to be complete, make a logout.php template and create a page called /logout/ that uses it. /site/templates/logout.php if($user->isLoggedin()) $session->logout(); $session->redirect('/'); 6. The above templates include main.php at the end. This should just be an HTML document that outputs your site's markup, like a separate head.inc or foot.inc would do, except that it's all in one file and called after the output is generated, and we leave the job of sending the output to main.php. An example of the simplest possible main.php would be: /site/templates/main.php <html> <head> <title><?=$page->title?></title> </head> <body> <?=$page->body?> </body> </html>
    1 point
  28. It shows on modules overview that it's configurable, but when opening there's nothing to configure.
    1 point
×
×
  • Create New...