Jump to content

berechar

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by berechar

  1. Hi all, I would like to add a menu item the the 'setup' drop-down menu in the admin (eg. where 'Import Pages from CSV' ends up). This menu item should only function as a button: I would like to click it, run it's function(s), and return to the same page as where I was. I would use it to get some PW data, wrangle it, and save it. Because the information is very static and big, it doesn't have to be reguraly be updated, therefore, a button is enough. Any help, pointers and how to's regarding to make such a module-button would be great. Best, Berechar
  2. Hi Can, Thanks for the reply. Yes, the essays folder is located next to the PW folders 'site' and 'wire'. Unfortunately, your rules result in a (default) blank page, which means that the condition wasn't met. I see in your RewriteRule that you're directly refering to an HTML page. I changed this in my original rule, and now the right page is being served! RewriteCond %{REQUEST_URI} !(^|/)project-[^/]+/([0-9]+)/essay($|/.*$)$ RewriteRule ^project/([0-9]+)/essay($|/.*$)$ http://website.local/essays/$1/index.html [NC,L] Unfortunately, all the resources referrals on this page (images, css, javascript) are now broken. It uses the new URL as the base. Can this be prevented?
  3. Any PW System Administrators in town? I don't seem to get why the page is being forwarded. I'm quite convinced that it's the right pattern for the job... I tried some variations on the previous code, unfortunately without success RewriteCond %{REQUEST_URI} !(^|/)project-[^/]+/([0-9]+)/essay($|/.*$)$ RewriteRule ^project/([0-9]+)/essay($|/.*$)$ http://website.local/essays/$1 [NC,L]
  4. Thanks, the page is on the same site. I came up with the following, but this seems to redirect me to the new URL (which is good), but doesn't save the originial URL (which is bad...) RewriteCond %{REQUEST_URI} !(^|/)project-[^/]+/([0-9]+)/essay$ RewriteRule ^project/([0-9]+)/essay$ /essays/$1 [P] Maybe the [P] flag isn't working? mod_rewrite is on...
  5. hmm, this approach seems to work, but is quite slow if I compare it by going to the actual page.
  6. Hi all, I'm currently in the midst of making pages in PW which route the user to other directories and their index.html files (they are separately created and uploaded to the website). Instead of a redirect, I would like to keep the URL intact because it has valuable information for the PW tree. eg. PW Page (URL): site.local/project/33/essay Referred location (external directory, not part of PW): site.local/essays/33 Hopefully someone could give me some pointers on how to use the .htaccess file properly! Best, Charlie
  7. The access settings are all right. The guest van VIEW any page. When I visit the site as a guest, I can visit the home page, but clicking on a link (eg. /about) sends me back to the home page. When I try to visit a page directly (eg. www.website.local/about) it also sends me back to the home page. The home page is correctly displayed. * This never happened with the PW2.7, so there should be something going on with PW3. Unfortunately I can't find any records of this behaviour....
  8. Every page is published. The modules which I have installed are TemplateEngineFactory and PageReferencesTab. Shouldn't have any businesss with view access... The home-template gives view access to the guest role, all the other templates inherit this. * It seems to be the issue for every browser. Whenever you are logged out (being a guest), you are trapped on the homepage. Is there a way to somehow 'see' what's happening? How this bounce occurs? I couldn't find any message regarding this behaviour in the logs folder.
  9. Thanks AndZyk and Ivan for your replys! It seems that Ivan is right, when I login I'm able to visit each page. But I don't get why I can't visit those pages when I'm a guest. I haven't tinkered with any user settings ;-)
  10. Hi all, I'm currently developing a PW3 site in Firefox, and wanted to see how the site was doing in Chrome + Safari. Unfortunately I can't visit any of the pages, except the homepage. How can this be resolved? I've never seen this behaviour before Best
  11. Hi everyone, A question regarding security/best-practice concerning a simple front-end login through AJAX calls. My plan is to use this kind of module inside a small AngularJS architecture to update the entire application when someone is logged in/out. * I've made a simple HTML form in which the user can login by typing his/her username and password in the corresponding fields. After submitting the form, an Ajax GET request is made with these values to a page which has access to the Processwire API. This page checks if these values (after sanitization) correspond to an existing user in the CMS. If the user and password matches, the user is logged in, and a success message is being returned. If the user and password mismatches, an error message is being returned. * I don't know much about encryption, therefore I highly doubt if this a 'safe' way of doing things. Hopefully someone can give me some pointers on this! Best, berechar
  12. Hi all, A question regarding security/best-practice concerning a simple front-end login through AJAX calls. My plan is to use this kind of module inside a small AngularJS architecture to update the entire application when someone is logged in/out. * I've made a simple HTML form in which the user can login by typing his/her username and password in the corresponding fields. After submitting the form, these values are fetched with jQuery. Then an Ajax GET request is made with these values to a page which has access to the Processwire API. This page checks if these values (after sanitization) correspond to an existing user in the CMS. If the user and password matches, the user is logged in, and a success message is being returned. If the user and password mismatches, an error message is being returned. * I don't know much about encryption, therefore I highly doubt if this a 'safe' way of doing things. Hopefully someone can give me some pointers on this! best, berechar
  13. I've disabled the hooks (thus reverting to 'manual control'), and everything works with no unexpected behavior. So it definitely has something to do with how I was populating automatically. Should I format the Datetime string differently for the [publish_from] field? No 'Y-m-d hh:mm:ss' ?
  14. I though I had resolved this, but the following happenend. Everything works fine when the publish_from datetime is set for the current day with a timestamp that yet has to come on the same day. But, whenever I schedule a page for the following day (so I schedule it before 00:00am), and it needs to be published in the morning, it makes the page corrupt again... not viewable So weird... I though the strtotime($date) worked...
  15. I'm currently finding quite unexpected behaviour with the module, it seems to disable the 'view' option... The button/option simply just vanished... But when you change the page to [unpublished] and save, you can 'view' it again. But when you publish it again (or publish AND hide) it disables the 'view' option again. So the page seems to become 'corrupt'. When I copy all it's content to a new page and just publish it, everything is fine. I'm running ProcessWire 2.5.3 © 2015, maybe there's an issue? The only thing what I maybe do differently from the default, is that I've made a page-save-hook which populates the publish_from field with another date field, and appends a timecode (eg. 08:00:00). I first thought this might be an [user] issue regarding the permissions, but everything worked fine [before] the automatic-publishing. * * * EDIT 1 * * * After much debugging, I think I found the answer. I disabled the page-save-hook which fetched the [date] field and populated the [publish_from] field with an added timestamp (08:00:00). This seemed to 'corrupt' the page, disabling the option to view when published. Conclusion: I think the type of input became a string instead of a date * * * EDIT 2 * * * For anyone interested to prevent yourself from headaches, this is how I end up building a working datetime to work with SchedulePages. $pageDate = date("Y-m-d", $page->getUnformatted("date") ); $publish_from = date( $pageDate . ' 11:00:00'); $this->message( $publish_from ); $page->publish_from = strtotime($publish_from);
  16. this...is...great! I just don't get it... How do you know that? I also looked inside the wire/modules/input folder, but I just didn't knew which module was the right one...
  17. This is great LostKobrakai!!! Before the new action is called, I call $page->save() to save the current input (I think that an user probably thinks that such a button also saves, only with extra functionality). However this seems to trigger this new event twice, only when the page has been edited. Once before the save event, and once after. How can I escape the first event, so that it will only be triggered after having latest information? Many thanks! *** EDIT *** I'm utterly stumped with this. How can I add a simple "<a href="####" target="_blank"></a>" link/button as an element to the form. I've looked at the 'Hello World' example, but I just don't get it... I need to fetch the ID of the page and use it to reference to another URL..
  18. Hello everyone, I'm looking for a way to add a submit button ('Generate PDF') for a set of templates, which generates a PDF when clicked. So, a submit-button field to which I can attach attach a piece of code. I don't want to run it every time I save, because that will be too much time-consuming. I found https://processwire.com/talk/topic/8457-add-a-new-action-button-to-page-edit-screen/?hl=%2Badmin+%2Bbutton , but I can't seem to get it working. It should be placed inside the admin.php file right? Or is making a module the best way to do this... Best, Charlie *** EDIT *** I'm currently in the middle of making the [GENERATE PDF] button module. I found the Page::editable hook which works great. Somehow it also parses immediately the parent, and because I only want to parse the current page, I remove the parent like this: $page = $event->object; $page->parent = ""; // remove parent! Is this good/okay/bad practice? Then I'm trying to add a button to the template like the following: $field = $this->modules->get('InputfieldButton'); $field->attr('name', 'generate_pdf'); $field->attr('class', $field->class); $field->attr('value', '[GENERATE PDF]'); return $event->return->append($field); But this throws me an error on the appending (Error: Call to a member function append() on boolean (line 60)... The follow up question would be: how can I add an event to when this button has been clicked, and use the current available information of that page
  19. The fact that a lazyCron on [every minute] doesn't produce more overhead then [every hour] is music to my ears Thank you for explanation!
  20. Ah I see. So would that mean that when you have a lazyCron set on [Every Hour], there's the maximum possibility that it will be triggered 59 minutes after your chosen time? Thus shortening the interval, [Every 30/15/5 minutes],would make it's activity frequency higher and shortens this gap. With the downside that it's being triggered more often, thus resulting in more 'useless' updates... great! thank you so much!
  21. Yes, it's for the admin. This might become a summer project
  22. Just installed it and it works like pure magic Just out of interest, I still don't quite grasp the workings of the module and (especially) the LazyCron module. I schedule a post, say [05.05.2015 @ 15.00] with a lazyCron on [Every hour]. My aim is to publish the post that exact date. LazyCron is lazy because it is triggered by a pageview of the main website. (or also admin? or both ;-)... ) Does this mean that once you visited the site, you trigger the lazyCron, it runs the Schedule Module, and then it waits for an hour for the next page-view trigger? Is this hour then on the 'whole hour', or specificly on the first time the site has been viewed.... I don't get it haha. * btw – do you really need to specify an unpublish-date? I actually never want to unpublish ** btw 2 – is the timing of the cronjob and the scheduled pages based on the clock of the hosting server? So if the hosting is in Country A, but I need to publish in the morning for Country X, I should somehow change the (lazy)cron-job timezone? Kind regards!!!
  23. Hm! That's quite nice! Unfortunately it doesn't enable creation of new links... Ideally you would need a field which is shared between templates...
  24. Hello everyone, I'm currently linking several templates to each other thanks to the Page Field. Whenever I link a Page (A) to another Page (B), I can only see/edit/remove this relationship at Page A, but not on Page B. Is it possible to also create/see/edit/remove this relationship from Page B? Thus, having a bidirectional Page Field? Hopefully this is possible, it would be of major help in the administation workflow. Greetings, Charlie
  25. hmm, doesn't work unfortunately, it returns an empty list.
×
×
  • Create New...