Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. @nixsofar: Do you speak from the exact same server in regard of the 2.6 and 2.7 installs? And what's about to install the 2.6, and after checking and seeing it's running, just upload the complete wire folder and subfolders from 2.7 to, e.g. wire-27. After upload is complete, rename wire to wire-26 and wire-27 to wire. Besides the complete wire folder you also have to switch the index.php. That's all. (the htaccess hasn't any changes between this two versions and can stay as is). Does this work?
  2. I struggled with this too in the past. A while ago, I switched to use The IntlDateFormatter class like, for example: $fmt = datefmt_create( 'de-DE', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Europe/Berlin', IntlDateFormatter::GREGORIAN, 'MMMM Y' ); // format doesn't use PHP style, but ISO-Format! see: http://framework.zend.com/manual/1.12/en/zend.date.constants.html#zend.date.constants.selfdefinedformats $datum = is_numeric($page->getUnformatted('datum')) ? datefmt_format($fmt, $page->getUnformatted('datum')) : ''; And welcome to the forums, @Klenkes. (?)
  3. Congrats! (and take all the time you can get for beeing with the baby)
  4. If the script says the service is down, this only mean that it couldn't connect to the target server. So, when on the website server the outgoing request is blocked (firewall), this would also result in the same error message. If you have email / smtp accounts on other servers, e.g. gmail, hotmail or what ever, I suggest try to connect to them via the test script and see if it is possible. And good luck!
  5. It also has zooming functionality. You only have to use big enough images. Maybe you can test it with a smaller browser window and then double click into the image or click the magnifier icon. That panning and zooming is especially useful on mobiles, but can also be used on desktops. It also supports fullscreen mode. Have I allready said that I lo.., - ah yes, I had. PS: but it has not such a multi-stage zooming functionality like open seadragon.
  6. what I love these days is photoswipe 4! But it's not a single image viewer, it's a slideshow player. But the best I know of. It comes standalone (for performance!), has inbuilt support for mobiles, including sending smaller images to those devices, full support for mouse, keyboard and touchscreens, etc. As I said, I love it. I use it on my site.
  7. Besides all the good and valuable points here mentioned, but for the moment: what's about to crop the images automatically for oputput in the lightbox to e.g. 400 x 600. If I would need minimum dimensions 400 x 600 or 600 x 400, I would set both min fields to 600 and then, depending on the ratio, crop / resize the images to the exact dimensions, 400x600 or 600x400. And yes, I know, it depends on the clients if they are able to check the result of uploaded images on the frontend.
  8. When you tried with the Thunderbird, was it on the same machine as the website is? Or the other way round: have you tried this settings and testconnection from an install on your localhost? If not, you also have to check if the server where your site is hosted has no outgoing firewall restrictions that get in your way. If the install is on an online machine, you can use the php library here in the spoiler. I often use this for quick checks on hosting machines to see if I'm able to reach other machines, ports, services from there. It is a pure PHP lib to ping severs on specified ports with defined transports.
  9. Thanks for the info and the module! I will try it out when I have a bit more time. So, you influence filesizes with specifying the quality level (0-100). You can set it sitewide in the config.php (default is 90) or you can pass it individually in an options array everywhere on API level. Is the last file in your screenshot created via GD, and what setting for quality have you used?
  10. Have you set $config->debug to true in your site/config.php ?
  11. you can call $database->getQueryLog():
  12. EDIT 3: Updated the code. Now it doesn't alter the modified time and modified user-id anymore. Before the change, it altered it of each page that changes the sort value! Also now it is lightning fast! instead of 30 seconds it now only uses 2 seconds.
  13. I have changed the line in my code that uses $page->setAndSave() with an own function that updates the values directly in the pages table. This way it works for me at the moment. But I think, we should send Ryan a link to this thread. databaseUpdateSortInPages($page->id, $sortValue); function databaseUpdateSortInPages($id, $sort) { $sql = "UPDATE pages SET sort = $sort WHERE id = $id"; $query = wire('database')->prepare($sql); $query->execute(); }
  14. yes, i have. Here is what is in the $options array when it reaches Line 1110, just before the if(empty($options['quiet']): $options array(6) { ["uncacheAll"] bool(true) ["resetTrackChanges"] bool(true) ["adjustName"] bool(false) ["forceID"] int(0) ["ignoreFamily"] bool(false) ["quiet"] bool(true) } $data array(5) { ["parent_id"] int(1011) ["templates_id"] int(44) ["name"] string(64) "sanierung-industriegebaeude-weiss-umwelttechnik-gmbh-reiskirchen" ["status"] int(1) ["sort"] int(999998749) } And after the if statement, $data looks like this: $data array(9) { ["parent_id"] int(1011) ["templates_id"] int(44) ["name"] string(64) "sanierung-industriegebaeude-weiss-umwelttechnik-gmbh-reiskirchen" ["status"] int(1) ["sort"] int(999998749) ["modified_users_id"] int(41) ["created_users_id"] int(1101) ["modified"] string(19) "2015-11-15 22:06:54" ["created"] string(19) "2015-09-25 08:18:44" } The info in the page, before executing the code is: After the execution, the info looks like this:
  15. Yes, I have seen this. But in my case it seems not to use the old values. I only want to change the sort value, and therefore it would be really good to not update the last modified timestamp. But when I inspect those pages in the pages finder, the modified time shows "before 2 seconds" or that like. I already have hacked into page::save and pages::savePageQuery with an debug function and saw that it retrieved the right values from the DB. So, I don't understand where it lost that or where it changes it or if it do another save after that ?? It shouldn't. My code is really simple, it is that piece to move pages down in the pagetree.
  16. Hi, I try to avoid updating of the modified timestamp and modified user. It should be done with passing "quiet"=>true in an options array together with the save method(s): $page->setAndSave('sort', $mySortvalue, array('quiet' => true)); But regardless if I use setAndSave() or save(), it gets updated every time. What I'm missing? I use PW 2.7 stable.
  17. @ukyo: you were right, there was a bug with the naming of variations. With using them from API in templates, it wasn't a big problem, but with trying to use them with the CKeditor it was, because the created name of the variation prevents PW from identifying them as variations, as you said. I found out that there simply was missing a single dot in front of the suffix string: -pim2-suffix has to be .-pim2-suffix in cases where only the pim works on original images, whereas when pim worked on a variation, everything worked alright. This is fixed now with version 0.2.7 of pim2.
  18. just completed and updated the function in the post above.
  19. Many thanks for all the suggestions! My current working solution is using a Pagefield with PageTreeSelect, and as a sidenote: wow! I never have used this fieldtype combination before. I always used ASM-Select. Just fallen in love again with PW. The second element is an injected button, what I have learned recently from a nice and usefull snippet of @Lostkobrakai. The working code is located in the ready.php and uses the PW API. Our pages in the example here uses the PageTreeAddNewChildReverse module, so the sort numbers stored in the DB are very high. (If you wonder why they have such high numbers in the screenshots.) The Pagefield where we select the new neighbour page is named "albumselect". /* moving albumpages programatically in the PageTree */ $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $DEBUG = true; $FIELD = 'albumselect'; // change to the name of your Pagefield ! $page = $event->object->getPage(); if (!(bool)$page->fields->get($FIELD)) return; // check if the page includes the submitbutton for our function if (!$page->sortable()) { // check if the page is sortable and the user has the right to sort it $this->warning($this->_("You have not the right to sort this page.")); return; } if ('sort' != $page->parent->template->sortfield && '' != $page->parent->template->sortfield) { $this->warning($this->_("The sortsetting of the parent page does not allow drag and drop. It is set to: {$page->parent->template->sortfield}")); return; } $form = $event->return; $input = wire('input'); $pages = wire('pages'); $i = $num = 0; if ($input->post('hook_move_page_in_pagetree') && $input->post($FIELD)) { $page->of(false); $selectedNeighbour = $pages->get($input->post($FIELD)); #$sortLow = $page->parent->child('include=all')->sort; // the sortnumber of the first page in the tree, top page $sortCur = $page->get('sort'); // the current number of the page we want to move $sortEnd = $selectedNeighbour->getUnformatted('sort'); // the number of the page where we want to sort in the current page if ($DEBUG) my_var_dump(array('sortCur' => $sortCur, 'sortEnd' => $sortEnd), 1); if (0 < $selectedNeighbour->id) { if ($sortCur != $sortEnd) { // has the user selected a real or valid change of position? if ($sortCur < $sortEnd && $sortCur != $sortEnd - 1) { // we want to move this page down in the tree foreach($page->parent->children('include=all') as $p) { $num++; $p->of(false); if ($i++ > 50) { set_time_limit(30); $i = 0; } // just to play save, reset timelimit if ($p->sort == $sortEnd) { // we reached the page on which top we want to place the current one if ($DEBUG) { my_var_dump(array('num' => $num, 'page->sort' => $page->sort, 'result' => $sortEnd - 1, 'sortCur' => $sortCur, 'sortEnd' => $sortEnd, 'break' => true), 1); } else { #$page->setAndSave('sort', $sortEnd - 1, array('quiet' => true)); databaseUpdateSortInPages($page->id, $sortEnd - 1); } break; // we are finished now } if ($sortCur < $p->sort) { // only change sort for pages that are between $sortCur and $sortEnd if ($DEBUG) { my_var_dump(array('num' => $num, 'p->sort' => $p->sort, 'result' => $p->sort - 1, 'sortCur' => $sortCur, 'sortEnd' => $sortEnd), 1); } else { #$p->setAndSave('sort', $p->sort - 1, array('quiet' => true)); databaseUpdateSortInPages($p->id, $p->sort - 1); } } $pages->uncache($p); // free memory } } elseif ($sortCur > $sortEnd || $sortCur == $sortEnd - 1) { // we want to move this page up in the tree foreach($page->parent->children('include=all') as $p) { $num++; $p->of(false); if ($i++ > 50) { set_time_limit(30); $i = 0; } if ($p->sort >= $sortEnd && $p->sort <= $sortCur) { if ($p->sort == $sortCur) { if ($DEBUG) { my_var_dump(array('num' => $num, 'p->sort' => $p->sort, 'result' => $sortEnd, 'sortCur' => $sortCur, 'sortEnd' => $sortEnd, 'break' => true), 1); } else { #$page->setAndSave('sort', $sortEnd, array('quiet' => true)); databaseUpdateSortInPages($page->id, $sortEnd); } break; } else { if ($DEBUG) { my_var_dump(array('num' => $num, 'p->sort' => $p->sort, 'result' => $p->sort + 1, 'sortCur' => $sortCur, 'sortEnd' => $sortEnd), 1); } else { #$p->setAndSave('sort', $p->sort + 1, array('quiet' => true)); databaseUpdateSortInPages($p->id, $p->sort + 1); } } } $pages->uncache($p); } } } } if ($DEBUG) die(); } $button = wire('modules')->get('InputfieldSubmit'); $button->attr('id+name', 'hook_move_page_in_pagetree'); $button->value = __('jetzt einsortieren!'); $button->addClass('ui-priority-secondary'); $form->insertAfter($button, $form->get($FIELD)); }); function databaseUpdateSortInPages($id, $sort) { $sql = "UPDATE pages SET sort = $sort WHERE id = $id"; $query = wire('database')->prepare($sql); $query->execute(); } . . EDIT: Updated the above code. It supports up and down moving now. Also it has a debug function now. (The used function for debug output is in the spoiler beneath) What could be done better: [x] first check if the pages are set to use manually drag/drop sortorder or not. [x] test with direct manipulating DB-tables to improve speed. Currently, on my server, it took up to 35 seconds for iterating over 1250 pages and saving a new sortvalue for each of them. But this only happens if we move it from one end to the other (first place to last place). If we move a page 150 places, there will be only changed 150 pages in DB. This tooks around 4 seconds here. EDIT 2: Updated the code and included @Lostkobrakais idea to check for the PagetreeField on every page, and not on templatenames etc. This way we can add/remove the functionality to every templates we like, just by adding/removing the Pagefield to them, without altering the hook-function. (In our case the pagefield is called 'albumselect'). EDIT 3: Updated the code. Now it doesn't alter the modified time and modified user-id anymore. Before the change, it altered it of each page that changes the sort value! Also the execution time is much faster now. It only takes 3 seconds on my server to move it 1200 pages down or up. (Before using direct DB-access, it took 35 seconds)
  20. I believe this isn't doable in PW because on every manually move in the pagetree all integer sort fields gets rebuild in a linear row, without those niches. Otherwise this would be the best or simplest solution, I agree.
  21. What do you mean with the timestamp? The timestamp when the variation will be created / recreated? If yes, I think this isn't possible without some extra programming logic. CroppableImage is an API tool, that means, you have to define some (static) constants in the template files during development time, like a suffix. This is needed to detect if an imagevariation already exists or need to created on execution time. It would need an extra layer, etc. I don't know what you want to do with the timestamp, but you know you are totally free how to create the markup for an image tag. And the timestamp is already stored in the filemtime() of the file. So, if you need the timestamp in PHP, you already have it with filemtime(), but I guess you need it on client side with javascript? Then you may read it and put it into a data-timestamp attribute of the image tag, for example: $ts = filemtime($image->filename); echo "<img src='{$image->url}' data-timestamp='{$ts}' />"; If that isn't helpful for you, please tell us a bit more what you are after with the timestamp. And welcome to the forums!
  22. here is a troubleshooting guide: http://processwire.com/docs/tutorials/troubleshooting-guide/page3 or maybe your problem is described one page back.
  23. It isn't about sorting 400 pages. The pages have kind of a chronological order. And mostly there will be added new projects to the tree what only need to be sorted within the top 20 pages. That's just fine. But there are also some older projects that should find the way into the online archive. And this pages needs to be pulled down 400 pages or more. (sigh') I think the first thing I will experiment with, is to display the pages sort (range) number in the pagetree. So we can see them and easily pick one we want a new page moved to. Add a "desired sort range" inputfield and maybe a button to those pages template, where we can add in a sort range number where the page gets moved to on / after saving or when an own button was pressed.
  24. On a site we have a branch with 1200+ pages. The sort order is manual drag and drop. Sometimes we need to move new created pages 300 or 400 places in the pagetree. This is a real pain. Is there any way (besides moving them manually) how we can sort in a page at a desired place?
  25. I'm using it with insertBefore the image field and it works fine, regardless of PageStatus. I also have added two lines to the AdminCustomFiles/AdminThemeXXXXX.css files to move it to the right: #wrap_hook_sort_images { float: right; } #wrap_hook_sort_images:after { clear: both; } Such a nice and helpful snippet from @LostKobrakai, I really love it.
×
×
  • Create New...