Jump to content

Karl_T

Members
  • Posts

    158
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Karl_T

  1. I will try the below module in my next aws project. It seems like that it uploads the assets to S3 and return according S3 url if I don't get it wrong. You may take a look.
  2. Bump. I confirm the same issue in a fresh installed latest PW3. I want to debug but TracyDebugger is not loading in this module.
  3. Thanks for this great tutorial! I am impressed by your PW admin UI manipulation skill all time. This tutorial could definitely get someone's hands dirty. Yes it is really quite hard imo because the related information is not easy to find. They do exist but always sit inside various post replies. It just looks like a missing piece to beginners. I long for a more in-depth version of this tutorial, or a complete guide precisely, that shows how to accurately use wiretab, pw-modal, panel, buttons etc. and layout all of them properly. I discovered a bit from reading through the core files and modules by trial and error but I believe I still have a long long way to go. I believe many people, like me a while ago, stuck in the layout phase and then give up their modules development.
  4. I had the same wonder a while ago. You may take a look at Ryan's reply here: https://github.com/processwire/processwire-issues/issues/224
  5. Hi there. I have encounter another issue that what ever I change the sharpen and quality during cropping, the sharpen and quality are always showing soft and 90 respectively after confirm the crop. The resulting images are the same too, so it is simply not a display issue.
  6. This is the first time I encounter this issue. Thanks for the tip for fixing it.
  7. Thanks for this great module! I am finding responsive image solutions and then I luckily come here. I have encountered an issue after I install the module. I tried to change the inputfield type of an existing image field to croppable image3. The croppable image3 specific crop setting is not there after switching. So, in the edit, it is just look the same as the normal image field. Sorry if it has been reported before as I did not read all replies one by one.
  8. You could use pw-append on sidebar in template when it is needed instead of putting it inside _main.php. In _main.php <div id="main"> FULL WIDTH OR SIDEBAR IN HERE </div> Inside some-template.php <div id='sidebar' pw-append='main'></div>
  9. Hi @kixe, I found that single select is not working. I have fixed the issue based on your files. I forked the original repo here: Github
  10. There is another related bug. If you have more than one image fields, you will see the image all in the same size even you have adjust the size bar individually after you save and refresh.
  11. Recently I am fixing this issue, again, and I find this post in google. There's another solution that I found in the ListerPro forum before. The created, modified, publish date format can be changed via language translation. The language support module has to be installed in this case. Go to Setting > Language > choose the language you use > Click Find Files to Translate button > click /wire\modules\Process\ProcessPageLister\ProcessPageLister.module and submit > translate "rel" field(should be listed on top) to wanted format like Y-m-d Reference: https://github.com/processwire/processwire/blob/57b297fd1d828961b20ef29782012f75957d6886/wire/modules/Process/ProcessPageLister/ProcessPageLister.module#L238
  12. I found the solution, but in an ugly way. You may find the code in github.
  13. Ya, you are right. Thanks for pointing this out!
  14. Thanks for letting me know your great module. The module is really handy and fit for many use case. I have waited long to see excel like inputfield like this one as I do not have the ability to make one as I am not good at database. The case I encounter is that I need the permission control over the price for different country. I think it would be the best to make the field multi-language enabled. Below is the update. Only default language is saved correctly, while other languages are still null if I saved any value into them. The issue is that the sanitizeValue() input $value is always null for other languages, while sleepValue() $value is good. I cannot find where the value get removed. <?php namespace ProcessWire; require_once(wire('config')->paths->root . 'wire/modules/LanguageSupport/FieldtypeLanguageInterface.php'); /** * Multi-language capable float field * * ProcessWire 3.x, Copyright 2016 by Ryan Cramer * https://processwire.com * * */ class FieldtypeFloatLanguage extends FieldtypeFloat implements FieldtypeLanguageInterface { public static function getModuleInfo() { return array( 'title' => 'Float (Multi-language)', 'version' => 0, 'summary' => 'Field that stores a floating point (decimal) number in multiple languages', 'permanent' => false, 'requires' => array('LanguageSupportFields'), ); } /** * Sanitize value for storage * * @param Page $page * @param Field $field * @param LanguagesValueInterface|float $value * @return LanguagesPageFieldValue * */ public function sanitizeValue(Page $page, Field $field, $value) { foreach($value as $languageName => $languageValue) { $languageName = $this->wire('languages')->get($languageName)->name; if(!strlen("$languageValue")) $value->$languageName = ''; if(!is_float($languageValue) && !is_int($languageValue)) { $value->$languageName = $this->wire('sanitizer')->float((string) $languageValue, array('blankValue' => '')); } if(is_null($field->precision)) { $value->$languageName = (float) $languageValue; } else { $value->$languageName = round((float) $languageValue, $field->precision); } } return $value; } /** * Return the database schema in specified format * * @param Field $field * @return array * */ public function getDatabaseSchema(Field $field) { $schema = parent::getDatabaseSchema($field); $languageSupport = $this->wire('modules')->get('LanguageSupport'); foreach($languageSupport->otherLanguagePageIDs as $languageID) { $schema['data' . $languageID] = 'float'; $schema['keys']["data{$languageID}"] = "KEY `data{$languageID}` (`data{$languageID}`)"; } return $schema; } /** * Format value for output, basically typecasting to a float and sending to textformatters from FieldtypeFloat * * @param Page $page * @param Field $field * @param LanguagesValueInterface|float $value * @return float * */ public function sleepValue(Page $page, Field $field, $value) { $precision = $field->precision; foreach($value as $languageName => $languageValue) { $languageName = $this->wire('languages')->get($languageName)->name; if(is_null($precision)) $precision = self::getPrecision($languageValue); if(!is_string($languageValue)) $value->languageName = number_format($languageValue, $precision, '.', ''); } return $value; } }
  15. I am currently cloning core text language field into float field as I want to use the multi-language function as a multinational solution. I am using the float field as price field, since the price is different for different country(language). Below is my trial, unfortunately a failed one. Any value will be saved as zero or null in database. I would like some advises on this. Thanks. EDIT: please ignore the below code. Updated code has been posted in reply
  16. Wow, this is exactly what I am looking for. Great thanks!
  17. Currently the page tree(name=page) under admin is locked. I would like to generate a page to place above the page tree, using $page->sort = 0, but it is not possible before removing the statusSystemOverride attached to it. I tried to remove the status like this: $pages = $this->wire('pages'); $tree = $pages->get('name=page, template=admin'); $tree->removeStatus(Page::statusSystemOverride); $tree->save(); And recover the status after saving my generated page $p = new Page(); $p->template = 'admin'; $p->title = 'Some Page'; $p->name = 'somepage'; $p->parent = $pages->get(2); $p->process = 'SomeProcess'; $p->sort = 0; $p->save(); $tree->addStatus(Page::statusSystemOverride); $tree->save(); And the Page group is disappeared on the sidebar. I cannot recover it and need to reinstall the PW. I am developing a module so I would like to know the correct way to place page above the page tree by API not by drag and drop. Thanks.
  18. テラバトル2のアイテムゲットガチャで、激レアクラスの守護者をゲット!! #DMMGAMES #DMMガチャ[09/09 15:15:37] https://t.co/D2E8o65Hoy

  19. I solve the problem by overriding the LanguageSupportPageNames core module. 1. Copy the LanguageSupportPageNames.module from wire/modules/LanguageSupport/ to site/modules/ 2. Change the line if(!$setLanguage) $setLanguage = $languages->get('default'); to (for example, if you want to redirect some users to chinese site) $user_lang = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE'])[0]; if($user_lang == 'zh-TW' || $user_lang == 'zh-HK' || $user_lang == 'zh-CN' || $user_lang == 'zh-SG') { if(!$setLanguage) $setLanguage = $languages->get('chinese'); //language name that you want to redirect from the above language code }else{ if(!$setLanguage) $setLanguage = $languages->get('default'); // else go to default language } 3. Go to Admin > Modules and refresh modules. Choose to use module inside site/module/. In this way, when no language segment is entered in the URL, the user will be redirected according to their HTTP_ACCEPT_LANGUAGE header. On the other hand, URL with language segment will not make any redirect.
  20. I would like to know how to hook or change the behavior that when I go to URL without the language segment. For example: If the domain is www.abc.com English(default) URL is www.abc.com/en/ Japanese URL is www.abc.com/jp/ When I browse www.abc.com, it redirects to www.abc.com/en/, which is the default behavior after I set "Default language homepage URL is same as root URL?" to "NO" inside "Languages Support - Page Names" module config. I would like to change this hard redirect to check the user browser language before redirecting to other language. For URL that having the language segment should not be affected. That means browsing www.abc.com/en/ is always go to English language without redirect. I want to apply this change to any frontend pages, not only homepage. Thanks.
  21. Thanks. I put <?=$session->CSRF->renderInput();?> somewhere inside template. And then do something like the following inside js. var data = { 'firstname': $("#firstname").val(), 'lastname': $("#lastname").val(), }; var CSRF_name = $("._post_token").attr("name"); var CSRF_token = $("._post_token").val(); data[CSRF_name] = CSRF_token; $.ajax({ url: "/ajax/", data: data, method: 'post', }); then inside ajax.php if($session->CSRF->hasValidToken()) { //do something } This works.
  22. For some reasons I am not submitting a form but individual input fields via ajax. I would like to use SessionCSRF to protect from cross domain request. Is it possible to make SessionCSRF work in this case? And how? Thanks.
  23. Fixed. The time of modified, created and changlog(module) is reading the database server timezone. I am using a remote database, so the timezone is different from the web server. The issue fixed after changing the remote database server timezone.
  24. Greeting. I am having hard time trying to make the time inside processwire correct. I have a correct server time. I have a correct time zone inside config.php, echo correctly in php. I get correct timestamp when echo in php and using tracy debugger console. However, the time stored for creation, modified, changelog are all using Unix Timestamp, i.e. UTC, while my correct time should be UTC+8. What is the possible config having this behavior?
  25. I would like to save very long string to a text field. My case is that I am saving canvas serialized data into text field for saving as state. However, the the text link cannot excceed certain length which is around 66535 something even though I set the field's max length as 0. What I can do to release the limit? Thanks.
×
×
  • Create New...