Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/27/2018 in all areas

  1. For me it's the worst you can do, and I hate it when I get redirected to a language I don't want. Sometimes you can't even get to another language. Just don't ever do automatic redirection based on anything.
    4 points
  2. v0.1.1 released - adds an option to automatically derive a label from the template name if a new template is added via the API. Also finally got around to submitting it to the modules directory.
    3 points
  3. Try (untested) $myCategoryPage = $pages->get('/path/to/an/example/category/page/); // if the category page is not referenced in a page reference field if(!$myCategoryPage->numReferences) { // safe to delete $pages->trash($myCategoryPage); } http://processwire.com/api/ref/page/ ps: if it doesn't work, try $myCategoryPage->numReferencing instead. I get confused which is which :-). Please report which one worked for you, thanks.
    2 points
  4. Updated the module to make sure the filepath exists. I also added an example in the readme how to set a background:
    2 points
  5. Or you can even use the class name too config()->scripts->add(config()->urls->{$this->className} . 'scripts/createInvoiceButton.js');
    2 points
  6. config()->scripts->add(config()->urls->RockCRM . 'scripts/createInvoiceButton.js');
    2 points
  7. Perhaps FieldtypeDropdownDynamic might be worth a look. It shouldn't be hard to enhance it with an image picker like you're doing in your module. It lets you define PHP code to fill PW select fields. Just install the module, then create a PHP file somewhere under site/templates that builds your selection: <?php namespace ProcessWire; # this is site/templates/selections/intranetforms.php $opts = []; foreach(scandir($config->paths->templates . "IntranetForms") as $d) { if(substr(strtolower($d), -4) != '.tpl') continue; $name = preg_replace('/\.tpl$/i', '', $d); $opts[] = array("label" => $name, "value" => $name); } return $opts; Then add a field of this type, enter the relative (to site/templates/) path to the PHP and make sure to check the filename option before saving.
    2 points
  8. I think the problem here is that you are replacing newlines with <br>, but that doesn't make sense for the content you are importing. If your content consists of markup then you don't want newlines to become <br>s because the newlines exist in the markup just for code readablity and aren't something that should result in new HTML tags in the saved field value. If you set the field value directly from $r['textEN'] then it should work.
    2 points
  9. Creating a support topic for this action now that the new actions-as-modules feature has been added to Admin Actions. Unordered List to Pages An action for the Admin Actions module for ProcessWire CMS/CMF. Creates a structure of new pages from an unordered list entered into a CKEditor field. The nesting of further unordered lists within the list will determine the nesting of the created pages. Created pages get a default template that you select, and you can override this default template per list item by specifying a template name between [[ ]] delimiters. This action can be useful to quickly create a page structure; especially so if you are rebuilding an existing non-ProcessWire site that has a Sitemap page that you can copy and paste from. Usage Install the Unordered List to Pages module. Visit the Admin Actions config screen and enable the "Unordered List to Pages" action for the roles who are allowed to use it. Navigate to Admin Actions > Unordered List to Pages and fill out the config fields: Source Enter/paste an unordered list in the Source field. There is a "cheatsheet" field above that explains the syntax you can use to set some template options for each list item. If you want to override the default template for an item you can specify a template name after the page title between double square brackets. If the template doesn't already exist it will be created. Example: Page title [[staff_members]] You can also specify one or more allowed child templates for a template like so: [[staff_members > manager tech_support]]This would create the page using the staff_members template, and set the allowed child templates of staff_members to manager and tech_support. Alternatively you can specify one or more allowed parent templates for a template like so: [[manager < staff_members]] This would create the page using the manager template, and set the allowed parent templates of manager to staff_members. Parent page Select a parent page that the new pages will be created under. Default template Select the default template to use for the new pages. Screenshots Action config: Result: https://github.com/Toutouwai/AdminActionsUnorderedListToPages https://modules.processwire.com/modules/admin-actions-unordered-list-to-pages/
    1 point
  10. One more thing: since that issue has been discussed we have $page->references();: https://processwire.com/blog/posts/processwire-3.0.107-core-updates/#page-gt-references Maybe it is time to rethink it?
    1 point
  11. related issue at github: https://github.com/processwire/processwire-issues/issues/620
    1 point
  12. Given the client situation I think it's best to inform them to be careful with the categories (for now)... And maybe later I will go for the hook option (it would be my first hook actually - no more escapism ? ). IMHO: I think that this should be some core logic not to be able to delete pages that are referenced by other pages via the PageField. Or at least get a notice that there are still references to it. It feels odd to me like this.
    1 point
  13. Then you have to hook into something. If you want that referenced categories not to display the trash link, then you can hook into the tree render. Or, if you don't mind the display of the trash page link, then you can hook before pages::deleteReady. Alternatively, depending on who is administering the site, you can lock all your category pages and only unlock one you want to delete, at delete time :-). You can check if it is being referenced in a page field by going to the settings tab when editing the category page and scroll to 'What pages point to this one' section.
    1 point
  14. Great, thanks for sharing! A little comment, if I may. Reading your original post (and to some extent the blog post), I got confused by what you meant by property. On the one hand, it seemed to refer to property in a OOP sense since you also talked of objects. It also seemed to refer to an actual physical property since you refer to a 'room' :-). My German is not great, so that didn't help :-). Reading the blog post, it also seems by property you mean an option in a select? Maybe you could clarify this and use options instead if that is what you mean? Thanks again!
    1 point
  15. Okay guys. This was very hard with much trial & error, but I finally got the solution (which is after all very simple). It is even worth an own blog post on my website: How to disable options in select elements that are already selected in another select element Here is a YouTube video of it in action
    1 point
  16. Those video backgrounds are usually only there to spice up a home page or similar and are not big in size. Have a look at the video background of this website: https://isl.co/ That video background is only 5,3 Mb so it is easy to host on the same server as where your website is. I would not go for an iframe as it is often exploited by spammers. Use the html5 <video> tag instead. Use a webm version as well to be compatible with firefox browsers.
    1 point
  17. In my experience YouTube always feels a bit clunky in comparison to hml5 video with feels more instantaneos, but could be made to work (I've only got it to be responsive with some js though), I agree the most "slick" solution is to use native html5 video and a CDN. I have personally used AmazonS3/Cloudfront for this.
    1 point
  18. So if im in france ill see the french version and not understand anything and cant change it? Sorry happened to me and got really frustrated and simply left the service.
    1 point
  19. what about your own topic that you started in may?
    1 point
  20. I wouldn't do that for a background video. It might get blocked in other countries for no reason at all (like the silence in the movie sounding exactly like the silence in a popular movie which Disney has copyrighted) without you/your client noticing. I'd either host it myself (in this case the server or a script should support partial transfers) or use a CDN.
    1 point
  21. There is also this: https://modules.processwire.com/modules/fieldtype-select-file/
    1 point
  22. @Mike Rockett thank you for your help! With the following modification, I was able to do the jumplink stuff. RewriteCond %{REQUEST_URI} ^\/index\.php [NC] RewriteCond %{QUERY_STRING} ^(.+)$ [NC] RewriteRule ^ /index2.php?%1? [R,L]
    1 point
  23. I've gone this way! And used the Google Anaytics API to retrieve the data if needed.
    1 point
  24. @panx - looks like there might be an encoding issue with the RewriteCond directive there... Not sure how it would have happened, but my best guess would be to type the directives in manually. Also, the second RewriteCond line in that state won't apply to you. You'd likely need a catch-all of sorts to match the different types. I'm not able to test this as I no longer use Apache, but this could work: RewriteCond %{REQUEST_URI} ^\/index\.php [NC] RewriteCond %{QUERY_STRING} ^(.+)$ [NC] RewriteRule ^ /index_php/%1? [R,L] From there, you'd be able to create a jumplink for index_php/reference={reference:segment}&object={object:num}, which could then be directed to reference/{reference}/object/{object}.
    1 point
  25. I'm pretty sure it's CKEditor doing that and not sanitizer->textarea(); Maybe this will help?
    1 point
  26. @joshuag Are there any updates on this awesome module already? Can't wait to try it.
    1 point
  27. Thx folks! I must have skimmed over the docs too quickly. I saw neither of 'expand' nor the '@' class :-).
    1 point
  28. Here's something to chew on. Start with this tutorial: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ Some code to play with. This creates a paginated ProcessWire-rendered HTML table. Create a module as per above tutorial. Use the following code in your Process module's execute() method. You need to create some people pages. In this example, they use the template 'people'. Edit functionality not included. Have a look at Blog module for that, here. For CSV upload (not included), have a look at Matrix module here for uploading CSV file and here for reading CSV file. /** * Display, Add and Edit People. * * Called when the URL is peoples's page URL + "/people/" i.e. URL Segment. * Renders a table with People information. People can be edited via modal. * * @access protected * @return mixed $form rendered form * */ public function ___execute() { $modules = $this->wire('modules'); $input = $this->wire('input')->post; $pages = $this->wire('pages'); // CREATE A NEW FORM $form = $modules->get('InputfieldForm'); $form->attr('id', 'people'); $form->action = './'; $form->method = 'post'; // CREATE AN INPUTFIELD MARKUP: Will hold list of people table $m = $modules->get('InputfieldMarkup'); $m->textFormat = Inputfield::textFormatNone;// make sure ProcessWire renders custom HTML // $m->label = $this->_('Edit'); // $m->description = $this->_('Click on a title to edit the item.'); // CREATE A NEW TABLE: for people $t = $modules->get('MarkupAdminDataTable'); $t->setEncodeEntities(false); $t->setClass('peopleTable'); // set header rows $peopleTableHeaders = array( '<input type="checkbox" class="toggle_all">', $this->_('Title'), $this->_('Name'), $this->_('Surname'), $this->_('Another Column'), $this->_('One More Column'), $this->_('Published'), #$this->_('Date'), ); $t->headerRow($peopleTableHeaders); // grab a limited number of people to show in people dashboard. Limit is hardcoded in this example $people = $pages->find("template=people, include=all, sort=-created, parent!=7, limit=10"); foreach ($people as $p) { if (!count($people)) break;// if no people found, break early // check if person page is published or not $p->is(Page::statusUnpublished) ? $status = '<span class="unpublished">' . $this->_('No') . '</span>' : $status = $this->_('Yes'); // set table rows $peopleTable = array( "<input type='checkbox' name='posts_action[]' value='{$p->id}' class='toggle'>",// disabled sorting on this in .js file "<a href='{$this->wire('config')->urls->admin}page/edit/?id={$p->id}&modal=1' class='editPeople pw-modal pw-modal-medium'>$p->title</a>", $p->title, $p->person_name, $p->person_surname, $p->another_column, $p->one_more_column, $status ); // render the table rows with variables set above $t->row($peopleTable); }// end foreach $people as $p // display a headline indicating quantities. We'll add this to people dashboard $start = $people->getStart()+1; $end = $start + count($people)-1; $total = $people->getTotal(); if($total) $peopleCount = "<h4>" . sprintf(__('People %1$d to %2$d of %3$d'), $start, $end, $total) . "</h4>"; // add a description to people dashboard {postsCount, limitSelect and instruction OR no people found status} $m->description = $total == 0 ? $this->_('No items found.') : $peopleCount . $this->_('Click on a title to edit the item.'); $m->notes = "People table notes"; $currentUrl = $this->wire('page')->url . $this->wire('input')->urlSegmentsStr."/";// get the url segment string. In this case it is "people" $pagination = $people->renderPager(array('baseUrl' => $currentUrl)); $m->attr('value', $pagination . $t->render() . $pagination);// wrap our table with pagination $form->add($m); $post = $this->wire('input')->post; // render the final form return $form->render(); }
    1 point
  29. Ukrainian translation, based on ProcessWire 3.0.88 Dev *** Не буду стверджувати, що переклад ідеальний, орієнтовно на 4+ https://en.wikipedia.org/wiki/Ukrainian_language uk-wire.csv
    1 point
  30. Thanks for the feedback @alxndre. The module is about better efficiency for the "Add Template" workflow, and I don't think sorting the page list is related to that. I'd like to keep this module fairly focused rather than becoming a collection of general admin tweaks (we already have a great module for that). I agree with Soma's request though. He says his solution is a "dirty hook" but it actually looks very clean to me. I don't think I could come up with anything cleaner so I suggest sticking with Soma's solution. It doesn't need to be added in a module now that we have /site/ready.php.
    1 point
  31. Put this in your site/ready.php file: $this->addHookAfter('Session::loginSuccess', null, function($event) { if($this->wire('user')->hasRole("target-role")) $this->wire('session')->redirect("other-url"); });
    1 point
×
×
  • Create New...