Jump to content

horst

PW-Moderators
  • Posts

    4,085
  • Joined

  • Last visited

  • Days Won

    87

Everything posted by horst

  1. This is something that should be included into the DiagnosticsModule, a check like it is done with the installation routine!
  2. if this all doesn't work, one can get an info output of vhosts (with apache on windows) with calling: cmd /K C:\Apache2\bin\httpd.exe -S (replace C:\Apache2 with the path to your apache directory) This gives a screen like
  3. Oh, that with the reverse order isn't an easy one. Files / Images are uploaded via ajax, and multiple of them asynchron, as Pete already said. On a site where the owner uploads many images at once via zip, I use a bootstrap script to let him rebuild the sortorder by name. The script only get invoked manually by clicking on a link. It is in the template, like the edit-link if a user is logged in and the page is editable: if($page->editable()) { echo "<a class='nav' id='sortimages href='/pwsortimages.php?id={$page->id}'>SortImages</a>"; } Here are the script code I use. If this can be handy for you, until someone comes with a better solution, you can sort by -created or -modified I think. <?php // define userroles that are allowed to work with this script, like: superuser|editor|author $userRolesSelector = 'superuser|editor'; //-------------------------------------------------------------------------------------------// // check if we have got an id $pageId = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : false; if(false===$pageId) { header('HTTP/1.1 403 Forbidden'); exit(3); } // bootstrap PW require_once(dirname(__FILE__) . '/index.php'); // check user-account if( ! wire('user')->hasRole($userRolesSelector)) { header('HTTP/1.1 403 Forbidden'); exit(2); } // check if id points to a valid page $p = wire('pages')->get($pageId); if($p->id!=$pageId || !$p->editable()) { header('HTTP/1.1 403 Forbidden'); exit(1); } // now we reset the order for the images / files $p->of(false); $p->images->sort('name'); // -created ?? $p->save(); // and redirect to the page edit screen $url = wire('pages')->get(2)->url . "page/edit/?id=$pageId"; header("location: $url"); exit(0);
  4. something like this should work: $tempPath = '/some/writeable/path/on/your/server/'; if($page->onefile) { $dest = $tempPath . $page->onefile->name; if(copy($page->onefile->filename, $dest)) { // http://www.php.net/manual/en/function.copy.php $page->setOutputFormatting(false); $page->files->add($dest); unlink($dest); $page->onefile->removeAll(); // or $page->onefile->delete($page->onefile->filename); ? $page->save(); $page->setOutputFormatting(true); } }
  5. @teppo: I trust you! Meanwhile I have updated / edited my post above but have not noticed that you replied to it.
  6. I do not mind that people should not play. But by my school days Orwell was still required reading. I just came to the conclusion that the large corporations seem to see people of all ages simply as beef cattle or slaves. In central Europe statistically every person up to age 70 buys for 4 million euros goods, including food, clothes, etc. (1 human == 4 million euros) Industrial food corporations don't want new born humans getting mother's milk. Why don't want they? I could go on and ask some questions about pharmacy cooperations or others, but the parallels should be clear already. Google want to install a global ring with new telecommunication Satellites. For this, they invest 3 billion euros. (or only dollars?) Do they do so just that people have something to play? I think no. And if someone now want to ask what Google and their glasses has to do with the industrial food corporations, well -, then it seems to be darker than I 've thought. (Google is a corporation with commercial interests. Their goods are informations and they sell them to who ever want to buy them, most likely to those who have much much much money.) ------ @teppo: No offence here, but if you think we live in a beautiful world and are free to do what we like, (and maybe you think I'm to old to be up to date with younger lifestyle) than go and ask some greek people in the same age as you are. If you don't know greek young people, go and ask some from spain or portugal. They all live in free democratic countries for more than 60 years, - not in repressive systems, - but only on the paper. ------ EDIT: I like some points of http://criticalengineering.org/en and if you have something like 'repair cafes' in your neighbourhood and go there, you will see that today mostly all of the technical goods have some quirks in it that are not good to the people who have buied them. It could be simple things like the primary transformer that scale down voltage to suite the needs of the actual good. It seems to be common now to built in components for higher costs but results in lesser quality. Example: in germany you have 230V and the electronic industry offers 'one piece components' that scale down the voltage to 12V with a max usage of 1 ampere (just an example, not sure if I recall all parameters right here). These components have a cost of 50 cent per piece for the corporation if they take some thousands. But now a days most corporations like to buy and built in components for a cost of 80 cent per piece that supports a voltage scale down to 15V. You can compare this with overclocking your PC RAM and CPU. The goods work fine but get more damaged with every minute you use it - and without any adavantages for you in the usage. Question: why do the corporations not want to save 30 cent per piece? (If they sell 10 million goods, there would be 1 million more income) If you like I can provide more examples: Recently we need to buy a new washing machine because the 4-5 year old one doesn't work anymore. After opening it we saw that only the carbon brushes of the electric motor were worn down. But we don't get new carbon brushes in the needed sizes anywhere. Also the electric motor wasn't build / designed to get opened in an easy way (like it was in the past for nearly every sized electric motors). That results in buying a new washing machine = costs 500,- euro. Carbon brushes would have cost 5 - 10 euros? And a professional repair service, for those who cannot do those things by themself, may have a cost of 50,- to 100,- euros? Having the the machine repaired has many benefits / advantages for the community / humans / nature etc., but not for the big corporations. So, I think one need some different points of view if a community builds a CMS / CMF framework or if a global corporation like Google does. The motivations and interests are different.
  7. ID is ok, but hard coded somewhere in the code isn't that good. Because you display code for the public and at least you should comment that for users that are not familiar with PW or module code (starters?).
  8. wire('pages')->uncache($auction); // at the end of the loop ?
  9. A hardcoded parent folder id (1286) isn't the best way to specify it, ($page->parent->id != 1286 && $page->parent->id != 7) && $page->parentPrevious->id == 1286 ... here is the code if you use it with wiremail: public function sendMailOnChange($event) { $page = $event->arguments[0]; if(!$page->parentPrevious) return; // if page is not being moved then stop now // When page is moved outside its parent but not trash if(($page->parent->id != 1286 && $page->parent->id != 7) && $page->parentPrevious->id == 1286) { // Email address of user that created page $userEmail = $page->createdUser->email; // Message that appears after page is moved $this->message(sprintf( __("Mail was sent to: %s at his email address: %s "), $page->createdUser->name, $userEmail); // preparing and sending email $subject = __("YOUR MESSAGE IS MOVED"); $textBody = sprintf( __("Hello: %s \r\nyour post has been moved !!\r\nYou can find it here: %s"), $page->createdUser->name, $config->httpHost . $page->url); $from = 'me@example.com'; // if you have defined it in config page, you simply can send an empty string here $numSent = wireMail($userEmail, $from, $subject, $textBody); } } If you have installed one of the extended wireMail modules, you have done your smtp server config on the modules config page and don't need it to repeate in the code for every mail you send. Also you have tested via a testconnection if the settings a free of typos. One more thought: maybe a simple plaintext mail is enough, if the only html you need are 2 linebreaks. - plaintext does support that too.
  10. I have no phpmyadmin installed, I used another tool and it first said: Table does not support optimize, doing recreate + analyze instead. than it said: status ok. But when I come back to the DiagnoseModule it is unchanged. Does phpmyadmin display info for overhead? Should I install it?
  11. Version 5.5.13
  12. @Steve: works perfect! Have optimized 10 tables successfully. - Maybe one optionally can have one button invoking optimize for all tables at once, instead of doing it repeatedly one by one? - And I have encountered a table that was created as InnoDB and not MyISAM. It shows Overhead 23MB, is this correct? This one get not optimized by clicking the link.
  13. http://julianoliver.com/output/log_2014-05-30_20-52 ------ and a german article: http://www.heise.de/security/meldung/Don-t-be-a-glasshole-Google-Glass-Blocker-fuer-WLANs-2216158.html
  14. $pass = $input->post->awesome_password; if( (isset($pass) && $pass != $page->page_password) || !$pass) //....show form etc... or better / shorter $pass = $input->post->awesome_password; if ( !$pass || $pass != $page->page_password ) //....show form etc...
  15. @Jonathan: looks good! Thanks.
  16. For example if you have a hidden tree with children containing different downloadable content and one public page with url /download/ that get information which downloadable page is requested by session or some input. The current page is /download/ but I want to render and display another page. Does this make sense?
  17. But then, is it possible to force rendering _with_ layout from a (let's say kind of) controller page?
  18. Love the CropImage approach too, - especially the art direction possibility! But want to mention that there maybe also an interest of getting adaptive / retina images for people who don't want use the cropimage module. Do we need to create two modules? Or can we say if you need adaptive images, just load the thumbnail module and specify three target variations but with only one dimension to get an uncropped but resized version: smartphone,200,0,template,2x Does this result in a 200px width and a height according to the aspect ratio? (there was lately an update with cropimages module, but haven't downloaded and installed it now.) But can this really work? Or are these two usages to different? I want my adaptive images created on upload! if I don't want use art direction via cropimage module. ------- Like Martijn, I also want to have an adaptiveRender() method. Could this be an optional feature, that a developer doesn't have to use, but is able to use? To use it he once should have to provide a template markup with placeholders for the image variations. ------- The basic root seems more clear after @MadeMyDays post. Only I haven't got which way to go with simple adaptive images on upload (imagesfield) and the more individual way with crop images. Also a usage of both should be possible in one site / on one page. Any thoughts / hints / tips on this?
  19. EDIT: now I'm on desktop. You can simply set a temporary $config var to force the output of the $layout_body without the content of the _base.php. Simply define $config->onlybodycontent = true before starting the loop and in top of your _base.php check for it: <?php if($config->onlybodycontent) { echo $layout_body; return; } ?> <!DOCTYPE html> <head> ... This is same like you can use it with content loading via ajax into a page: if($config->ajax || $config->onlybodycontent) {
  20. I think there are already lots of thready / posts that covers that: just google
  21. How do you do the loop? Some code would be useful, also which template (file/s?) do they use and which one(s) uses the parent (where the loop happens)?
  22. @vxda: I think you cannot do on the template. You need to do it with a module. Please refer to the API of that and to the "Hello World" module. If you have any questions than, maybe what hook to use, please ask here, (for any further help). Also you need not to include an external mailer. You can use the new wiremail() function and one of the new wireMail-extension modules: teppos SwiftMailer or my WireMailSmtp.
  23. @owzim: I remember vague that this was real in the times when PHP version just had changed from 4.0.6 to 4.1.0. But its a long time ago Unfortunately the code you provided for testing will not run with the oldtimers, otherwise I would have done a test with it.
  24. Good article! If we want to follow that, we should go with hisrc & jQuery, or independently with foresight. (Or modify them | take out the bandwith thing | create something own) Which effects does this have for browsers with disabled JS? Can it have a NoJS-fallback?
  25. @Martijn: would be best, the browsers have implemented the <picture> tag and do this stuff by themself. The workaround solution for it (picturefill) do not have a bandwith check too, (or I haven't seen it). I have linked to the hisrc because I have thought maybe you can take this, because it looks close to what you have. This way you don't need to build all new. This also has no bandwith checking. Also I cannot imagin how to implement that on a per image basis. the PageimageAdaptive should do the following: has a configpage where you can add the data for the different variations (imagefields ?, templates ?) hook into imageupload and create the variations add new property / properties to pageimage to output complete img markup and / or only url/s optionally enable retina variations in the configpage or request with pageimage options on a per image basis need something to output / inject the needed JS code into the page Have I forgotten something? Actually I can do 1., 2., 4. 3. I will find out how to do it 5. I don't know yet
×
×
  • Create New...