Jump to content

adrian

PW-Moderators
  • Posts

    11,097
  • Joined

  • Last visited

  • Days Won

    365

Everything posted by adrian

  1. Ok, I see - I manually deleted those and reinstalled and it works now. I still don't really like the downloads.ext filename, but maybe that's a personal thing. Also, the dg_download template still has URL Segments enabled, but they aren't needed. Doesn't really matter since that template throws a 404 anyway, but would be cleaner to not enable it. Thanks again for putting this together! PS Not everyone has their templates folder writeable by PHP, so you might want to add a note and also handle any permission errors if those template files can't be added/removed.
  2. OK, the apache check is working - I am getting the correct line in the htaccess file, but there is still a problem with the download URL. You have the URL segments settings correct, but the dg_download.php file is still the one with: $hash = $input->urlSegment1; echo $modules->get('DownloadGuard')->validateDownload($hash); That now needs to be in the dg_downloads.php file and changed to grab the second URL segment, since the first one would now be "hash". Also, doing that will result in all the downloaded files being named "downloads.ext" rather than the name of their child page.
  3. More comments for you! When uninstalling, I am not sure about deleting the Downloads page tree and the required templates - this could result in a LOT of data loss with a simple click of a button. kongondo has struggled with this and his Blog module and went with a separate, optional, cleanup script before uninstall. I think you need to do something along these lines, or at least, don't remove these things. Maybe you should limit the uninstall to deleting all the .htaccess files and the module files, but nothing else? Also, looks like there is an error with the install routine and making use of the new PW "Which URL segments do you want to allow?" option. Looks like you are trying to set it with this line: $t->urlSegments = array('regex:^hash/[0-9a-zA-Z]+$'); but you have that on the dg_downloads template, rather than the dg_download one, which is where it is needed. Hope that helps! EDIT: Now I see what is going on with that non-working "hash" url - that would have worked, but you didn't have urlsegments enabled for the dg_downloads template, even though you had tried to set the regex rule there. Anyway, not sure which way you want to go, but at the moment, it is half and half and therefore not working
  4. Hi Martin, Thanks very much for this - looks very useful! Just having a look through it now. The first thing I noticed is the htaccess rules. You will need to add support for apache 2.4+ which means that: order allow,deny deny from all no longer works. Instead you need: Require all denied but of course you need to support older versions, so you will need to detect the apache version: http://php.net/manual/en/function.apache-get-version.php As for testing it, I am currently getting a 404 for this: http://pwtest.dev/downloads/hash/aa3033f10280fc120dbec5f3877dbcfa54ccd4d1ba5e7 I checked this link: http://pwtest.dev/downloads/test/aa3033f10280fc120dbec5f3877dbcfa54ccd4d1ba5e7 where "test" is the name of the child page under Downloads that I created. This wants to work, but first I needed to change this line: $max->save(); to: $max->save("dg_downloads"); because I was getting a "Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved" error, although not actually sure since you were already doing this. Anyway, saving just the field works fine!
  5. This is something that I am sure horst will follow up on, but as far as I know, the only thing you need to do (or can do), is to make sure the filename matches the conventions for variations: https://github.com/ryancramerdesign/ProcessWire/blob/7b9730d43e6eda8bd27841a4811a1b9737bfe903/wire/core/Pageimage.php#L484 If you need a different filename format that isn't automatically detected by the core isVariation() method that I pointed to above, you can hook it and modify like I have done here: https://github.com/adrianbj/ImageRasterizer/blob/master/ImageRasterizer.module#L243 Hope that helps until our image expert sees this!
  6. Great to hear. I have committed another update that removes those checks - they really aren't very useful anyways as they can be manipulated in the browser and aren't always provided (hence the errors you were getting). Can you please confirm that all the other multiple Table field and issues with only one row importing are also now solved? Thanks for your help in getting this all fixed.
  7. I am thinking it must be my mimetype checks. Can you please try replacing: if(($csv_file_extension == 'csv' || $csv_file_extension == 'txt' || $csv_file_extension == 'tsv') && ($csv_type == 'text/plain' || $csv_type == 'text/tab-separated-values' || $csv_type == 'text/csv')){ $this->session->{$fieldName . '_csv_data'} = file_get_contents($_FILES[$csv_filename]["tmp_name"]); } with: if($csv_file_extension == 'csv' || $csv_file_extension == 'txt' || $csv_file_extension == 'tsv'){ $this->session->{$fieldName . '_csv_data'} = file_get_contents($_FILES[$csv_filename]["tmp_name"]); } and see if that allows the csv upload to work.
  8. Great work - just playing with it now and it's really slick - thanks for the contribution! One thing I noticed - not a big deal, but when you search by text, with "From all categories" selected, it duplicates the matching icons. Also, out of interest, did you see this: http://processwire.com/blog/posts/processwire-core-updates-2.5.15/#new-icon-selection-module-in-the-core It's an Inputfield, but not a Fieldtype, so it can't be used in templates as is, but I wonder how these two modules could be consolidated, or maybe they should remain completely separate - just thinking out loud - I have no idea whether Ryan is planning a matching fieldtype for his module.
  9. @KaMeKuN - today's dev commits from Ryan provide a new fieldtype that supports select options with multilanguage support without relying on pages - perhaps you would prefer this approach. Have a read about it here: https://processwire.com/api/modules/select-options-fieldtype/#multi-language-translating-options
  10. There is this new fieldtype: http://modules.processwire.com/modules/fieldtype-image-extra/ But be sure to look at my comment about some things that need fixing: https://processwire.com/talk/topic/7910-module-fieldtype-image-extra-multi-language/?p=85654 So long as you don't have debug mode on, that warning won't show and therefore won't break things. Otherwise, you can use a PageTable field (core module, but needs to be installed) with a template that contains an images field along with a URL field, and any other metadata fields that you might want. Let us know if you need more info about this field type (https://www.google.com/?q=site%3Aprocesswire.com%20%22pagetable%22) You can also just use child pages - one for each image - since you seem to be relatively new to PW I'll assure you that this is not actually a bad idea, even though it may seem like it at first glance
  11. I added a poll for you to this thread. Let's see how everyone responds
  12. Oops - very sorry about that - I should have looked back at your site to check before making that faux pas
  13. Love your research Kathy - we might need to chat at some point I'll have to give you some background to that statement in a PM at some point when I find some time.
  14. Love the enhancements, but I am getting something weird - if I only enter 2 characters and then hit enter, it creates a new tag for to match those 2 characters, and then randomly adds a second tag to the list. Then hit enter and I get this:
  15. Thanks @RJay - I think I have managed to fix all those issues - I hadn't tested with multiple Table fields on the one page. Please check the latest version and let me know how it goes for you. PS There was nothing wrong with your CSV file.
  16. Hi RJay - wow, that doesn't sound good Yes, please PM me the file. Also, does the same CSV file work on a template with only one Table field?
  17. No offense kongondo, but I would actually really like to see the inline way of adding new tags/pages - Since they are already typing, I think that is what many users would expect to be able to do, rather than needing an additional field. Nico's https://github.com/NicoKnoll/TextboxList works like this, but of course it would be great to have this in this module so everything is connected to the page field.
  18. There is also this - paint hasn't even dried on it yet https://processwire.com/talk/topic/8955-inputfieldchosenselect/ You can type or select and it has autocomplete. Surprised you didn't mention it @LostKobrakai
  19. I really like: http://modules.processwire.com/modules/inputfield-select-multiple-transfer/ It is kinda like an ASM, but with a built in live filter bar - works pretty nicely, although the search bar could do with some css tweaks to make it a little larger.
  20. @LostKobrakai - just playing with this now and I like it - thanks, but there is a bug In InputfieldChosenSelect.js you have: $(".InputfieldPageTags select[multiple=multiple]").each(function() { I am not actually sure how that would ever work since that approach would need the name of the field, eg if your field name is: tags $(".Inputfield_tags select[multiple=multiple]").each(function() { but this also works and won't be dependent on the field's name: $(".InputfieldChosenSelect select[multiple=multiple]").each(function() {
  21. I would say that in general starting a new site with the dev branch is a decent approach. I typically update my local test sandbox install with the each new set of commits and depending on Ryan's comments about the commit I will sometimes even update live sites after seeing that everything looks stable for a few days. Occasionally he will mention that a commit contains lots of changes and to be cautious - in that case I may hold off on updating live sites a while longer so I am sure things are ok.
  22. That wasn't my intention at all We have all fallen victim to this one - several times! I don't ever remember to do it, but it is why it is recommended to do: f("Y"==$on){ With it reversed like that, if you forget the second equals sign, it will throw an error, rather than assigning the value!
  23. @creativejay - what Soma is getting at is that in PHP (and many other coding languages, maybe all ?) a single equals sign does not check if one thing equals the other, but rather makes it equal. So even though you have the if(), that line is always setting $on to "Y". You need to use two equals signs, eg: if($on=='Y') { In some situations you even want to make use of three. Here is a useful discussion on the differences: http://stackoverflow.com/questions/2063480/the-3-different-equals
  24. @LostKobrakai, I like the look of your InputfieldChosenSelect field type - I can see that being very useful at times - thanks! Just to throw in another option - Nico also has a fieldtype for tagging: https://github.com/NicoKnoll/TextboxList Similar interface to yours, but the tags are stored as a comma-separated list, rather than as pages in a page field.
  25. This is Joss' territory, so I am sure he will chime in with why Page fields are perfect for this, but until he does .... I'll say it - page fields are perfect for this Seriously though, they handle the multilanguage side of things and have so many other advantages. Remember that a page is just a row in a DB table which is how this would be set up in most other systems anyways - I think it is just the "page" tree structure in the admin that makes people think it is more resource intensive or something? If you are worried about your users see the page tree with 30 children, just make it a child of a hidden settings page or something else like that. If that is not sufficient, which it really should be, you can even hide the page (and its children) completely from your editor users using this draft module: https://processwire.com/talk/topic/1176-hiding-uneditable-pages-from-users/?p=84916
×
×
  • Create New...