-
Posts
1,334 -
Joined
-
Last visited
-
Days Won
62
Everything posted by BitPoet
-
Keep in mind that the regular processInput method is still called afterwards, so any assignments to the page's fields will be overwritten by the submitted data. You need to fetch the $input argument from $event->arguments(0), read the submitted value from there and assign your computed value to $input["reservationdeadline"] (peek into the POST data in the developer console if you're unsure what date format to use). Don't modify $page, let the regular PW logic handle that part. Though you'd probably find it easier to remove the "required" option and run your logic in a saveReady hook.
-
Pagetable field stripping off decimals when using german language?
BitPoet replied to bernhard's topic in General Support
and peeked again in the github repo to find that the setLocale part was added in 2017, so 2.7.2 won't have that (yet). So, yes, my line is likely a no-op. -
Pagetable field stripping off decimals when using german language?
BitPoet replied to bernhard's topic in General Support
I peeked into the setLocale method in Languages.php ($locale is fetched from the translation in wire--modules--languagesupport--languagesupport-module). } else if(strpos($locale, ';') !== false) { // multi-category and locale string, i.e. LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C foreach(explode(';', $locale) as $s) { // call setLocale() for each locale item present in the string if(strpos($s, '=') === false) continue; list($cats, $loc) = explode('=', $s); $cat = constant($cats); if($cat !== null) { $loc = $this->setLocale($cat, $loc); if($loc !== false) $setLocale .= trim($cats) . '=' . trim($loc) . ";"; } } $setLocale = rtrim($setLocale, ';'); if(empty($setLocale)) $setLocale = false; } LC_ALL=de_DE is a different case, as it contains no semicolon and is therefore passed verbatim as the value to setlocale. -
Pagetable field stripping off decimals when using german language?
BitPoet replied to bernhard's topic in General Support
XXX will be treated as an invalid locale and PHP falls back to the system's default locale (which is also used when the translation is empty). My line wouldn't be ignored, but unless there are any other functions using the locale, e.g. if you use a date format with weekday or month strings somewhere, there won't be any visible differences. -
Pagetable field stripping off decimals when using german language?
BitPoet replied to bernhard's topic in General Support
That de_DE could the culprit. You could try putting "LC_ALL=de_DE.utf8;LC_NUMERIC=C" (without the quotes) there instead (through the backend) to use German locale settings for everything but numeric things, for which the system's default locale will be used. -
Pagetable field stripping off decimals when using german language?
BitPoet replied to bernhard's topic in General Support
There's a translated string for LanguageSupport.module named "C" that holds the locale string passed to PHP's setlocale() function. -
Well, since adding and deleting FieldsetOpen fields also affects the closing field, this is a little stumbling block. I've opened an issue with a suggested fix.
- 7 replies
-
- 3
-
-
-
- duplicate fields
- fieldsetclose
-
(and 2 more)
Tagged with:
-
@theo: Thank you for the feedback, and I'm glad you like my module I'm going to look into that behavior as soon as I have a little time on my hands.
-
That's what OR-groups are for. $userTest = $users->get("(nick={$input->post->nick}), (email={$input->post->email})"); Btw., don't forget to sanitize your input before using it in selectors.
-
Uploading/saving a file into a file fieldtype on Windows
BitPoet replied to flydev's topic in General Support
I just ran simple one-liners: REM Native mkdir REM ============ REM Default PHP 7.1: php -r "namespace ProcessWire; include('index.php'); $path = $config->paths->assets . 'test1/1/2/3'; mkdir($path, 0, true);" REM 7.0: "C:\Program Files (x86)\PHP\v7.0\php.exe" -r "namespace ProcessWire; include('index.php'); $path = $config->paths->assets . 'test2/1/2/3'; mkdir($path, 0, true);" REM 5.3: "C:\Program Files (x86)\PHP\v5.3\php.exe" -r "namespace ProcessWire; include('index.php'); $path = $config->paths->assets . 'test3/1/2/3'; mkdir($path, 0, true);" REM WireFileTools REM ============= REM Default PHP 7.1: php -r "namespace ProcessWire; include('index.php'); $path = $config->paths->assets . 'test4/1/2/3'; $ft = new WireFileTools(); $ft->mkdir($path, true);" REM 7.0: "C:\Program Files (x86)\PHP\v7.0\php.exe" -r "namespace ProcessWire; include('index.php'); $path = $config->paths->assets . 'test5/1/2/3'; $ft = new WireFileTools(); $ft->mkdir($path, true);" REM 5.3: "C:\Program Files (x86)\PHP\v5.3\php.exe" -r "namespace ProcessWire; include('index.php'); $path = $config->paths->assets . 'test6/1/2/3'; $ft = new WireFileTools(); $ft->mkdir($path, true);" -
[solved] How to disable CKEditor's style preview in the dropdowns?
BitPoet replied to szabesz's topic in General Support
This is one of the few cases where I don't care that much since getting the new CSS selectors isn't difficult, so I just make sure to document these small UI hacks in a dedicated place in the admin area. The format and styles plugins (as well as some other basic widgets that are internally realized as plugins) are already included in the main ckeditor.js. -
Uploading/saving a file into a file fieldtype on Windows
BitPoet replied to flydev's topic in General Support
It does work here (tested on PHP 7.1, 7.0 and 5.3) both with native mkDir and WireFileTools. -
[solved] How to disable CKEditor's style preview in the dropdowns?
BitPoet replied to szabesz's topic in General Support
I've been looking for a solution to that years ago, and it seems the answer hasn't changed What I use as a workaround is to add larger styling for the combos in question with AdminCustomFiles, applying width and height to div.cke_combopanel__format and div.cke_combopanel__styles. -
Getting tab label in different languages on frontend fails
BitPoet replied to Juergen's topic in API & Templates
If tab1 is a FieldsetTabOpen, you need to use $template->fieldgroup->getField('tab1')->getLabel($language); -
module Dev Module to setup Default "New PW"
BitPoet replied to [Code] Specialist's topic in Module/Plugin Development
Why not set up the first site (or a kind of template site), run Site Profile Exporter, copy the created profile into the install package and run the regular installer with that profile for the subsequent domains? -
Published date not set and unable to perform update #12
BitPoet replied to Mats's topic in General Support
What's the exact error you get? -
Published date not set and unable to perform update #12
BitPoet replied to Mats's topic in General Support
Can you show us the output of SHOW VARIABLES LIKE 'sql_mode'; from MySQL? Which PW version are you installing / upgrading to? -
Published date not set and unable to perform update #12
BitPoet replied to Mats's topic in General Support
Did you make some space in /tmp? -
Add additonal settings to image field in template context
BitPoet replied to Juergen's topic in API & Templates
Try hooking InputfieldImage instead of FieldtypeImage. -
If anybody wants to give it a try, here's a little attempt at an OR-group capable PageArray extension (just to see if this might be worth investing some more time and creating a PR). Usage: $regularPageArray = $pages->find("template=mytemplate"); // Returns an OrGroupsPageArray instance with the contents of $regularPageArray: $groupable = $regularPageArray->getGroupable(); $groupable->filter("fieldA=1, (fieldB=today), (fieldB=tomorrow)"); // or $filtered = $groupable->find("fieldA=1, (fieldB=today), (fieldB=tomorrow)"); OrGroupsPageArray.zip
-
Add additonal settings to image field in template context
BitPoet replied to Juergen's topic in API & Templates
Shouldn't that be addHookAfter? -
Actually, you're right.
-
And append ->unique() to remove duplicates.
-
Yes, OR-groups unfortunately only work for database searches, not in-memory operations on PageArrays.
-
@oma: Like @kongondo, I'm not completely sure if I'm getting your question right. Are you, perchance, looking for or groups, i.e. a way to tell the filter "return all events that fulfill the other criteria and are either today or next month"? In that case, you need to still use commas but surround the individual selector parts that are sufficient for a successful match with parenthesis. $events = $pages->find( // Basic selector for all events not yet ended "template=events-detail, events_detail_dates_final_date>=$today" // First OR-group, today's events . ", (events_detail_dates_upcoming_start_date<=$now)" // Second OR-group, events next month . ", (events_detail_dates_next_month_start_date<=1519844959, events_detail_dates_next_month_end_date>=1517512159)" ); This would get all events-detail pages not yet ended and - sticking to your example and using parenthesis to outline PW's syntax - either (running through today) or (running next month).