Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/02/2013 in all areas

  1. I launched it today: http://fyp.washington.edu/ I can't even begin to explain how excited I am by this software. It feels like I accomplished more in a month than in the last ten years of professional web dev work. Finally, a CMS geared to the needs of content publishing and information modeling (i.e. taxonomy and ontology) -- not news, widgets, or journaling. Like so many others I had been struggling with the Drupal/Wordpress dichotomy. Drupal feels like hitting myself in the head with a hammer and Wordpress is insecure and inflexible. And both their inner workings seem completely opaque, no matter how often I build with them. Enter PW, CMS of my dreams. The FYP site is combined with Zurb's Foundation Framework, which I am similarly enthusiastic about. Also above all jQuery + CSS3, which seem like a never-ending treasure chest of wonders. I did the interface design and development as well as the information architecture and all of the programming. My favorite thing about the site is the way I was able to give it gears that turn with the seasons -- for each season of the year I added tag "pages" and then tailored parts of the interface to match. The homepage image, the default header, and the selection of front page slides are all determined by what time of year it is. I was able to expose almost EVERYTHING to the content stakeholders through the flexible field system. I could totally get run over by a truck tomorrow and all would be well. I LIKE THIS. Maybe some don't. But I've always been in this field in the hopes of empowering people and making room for creativity. ProcessWire works with these goals, not against them. Cheers, Jenn p.s. the slider is RoyalSlider. I dig it too.
    13 points
  2. I have actually implemented two projects with Perch before switching to ProcessWire. It is probably not as easy to add PW to a site which exists as a static HTML prototype as it is with Perch. That is something Perch does exceptionally well. Here comes the “but”: as long as the site you're maintaining with it stays really small and not too complicated, it is perfectly fine for it. If the site grows and gets more complex (and most sites tend to do that over time), the effort you have to put into it with Perch grows as well, although I have to stress that this is my personal impression. I really don't mean to talk down or belittle Perch. If you and your users like it and it fits your needs, it is probably the right choice. But if this is a site which is likely to grow more complex, it might be easier to go with a CMS which (again: just in my opinion) can handle bigger sites better.
    2 points
  3. Happy discovering. It's like christmas just more useful.
    2 points
  4. I created another version to show how to create this navigation with post which have a date with daytime. So it covers a range of 24 hours and not only a date without time. It looks for the next post found in future and past, so it will still work if there's a day in between where no posts are published. I created a new gist snippet for anyone interested as reference: https://gist.github.com/somatonic/5068777 It will give you something like this
    2 points
  5. New Bootwire Demo Profile This is a demo profile built on the Bootwire Starter Profile It has a few extra fields and templates, just enough to show some of the functionality in a working situation. It also comes with the Bootwire Admin theme. If anyone has got time, I would appreciate any comments, especially some proof reading! See it here: http://bootwiredemo.stonywebsites.co.uk/ Download it here: http://stonywebsites.co.uk/Bootwire-Demo-Profile.zip
    2 points
  6. Thomas, I don't think you can use pw password field in this. Create new field for legacy pass and save the md5 hash there. Then hook into login to check for that also. And remember to remove the legacy pass when user change his password.
    2 points
  7. Good morning/evening/night or whatever! I just commited to Version 1.0.2. Here are the new Features: Permission Checking: Don't show pages that aren't editable by the current user. Also removed all actions that the user doesn't have permissions to execute. You can directly edit a single page over Fancybox by clicking the small "edit" link after a page (thanks raydale) Added Batch-Creating of Pages Batch-Creating Screenshot taken with Soma's great new Teflon theme Includes permission checking and Family template restrictions. This means in detail: The selected parent must accept children and their template The pages template must accept the parents template User needs the permission to add children to the selected parents template User needs the permission to create Pages for the chosen Template How does it work? 1) Select a parent where your new pages will be added as children 2) Add as many pages as you want by clicking "add Page" 3) Click "Create Pages" You must enter a title and choose a template. The name is optional: If left empty, Pw will generate this for you. Batch-creating tips The chosen template and the statuses are always cloned from the last row. So if you need to add 30 pages with the same template, define it first and the click "add Page" - i'll make your life easier ;-) You can drag & drop the table rows should you want to change the order. The draging looks ugly but it works. For the lazy dogs and keybord hackers among us, you can add a new row by pressing "ctrl+n". This works (at least in firefox) only if no input has focus. After adding a new row, the title input gets the focus. By pressing 3 times tab you arrive at the published-checkbox, here the short-cut works. Restrict Batcher for a user to only allow editing or creating Create permissions "batcher-edit" and/or "batcher-add". As soon those exists, the module checks if the current user has those permissions. Good night
    2 points
  8. ProcessWire Email Obfuscation (EMO) Download | GitHub Email Obfuscation module for email addresses with 64 base crypting. This module finds all plaintext emails and email links from the document and replaces them with span elements including configurable replace text. All the addresses are encoded to 64 base strings and stored in spans data attributes. Then on client side we decode these strings back to their original state. Install Create new 'EmailObfuscation' folder into /site/modules/ and place the content of this repository into the directory. Login to processwire and go to Modules page and click 'Check for new modules'. Find 'EmailObfuscation' and click install. You can make optional configuration changes in the module admin page. Thanks This is a ProcessWire module fork from MODX Evolution plugin emo E-Mail Obfuscation. http://modx.com/extras/package/emoemailobfuscation EDITED ON: 2013-03-03 - Added description. 2020-04-16 - Fixed GitHub links and updated description. Hello all. Just found PW few days ago and it's already looking awesome! Here comes first contribute and some questions for developing it further. There was one existing email obfuscator on reposity that didn't use any crypting for addresses so I decided to do a little test run and port the one that we currenly use with MODX Evo to ProcessWire module. I'd like to make PageAutocomplete like gonfigure option to admin so that one could select and set templates to exclude module action. It looks like autocomplete is tied to pages and since templates are not set to system as pages this is option is no go, am I right?
    1 point
  9. Hi Folks, today we will learn how to set up a simple jquery plugin called calendario and fill events trough our admin backend. || ATTENTION || Modern Browser needed First of all, we need the jquery plugin. Grab your copy here: http://tympanus.net/...alendar-plugin/ Now create a new template file, lets call the file calendar.php In the next step we have to include all the needed files from the .zip package. You need the following .css files: calendar.css custom_2.css demo.css Just include them in the <head> </head> of your template file. Feel free to merge them together, so you could save some http connects. Now we need to include the needed javascript. Make sure you have included the latest jQuery library. Include the jquery.calendario.js and the modernizr.custom.63321.js right into the bottom of your template file. Save the calendar.php Now we will set up Processwire where the magic wil happen. We just need one new template. Create a new template called calendar. Assign the field headline to our template. Allow children to just use this template. Hit the save button. Now create a new Page as child of home and call it Calendar. Assign our calendar template to this page. Almost ready. Now we have to do some little scripting in our template file calendar.php Add this html markup to our calendar.php <div class="custom-calendar-wrap"> <div id="custom-inner" class="custom-inner"> <div class="custom-header clearfix"> <nav> <span id="custom-prev" class="custom-prev"></span> <span id="custom-next" class="custom-next"></span> </nav> <h2 id="custom-month" class="custom-month"></h2> <h3 id="custom-year" class="custom-year"></h3> </div> <div id="calendar" class="fc-calendar-container"></div> </div> </div> Now we have to call the javascript function, to get the calendar running. Just put this snippet right under the included jquery.calendario.js <script type="text/javascript" $(function() { var transEndEventNames = { 'WebkitTransition' : 'webkitTransitionend', 'MozTransition' : 'transitionend', 'OTransition' : 'oTransitionend', 'msTransition' : 'MSTransitionend', 'transition' : 'transitionend' }, transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], $wrapper = $( '#custom-inner' ), $calendar = $( '#calendar' ), cal = $calendar.calendario( { onDayClick : function( $el, $contentEl, dateProperties ) { if( $contentEl.length > 0 ) { showEvents( $contentEl, dateProperties ); } }, caldata : { <?= getEvents(); ?> // this is our function to grab our events }, displayWeekAbbr : false } ), $month = $( '#custom-month' ).html( cal.getMonthName() ), $year = $( '#custom-year' ).html( cal.getYear() ); $( '#custom-next' ).on( 'click', function() { cal.gotoNextMonth( updateMonthYear ); } ); $( '#custom-today' ).on( 'click', function() { cal.gotoNow( updateMonthYear ); } ); $( '#custom-prev' ).on( 'click', function() { cal.gotoPreviousMonth( updateMonthYear ); } ); function updateMonthYear() { $month.html( cal.getMonthName() ); $year.html( cal.getYear() ); } // just an example.. function showEvents( $contentEl, dateProperties ) { hideEvents(); var $events = $( '<div id="custom-content-reveal" class="custom-content-reveal"><h4>Termine am ' + dateProperties.day + '. ' + dateProperties.monthname + ' ' + dateProperties.year + '</h4></div>' ), $close = $( '<span class="custom-content-close"></span>' ).on( 'click', hideEvents ); $events.append( $contentEl.html() , $close ).insertAfter( $wrapper ); setTimeout( function() { $events.css( 'top', '0%' ); }, 25 ); } function hideEvents() { var $events = $( '#custom-content-reveal' ); if( $events.length > 0 ) { $events.css( 'top', '100%' ); Modernizr.csstransitions ? $events.on( transEndEventName, function() { $( this ).remove(); } ) : $events.remove(); } } }); </script> We are almost finished, but we are missing some very essential, have a look to our javascript. We are calling a function named getEvents() This function will grab our events and fire it right to our calendar. So here is the code: function getEvents() { $events = wire('pages')->get("/calendar/")->children(); foreach ($events as $event) { echo "'$event->title' : '<span>$event->headline</span> ',"; } } Put this snippet above the javascript includes. We will now create our first entry. Go back to the PW admin backend and create a Child of Calendar. Title and name need the Date on which the event has to be displayed. You have to form a date in this format: mm-dd-yyyy e.g. 12-27-2012. The headline field is our Event description. Hit the save button, go to your site and enjoy your event calendar. With a little coding you could extend the calendar to let it look like mine attached as screenshot. Hope this was useful to somebody. Cheerio.
    1 point
  10. Table of contents Introducing the App and author Needs First version in PHP/MySQL without any Framework Why Processwire? App Version 1.0 Introducing the App and author Hi, my name is Luis and i´m a German based Web and Frontend Developer. I started 2010 with my own Internetbusiness and noticed at the very beginning of my business that it takes to much time to handle my accounting, invoices and clients. The main problem was that I needed for almost every task his own software solution, so the usual workflow in creating an invoice was something like open the CRM Software because the invoice software was good in creating invoices but bad in managing and searching clients, copy and paste the client into invoicing, create the invoice and handle it over to the accounting software. Not good at all... So I decided to create my own solution to fit my needs in the office management. Needs Invoicemanagement and creation Clientmanagement, very basic CRM Accounting Multi-User Simple financial stats about the Keyfacts of my business possibility to export the data for my tax consultant PHP / MySQL to work with it on intranet After pointing out my personal needs and writing down my usual workflow I started to develop the first version. First version in PHP/MySQL without any Framework In winter 2011/2012 I completed the very first version of my OMS (office management suite). The whole project was written in good old fashioned PHP from scratch. I´ve used this version till November 2012. Why Processwire? In mid 2012 I discovered Processwire and had no idea in how many ways this tool would change my life as webworker. After playing around with PW and developing the first little sites I had a little talk with my tax consultant, she said that my financial reports are pretty good and help to save money. (less time, smaller invoice from her) Why not publish the tool? Well, at this point my app was solely written for my needs, without possibilities for an Multi-User environment or for use in an companies Intranet. I finally decided to port the app to PW because of it´s flexibility, scalability and built-in user-roles. I had to dig deeper into PW at this point to see if I really could. Late 2012 I started porting the app in PW and was surprised how insanely fast developing could be. The whole database structure was ported into PW Pages, no SQL query is done by the app itself. It was possible to recreate the core functionality in about 2 weeks, implementing the Login and Multi-User functionality took another week. WebApp Version 1.0 https://youtu.be/PIgUMLZEcIU The app is now available for purchase @ www.misterui.de * also Processwire with an own eCommerce Script
    1 point
  11. Hi there, I worked on making apeisas great Thumbnail module translateable (I need a German translation of the UI), but can't really get it to work. I hope that someone here can give me a pointer in the right direction on this. This is what I did: 1. Installed the LanguageSupport module via ModuleManager. 2. Added the German language pack to the Default language. => Everything worked great until now, the backend is mostly translated. 3. Since a lot of strings in Thumbnail weren't translateable, I went through the code and added $this->_() and __() where needed (referring to how it is done with core modules). You can find this version here: https://github.com/boundaryfunctions/Thumbnails/tree/translateable This is the commit adding translatable function: https://github.com/boundaryfunctions/Thumbnails/commit/c3bcb8af480d91bc8ee7cfd4477aadeeab6a708e 4. Using the Language Translator in the backend, I added translation files for each of the three module files of Thumbnail to my default language. I uploaded all three translation files I created (not the best translations at this point, to be honest) here: https://gist.github.com/d41fe1e71791fccf5cc4 5. All of the things I translated aren't translated in the backend, I'm still displayed plain English. Any idea what I might have done wrong here? I really don't get it, because these steps worked perfectly for me until now. Any help is much appreciated. With kind regards, Marc
    1 point
  12. IMPORTANT This is now well and truly out of date! I strongly suggest ignoring it. The Bootwire System This is a series of proof-of-concept profiles based on ProcessWire 2.3 (forthcoming) and the Twitter Bootstrap Framework They are currently using Bootstrap 2.3 and JQuery 1.9.1 Bootwire Starter Profile Version 0.5 This version if for those who just want to leap in and get their hands dirty, It includes almost no content at all, very few fields and templates and very little markup. The normal Bootstrap navigation is in place for reference. More details are in the readme. Download Here: http://stonywebsites.co.uk/Bootwire-Starter-Profile.zip Github: https://github.com/jsanglier/Bootwire-Starter-Profile ============================================================ All versions come with a Site Settings page which is a child of a Content Management page in the page directory. This is used for common elements such as site title. The Starter Version has almost nothing in it! Some additional tweaks have been added to TinyMCE and these profiles are pre-loaded with the Modules Manager, the Profile Exporter and the Page Delete module. Please use the Module Manager to ensure all modules are up to date. NEW: Now with some demo functionality in a functions.inc file. Bootwire Demo Profile Built on the starter profile, this version demonstrates some Twitter Bootstrap functionality in the context of a ProcessWire installation. The Demo can be viewed here: http://bootwiredemo.stonywebsites.co.uk/ Download here: http://stonywebsites.co.uk/Bootwire-Demo-Profile.zip Github: https://github.com/jsanglier/bootwire/ Bootwire Admin Theme I have created an admin theme using Bootstrap 2.2.2. It is functioning but should be treated as a work in progress. However, you may like it. It has its own thread here. http://processwire.com/talk/topic/2640-bootwire-admin-proof-of-concept-admin-theme/ ============================================================== Future Profiles Bootwire Blog Profile This is intended to be a basic blog system using the Bootstrap framework. I am planning to start from scratch with the blog, basically because I need the exercise. It will not be as clever as Ryan's system, but it will have the following features (er ... possibly): Category Tree Tag System In-Article gallery Media pages Alternate themes for posts Lots of global settings Manual related posts Automated related posts (okay, probably beyond me) er ,,,, some other great feature that I have not thought of yet.
    1 point
  13. I first asked this question on Twitter but I guess the forum is a better place to get a good answer. The following code is taken from the head.inc file of the default PW theme: // Create the top navigation list by listing the children of the homepage. // If the section we are in is the current (identified by $page->rootParent) // then note it with <a class='on'> so we can style it differently in our CSS. // In this case we also want the homepage to be part of our top navigation, // so we prepend it to the pages we cycle through: $homepage = $pages->get("/"); $children = $homepage->children; $children->prepend($homepage); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; } The definition of $page->rootParent from the cheatsheet: I understand, that if you have the following page structure … Home About ProjectsProject ASubproject 1 Project B … and calling $page->rootParent->title on »Subproject 1« outputs »Projects«. But why can I also check with it that a page is the »current« one like written in the above code ($child === $page->rootParent)? I guess the problem I have with this is that one method implies two different semantics (which confuses me). Just wanted to share my thoughts about this as I’m trying to truly »learn« PW form the inside out.
    1 point
  14. I think one thing which would really add to the ease of setting up and managing sites within PW would be added batch functionality. One small example, I had added a dozen or so new users as a testing process and I wanted to delete them. To do so I had to click each one individually, then click delete, then check the box to confirm and repeat eleven times. This is no great hardship but I believe it's a good example of the occasional bottleneck in the backend. Of course this can be done in the API and Ryan's even helped me to create my own batch delete form in the past but it just feels odd having to do this through one of my templates. I should also point out that Soma has done some great work on a module to add some batch functions but I think if pages had checkboxes and delete/edit functions on them it would be a great addition!
    1 point
  15. Exactly! Thanks SO much for the sample code, browser-written or fully tested, always helpful for a PHP weakling Cheers!
    1 point
  16. No problem! Happy to help. I know excactly how you feel - the more you work with ProcessWire, the more enjoyable it gets. Yup - so when you save the booking as a page, the booking date can be used as a selector. So would be a quick example: (untested, written in browser) $m = date('n'); $bookings = $pages->find('template=booking, booking_date>=mktime(1,1,1,$m,0,date('Y')), booking_date<=mktime(1,1,1,$m,0,date('Y'))'); You'd probably want to be a little more specific with the selector (defining the parent page). Gotta rush out the door...
    1 point
  17. Nice work so far. I was not active in PW-forums for some time, because I suffer on herniated disc (Bandscheibenvorfall). I'm so glad you did this site.
    1 point
  18. How are you saving each booking? Does each booking have it's own page in PW? If each booking has a date field (that defines the day that is booked), I would think it's rather straightforward. When you display the calendar, you'd just want to grab all the bookings that fall within that month. You'd loop through each of the days in that calendar month and if a booking exists for that day, you wouldn't provide a link to the booking form. Of course, I am making assumptions here about the entire process.
    1 point
  19. I'm not up-to-speed enough on Google Maps to be able to troubleshoot very well. But if it stopped working on its own without there being some change somewhere, then it's got to be related to a change at Google Maps? Still, you might want to put a console.log(poi_id) and console.log(poicolor) in there to monitor and isolate what's going on. It would be nice to know specifically where the info is getting lost.
    1 point
  20. I haven't done much front-end user stuff but the API and flexible role/permission/user system makes this pretty easy. Of course, depending on the exact needs it could get more complex. So for example you could create a new permission called frontend-edit. Create a role called frontend-editor and give it page-view and frontend-edit permissions. This will keep a user with (only) the role frontend-editor out of the back-end but allows you to log him and check for permissions in templates, allowing stuff you want. if ($user->hasPermission("frontend-edit")) { echo "<a href='{$page->url}edit'>EDIT</a>"; } else { echo "you are not logged in or you do not have permission to edit this page"; } if ($user->isLoggedin()) { echo "here you go, view this awesome page"; } else { echo "plz login if you wish to view this awesome page"; A front-end login could be as simple as creating a page, why not name it login, and putting this into the template file: <?php /** * Login template * Based on a forum contribution by Ryan, can't locate it, but the are many examples of login forms. * */ if($user->isLoggedin()) { // user is already logged in, so they don't need to be here $session->redirect($config->urls->root); } // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect($config->urls->root); } } include("./inc/head.inc"); ?> <?php if($input->post->user) echo "<div class='alert alert-error'>Vekeerde combinatie van gebruikersnaam en wachtwoord</div>"; ?> <form class="" action='./' method='post'> <label for="user">Gebruikersnaam</label> <input type="text" name="user" id="user" placeholder="Gebruikersnaam..."> <label for="pass">Wachtwoord</label> <input type="password" name="pass" id="pass" placeholder="Wachtwoord..."> <label></label> <button type="submit" name="submit" class="btn btn-primary">Login</button> </form> <?php include("./inc/foot.inc"); ?> These are just some examples but most if not all what you need is already available. It's up to you to code it the way you want. The API cheatsheet gives a nice overview of available building blocks. For the Create, Update and Delete stuff i think you would need to roll your own forms, populate them via the API and do with it what you want. Of course making sure you properly sanitize the inputs, maybe do some of your own validation etc.
    1 point
  21. Hello, I just set up a PageAutocomplete field which was supposed to use a different field for selection (different to name or title that is). I didn't work. It seemed to find something but the pulldown showed empty lines and when I selected one of them, the list only showed "Label". Once I switched the field to title, everything worked fine. Is this a bug or is there something to configure before using a custom field for PageAutocomplete? Thanks, t PS: Using PW 2.2.15
    1 point
  22. Looks it it's a bug. Thanks for finding it. This has been fixed in the latest commit to the dev branch.
    1 point
  23. hi wanze, thanks pretty much for your reply. as i'm a beginner with php and in particular with object orientated programming could you give me a hint how to implement this? do i have to "hack" the core (i.e. amend the session class)? best, christoph EDIT: read twice through your reply and think i got it on the second try ;-) pw is setting 301 header by default, right? no need to edit anything.
    1 point
  24. That should be fine Mark as you can set the PHP ones in your PHP.ini, but -indexes is there for security really so it doesn't list files in folders ny default if you type in a directory name so I'd question the security of a host that doesn't let you do that to be honest... assuming I got all that right The main thing is you're up and running and the fun starts NOW!
    1 point
  25. Welcome to the forums ProcessWire, like most CMS', can only edit pages in its own database so I don't think you'll find many systems that allow you to edit your own static pages that haven't been created with a CMS well as add new ones that have been created with a CMS - that's just not the way they usually work. That said, if you can share a link to your site it really is much easier to import a currently existing site into ProcessWire than with other systems so we can certainly help you there. Depending on the complexity and size of the current site it really can be a quick process.
    1 point
  26. I just tried a migration from dev to staging and got a whole bunch of class not found and problems trying to redeclare things that are "include_once" (sorry I didn't record exactly what they were). I tried several times clearing the cache folder of module files with no success. Initially the front-end looked fine and I could even get into the main admin pages, but couldn't edit anything without these errors. What finally cleared it all up was killing APC and restarting apache. Of course I guess I don't which it was - APC, or just the apache reboot - that fixed things.
    1 point
  27. There's a setting for this in Process Users module (Admin > Modules > Users.) It allows you to choose exactly which fields you want to show in users list.
    1 point
  28. 1 point
  29. Hi totoff, It does set header 301 if you use Session::redirect by default. Here's the method from the Session class: <?php public function ___redirect($url, $http301 = true) { // if there are notices, then queue them so that they aren't lost $notices = $this->fuel('notices'); if(count($notices)) foreach($notices as $notice) { $this->queueNotice($notice->text, $notice instanceof NoticeError ? 'error' : 'message', $notice->flags); } // perform the redirect if($http301) header("HTTP/1.1 301 Moved Permanently"); header("Location: $url"); header("Connection: close"); exit(0); }
    1 point
  30. Couldn't you just do this? <body class="<?=$page->rootParent->name;">
    1 point
  31. What I've been doing in another module is removing all templates flagged as system. That's probably what you want to do here too. foreach ($this->templates as $t) { // skip system templates if (!($t->flags & Template::flagSystem)) { $f->addOption($t->id, $t->name); } }
    1 point
  32. I'm happy to hear that you guys find this module useful. I haven't had too much (/any) time to work on this module yet (current status: spitting out essays for school at lightning speed..) but hopefully should get to use most of next weekend adding and fixing things here and there At the moment those arent supported, but that's going to be the very next thing I'll be adding (I hope.) Language-alternate fields are no problem since they're actually separate fields, but multi-language fields use slightly different schema and thus require some extra care here. I actually tested what happens if you enable this module for multi-language field and the result was pretty much as expected: only version that gets saved is the original one (column "data" in field_fieldname table) and if you attempt to roll back an old revision all language versions are replaced with that one. Not exactly useful.. luckily I did kind of expect something like this to come up, so this shouldn't be a huge thing to implement Thanks, Pete! I'll definitely take a look at these ASAP. There were couple of PHP diff libraries I originally browsed through and this may have been one of those, can't really remember anymore. Originally I were a bit worried about including an external library like that with a module. Perhaps that's not such a bad thing after all -- and BSD license should definitely make it possible. Anyway, I'll check this library (and that jQuery merge tool you mentioned) properly as soon as I get some free time Probably the most straightforward way to achieve diff-like capabilities would be building on current method (storing full data etc.) and then either running PHP diff at Process module and getting output via AJAX call or (what I originally planned to do, and still would kind of like to try out) use something like this JavaScript diff algorithm by John Resig.
    1 point
  33. Creating content in PW API is as simple as it can get. First we want to create a new Page object, then fill some properties and give it a template, parent and a title. Now save it. Or to modify an existing, you can simply load a page with $pages->get(id|path|selector); and change properties and save it back. In praxis this basicly looks like this from within a template code: $mypage = new Page(); $mypage->template = "basic-page"; $mypage->parent = $pages->get("/"); // root $mypage->title = "My New Page"; $mypage->image = "http://www.some.com/img/myimage.jpg"; $mypage->body = "Hello World"; $mypage->save(); Or within a php file bootstrap of the PW index.php, ( or template scope too ) // bootstrap API include("./index.php"); $mypage = new Page(); $mypage->template = "basic-page"; $mypage->parent = wire("pages")->get("/"); // root .... $mypage->save(); To load and edit a page which has fields with text formatters like dates or text fields, you might need to turn off output formatting of the page you edit. $page->setOutputFormatting(false); or alternative short syntax: $page->of(false); $mypage = wire("pages")->get("/about/"); $mypage->of(false); $mypage->template = "basic-page"; .... $mypage->save();
    1 point
  34. Sorry for the delay, I've read your posts but forgot to further think about it and respond. It often happens I read it on mobile and forget about it later on laptop because it's already read. I think this is rather edge case and nice to have possibility, but for my needs it would make mostly more sense to have different field in PW and have a different css there if needed but never had. However you can simply overwrite the default tinyMCE config used by textareas in the default.php of admin theme. If you look at my Teflon theme there I'm setting the theme of tinyMCE globally via js. https://github.com/somatonic/teflon-admin-theme-pw2/blob/master/templates-admin/default.php#L90 There was a long thread where we figured this simple idea, but can't remember which thread This sample code works to use a "template-name.css" only on page edit process. So all TinyMCE fields will use this. <script> // overwrite TinyMCE skin setting globally // as defined in /wire/modules/Inputfields/InputfieldTinyMCE/InputfieldTinyMCE.js // and loaded before if('undefined' != typeof InputfieldTinyMCEConfigDefaults){ InputfieldTinyMCEConfigDefaults.skin = "default"; <?php if($page->process == "ProcessPageEdit") { $cssfile = $config->urls->templates . "css/" . $modules->get($page->process)->getPage()->template . ".css"; echo "InputfieldTinyMCEConfigDefaults.content_css = '$cssfile';"; } ?> } </script> I haven't tested further side effects and what if you want to still have different css for different fields... so this could also be made into a module that injects this code in the head of the admin page, so you could configure anything. Everything is possible in PW, just question how.
    1 point
  35. One day I will do this properly completel with examples, but for the moment, this is a hints and tips approach Creating a proper video tutorial First of all I have to say that I am not in favour of video tutorials for myself, especially covering a subject which is basically concerned with reading and writing. However, they do work well as an overview and many people like following them. The Big Wrong Things "So, what can go wrong? I mean, I know the subject, I sit there coding every day, this is my world - just turn on and record. What is the problem." The list is, sadly, endless. But here are a few things that can ruin your plans (and spoil my viewer experience): Mouse pointer waving around pointlessly Bad visual quality so it is unreadable at full screen Irrelevant windows all over the place Endless leaping between this screen and that screen and this and that folder, application and so on Muttering Repetitive, "I will just ... er,...not there ... oh yeah, that one.... oh, forgot a bit..." Forgetting to introduce not just the video but the various parts Tiny font size Buzz words, nicknames, unexplained short cuts ... Too long Trying to tackle a too complicated a subject And there are many more. So, how do the pros do it? I probably have a bit too much fun listing all the things I have done over the years just to confuse people, but the truth is that my main role has been rather bland - I have produced and/or recorded THOUSANDS of sound tracks for corporate productions, and video edited and even directed quite a few too. These have tended to be big budget affairs with professional camera operators, enormous Grass Valley editing suites, professional presenters and voice overs and so on. But that does not mean that the skills eat up the budget - it is just the fees that do. The skills are straightforward and logical and are free to anyone who wants to practice a bit. So here is a bullet pointed step-by-step guide. 1. Preparation Knowing what you are talking about ISN'T preparation - it is nothing more than a knowledge base. Most technical videos are written by people who do not know the subject but do the research and turn it into something meaningful. Trust me, even if you know the subject inside out you still need to do research and preparation: What level of expertise does the audience have? What is the conclusion of your tutorial? Do you know how to explain every action your will make? If you go through what you are trying to do correctly, you will find out there are lots of things that you know instinctively that you realise others might not know, or you have no idea how to explain. List them. Break it down. Remember that your audience cannot read your mind, so look for the things that you frequently skip over that may lose someone not living in your head. 2. Script Writing I cannot emphasis this enough - WRITE A SCRIPT!!! I don't care that YOU think you are the best ad libber around - you aint. I probably am, but I would never do a lesson unscripted. Even politicians who do long speeches "unscripted" don't really - they script every word and then learn it inside and out over days. Writing scripts scares the bejeesus out of people, which is why there are so many terrible, unscripted tutorials out there, but it is not as hard as it seems and it will make the rest of the process far easier in compensation. Start with a list. Coding tutorials, in particular, are nothing more than a list of actions - write this, press that, check this. So, when writing your script - start by doing that. Make each action as short as possible: "Open a new file" "Write <?php at the head" "Save file" and so on. It is as boring as hell, but you will not only get the lesson in the right order, you will quickly find out what is missing or what does not work. Break it into scenes. I think most people think that scenes in videos and film are three or four pages long. Well, to be honest, a lot of them are just a few lines. Think of it as a paragraph. Take my bullet points above; creating a new file and preparing it to be used as a php file is a complete action - it is a scene. The next scene maybe setting out two or three empty functions for one particular aspect, or perhaps preparing some other files. These scenes are intentionally short and this will become important later. Turn it into SPOKEN English/other language. This is distinct from language to be read. When we speak, we use short phrases, breath a lot, use huge amounts of semi-colons and frequently start sentences with "and." Your script will be spoken out loud and when you start turning your list of actions into sentences, you must remember this. Read each sentence out loud as you finish it; not in your head or mumbling, but right out loud at the volume at which you will record the finished video. Do not run words together, remember to hit the consonants NICE and clearly and look for the emphasis words; you can ALWAYS use capitals if that HELPS. Recording This is your make or break moment! Actually, no it isn't - you just did that when you wrote your script. If you have written the script well, the the next stages are predestined to be okay. You will make mistakes, but they will be easy to correct. It will only go wrong if you have left stuff out of your script, so read it through a few times to make sure it is perfect. Then PRINT IT OUT. Should you rehearse? Yes and no. You will not be recording this in one lump (that way lies madness) so it is a waste of time rehearsing the entire thing. However, rehearsing each section before recording is a good idea. You need to work out your moves between screens and how you speak the words. In the pro world we would only do a guide vocal at this point and then the voice over would come into my studio with a tidied script and we would re-record the final version. That is why pro stuff is so good. You can take that route if you wish, but the chances are you want to talk as you go. Take One You have written this in scenes, so only record one scene at a time. Play it back when you are happy and make sure it makes sense. These are now bite sized so are much more manageable that working in huge chunks. Put your screen recorder into record and wait a few seconds before you start talking or making screen actions - it will take the pressure off. In the pro world, when the director yells ACTION, there is always a pause while the performers get their brains into gear. And good thing too - otherwise their first words would be a reaction to the shouted word "action" and not as part of the scene as they should be. This applies as much to a corporate as it does to a drama. How many takes you do is up to you - but do not be pissed off if you have to do several. Coders are meant to be perfectionists, and doing a voice over and screen shots requires just the same attitude and degree of patience. What speed should you speak at? Slower than you think is right. This is not a commercial and you are not a professional voice over. Speaking clearly at speed takes YEARS of practice and even some of the best voice overs never get it right. But in corporate presentations, speaking fast is an absolute no-no. Speak evenly, in a considered, non-patronizing way, emphasising all the important words and resist the temptation to speed up towards the end of the sentence. Emphasis is a funny beast - many people believe that we emphasise by speaking louder. But in reality, we emphasise by slowing down the word and leaning on one particular syllable. Which word and syllable you emphasise is important too. There are two main forms of emphasis - importance and comparison. Importance is where you want to make something the most important bit of information. That can be a verb or an adverb or adjective. "It is VITAL that you shut the door." Vital is the important word here - you are emphasising the importance of the action "shut" by saying how vital it is. Comparison is when you are offering an either or - even if you are not explaining or referencing what the other thing might be. "It is vital that you shut the DOOR" Here it is now the door that is important and we are saying you should shut the door, rather than a window or cupboard or anything else. It is making a comparative. You can get it wrong. "What did you do in the nineteen seventies?" "I went to school in the nineteen SEVENTIES." That is the wrong answer, even though it is the correct words. You have made a comparative of the date. You should have said: "I went to SCHOOL in the nineteen seventies." On your printed script as you rehears, underline words that you should emphasise to make sure you don't start making it confusing simply by emphasising the WRONG words, and make marks / where pausing slightly / will also help with clarity. Your reading will be much better and the whole process much easier. Editing. You can ruin good footage in an edit, but you cannot do a great edit out of terrible footage. Do not rely on the edit to save you - get it right at the recording stage and the editing will be more fun. You have written this in scenes and when you edit, respect those scene breaks. You probably broke it up at logical points so it will not help if you try and run it altogether seamlessly. Pause between scenes - if there are major breaks, consider fading to black and slipping in a caption; it might give people break points to stop and take stock and it will help with the clarity. Do not put music over the main content - not that sort of video. Clean up the sound as you go - remove any paper rustles or next doors dog barking! Think about pace - keep the edit pace even. Avoid tricks. Just stick to fading in and out of black - don't spiral stuff in and out or do other things that your editor can do. Again, wrong sort of video. People are not looking at this for your editing skills, but your coding skills. They should not notice the edit at all - just absorb the wonderful knowledge that you wish to impart. Try to avoid zooming into a screen - the quality can fall apart very quickly and you will have achieved nothing. Presenting your final edit You have gone to the trouble of writing a script, so when you put your video up, maybe put the script up there with it - might help people as a quick reference! Make sure you précis your video with a good written summary of what it is about and what you hope the viewer will learn/achieve. And that is about it! I have not covered every single pitfall and problem you will encounter - that would be a book's worth and a boring one at that! But hopefully I have given you some fairly straightforward, easy to follow advice that will just help your next video turn the corner from "nice chatty person telling us something" to "expert giving serious guidance." Happy filming! Joss
    1 point
  36. I don't think it would need to dominate the design at all. You're talking about ticking boxes or multi selecting then a select box with a context menu. It's all about being efficient in handling the content and fields/templates. If you think about it, it's a huge part of what the CMS is: Adding fields and templates, creating pages, updating them, publishing them, unpublishing them, deleting them, changing user access. Surely being efficient at all this is the system's "bread and butter". I think the various modules help plug a gap but I don't see this sort of functionality as occasional or project-specific and hence I see it very much as part of the system core.
    1 point
  37. UPDATE I have updated the Bootwire Starter Profile to version 0.5 This version included a functions.inc file that is included into the head.inc file. This file has demo functions of various Bootstrap functionality that can either be used immediately, or (more properly) used as a starting point for your own functionality. These versions are kept very basic. Functions include: Carousel Collapse (accordion) Tabs Button Dropdown Thumbnails used as a gallery The functions are fully commented with instructions as to which fields were used or need to be created. I have also added a bootwire.js file that includes a couple of bits of JQuery to correct some issues with thumbnail and div alignment over multiple rows. Read the instructions to see how to use this code. Hopefully, this profile is now very functional as a base starting point. Any feedback from testing would be appreciated. Joss Note: I have temporarily removed the link to the demo profile while I update it with the new functionality
    1 point
  38. Ok back to the code pete also thrown around, I wanted to take part in the competition and provide a much cleaner solution to do this if you really want to go with this: // create new empty page array for storing pages $dest = new PageArray(); foreach($pages->find("template=report") as $location) { $max = $location->mountains->sort('-stats_maxElev')->first()->stats_maxElev; $location->max = $max; // save value to page temporarly for sorting later $dest->add($location); // add location to page array } echo '<ul class="blocklist">'; // sort by temporary field and output destinations foreach($dest->sort('-max') as $item) { // sort and get mountain with biggest stats_maxElev $mo = $item->mountains->sort("-stats_maxElev")->first(); echo "<li><p class='tabular'>"; $ft = number_format( round($mo->stats_maxElev * 3.28084) ); $mt = number_format( $mo->maxElevM ); echo "<a href='$item->url'>$mo->name - $mt m / $ft ft</a>"; echo "</p></li>"; } echo '</ul>'; It's still a little akward and not for large large scale as it needs to loop all to get max heights. Only some custom sql query could be taken here to to get page id and use limit. It would be so nice to do it with the code I wrote previous post with using page field, but it doesn't work as of the nature of repeaters.
    1 point
  39. Omg that happens to me too exactly.. Thought this would be only me. But I gues we are all humans more or less
    1 point
  40. most of the time I end up wearing my earbuds for two hours, but forget to turn any music on *edit: Martijn, love that Lollywood song and video
    1 point
  41. I suppose Pete, myself and the other Britons should start working on the British version of the site. It will be particularly genteel. be full of really obscure references to concepts like "colour" and "through" and take tea breaks between pages...
    1 point
  42. $goodvar = stripCrapCopy($dodgyText, goodText, en-GB);
    1 point
  43. Haha! It's gonna be legen... ...wait for it... ...and I hope you're not lactose intolerant because the second half of that word is DARY!
    1 point
  44. I think panictree is absolutely right here. So for internationalization of processwire and community this could be the way to go: Having the main site processwire.com holding all informations in english Subdomains for languages containing the main site translated and adopted to local requirements therefore a language coordinator should be announced (or a group of users) which maintain translations and handles language-specific things forum in english, but it should be possible for non-english-speaking users to post messages, which then might be translated by the language coordinator pideluxe
    1 point
  45. Depends. Here's an example: I'm involved in the development of the Serendipity blog engine. While it's not technically a German project at all, our lead developer (“our Ryan”) is German, as are most of the contributing devs. Since Serendipity also has a lot of German users, it seemed reasonable to set up a German-only subforum on the user forum for those of them who are not confident in their English skills. So now we have quite a few German-only forum threads which “hide” valuable info from people who don't read German, although we usually encourage anyone to use the English subforums if at all possible. So while I think that a certain amount of local activity can be a good thing - basic localized information/documentation, a list of local users/developers etc. -, too much local activity can also lead to a fragmentation of the community. I would, e.g. not necessarily consider a “German PW forum” a good idea. Also, localized documentation is kind of cutting it both ways - while it's a good thing for people who don't read English properly, it is very hard to keep localized docs up to date. Just my 2 cents, though.
    1 point
  46. reading through this, fron the UX standpoint, your best option might be to create admin module, that will be in the main navi, like 'add person'. when you open it, it shows you firstname lastname fields, and when you submit that, a new page is created, with name and title created programatically. for the edit/delete actions, nothing changes (and you seem to have figured those out)
    1 point
  47. 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
×
×
  • Create New...