CaelanStewart

Members
  • Content Count

    43
  • Joined

  • Last visited

Community Reputation

35 Excellent

About CaelanStewart

  • Rank
    Jr. Member

Recent Profile Visitors

1,031 profile views
  1. CaelanStewart

    Don't be sorry, not your fault I worry haha. And I shall speak to my boss about getting the account details. Thanks
  2. CaelanStewart

    Thank you, that's a relief! I was worrying that I'd somehow upset somebody. I can be a little direct and in the process cause upset so in the back of my mind I was worrying that might be it. My boss made the actual purchase, I shall speak with him to get his PW account! Thanks again.
  3. CaelanStewart

    ATTENTION MODERATORS: I just posted this thread a couple of hours ago. I reloaded the page and it said the thread doesn't exist. I apologise if I broke some rule, but if this thread shouldn't be posted, please send me a private message telling me what I have done wrong, rather than just deleting the thread! EDIT: Looking at the rules, I can see it says that suggestions should be posted elsewhere. I guess this thread is simultaneously a suggestion and a call for assistance. If any if you guys know of a quick and easy way to do this, that's brilliant. If not, I'll have to find another way. But please clarify with me what the thread was deleted for. Again, I apologise this is public, but I known not who deleted my original thread. ORIGINAL THREAD: Hi, A client just contacted us saying that they'd like to be able to preview pages before they save them. So we purchased ProDrafts since it seemed to enable this functionality. However, some issues emerged with the drafts feature that mean it cannot work for our use case without changes made to the code that check for draft versions of a page. There are several sections on this website where an arbitrary number of child pages can be added, which are then displayed on the parent page. Hence, the child pages are not actually viewable, since they don't have a template file, they act purely as a sort of repeater field. I would have used a repeater field should I have known this would happen, however, at the time, it didn't feel right to use a repeater due to the potential for a number of items to be added that might make a repeater field feel a little clunky. So, the core of my issue, I can find no way to view the drafted version of the child page, which is displayed on the parent page. I read the documentation for ProDrafts, and I can see the section at the bottom detailing the API and how I can do what I ask with some changes to the code in the right places However, that doesn't really make sense to me. Is there not an option, which for logged in users, enables at the API level the showing of drafted pages by default, should any exist? Surely it would be as simple as forcing the appending of the selector option that includes drafted pages. Or if that is not an option, if I've enabled drafts on a page which has no template file, but which is a child of a page which does have a template file, could you not just show the preview controls for the parent? This would be opt in, since I'd need to enable drafts on the template which has no file first. And it makes little sense to use drafts on a page which is not viewable if I cannot view the drafts first. Is there some way to do this that's built in? Thank you all in advance
  4. CaelanStewart

    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.
  5. CaelanStewart

    Yeah, Ben C was referring to a post about four or five about his. This one to be precise:
  6. CaelanStewart

    I had the same issue, how did you fix it? EDIT: Nevermind, found it. Cheers.
  7. CaelanStewart

    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.
  8. CaelanStewart

    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.
  9. I see, it's that simple! I did look at the docs (even that page), but I missed that part. Cheers.
  10. 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.
  11. CaelanStewart

    @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.
  12. CaelanStewart

    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!
  13. CaelanStewart

    @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
  14. CaelanStewart

    @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.
  15. CaelanStewart

    Added some more info and sites...