-
Posts
11,193 -
Joined
-
Last visited
-
Days Won
373
Everything posted by adrian
-
One thing when cropping to large sizes (eg 1000px or so), then on hover preview won't fit on the screen - perhaps it can be displayed at a smaller size when it is greater than a certain percentage of the viewport size? Sorry in a rush, but if this doesn't make sense, please let me know.
-
-
Just a quick glance, but I think what you are looking for is: $page->audiofile->add($upload_path . $filename);
- 6 replies
-
- WireUpload
- FieldTypeFile
-
(and 5 more)
Tagged with:
-
I love it - very handy! Just a couple of small things. Need a nice icon for the module to show up under the Setup menu I would use the same labels as the template access tab, ie: VIEW PAGES, EDIT PAGES, CREATE PAGES, ADD CHILDREN and also in that same order.
-
Not sure if this solves your needs in another way, but check out this module: https://processwire.com/talk/topic/5658-alpha-release-usergroups-page-based-permissions/ But, you might also be able to achieve what you want through some recent additions to dev which allows for parents for users: http://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users
-
I just submitted a PR to extend Ryan's new "Send to Templates" functionality on the Action tab to be an "Add/Remove fields from templates" function. Not sure if he will go for it as is - he might have something grander planned, but it was a quick addition: https://github.com/ryancramerdesign/ProcessWire/pull/902 There are some screenshots in one of the comments that shows how it works. Would be curious what others think of how it works if you feel like trying it out!
-
Sorry for that - at one point I merged some posts into that thread and the ID changed, hence the broken links. Best bet is to actually just point them to the Github repos: https://github.com/adrianbj/ProcessMigrator https://github.com/NicoKnoll/MigratorWordpress The main migrator thread is now at: https://processwire.com/talk/topic/8660-migrator Thanks for spreading the word!
-
Page Field => direct children of template page
adrian replied to berechar's topic in General Support
Yeah - I think Jan Romero's way makes more sense. I actually don't know why Soma's suggestion isn't working. My suggestion loads up a bunch of pages but it doesn't really make any sense because it will actually only find the children of the page's children, which basically means all the grandchildren - oops! -
I think your best option would be to modify this module: https://github.com/Hani79/Processwire_FieldType_Templates It is for selecting templates but could be easily converted to work for fields - let us know if you need any help converting, or if you do it, please share it here!
-
Page Field => direct children of template page
adrian replied to berechar's topic in General Support
Try: parent=page.children EDIT: Bad idea - see below -
Well you could either start with a close tag: ?> //close initial php open here <div class="row"> <?php $suppliers = $pages->find("template=brfs-suppliers-detail"); foreach ($suppliers as $supplier) { echo " <div class=\"small-12 medium-6 large-4 columns partner-wrapper\" > <img src=\"{$supplier->supply_partner_logo->url} \" class=\"partner-thumb\" > {$supplier->title} </div> "; } ?> </div> or instead put your divs in the php code block and echo them out. <?php echo '<div class="row">'; $suppliers = $pages->find("template=brfs-suppliers-detail"); foreach ($suppliers as $supplier) { echo " <div class=\"small-12 medium-6 large-4 columns partner-wrapper\" > <img src=\"{$supplier->supply_partner_logo->url} \" class=\"partner-thumb\" > {$supplier->title} </div> " ;} echo '</div>'; ?>
-
Check out the new feature Ryan just committed to dev - on the field's new Action tab you can "Send fields to templates". Then on the next screen you get to order their positions on each of the templates they were just assigned to - pretty cool!
-
Is this custom page attached to a process module? In that case you simply assign a new permission to the process in the module's config, eg: public static function getModuleInfo() { return array( 'title' => "My Process Module, 'permission' => 'special_permission', ); } That will limit access and viewing to those roles with that new "special_permission" permission. Does that take care of your needs? If it doesn't have its own process, please explain a little better what this page does, how it was created etc.
-
You will want something like this: public function ___execute() { $this->exportExcel(); } public function exportExcel($event) { header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=name.xls"); header("Pragma: no-cache"); header("Expires: 0"); $this->outputExcel(); exit; } public function outputExcel($data) { // your php://output" code } I used something like this is in: http://modules.processwire.com/modules/table-csv-import-export/ In that module you can test the behavior of downloading directly from a PW menu item by going to Pages > Admin > Setup > Table CSV Export and removing the hidden flag, then go to Setup > Table CSV Export and it will start a download directly from the process attached to that page. The module is not designed to be run directly from that helper page, but it will show you that it can work that way! Hope that helps to get you started.
-
https://github.com/ryancramerdesign/ProcessWire/issues/808 Feel free to add a comment about your experience if you want
-
kongondo was saying that the page he linked to has all PW versions all the way down to 2.2.4 - it includes 2.4, 2.3 etc. Weirdly it doesn't have 2.5 though - which you really should be using
-
Checking if a page has a FieldtypeMulti field
adrian replied to gRegor's topic in Module/Plugin Development
I am not going to be much help, other than to say that your code works fine with empty Page fields, File fields, etc - ie other field types that extend FieldtypeMulti. Can you can confirm the same at your end? If so, then it suggests it must be something specific to your FieldtypeWebmentions. Can't see why it would make any difference at all, but have you tried iterating through the page's template? foreach($page->template->fields as $field){ -
Looks like you are typing the address into the www field without the http:// so you can either make sure you do that, or you can do this in your template: <?php echo "<a href='http://{$image->www}'>Click Here for the WEBSITE</a>";?> I would recommend the former approach though because you never know if it will be a http or https site if you do it from your template. Nevermind - not thinking this morning - listen to kongondo below
-
$page->children("sort.... from smallest to greatest number
adrian replied to Matte85's topic in General Support
I don't think you'll be able to do that in a PW selector, but you can sort it after you have the page array. I asked this question a long time ago - that thread should help you: https://processwire.com/talk/topic/3392-emulate-natsort/ I am not sure if natsort works with comma decimals, but maybe there is an alternative php function you can use if needed? I am sure one of the european PW devs will have some input if this is an issue. PS Welcome to the forums! -
DownloadGuard - Module for restricted access on downloads
adrian replied to backes's topic in Modules/Plugins
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. -
DownloadGuard - Module for restricted access on downloads
adrian replied to backes's topic in Modules/Plugins
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. -
DownloadGuard - Module for restricted access on downloads
adrian replied to backes's topic in Modules/Plugins
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 -
DownloadGuard - Module for restricted access on downloads
adrian replied to backes's topic in Modules/Plugins
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! -
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!
-
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.