Jump to content

kixe

Members
  • Posts

    803
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. This Module was one of the first modules I have written for PW. By myself I didn't use the module since a long time. Now I integrate Audioplayer normally with html5 audio tag and beautify it using the following 2 Javascript Libraries. http://mediaelementjs.com/ https://github.com/johndyer/mediaelement/ or https://kolber.github.io/audiojs/ But if you like it, I pushed an update (v1.2.0) to github and the modules directory and tested it under 3.0.x without problems. Please read instructions, create a template file like: // template file echo $page->player['code'];
  2. Assuming that each user should have access only to his own account/ content, there is no need to work with UrlSegments since you have access to the $user API. The output of example.org/dashboard/ can be individually to each user. Example: Create a role 'frontenduserrole' without any permission. Create a template dashboard and a file dashboard.php like if ($user->isLoggedin() && $user->hasRole('frontenduserrole')) { echo "Welcome back $user->name"; } else echo "You need to login first.";
  3. You have to create a plugin, place it in /site/modules/InputfieldCKEditor/plugins/ and enable it in the fieldsettings under Setup > Plugins Take this one as a starting point: Save the following code as /site/modules/InputfieldCKEditor/plugins/keystrokes/plugins.js // Assigne Ctrl+I to "bold" INSTEAD OF 'italic'(default). ( function() { CKEDITOR.plugins.add( 'keystrokes', { init: function( editor ) { editor.setKeystroke( CKEDITOR.CTRL + 73 , 'bold' ); } }); } )();
  4. With Standard Processwire Installation you have the option to configure SetupPageName (childNameFormat) under Tab Family in the Parent Template, which allows you to derive (auto assign) the name from title. Until now this is not possible with id. But you could use the following module which extends the SetupPageName function exactly for your needs. http://modules.processwire.com/modules/process-setup-page-name/ Unfortunately this module doesn't work properly in multilanguage surrounding. If you want to use the Field in multiple pages it might by better to use a Page field instead of PageTable. If you define Parent and Template in the field settings you can add a new Page from the field too. Pages in PageTable Field must be created/ deleted from Field.
  5. I cannot test it but in module scope you maybe cannot use the $languages api. Try with wire('languages'). Do you have debug mode on? Try this one protected function syncLangProperty(Page $page, $property) { $languages = $this->wire('languages'); if ($this->wire('modules')->isInstalled('LanguageSupport') && !empty($page->getLanguageValue($languages->getDefault(), $property))) { $defaultValue = $page->getLanguageValue($languages->getDefault(),$property); foreach ($languages as $language) { $page->of(false); $page->setLanguageValue($language, $property, $defaultValue); $page->save($property); } } return $page; }
  6. $globalTitle = 'Test'; foreach ($languages as $language) { $page->of(false); $page->setLanguageValue($language, 'title', $globalTitle); $page->save('title'); }
  7. Correct Syntax for Fieldtype Select Options $optionsfield // return id (string) $optionsfield->id; // return id (int) $optionsfield->title; // return string USE THIS or $optionsfield->value; // return empty string or value (if your option settings like '1=value|title') // dot syntax in selector string $pages->find('optionsfield.id=2'); Docs: https://processwire....tions-on-a-page or https://processwire....d-on-selections @BitPoet $page->manufacturer return id as a string, NOT the title!
  8. Your approach will not work. If you want to go on with repeaters you have to use nested repeaters. Other options: Page/ PageTabel Field or ProFields Matrix. More Information about nested repeaters and ProFields Matrix here: https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/ I would do this job with a simple Page or PageTable Field Create some fields (currency, period, percent) Create a template 'rate' and assign the fields above Create some pages (rates) with template 'rate' USD 12m 5% USD 6m 5% EUR 6m 6% Create a Page Field 'rates' and use template 'rate' for selectable pages Assign this Page Field to the 'loan' template.
  9. @Juergen, obviously I missed your post half a year New Edition But finally I found it and redesigned the template file I provided in post 88 of another thread It is working now properly according to the google guidelines. It comes with 301 redirect to the path version that lacks the language segment which works in PW 3.0 up but not in 2.7. In this case you need to uncomment the code line which forces the redirect. Template detects if the translation is checked 'active'. Furthermore you can easily adjust selectors for the page array where the pathes are taken from. Feel free to try and use it. multilang-sitemap-xml.php.zip
  10. It works using wireSendFile(). New template: <?php /** * using this template allows you to use template cache * */ $file = $page->pdf->filename; $disposition = 'inline'; // change to 'attachment' to provide download $headers = array( "content-length" => filesize($file), "content-disposition" => 'inline; filename="'.basename($file).'"' ); wireSendFile($file, array('forceDownload' => false), $headers); Define any headers to set new or overwrite default. "Force download 'must be set to false to avoid that 'Content-Disposition' is overwritten due to file extension. But I am not sure if this uses the cache. Maybe its useless anyway it takes the same time to render.
  11. @LostKobrakai Thanks, I know this. But this is only the Content-Type header. I want to change some others too! As a minimum: Content-Disposition and Content-Length.
  12. Hi there, I am using the following template file to provide a pdf download, of a pdf stored in a file-field. <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); If template caching is disabled, everything working as expected and the following header is sent HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:03:27 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Disposition: attachment; filename="anyfile.pdf" Content-Length: 909233 X-XSS-Protection: 1; mode=block Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Content-Type: application/pdf Using Template cache the header is overwritten by HTTP/1.1 200 OK Date: Fri, 26 Feb 2016 13:06:11 GMT Server: Apache X-Frame-Options: SAMEORIGIN Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache X-XSS-Protection: 1; mode=block Vary: Accept-Encoding Content-Encoding: gzip Keep-Alive: timeout=2, max=1000 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 Any ideas to prevent this?
  13. A module is needed doing this. How to build a module: http://wiki.processwire.com/index.php/Module_Creation Get informed about hooks here: https://processwire.com/api/hooks/ This one should do the job <?php /** * ProcessWire Module Modify View Url * * @version 100 * @copyright 2016 Christoph Thelen * @author kixe (Christoph Thelen note@qualyweb.com) * */ class ProcessModifyViewUrl extends Process implements Module, ConfigurableModule { static public function getModuleInfo() { return array( 'title' => 'Modify View Url', 'summary' => 'Provide alternative url for the action button \'view\' and the view tab under /page/edit/', 'author' => 'kixe', 'version' => 100, 'singular' => true, 'autoload' => true, 'icon' => 'mail-forward' ); } static public function getDefaultConfig() { return array( 'url' => 'http://example.org' ); } public function __construct() { foreach(self::getDefaultConfig() as $key => $value) { $this->$key = $value; } } public function init() { $this->addHookBefore('ProcessPageEdit::buildFormView', function($event) { $event->arguments(0, $this->url); }); $this->addHookAfter('ProcessPageListActions::getActions', function($event) { $actions = $event->return; $actions['view'] = array( 'cn' => $actions['view']['cn'], 'name' => $actions['view']['name'], 'url' => $this->url ); $event->return = $actions; }); } public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $defaults = self::getDefaultConfig(); $data = array_merge($defaults, $data); $f = wire('modules')->get("InputfieldText"); $f->attr('name+id', 'url'); $f->label = __("Alternative Url"); $f->value = $data['url']; $inputfields->add($f); return $inputfields; } }
  14. I think yes, some usage examples: //validate user $session->isValidSession($userID) //get the IP address of the current user $session->getIP() // login a user $session->login($name, $pass) // login a user without requiring a password $session->forceLogin($user) // return true or false whether the user authenticated with the supplied password $session->authenticate(User $user, $pass) // logout the current user, and clear all session variables $session->logout() // redirect this session to another URL $session->redirect($url) // get the session history (if enabled) $session->getHistory() Further informations: https://processwire.com/apigen/class-Session.html http://cheatsheet.processwire.com/ http://processwire.com/api/variables/session/
  15. If 'View/ Edit links on selected pages' is enabled this option should be hidden in case user has no edit permission for the selected page. Now an ugly error message is shown in the modal. Would be nice to not provide the link in this case. Apart from this module is working properly under 3.0.8. Thumbs up and many thanks for the last fixes.
  16. I am working on 2 Sites going only within the next month. Another big one going online maybe in June. A private site is already online. Until now everything is working quite stable. Look forward, not backwards.
  17. Same like BitPoet. Used it nearly ten years ago. It is very limited compared to PHP. Most of the hosters are providing comfortable and cheap PHP and MYSQL Environments. No need to use SSI.
  18. 11 month old this topic but I run in same problems described in post #5 (PW 3.0.8) After digging a while I found out that Javascript puts WireTabs outside the form whereas normally (for example in ProcessPageEdit) the WireTabs are inside the form. You need to adapt the css for the form in this case like: #content .container > form { /*instead of: top: -2px;*/ top: 0; } #content { /*instead of: padding-top: 1px;*/ padding-top: 0; } This solution works for me.
  19. Many Thanks. This will be a first choice development tool.
  20. Thanks for the quick answer. I am pretty sure your module works proper in 2.7. I am involved in 2 projects both based on 3.0 probably going online in summer. I updated already most of my stuff for 3.0. Ryan is working very very quick and I am pretty sure we will have a stable Version of 3.0 very soon.
  21. Hi kongondo, I tried out your huge module and I think would like it, but it doesn't work properly (using PW 3.0.7). I will give you a small bug list. clicking on Posts results in Error: Call to a member function count() on null (line 1355 of .../site/modules/ProcessBlog/ProcessBlog.module. Problem: field blog_files isn't assigned to the blog-post template by default which is the reason for the error above. After removing line 1355 the modal for posts doesn't appear after clicking, linked page opened instead The dropdown function of the tabs in Admin are disabled if blog tab is active cannot open Settings -> Settings -> Edit cannot open Tags -> New -> Tags Add cannot open Categories -> New Categories -> Add cannot open Posts -> Quick Post -> Add cannot open Edit Posts -> Actions Dead link (404) in Module description on processwire.com http://kongondo.com/tutorials/specific-features/creating-a-blog-in-processwire/ (just realized in the topic of this thread a temporarily link to the tutorial) A personal wish: Dashboard -> Archives -> month clickable with link to a list of selected items
  22. There are Trillions of ways to access your values in Processwire. To get what you expected create a simple template file like this one: <?php /** * return all populated string values in the order of fields as defined in template settings * * **/ $ul = ''; foreach ($page->fields as $field) { if (!$page->$field) continue; $ul .= '<li>'.$page->$field.'</li>'; } $ul = "<ul>$ul</ul>"; echo $ul; ?> Learn a bit PHP. Read some PW Tutorials. Stay with PW and get happy
  23. If you want to run the module with PW 307 and up you have to upgrade to Version 111
  24. @LostKobrakai I am looking for a modification of Fieldtype Concat module, which allows to pull values from parent page fields too (via dot syntax). Is this implemented in the modified module? Would you share your module?
  25. @Juergen Thanks for reporting this. If I find a little time I will have a deeper look. Multilanguage support isn't tested very well until now. There are still some other situations where the module doesn't work: If you want to generate name from a file field (selector like 'myimagefield.description') you will get an error. Name generation from a ProfieldsTable column is also not possible. I agree multilanguage name generation should be supported.
×
×
  • Create New...