Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/05/2017 in all areas

  1. How to disable/ enable specified languages in language fields for specified pages. 1.) Put this in your config.php and define pages and related languages via IDs /** * enable specified languages for specified pages in the page edit interface * use keys (IDs) for the pages and arrays of language->ids which you want to enable for this page * */ $config->editablePageLanguages = array( 1 => array(1072), // only one other language beside default 1634 => array() // only default ); 2.) Add this hook to your ready.php $this->addHookBefore('ProcessPageEdit::execute', function($e) { // get id of page beeing edited $pid = (int) $this->input->get('id'); if (!$pid) return; $configPageLanguages = $this->wire('config')->editablePageLanguages; if (!array_key_exists($pid, $configPageLanguages)) return; foreach ($this->wire('languages') as $lang) { if ($lang->isDefault() || in_array($lang->id, $configPageLanguages[$pid])) continue; $lang = $this->wire('languages')->get($lang->id); $lang->status = 1024; } $this->wire('languages')->reloadLanguages(); }); With a few changes within the foreach loop, you can change from whitelisting to blacklisting if this is more appropriate to your needs.
    4 points
  2. Hi @gebeer like @Juergen said, you should have no problem doing what you need with Recurme. Perfect use case for this module i am experimenting with an adjustment to the Recurme interface to account for all day events and time-end field. Hoping to release an update that addresses that need this week.
    2 points
  3. Dear @kixe thanks a lot for this approach! Sorry to correct you, but in your code the config variable differs, it should be $config->editablePageLanguages in config.php I wrote a small module for this, please feel free to use it! LanguagesHideInput.module.php <?php namespace ProcessWire; class LanguagesHideInput extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hide Languages Input', 'version' => 1, 'singular' => true, 'autoload' => 'template=admin', 'requires' => 'ProcessWire>=3.0.0', ); } public function init() { $this->addHookBefore('ProcessPageEdit::execute', function($event) { $this->message=$this->allLanguagesPages; $page = $event->object->getPage(); if (!$page->id || $page->id==1 || $page->template->flags == Template::flagSystem) return; if (array_key_exists($page->id, $this->allLanguagesPages)) return; foreach ($this->wire('languages') as $lang) { if ($lang->isDefault() || in_array($lang->id, $this->defaultLanguages)) continue; $lang = $this->wire('languages')->get($lang->id); $lang->status = Page::statusHidden; } $this->wire('languages')->reloadLanguages(); }); } } LanguagesHideInput.config.php <?php namespace ProcessWire; class LanguagesHideInputConfig extends ModuleConfig { public function __construct() { $langs = []; foreach (wire('languages') as $language) { if ($language->name == "default") continue; $langs[$language->id] = ($language->title); } $this->add(array( 'defaultLanguages' => array( 'label' => __('Default Languages'), 'type' => 'Checkboxes', 'options' => $langs, 'value' => [], 'description' => __('Select the languages you want to show, others are hidden.'), ), 'allLanguagesPages' => array( 'type' => 'PageListSelectMultiple', 'label' => __('Exclusions'), 'description' => __('On these pages all the langauges will appear.'), ), )); } }
    2 points
  4. No, I'm not referring to the Alternate template file feature. I'm just saying that if you create a template without a file, and later decide you want to add a file for it, all you need to do is put that file (named the same as the template it relates to) into /site/templates/. Maybe you never tried it that way before but give it a go and you'll see what I mean.
    1 point
  5. @Petra Welcome to the forums. In such cases you have 2 handy friends in ProcessWire. https://modules.processwire.com/modules/process-jumplinks/ https://modules.processwire.com/modules/process-redirects/
    1 point
  6. The nifty code: $base = wire('config')->urls; $cssUrl = $base->InputfieldPassword."InputfieldPassword.css"; echo '<link rel="stylesheet" href="'.$cssUrl.'">'; $jsUrls = array(); $jsUrls[] = $base->InputfieldPassword."complexify/jquery.complexify.min.js"; $jsUrls[] = $base->InputfieldPassword."complexify/jquery.complexify.banlist.js"; $jsUrls[] = $base->JqueryCore."xregexp.min.js"; $jsUrls[] = $base->InputfieldPassword."InputfieldPassword.min.js"; foreach ($jsUrls as $jsUrl) { echo "<script src='$jsUrl'></script>"; }
    1 point
  7. Thanks for the confirmation. In my case, even if I get this handy dependent selects feature to work, it would not fit the bill of allowing the user to select multiple pre-defined specs and values. Unfortunatley, this would only allow one spec to be defined. I've come up with a elegant solution though. I've opted for the AsmSelect field that targets the spec values (e.g. blue). And Instead of just using the spec page/value as the label I included the page's parent too (color: blue) which makes it clear when viewing the list. See shoot below. And I included a link in the field's notes so they can quickly jump over to the appropriate location if they wish to add a new spec type or spec value. Now that should allow me to safely gather the appropriate data to setup those filters. That's the next bridge I'll be crossing. Thanks again.
    1 point
  8. Good idea, but I think they are handpicking those, I don't see a submission form. Do you?
    1 point
  9. Maybe I'm misunderstanding the situation here, but it isn't necessary to do anything in the PW admin or via the API to associate a template file with a template - you just add a file named the same as your template to /site/templates/. So if you created a template named "my_template" then you add a file "my_template.php". You don't have to create the template and the template file at the same time. You could create a template last week and add the file today and it is automatically associated with the template if the name is the same.
    1 point
  10. I realise this was a one-off but just wanted to point out that calling the get() inside the foreach loop is not very efficient. It is better to do that (once) outside the foreach since it is the same template you are retrieving each time.
    1 point
  11. hello @gebeer it is possible to add as much dates as you want to one day (fe. 100 or more if you want). You only have to create one event (page) for each of your events and make them recurring to your needs. So from the module there are no restrictions. It also doesnt matter if the starting and ending time of several events are the same on the same day. On the calendar view only few events are displayed for this day (depending on the space in the calendar row - see next image on the 6th). All others will be overflown. After hovering the calendar cell all events on that day will be displayed. If you are entering fe 100 events on that day (and I am sure you would probably not ) the list will be very long, but technically it would be possible. There are a lot of recurrence possiblilities fe. the first and the last day of a month every second monday every month,.... take look at the documentation. Jürgen
    1 point
  12. I agree with @Juergen on the start/end time input workflow with separate time input fields. Would like to use this module for a room occupancy calendar. @joshuag Is it possible with your module to have multiple events for one day with start and end times that recur daily/weekly/monthly? E.g. 17.00 - 19.00 every Monday 19.00 - 21.00 twice a month on Mondays etc.
    1 point
  13. This week we've got a great guest post from Alex Capes. Alex recently worked with design agency Human After All to build a website for Canongate, a leading independent book publisher. This post discusses the highlights, challenges and successes in building this impressive ProcessWire-powered site. I was really impressed with this site, and I think you'll like reading about it. https://processwire.com/blog/posts/building-canongate/ Next week I'm going to be out of town for much of the week so likely won't have a blog post next Friday. If anyone is interested or has ideas for another guest post, please drop me an email. Thanks.
    1 point
  14. Hi @webaff multilingual about 400 files at launch, scalable up to 10000 files files are typically PDF but can be of other files types front end user login with forgot password function https://modules.processwire.com/modules/frontend-user/ or custom solution nice to have: front end user registration https://modules.processwire.com/modules/frontend-user/ or custom solution 3-5 user roles for access control on page level (each file can be accessible for users of all roles or just for users of certain roles) login history https://modules.processwire.com/modules/process-login-history/ or a custom hook probably for ___loginSuccess files must not be accessible by direct link, of course. Would be nice to store them outside the http-root. https://modules.processwire.com/modules/fieldtype-secure-file/
    1 point
  15. Years later we have more options) There is a special module by @ryan for that now. You can also do a backup from cli with wireshell. There is a nice module by @flydev still in the way, but looking promising. Look here for some discussion and 3rd party tools.
    1 point
  16. This is a minimalistic website for the german architecture office Weissenrieder Architekten BDA. The front-end uses UIkit 2 and Isotope for the projects overview. Every project category can be accessed in the overview with an URL segment. ProFields Table was used for the project detail view. www.architekt-weissenrieder.de Modules used: AdminThemeUIkit Table ProCache Markup Sitemap XML Email Obfuscation (EMO) Jumplinks Tracy Debugger Regards, Andreas
    1 point
  17. There is limited (and undocumented) AJAX 'dependent selects' support built into Page Reference fields. You must use the 'Custom find' or 'Selector string' option for defining selectable pages, and reference the source Page Reference field (that exists on the same page) using syntax like this: parent=page.page_reference_field_name Based on testing I have found: It only works for Select, Select Multiple or AsmSelect inputfields It does not work inside a repeater item
    1 point
  18. First, some background to lit a light. There are some functions in PHP that may produce unexpected results in special situations. This functions are used by PW core files and in user contributed modules. Some users may have problems with file upload (pdf, zip, image, whatever) if filename has non-ascii character at the first place. For example, if user upload a file named "år.jpg" (year in Swedish language), it is expected that PW would transliterate (transform) the filename to "ar.jpg", but because of the bug in basename() PHP function, the filename would become just "r.jpg". Nevertheless the file would upload successfully. But if the filename is "привет.jpg" (Hi in Russian language) the upload would fail. There are two ways how to handle this: Write and use custom functions instead of builtin functions Let end user fix that with proper locale Option 1. is used in some CMS/CMF (like Drupal), PW (Ryan) opted for option 2. After successful login PW perform a test and warning is issued in case of test failure. It is now your responsibility to set proper system locale. The locale is a model and definition of a native-language environment. A locale defines its code sets, date and time formatting conventions, string conversions, monetary conventions, decimal formatting conventions, and collation (sort) order. Those "problematic" builtin PHP functions are locale aware, that means they work as expected, if locale is configured appropriately. Locale can be set by the underlying operating system or in PHP. Because on shared hosting you don't usually have root access to the OS, the only option to set the locale is by using the builtin setlocale() PHP function. But, before you can use/set the locale, it must first be installed on the OS. On most unix systems at least some basic locales are already there, they are just not used. To check what locale are you currently using and what locales are available for you to use, create the file testlocale.php at the root of your website with the following content: <?php echo "<pre>Current locale:\n" var_dump(setlocale(LC_ALL, '0')); echo "\n\nAvailable locales:\n"; echo exec('locale -a'); Then point your browser to http://yourwebsite/testlocale.php If your current locale is "C" (and you are on unix), then you will probably get warning after login to the PW admin. What you want to do is change the locale to something that has "UTF-8" or "utf8" in the name of the available locales. In your case you would be looking for something like "sv_SE.UTF-8" or "sv_SE.utf8". Now, there is a chance that Swedish locale is not installed. You can ask your hosting provider to install it for you or use some other UTF-8 locale. On most unix systems I have seen, at least "en_US.UTF-8" or "en_US.utf8" is installed. If even that English locale is not available, then look for "C.UTF-8" or "C.utf8". And this is what you have to use as parameter in the setlocale() call: setlocale(LC_ALL, "sv_SE.utf8"); You could actually "stack up" multiple locales and one will eventually work: setlocale(LC_ALL, "sv_SE.utf8", "sv_SE.UTF-8", "en_US.UTF-8", "en_US.utf8", "C.UTF-8", "C.utf8"); Now, regarding where to put that setlocale() call. If you are not using PW multi language capabilities (you don't have Languge Support module installed), then you place setlocale to /site/config.php. That's it. If Language Support module is installed (PW checks for that), you have two options: Translate the string "C" in LanguageSupport.module for each installed language Put setlocale() call in /site/init.php My preferred method is option 1 and this is what PW (Ryan) recommends. See https://processwire.com/api/multi-language-support/code-i18n/ for more info on translating files. Option 1 allows you to set different locale for each of the installed language, while option 2 allows setting of one locale for all languages. PW will also provide links for the files that needs to be translated in the warning message. Ryan just pushed an update that makes it use the locale setting on the frontend when using LanguageSupportPageNames module (until now just language was changed, but not locale). Also setLocale() and getLocale() methods are added to the $languages API var.
    1 point
  19. I'd strongly suggest you to take a look vue.js instead of react. It's considerably more friendly to beginners, but does still have all the powers react does have (not judging advanced stuff like react native). I personally also feel, that react is more targeted to a "all or nothing" usage (at least in terms of tooling), whereas with vue you can start out just by implementing small components in your site, without the need to change everything from the get-go.
    1 point
  20. @jmartsch i'm using it on a project i'm developing at the moment and it works really nicely. I've also built a little module. maybe you are interested in testing/collaboration? at the moment it has only 2 buttons on hover: 1) show the template path that is rendering the item 2) show edit button to edit this item directly of course it is quite similar to fredi and feel... ps: the built in modal has an awesome experience on mobile. its fullscreen and feels almost like a native app
    1 point
  21. The Site Profile Exporter will backup the database: http://modules.processwire.com/modules/process-export-profile/ It will also include all files and templates so it may be more than what you are looking for. If you want to backup just the database, there are a lot of non PW specific tools for this. If you are comfortable with the command line look into mysqldump which you can trigger with a cronjob and automatically copy to a remote server using rsync. The site profile exporter uses mysqldump for the DB part of the export. If you are after a more automated and user friendly approach with a graphical user interface, something like: http://sourceforge.net/projects/automysqlbackup/ works well, but there are lots of other options if you google: https://www.google.com/search?q=mysql+backup+tool Perhaps it might be a worthwhile addition to PW to have a stripped down version of the site profile exporter that just exports the database. This could be run with the lazycron module.
    1 point
  22. Hi Michael, I have not seen any fields like that, but as an alternative you could try using a "page" type field. It would create a new page for each tag, but has a nice friendly interface for the user to manage them. 1. Add a new page in your tree called "Tags Collection", and make it hidden. 2. Create a new field called Tags and make it a "page" type. 3. On the input field settings, make the "Parent of selectable page(s)" the Tags Collection page 4. For the "Input field type" try one of : Select Multiple, asmSelect or PageListSelectMultiple (I prefer the asmSelect) 5. Check the “Allow new pages to be created from field?” to allow the user to easily add new tags directly from the field
    1 point
×
×
  • Create New...