Jump to content

Leaderboard

Popular Content

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

  1. Hi reno, I think it is doable with two hooks. One hook would return false for Page::viewable() for the ProcessPageList page. Another Hook can be used to redirect your users to a custom admin page after login. I've only used the second one in a project, but I think something like this should work: // This needs to be an autoload module public function init() { $this->addHookBefore('ProcessHome::execute', $this, 'rootPage'); $this->addHookAfter('Page::viewable', $this, 'viewable'); } /** * Redirect users with custom-role to another page after login */ public function rootPage(HookEvent $event) { if ($this->user->hasRole('custom-role')) { $this->session->redirect('custom-admin-page/'); } } /** * Don't give users with custom-role access to Pages page */ public function viewable(HookEvent $event) { $page = $event->object; $user = $this->user; if ($page->id == 3 && $user->hasRole('custom-role') { $event->return = false; } }
    5 points
  2. when u.displays different msgs in logon,passwerd functionz u give hacker abilitys to find.account names best security--- u shuld not have some thing thats tells if user known or not known to not authentiked user
    4 points
  3. Also an ex-MODx'er myself. It's been fun converting some very different sites over the past few years as things that required a lot of custom code and queries in snippets in MODx to something that's much more manageable using the API in ProcessWire templates. Kidderminster-Husum-Twinning Before: https://web.archive.org/web/20130726180253/http://www.kidderminster-husum-twinning.co.uk/ After: http://www.kidderminster-husum-twinning.co.uk/ StrategyCore Before: https://web.archive.org/web/20120118171718/http://strategycore.co.uk/ After: http://www.strategycore.co.uk/ Etc etc
    3 points
  4. Let me give you a bit of insight on my latest project: http://dreitagewoche.de It is a weekly updated, hand crafted event calendar for Hamburg in Germany. Its team looks for the most appealing events every week and collects them for the three days of the week that really matter: thursday, friday and saturday. It features parties, exhibitions, concerts, festivals, theatre and everything else a bit of the mainstream. On the technical part (it uses PW 2.3): Single events can occur on multiple dates and support a link to a location (page) with Google Map coordinates. Beside events we support blog-like entries and regular pages and other stuff. Events are displayed based on their date, showing up in an archive when they aren't up to date anymore. This method also allows for a custom preview of all upcoming entries for the editors. I make use of template caching which speeds up the page remarkably. Beside that I am using some modules, including twitter feed, soundcloud embed, vimeo & youtube embeds. The backend is modified using admin custom pages module which allows me to tailor pages showing only upcoming events or locations. With around 30 pages added every week this was crucial. Overall I am very pleased with PW: It performs well, is easy to develop even with nested data and is fast and intuitive enough on the backend. And a full deployment means basically just a few clicks and a coffee while it is uploading. One thing that did trip me was customizing the backend and actually the obvious need to do it. With hundreds of pages the normal view is not as helpful as I thought. The module I mentioned did help a lot, without that I would have been in trouble. I am looking forward to using PW 2.4 on a project like this and how it accomplishes those challenges. Let me know what you think, especially about tailoring the backend and dealing with lots of pages. I attached a screenshot of our backend (it is 2.3 and a modified backend theme, based on ergo theme) Cheers!
    2 points
  5. @WillyC I think yellowled's point is a little different - perhaps I read the post wrong. Anyway, detecting the use of an email address in a username field & telling the user to use a username doesn't feel like an information leak to me. At best you are providing a binary chop of the input space letting the hacker know that this field really is for a username and not for an email address. In other words, I think it's okay to say... "Hey, this field requires a username, not an email address!" ...but not... "User `WillyC` doesn't exist. Please try again." A generic 'reset message sent' regardless of if the user is known or not should be shown if the input field has the right type of data.
    2 points
  6. Hey, I forked this project and created a version which is a lot simpler but only runs on PW 2.4 or higher. https://github.com/NicoKnoll/pw-admin-custom-pages What do you think? @diogo Maybe you can merge them somehow and move your version in an "PW lower than 2.4" folder or so.
    2 points
  7. Greeting, I'm always a bit jealous of you ex MODx-ers. At least you came from a decently flexible system, which got you using some proper pratices, and (I think) you could convert some sane code into ProcessWire materials. For those of us who came from Joomla, not only was there nothing to re-use, but Joomla encourages such bad coding habits it takes a while to convert your sites and adjust your thinking. But the bottom line is: we're here now! Thanks, Matthew
    2 points
  8. Someone I work with was busily deleting files fro the Windows folder one day to free up space because "they didn't seem to be anything he recognised as being relevant". Same chap also had his laptop on a boat on a sailing holiday and it got soaked when a big wave came over the side. I constantly threaten him with his next laptop being one of these:
    2 points
  9. I assume you are having issues with quote matching? You can take a couple of different approaches: echo "<li class='col'><a href='{$child->url}'>{$child->title}</a></li>"; echo '<li class="col"><a href="'.$child->url.'">'.$child->title.'</a></li>'; Have a read through some of these links: http://www.scriptingok.com/tutorial/Single-quotes-vs-double-quotes-in-PHP http://www.trans4mind.com/personal_development/phpTutorial/quotes.htm http://techtalk.virendrachandak.com/php-double-quotes-vs-single-quotes/
    2 points
  10. You can detect whether the current page was loaded from ajax by checking the value of $config->ajax from your template file: <?php if($config->ajax) { // page was requested from ajax } Following that, you will likely want to render the page differently to accommodate whatever you are doing from the javascript side. For instance, you might want do one of these: 1. Deliver alternate or reduced markup when loaded from ajax 2. Deliver a JSON or XML string for parsing from javascript Below are examples of each of these scenarios. 1. Deliver alternate or reduced markup when loaded from ajax You might find checking for ajax helpful when you want portions of pages to load in your site without re-rendering the entire page for each request. As a simple example, we'll use the default ProcessWire site and make it repopulate it's #bodycopy area when you click a page in the top navigation. (To use this example, you'll need the default ProcessWire site templates, though you can easily adapt the example to another situation.) To accomplish this, we'll update our main page template to only include the header and footer markup if the page is NOT being loaded from ajax: /site/templates/page.php <?php if(!$config->ajax) include("./head.inc"); echo $page->body; if(!$config->ajax) include("./foot.inc"); Next we'll update the top navigation to do ajax loads of the pages when the client has javascript (and leave as-is when they don't). Paste this javascript snippet before the closing </head> tag in the header markup file: /site/templates/head.inc: <script type="text/javascript"> $(document).ready(function() { $("#topnav a").click(function() { $("#topnav a.on").removeClass('on'); // unhighlight selected nav item... $(this).addClass('on'); // ...and highlight new nav item $("#bodycopy").html("<p>Loading...</p>"); $.get($(this).attr('href'), function(data) { $("#bodycopy").html(data); }); return false; }); }); </script> Now when you click on any page in the top navigation, it pops into the bodycopy area without a page load visible from your browser. And all pages remain accessible from their URL as well. Note that this is just a test scenario, and I probably wouldn't use this approach for the entire bodycopy area on a production site (it would make bookmarking difficult). But this approach can be very useful in the right places. 2. Deliver a JSON or XML string for parsing from javascript Lets say that you want pages in your site to return a JSON string with the page's id, title, and number of children when it is requested from ajax. When not requested from ajax, they will return their content as normal. To handle the ajax requests, you'd want to add something like this at the top of your template file before any other output. <?php if($config->ajax) { // this is an ajax request, return basic page information in a JSON string $json = array( 'id' => $page->id, 'title' => $page->title, 'numChildren' => $page->numChildren ); echo json_encode($json); return; } // not ajax, continue with regular page output And here is some markup and inline javascript you might use to test the ajax call on some other page (or the same one if you prefer). You would paste this snippet right in your site's markup where you want that info to appear. <ul id='info'></ul> <script type='text/javascript'> var url = '/'; // this is homepage, so replace '/' with page URL you want to load JSON from $(document).ready(function() { $.getJSON(url, function(data) { $.each(data, function(key, value) { $("#info").append("<li>" + key + ": " + value + "</li>"); }); }); }); </script> The above snippet would output something like this: • id: 1 • title: Home • numChildren: 5 To take this example further, you could build an ajax-driven sitemap or any number of web services. Conclusion Hope this helps you to see how simple it is to use ProcessWire to deliver output for ajax. These are just contrived examples, but hopefully examples that might lead to more ideas. In addition, much of what you see in these examples is also applicable to building web services in ProcessWire.
    1 point
  11. Thanks to Ryan, I've managed to knock my next module into usable shape. The URL Shortener adds a link shortening feature to ProcessWire, so you can host your own short URL service from a PW site now. You can create as many bins for short links as you need & the module sets up an example bin when you install it. Each bin is a PW page that uses the LinkShortenerHome template. This template allows you to set the length of the shortened links that will reside in it. Shortened links are simply child pages that automatically use the LinkShortener template. As these links are normal PW pages you can manipulate them from the admin page tree just like any other page. Anytime you create a new short-link page in any of your bins, it will automatically be named with a random string that is not already in use in that bin. You get the chance to review this short string before adding the full URL and saving the page. Once the page is saved any visit to the short link's URL will be redirected to the full URL.
    1 point
  12. Here's a video of a module we're working on that I thought you guys might like. The module, Lister, provides a different type of Page List than the tree that you usually interact with in ProcessWire. It gives you a table of pages with customizable columns, filters and actions. Rather than try to explain what it does, I figured I'd show you. This module also uses a new (soon to be released) Inputfield invented by Apeisa, developed by me, and sponsored by Avoine, called InputfieldSelector – it's what you see on the configuration screen as well as the Filters tab. I recommend bumping up the size/quality to 720p so that you can properly see everything. The video has no sound... I tried to do one with narration, but that didn't work out.
    1 point
  13. Hi, I didn't like the way how ProcessWire works with files right now. So I thought it's time for an Module which makes it better. Right now the module isn't finished but I'm working on it (probably together with Soma). My goal is to create an module which let's you mange all of your files and images easy and let you upload files which aren't connected to a page so that every page can use it. If you have wishes or ideas for this module you can post them here. (Also if you know a better way to solve this) And by the way here's a first screenshot (I started today, so it isn't that great right now). UPDATE: Download: https://github.com/N...oll/ManageFiles
    1 point
  14. Here's another self-hosted option that might suit you: Lipsync (On github at https://github.com/philcryer/lipsync) and attached is a presentation to go with it. DEFCON-19-Cryer-Taking-Your-Ball-and-Going-Home.pdf
    1 point
  15. Git annex is soon truly cross-platform: https://git-annex.branchable.com/install/ Sparkleshare might not be for you, but good to review nonetheless: http://sparkleshare.org/ Kolab also has a file cloud now, but maybe it has too much other stuff for your taste: http://kolab.org/news/2014/04/09/kolab.org-3.1-released-file-cloud-plenty-irony
    1 point
  16. @Nico: making the strings translatable? Think, this should be done in general with every new module.
    1 point
  17. Good question - I'll have a look.
    1 point
  18. Valery, I think you misunderstood my post? I would go for pages (just like you showed in the screenshot) but unlike you, instead of using repeaters, I would use normal pages - one for each product. Then....for the client, instead of showing orders via pages (i.e. in your case repeaters); I would show orders on the Process Module - in a table. For other ideas, see also Pete's Dashboard module that you can add to using 'normal' PW $pages API. These are just by the ways; l agree with what you've said. Work with what you are most comfortable with as long as it doesn't negatively impact the site
    1 point
  19. Just a note on SEO best practices - when correctly using rel next and prev, you can leave the canonical tag out on all paginated pages. This article has a great write up, but basically, next and prev make it redundant, and you can do serious damage to your SEO if implemented incorrectly with pagination. Better safe (and brief) than sorry!
    1 point
  20. I think there is no general answer possible It very much depends on your configuration of MySQL, assuming you're not using another database. If the query is simple and you have indexes or query for the primary key, it will probably be very fast Maybe you can do some performance testing for both possibilities? Cheers
    1 point
  21. Exact same reaction as you ankh2054 when I stumbled across PW (thanks to Marty Walker whose site I found and saw PW mentioned). I have not regretted or looked elsewhere since and I have actively re-built some sites from other CMSs to PW JUST for my own benefit. Welcome and enjoy!
    1 point
  22. I'm now on page 70-odd of stories on the Clients from Hell website... it's a bit addictive, and quite amusing
    1 point
  23. Hi, I think it would be really helpful to have an alternative to the default filesystem for large sites or sites that are hosted on distributed servers where the files can be saved externally to the likes of Amazon S3 instead of the '/assets/files/' folder, especially considering that filesystem on servers have a limit of either 32k or 64k for folders/sub-folders. This can be possibly achieved by creating a custom FieldType or a Module that can hook into the fileupload process, but having this built into the core would be a dream!
    1 point
  24. Ryan, Antti, (Avoine), I honestly can't thank you enough for this — this is a game changer (and that's not hyperbole). I'm giddy.
    1 point
  25. Check if your /site/assets/sessions/ folder has write access.
    1 point
  26. For the most part, I like the way that it works now. It's not really a "technical limitation," but a matter of flexibility. No matter how you do it, it's going to be a 2-step process of uploading and selecting the image, but the PW way bypasses having to build a separate folder structure while uploading your images and then having to hunt them down afterwards, while still retaining the flexibility of using images that appear on other pages if you want to. When you "add an image to the page" you literally are doing just that--adding an image to the page. Keeping the images separate from the individual WYSIWYG fields also allows you to reuse images more easily (in other WYSIWYGs or in your templates) and to see at a glance what images you have stored & available for use on that page. I think that it is actually more intuitive for people who are not familiar with CMSs at all. Plus the drag-and-drop functionality and auto-resize settings in the image containers bring a whole new level of usability to the CMS. I do agree that being able to drag and drop from the images field to the WYSIWYG would be an excellent feature, though. All of that being said, I recommend using individual custom image fields and outputting/resizing those images directly in the template with the API as much as possible. I have found that it is the most foolproof system for clients, and is where ProcessWire truly excels. Only use images inside the WYSIWYG for inline article images and never for images that are part of the site's layout.
    1 point
  27. Just to be certain: try the password reset again and make sure that you are keeping a window open to the "success" screen before clicking the reset link in your email. Basically, the password reset requires that you perform the action within the same browser session (for security). And the whole thing must be done by you in under 10 minutes. Otherwise it will expire. If it still will not work, the next thing to do is to get a hold of the server login information. Typically this would be an FTP or SSH login. With that in-hand, I can either login and reset the account for you, or I can provide you with a script that you can upload that will do it for you. You may email (ryan at this domain) or PM the information to me.
    1 point
  28. quote: I'm not quite sure what you mean the difference to be between 'close the browser' and 'completely quit the browser'? On the mac, if you close all browser windows, you don't quit the browser.
    1 point
  29. I'm not quite sure what you mean the difference to be between 'close the browser' and 'completely quit the browser'?
    1 point
  30. I'm glad you stressed that as depending on what you were after I might have suggested other ways of doing a community site (the easiest being using something like the community suite - forums, CMS etc - here: http://www.invisionpower.com/ since they're pre-built and function together well. But then you'd be at the other end of the scale from PW in terms of customisability and ease of use if you wanted to do anything outside of what the core package handles). To learn PW, my aim was to rebuild StrategyCore in PW as I could see how to do everything in my head and it was just a case of working it all out. It really helps to have a project in mind that you've got no set deadline for when you're learning something new, as long as you've got the time to do it. I ended up spending about 3 months' of evenings on that site, but I'll stress that easily half of that was just trying to get the forum software integrated in terms of article comments and user logins, so PW was the easy bit, including importing all the content from the previous system. The beauty of having done that is that I now have a decent code-base for those projects in my head that are mostly community-based sites with core functionality something along the lines of ryan's sites. I ended up with quite a lot of code in my head.inc file that's used on various different templates. I just pulled all of that out as it was getting quite messy and stuck it into a global.php file instead in the templates directory. If you have code specific to different templates that you don't want to clutter up the template itself the you could easily create a "controllers" subdirectory and put it in there. Theoretically the easiest way to go about it would be to create that "controllers" subdir and put in a file for each for your templates with the same name, then in head.inc do something like: include('controllers/' . $page->template . '.php'); And you've successfully split out most of the code from your templates with minimum effort That's the thing about PW - you can work pretty much any way you like with it (and I honestly wish I'd thought of the above sooner - oh well, next time!). What I've just suggested above would be desirable on my website because I have so many templates that it would have been better to split it all out a bit and not have so many loops or selectors happening in the template itself. Instead I could have separated much of that out as I honestly scratch my head a few times when looking back through some older templates I'd made. That said, it depends quite a bit on how complex the project is and what your preferred method of working is. For a simple website I wouldn't bother doing the above, but for a site with section-specific, complex structure then it could well be worth it. If you're working in a team of one, then it's up to you how you go about it and I often find myself falling into the bad habit of mixing and matching ways of working within a single project as I learn new things - fine for my own stuff, but crazy if someone else has to work on a project (fortunately they don't). I think that after watching the video on the PW homepage it was that site, plus tripsite.com (another of ryan's creations for a client) were the things that really drew me in to PW. I've got so many projects in my head along those lines and I just need time to work on them. Some of them might even make some money if I stop working on hobby sites
    1 point
  31. If I had to put it shortly: PW gives you (that are missing from many more traditional frameworks): Admin, users and access management UI for building your data schema (clicking on admin instead of coding) Url mapping to pages (no need to define routes) Something pretty similar to most (with a twist of course): PW API == GOOD ORM Controllers == template files can be easily used as a controllers What is missing (what some frameworks have): Crazy amount of helpers (as others have noted, using zend classes or flourish can be good help in that kind of situation) Routing (I hate doing routes... mostly repetition) Custom template languages Strict rules how to construct your code What pw "requires" that you might not like in your app: Unique database schema: you don't have single "posts" table, instead you end up with field_title, field_body, field_author, field_date etc.. tables MySQL, MyISAM
    1 point
  32. @onjegolders, as a rough answer I'd say that ProcessWire provides very good foundation for an app by making content management, access control etc. trivial. Frameworks, on the other hand, offer flexibility and powerful tools if you're building something that doesn't really need / use typical CMS/CMF features and for some reason requires very highly customized access control, URL manipulation / routing, data structures etc. MVC approach has clear benefits, but don't sweat it too much; separation of concerns is what's important -- when implemented properly, you don't need to make changes to multiple places every time your UI or DB (or business logic for that matter) changes slightly. I'd recommend reading this (old but still good) post about Rails development, which (imho) summarizes benefits of MVC / separation of concerns pretty well: http://weblog.jamisb...oller-fat-model. For the record, I've never tried Codeigniter myself and don't really know much about it. I've used Zend Framework for various projects -- and will definitely keep using it whenever it's the best tool for getting the job done -- but I've heard it has somewhat steep learning curve compared to some other frameworks. I'd still recommend checking it out though: http://framework.zen...n/learning.html.
    1 point
  33. Alan, this seemed to be true for 2.0. I think. I would search with site:processwire.com permission page-edit https://www.google.c...iw=1352&bih=850 Mainly it's simple and straight forward. If the module has no "permission" set only superuser will see it. If it has a "permission" the user has assigned to one of he's roles he will see the page in the admin. So "page-edit" is a possibility, but not the only solution. If one creates a module (look at AdminBar) he can decide to give it for example a "adminbar" permission, so it can be used for site admin to give access to only certain users using that permission. Edit: So far this is mainly for advanced module developement, which isn't covered anywhere yet, but will in the near future.
    1 point
  34. Alan, for non superuser to see the custom admin page, the module requires a permission set in getModuleInfo static method: simplest would be to add: "permission" => "page-edit" you could also create a custom permission and add that to the roles you want them to see the admin page.
    1 point
×
×
  • Create New...