Jump to content

CaelanStewart

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by CaelanStewart

  1. Hi, Trying to get spellcheck to work on CKEditor (latest released PW, 3.0.98). I noticed that the spellcheck is no longer working on our website, I'm not sure if it is due to updating to the latest version, bit busy to check right now. But regardless, the spellcheck doesn't work. Kind of. I got it to underline misspelled words with the typical red squiggle by adding the following to the CKEditor config (on field edit UI, 'Input' > 'CKEditor Settings' > 'Custom Config Options') { "disableNativeSpellChecker": false } But, now CKEditor overrides the native right click menu, hiding the browser's correction suggestions. I tried to disable it by entering the following value into the 'Remove Plugins' field under the 'Input' tab on the field edit page for a CKEditor textarea field: image,magicline,liststyle,tabletools,scayt,menubutton,contextmenu The reason for 'liststyle' and 'tabletools' entries, according to a post on Stack Overflow, is so that all dependencies of the `contextmenu` plugin are also disabled. To conclude, I understand that one may use 'CTRL+Right Click' to force display of the native context menu, but to be frank that's not simple enough for a lot of clients. How do I disable the CKEditor context menu and use the browser spellcheck without hindrance. Thanks again.
  2. Yeah, Ben C was referring to a post about four or five about his. This one to be precise:
  3. I had the same issue, how did you fix it? EDIT: Nevermind, found it. Cheers.
  4. It's because the events are being triggered too early, before the Color Picker's HTML is even added to the DOM, and also the event was missing for the standard repeater (which I've added). This version of InputfieldColorPicker.js is working now. I can't confirm it works for the repeater matrix, but if the class names used in the JS code above are correct, it should just work. I also added safeguards so that multiple events are not applied to the same elements. /** * An Inputfieldtype for handling Colors * used by the FieldtypeColorPicker/InputfieldColorPicker * * created by Philipp "Soma" Urlich * ColorPicker jQuery Plugin by http://www.eyecon.ro/colorpicker/ * * Licensed under LGPL3 http://www.gnu.org/licenses/lgpl-3.0.txt * */ function initColorPicker() { $('div[id^=ColorPicker_]:not(.color-picker-init)').addClass('color-picker-init').each(function(){ var $colorpicker = $(this); $colorpicker.ColorPicker({ color: $(this).data('color').toString(), onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $colorpicker.css('backgroundColor', '#' + hex); $colorpicker.css('background-image', 'none'); $colorpicker.next('input').val(hex).trigger('change'); } }); }); $('a.ColorPickerReset:not(.color-picker-init)').addClass('color-picker-init').on('click',function(e){ e.preventDefault(); var color = $(this).data('default') && $(this).data('default') != 'transp' ? '#' + $(this).data('default').toString() : 'transparent'; $(this).parent().find('input').val($(this).data('default')).trigger('change'); $(this).parent().find('div[id^=ColorPicker_]').ColorPickerSetColor($(this).data('default').toString()); $(this).parent().find('div[id^=ColorPicker_]') .css('backgroundColor', color) .css('background-image', 'none') .attr('data-color', $(this).data('default').toString()); if(color == 'transparent') { var modurl = $(this).data('modurl'); $(this).parent().find('div[id^=ColorPicker_]') .css('background-image', 'url(' + modurl + 'transparent.gif)'); } }); /* additions (swatches) by @Rayden */ $('div.ColorPickerSwatch:not(.color-picker-init)').addClass('color-picker-init').on('click',function(e){ e.preventDefault(); var color = $(this).data('color') && $(this).data('color') != 'transp' ? '#' + $(this).data('color').toString() : 'transparent'; $(this).closest('.ui-widget-content, .InputfieldContent').find('input').val($(this).data('color')).trigger('change'); $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]').ColorPickerSetColor($(this).data('color').toString()); $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]') .css('backgroundColor', color) .css('background-image', 'none') .attr('data-color', $(this).data('color').toString()); if(color == 'transparent') { var modurl = $(this).closest('.ui-widget-content, .InputfieldContent').find('.ColorPickerReset').data('modurl'); $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]') .css('background-image', 'url(' + modurl + 'transparent.gif)'); } }); } $(function(){ /** * Looks like its due to events being fired too early. */ function delayedInit(event) { console.log(event.type); setTimeout(initColorPicker, 500); setTimeout(initColorPicker, 1000); } $(document).on('opened', '.InputfieldRepeaterItem', delayedInit); $(document).on('repeateradd', '.InputfieldRepeater .InputfieldRepeaterAddLink', delayedInit); $(document).on('repeateradd', '.InputfieldRepeaterMatrix .InputfieldRepeaterMatrixAddLink', delayedInit); initColorPicker(); }); Hope that helps.
  5. I've found a bug in this module, if you set the field's settings to be closed when populated, you must trigger a resize event in order for the map to render when the field is expanded after the field has been populated and saved.
  6. I see, it's that simple! I did look at the docs (even that page), but I missed that part. Cheers.
  7. Hi All, I developed a module for ProcessWire for a project I've been working on for a School's Football Association. It's a website for them to list all of the competitions, rounds, fixtures and results etc. All of these are separated into yearly seasons, and each season is to contain a standard page structure, which the module creates. This module creates a page in the Admin for the seasons to be added from. Now, that's fine, it works, but now we're creating the client accounts with minimal permissions, it seems that only super users can access the page that was created by the module upon install. This page is created from the module's info array, like so: public static function getModuleInfo() { return [ ... 'page' => [ 'name' => 'season', 'title' => 'Add Season', 'permission' => 'season-add' // This did not work ] ... ]; } What I'd like to know, is how I can set the permissions for that page, and allow non-super users to see it in the admin nav and access the page. The page created is of the template 'admin', which I tried applying permissions to for the role created by the module, but that also did not work. The method I tried on the line with the "this did not work" comment was from the comments in the code in /wire/core/Process.php.
  8. @horst, I thought I'd share my implementation of an auto-watermarking module. This module depends on PIM, and also depends on some other stuff specific to the application the module was created for. If anybody wants to use this module for their own uses, you'll have to change the names of fields and templates that you want to apply a watermark to. We (PROGRESS: A Creative Agency) do plan to modify this module for more general use in future, and release it in the module directory. But we are really busy right now, and cannot do so. See the GitHub gist here.
  9. Wow, thanks! Good to see active and responsive development! Though, unfortunately, I had avoided the need to get the variations. At least the next guy won't have an issue! Yes, I'm secretly spying on everything you do! I knew!
  10. @horst, hi there. I wrote the code I posted specifically for this thread - the prefix is present in the actual code. Perhaps you could add an option to disable the caching of variations, or perhaps add a parameter to the getPimVariations() method that ignores the cache, like so? $pim = $page->image->pim2Load('some-prefix'); $pim->getPimVariations(true); // Passing true skips the cache
  11. @horst, an excellent module for ProcessWire, I'm glad that I now have the opportunity to use it in a practical setting. Though, I have encountered some issues, and though I have found workarounds, I thought I'd still make them known here, in case you did not know. So, I've been creating a system that hooks after the pageSave event, applies a watermark to images in a specific field, and overwrite the original file with it. Along the way, I've noticed the following problems: getPimVariations() does not include any images created and saved with Pim2 unless I reload the page: $pim = $image->pim2Load('watermark'); print $pim->getPimVariations()->count; // prints '0', expected '0' $pim->watermarkLogo($somePageimage, 'center', 5)->pimSave(); print $pim->getPimVariations()->count; // prints '0', expected '1' This also happens: // Call pim on image with existing pim variations $pim = $image->pim2Load(); print $pim->getPimVariations()->count; // prints '1', expected '1' $pim->removePimVariations(); print $pim->getPimVariations()->count; // prints '1', expected '0' I tried to get around the above error by calling pim2Load() on the image again, after calling pimSave(), to see if that'd work, and it caused some kind of infinite loop, or whatever - I had to restart the severs: $pim = $image->pim2Load(); print $pim->getPimVariations()->count; // prints '0', expected '0' $pim->watermarkLogo($watermark, 'center', 5)->pimSave(); $pim = $image->pim2Load(); // Causes max_execution_time timeout print $pim->getPimVariations()->count; // doesn't execute, expected '1' Am I doing something wrong? If I am, I think it may be prudent for you to make clear the limitations of your module.
  12. Added some more info and sites...
  13. I was not aware of this section's existence, and since I've submitted a number of sites to the site submission page, I thought it may be good to post them here, too. So, over the past couple of years I've been using ProcessWire, I've had the opportunity to build a decent number of ProcessWire websites. I initially didn't like the idea of using ProcessWire when I was first required to use it, but I soon came regret even thinking that - ProcessWire is now my favourite CMS! Here are some sites where I've been the primary/sole developer (I must say, I did not design these sites, I just turned the designer's visions into reality: PROGRESS: A Creative Agency This is the second iteration of the company I work for's website. it was built to reflect our amended brand identity and scope as an agency. Hilton Extraordinary F&B This website is access only, so you will be unable to see the site in action, however, I have linked to our case study on our website which has some screenshots. Note that the app is being discontinued, since they want a single sign on system. So for one, it just wasn't going to be simple to do the SSO system on the app. And two, the app was kind of pointless anyway, and they just fell for the old "we need an app for that", when a responsive website is just fine for their needs. The Extraordinary F&B site also protects many important static files by restricting access to them, and using Apache X-SendFile to allow access to them when the user is authorised. TY Logistics This website is four a courier company based in the UK. The animating lines was fairly challenging, but I got there in the end. The animating lines work by generating an SVG path string on the fly, using various elements as reference points, setting the stroke-dasharray and stroke-dashoffset to the path length, and then animating stroke-dashoffset to zero. It utilises ScrollMagic for managing the scroll-based animations. Guy Hollaway Architects This website was built for an architects based in London and Hythe, UK. Folkestone Harbour Arm This was created to list events and information about the newly refurbished and converted Harbour Arm in Folkestone, United Kingdom. Unfortunately, there are no events on the site right now, which makes some areas look rather bare. However, there is a screenshot available on the page for this site on the sites directory. Visit Romney Marsh This was a budget-wise project to promote the Romney Marsh in the south-east of England. It features a Google Maps integration for the listing of attractions and accommodation. And has another, very similar map for events on and around the Romney Marsh. Hythe Care Homes This has to be one of the coolest care home websites I've seen! We developed a site for Hythe Care Homes, a care business consisting of three separate homes for old-aged people. More to come soon when I have time. On my lunch break right now, you see.
  14. You were close, the default PW installation set the 'created' column value (not the default value) to 0000-00-00 for the home, admin, page, add and other default PW pages that come with the PW install. I changed all of those to some other date before the modified date for each of those rows, and the update ran perfectly. The version first used for this PW site is 2.5, so maybe MySQL removed support for zero-dates, and that's why it cropped up now. But I haven't touched those columns/rows and only AIOM plugin has been installed.
  15. Small update: I had pasted the queries into the wrong areas in phpMyAdmin, so I had thought it had executed successfully none of them had actually been executed. I have a PHP error when I publish a page now.
  16. Hi, Upon upgrading a site from 2.6.1 to 2.7.2 (latest stable), Update #12 fails with an SQL error: I narrowed it down to this query (SystemUpdate12.php): ALTER TABLE pages ADD published datetime DEFAULT NULL AFTER `created_users_id` The strange thing comes now: the error only seems to arise when PHP executes the query with the PW's DB class. I executed the queries in SystemUpdate12.php manually in phpMyAdmin and, and force update 12 to return true in the 'update' method of the SystemUpdater class and the other updates ALL worked seamlessly, only that one was an issue. PW seems to be functioning fine, too. EDIT: Turns out I was a silly sod and didn't paste the queries in the right place in phpMyAdmin, and I had though they'd executed when they actually hadn't. So when I pasted the above query in the correct place in phpMyAdmin, I got the same error as I did in PW: I tried repairing the table, before I tried the above and that had no effect. The installation has no other plugins (other than AllInOne Minify) or modifications to the 'pages' table. Bit of a weird issue, but I got it working pretty quickly.
  17. it also occurred to me I can do this, which is still shorter, but not so tidy: foreach(['pages', 'input', 'sanitizer'] as $w) $$w = Wire($w);
  18. Thank your for taking the time to clear that up. I have been enlightened!
  19. I somewhat disagree. The library may well try and define a class called 'Page' for instance, or a function called 'Wire' as much as it would the $page variable. And plus, consider the following code: <?php global $hello; $hello = "hello"; function goodbye() { $hello = "goodbye"; } echo $hello; goodbye(); echo $hello; The output is not "hellogoodbye" but is in fact "hellohello" as the '$hello' variable was never instantiated with the 'global' keyword inside the function. So unless this library sets the variable in the root scope, or also uses a global named '$hello' or '$page', then there will be no problem. Yes, all said ways are repetitive, but I find the cleanness and brevity of the 'global' keyword approach preferable.
  20. Hi All, Just a quick one, not a big issue. To access API variables from inside a function with ProcessWire, I believe is a tad tedious. Having to do this, just to access a few variables is a bit annoying, and frankly repetitive: $page = Wire('page'); $sanitizer = Wire('sanitizer'); $user = Wire('user'); $users = Wire('users'); $input = Wire('input'); When it'd be much easier (and faster, and less typo prone) to do this: global $page, $sanitizer, $user, $users, $input; I've seen the possibility of confusion mentioned before as a reason against this. But let's be realistic, if somebody is writing templates and making use of the ProcessWire API, they are going to know off the top of their head exactly which API variables they need. In fact, I purposefully avoid declaring variables that have the same name as PWs API variables when I'm writing PW templates. So my question really is: Why not?
  21. Sorry all, forgot I posted this, I am still interested. We did have a problem with a site I developed, also using ProcessWire (you can see it at http://www.guyhollaway.co.uk/). We used the AllInOneMinifier (AIOM) plugin, and the CSS files did not load sometimes. This has since been resolved. I'm pretty sure it's not our server's performance. We have a 4GB Linode VPS running our websites, and average load is still relatively low. Most of our sites on the server run through cloudflare, we have automatic gzipping of resources on most sites, our server is pretty well optimised.
  22. Hi All, We (the company I work for) used ProcessWire for a large internal resource library for an international company. It currently has 1,500+ active users, and hosts lots of documents and videos. It is expected to grow much larger in the near future too. The main point of this post is to ask if anybody else has used ProcessWire for similar things, and whether you have any tips to keep optimal performance. On a side note: We have noticed some strange behaviour occurring in the back end sometimes, such as a random delete field with a checkbox appearing in repeaters that don't have a field labeled "Delete", sometimes the CKEditors on a page won't initialise and leave a standard textarea, and sometimes the user listing page doesn't load first time. None of these are particularly impeding, as it doesn't happen too often. It is currently using ProcessWire 2.5.3, which we will be upgrading to the latest version soon, as we are in the process of adding new functionality, such as a per-user blog/comments system with an approval system.
  23. Hi, Half an hour after I posted this I came up with a similar solution, except using ProcessWire's Selector API. It's quick enough, and we've throttled the app to only check for new content every couple of hours.
  24. Hi, We have a client, who's website has grown quite large now. With a custom blog implementation, various resources sections, 434+ users registered (via a custom, designed registration UI that allows only company/associate employees to register. There is an accompanying mobile app for it, I have written an API so that the app and ProcessWire can communicate. What I need to do is check if any sub-pages within parent page (with no limit to depth) have been edited with the least processing possible, and the only way I can think of right now is to iterate through the pages, and check every lastEdited date against a set cached dates stored by the app. We just want to reduce the amount of processing required by the apps requests.
  25. Hi, We managed to pull this off relatively quickly. I made a log of every field/template/setting change we made to the site locally, I then downloaded the live site and put it offline while I upgraded the live site. I went through the live site and repeated each of the changes in the l had logged down, I then added in the few news article they have and then I was done. It only took a couple of hours, so the downtime was minimal. It is possible to upgrade ProcessWire, but it can be a bit of a pain in the butt. But in all honesty, ProcessWire probably wasn't the best choice of software for the kind of site I used it for, it was never designed to have a registration system and hundreds of users, it seems like it was designed for only a few users and no registration system. Let alone an API system for use with a mobile app. Nevertheless, ProcessWire has dealt with the strain reasonably well, and with some tweaks and some performance enhancing modules, it runs quite fast with 300+ users on.
×
×
  • Create New...