-
Posts
5,008 -
Joined
-
Days Won
333
Everything posted by Robin S
-
[Solved] API image upload I need to replace instead of adding
Robin S replied to Xonox's topic in API & Templates
I had to handle this kind of validation in my AddImageUrls module, so the code there might be useful for anyone else needing to do the same: https://github.com/Toutouwai/AddImageUrls/blob/f67ebe9729fc54d629fe939be2f9d3e9c7f68c16/AddImageUrls.module#L118-L170- 9 replies
-
- 2
-
-
- image upload
- api
-
(and 1 more)
Tagged with:
-
You can achieve loads of different scrolling effects with a library like http://scrollmagic.io/ Example similar to what you are describing: http://scrollmagic.io/examples/basic/section_wipes_natural.html
-
[Solved] API image upload I need to replace instead of adding
Robin S replied to Xonox's topic in API & Templates
I don't think any of the image field settings are honoured by $pageimages->add(). Not "valid file extensions", not "maximum files allowed", not min/max width/height, etc. It's a shame as it means you have to do a lot of manual validation if using add().- 9 replies
-
- 1
-
-
- image upload
- api
-
(and 1 more)
Tagged with:
-
Right, I understand now. You are wanting to give a role (let's call the role "manager") the ability to edit roles/permissions and add new roles/permissions. First thing to know is that in doing this you would be going well off the map of what is documented in ProcessWire and straying into some potentially dangerous territory. Normally only superusers manage roles and permissions, and if you decide to deviate from that you'll want to do your own thorough testing. It sounds risky to me and not something to be done lightly. But I took a look at what's needed to enable this and it seems that the steps are... Manage roles 1. Create new permission "role-admin". 2. Give this permission to the manager role. 3. Open the "role" template at Setup > Templates (you'll need to show system templates in the filter section). On the Access tab allow the manager role to "Edit Pages" and "Add Pages". 4. Open the "admin" template, and on the Access tab allow the manager role to "Add Children". Manage permissions 1. Create new permission "permission-admin". 2. Give this permission to the manager role. 3. Open the "permission" template at Setup > Templates (you'll need to show system templates in the filter section). On the Access tab allow the manager role to "Edit Pages" and "Add Pages". 4. Open the "admin" template, and on the Access tab allow the manager role to "Add Children". You can skip this step if you already did it.
- 7 replies
-
- 3
-
-
-
- roles
- permissions
-
(and 1 more)
Tagged with:
-
It's explained in this blog post: https://processwire.com/blog/posts/new-user-admin-permissions-automatic-version-change-detection-and-more-2.6.10/#new-user-admin-permissions
- 7 replies
-
- roles
- permissions
-
(and 1 more)
Tagged with:
-
Hi Adrian, Does the "User dev template" feature do anything with _main.php if using the delayed output strategy? If not, what do you think about adding a feature where _main.php is replaced with _main-dev.php if that file exists? Of course the relevant file names would depend on what is defined in $config->appendTemplateFile and the Tracy "User dev template suffix" setting. And to round things out I guess do the same for $config->prependTemplateFile (_init.php).
-
v0.1.10 released. Fulfilling a request by @adrian, if the currently edited page has children or the user may add children, a caret at the end of the breadcrumbs reveals a dropdown of up to the first 25 children and/or an "Add New" link.
- 79 replies
-
- 6
-
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Great idea, thanks! Added in v0.1.8.
- 79 replies
-
- 4
-
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Yes, it was an oversight. As more states need to be indicated in the dropdown items it gets harder to come up with distinguishable and tasteful styles for all of them. I think the hidden and unpublished pages need to use the same styling as in Page List, so that means I've had to change the styling for uneditable pages - these are now indicated by italics and reduced opacity (and the "not-allowed" cursor for devices that support hover). Other changes introduced in v0.1.7: The dropdowns now take $page->listable into account, so non-listable pages do not appear in the dropdowns. There is now a hookable BreadcrumbDropdowns::getSiblings method in case anyone wants to override the listed siblings for a page. This won't be needed in most cases though.
- 79 replies
-
- 1
-
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
I can't think of any reason it wouldn't work on multi-language fields. What specifically is not working for you? Double-check that you have added the Remove Blocks textformatter to the field in question... ...and you have placed your delimiters around the content you want removed.
-
Cool, I didn't know that one. That syntax works for a plain textarea field, however none of the variants are working for me in a CKEditor field. Probably the HTML tags prevent the normal markdown parsing.
-
First thing would be to use Tracy to check what the value of $x is when you create your repeater pages. Your post doesn't show where this variable is declared - maybe it is being reset within your loop or isn't incrementing as expected for some other reason.
-
module Recurme – Processwire Recurring Dates Field & Custom Calendar Module.
Robin S replied to joshuag's topic in Modules/Plugins
@joshuag, how can I configure Recurme permissions so that users can see and use existing calendar(s) in admin, but not configure/delete/add new calendars? I figure what I've described is the most commonly needed scenario, where the developer creates and configures calendars but users can use them to see/edit/add events. It seems that if I give the recurme-calendar permission to a role then the user gets too much freedom to create disaster, but if I don't give them the permission then they cannot see/use the calendar. To clarify, in the first screenshot it is the cog icon I want to hide, not the calendar itself. Edit: I see now that you can't add new events from the admin calendar. Feature request: it would be cool if you could though, so that hovering a day showed an "Add new" link that started the process of adding a new event with the start date pre-filled. -
My final code for {mailto} tag replacement: $tags = findSmartyMailtoTags($markup); // Ryan's regex function as shown above foreach($tags as $tag) { $href= 'mailto:' . $tag['attrs']['address']; if($tag['attrs']['subject']) $href .= '?subject=' . rawurlencode($tag['attrs']['subject']); $link_text = $tag['attrs']['text'] ?: $tag['attrs']['address']; $replacement = "<a href='$href'>$link_text</a>"; $markup = str_replace($tag['tag'], $replacement, $markup); }
-
Thanks Ryan, that is fantastic! I was curious about which would be faster, but after testing both functions they seem to be nearly identical in terms of speed.
-
- 79 replies
-
- 5
-
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
That's great, thanks! Just a couple more things and I'll have it sorted: 1. I need the match to be specific to the {mailto...} tag. That regex would currently also match {foo animal="cat"} 2. I need one of the matches to be the entire tag, so I can replace the tag with my reconstructed mailto link. Any ideas how it could be modified for those two objectives?
-
My knowledge of regular expressions is pretty weak - one of the things I need to improve on. If anyone can offer any help for the following scenario it would be much appreciated. I need to import a heap of content that contains Smarty tags for encoded email addresses. When I import the content I want to convert these tags to regular mailto links. An example tag: {mailto address="someone@domain.com" encode="javascript" text="link text" subject="The subject line"} And another: {mailto address="someone@domain.com" encode="javascript"} I have got some way with this but am falling down when it comes to optional capturing groups. The requirements for my regex are: The regex must match {mailto all the way through to } (because I want to ultimately remove the whole tag) The address parameter must exist, and I want to capture its contents: someone@domain.com The text parameter may exist, and I want to capture its contents if it does exist: link text The subject parameter may exist, and I want to capture its contents if it does exist: The subject line Thanks in advance!
-
I like idea 1 - will explore that. Idea 2 I don't think is necessary - even technophobes know how to copy/paste text if they want to duplicate it.
-
module Recurme – Processwire Recurring Dates Field & Custom Calendar Module.
Robin S replied to joshuag's topic in Modules/Plugins
@joshuag, currently when an event has no start time or end time entered, Recurme populates "time" and "timeEnd" with "12:00 am". This makes it difficult to distinguish between events that have those fields empty (can often be the case for end time in particular) and events that happen to actually have 12:00 am entered as their start time or end time. Do you think you could populate "time" and "timeEnd" with "false" or something else recognisable if start time or end time is left empty for an event? -
Remove Blocks A textformatter module for ProcessWire that removes blocks of text/markup between configurable delimiters from output. This allows you to "comment out" blocks of text/markup so they remain present in the field but are not shown in the front-end output. This can be handy if content needs to be removed temporarily and will later be reinstated. Or you could use a commented block as a placeholder to indicate to an editor where some content should be added. Installation Install the Remove Blocks module. Configure the open and close delimiters if needed. The default open delimiter is {{ and the default close delimiter is }}. Tip: don't use delimiter characters that CKEditor will encode to HTML entities, e.g. >. Usage Add the Remove Blocks textformatter to one or more fields. Add the open and close delimiters around any content that you want to be removed from output. https://github.com/Toutouwai/TextformatterRemoveBlocks http://modules.processwire.com/modules/textformatter-remove-blocks/
-
There is no hookable method especially for images inserted in a CKEditor field. But two options: 1. Use/code a textformatter module to manipulate the image tags within a field. This approach has the advantage that you don't have to mess around with your field settings to make sure the classes and attributes you want to add are allowed by ACF and HTML Purifier. There is even an existing textformatter module you can use: https://modules.processwire.com/modules/textformatter-srcset/ 2. Hook the saving of pages (e.g. Pages::saveReady) and modify the markup in your CKEditor field before it is saved. The approach would be similar to the textformatter option - you parse the markup to identify the image tags (using regex or a DOM parser such as DOM) and use the src attribute to get the relevant Pageimage to create your different sizes from. The difference is that this parsing/modification is done whenever the page is saved rather whenever the field value is loaded. Option 2 is more efficient, but I would tend to go for option 1 because it's not destructive and gives greater flexibility to make changes down the line. And maybe that existing textformatter module is just what you need.
-
My vote goes for the status quo - no need to change output formatting or have an indicator IMO. I think the best thing is to get into the habit of always turning output formatting off before setting any value to a page (I tend to do it individually for the page I'm changing rather than for all pages). I think it's simplest to follow that rule everywhere - frontend, backend, in a module, etc. It's just a single line of code, and if output formatting is already off for any reason then it doesn't do any harm to explicitly set it off to be sure. If Tracy was to get involved in output formatting I think it would add confusion, particularly for new users who are still getting to grips with output formatting.
-
Hooking ProcessPageSearch::findReady might be better because it's more specific to autocomplete and the method looks like it exists for just this sort of purpose. $wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) { $selector = $event->arguments(0); // Manipulate $selector as needed... }); /** * Hookable function to optionally modify selector before it is sent to $pages->find() * * Not applicable when Lister is handling the search/render. * * #pw-hooker * * @param string $selector Selector that will be used to find pages * @return string Must return the selector (optionally modified) * */ public function ___findReady($selector) { return $selector; }
-
PW cannot handle circular references in Page Reference fields: https://github.com/processwire/processwire-issues/issues/152 https://github.com/processwire/processwire-issues/issues/572