Jump to content

matjazp

Members
  • Posts

    722
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by matjazp

  1. I tried this: wire()->addHookAfter("Page::trashable", function($event) { $page = $event->object; wire('session')->message('trashable: '.$page->id); $event->return = false; }); With that hook the trash icon in page list is gone (for all pages of course), but I can still move the page to the trash. Also, I can trash the page in Delete tab (while editing the page) unless I hook to Page::deleteable.
  2. I noticed something: when you enable advanced settings in config.php and set "Disable trash option" in templates System tab (API: $template->noTrash = 1; // or 0 to disable) the trash icon is not present in page list (when you click on move), that is ok. But, you can move page to the trash... is this expected behaviour?
  3. I would like to prevent certain page delete (or move to trash) if it is still "in use" in other pages. I would like to hook in admin.php similar to https://processwire.com/talk/topic/5027-hide-page-instead-of-trash-or-delete/ wire()->addHookBefore('Pages::trash', function ($event) { $page = $event->arguments[0]; //do some checking wire('session')->message('just testing'); $event->replace = true; } ); but page is moved to trash and message is not displayed when I'm in the Page list (I click Move then Trash icon on the right). If I delete the page while editing it (In tab Delete and then confirm), it works as expected. What am I doing wrong? In debug tools hook is listed: before Pages::trash() anonymous function() class method 111
  4. @jordanlev, thank you for your thoughts, I was facing with similar problems. I quite like how edit pages works, but for end users I needed something just a little bit different. I didn't want to reinvent the wheel so I ended up creating my own ProcessPageEdit module, based on the original. There I hid the tabs (now we have module for that) and changed the logic about saving and redirecting. Then I didn't want header and footer, so again, I just grabbed AdminThemeDefault and made my own theme, where I get rid off unwanted stuff. I can elaborate further if needed.
  5. What is the purpose of Check field data in Fields -> Advanced? It reported: pages_id: 14, data: Edit Template pages_id: 15, data: Add Template pages_id: 12, data: Templates pages_id: 19, data: Field groups pages_id: 20, data: Edit Fieldgroup pages_id: 17, data: Fields pages_id: 18, data: Edit Field What should I do? I just saw new tab and deleted the orphans
  6. @Beluga, I already saw post from jordanlev. @Ivan, I know I can find a ready to use solution, we already have one, my question was more hypothetical. Thanks for your opinion.
  7. Let say that I need enterprise application for inventory of the equipment. The firm buys 100 laptops. Each laptop would get id number (automaticaly generated), name, location, date of purchase, responsible person etc. The user would need an option to modify & delete the items, make a search base on all fields (eg. what items are located in specific location, what are the items older than 5 years) and make reports as PDF. Emailing is not needed at this point. As I noticed in the video for form builder, collected data from the forms could be put into pages. The amount of data would be in range of 10.000 items per year and would need the archive for at least 10 years so 100.000 pages is bare minimum.
  8. I need an advise. I might need the "custom application" (nothing specific in mind) and I'm not sure how to start. I could create forms by hand (<input name=... type=...>), I could create forms in PW way ($f = $modules->get("InputfieldText"); $form->append($f); etc.) but I would like to do it more "visually". I could use FormBuilder (never used before, just saw the video). I could render the forms from templates, like in the admin area (ProcessPageEdit.module?). I could make my own admin theme as full blown admin would probably be too much. What is you advise? How to start? Thanks!
  9. I had to add extension=php_fileinfo.dll to php.ini on windows environment...
  10. On ProcessPageEditImageSelect module you can check "Skip width attributes on images tag". When I insert the image (CKEditor) width tag is still there, like width="1300" (image is 1300 px wide). After page is saved width tag is stil there, but it is width="1200". Where is 1200 coming from? Is it possible to use the old module (without all of this options that might be confusing)? Testing on PW 2.5.25 dev.
  11. Did you add "TextColor, BGColor" to the CKEditor Toolbar? My first line looks like this: Format, -, Bold, Italic, Underline, -, TextColor, BGColor, -, RemoveFormat You can further customize what colors will be allowed, under Custom Config Options: colorButton_enableMore: false colorButton_colors: F00,FFC609,FFF
  12. I have template pr-index, children (template pr-item) are reverse sorted by pubdate (Datetime field in pr-item), not reverse sorted by created date. Is it possible to have manual drag-n-drop in this situation?
  13. I finished http://feri.um.si/
  14. Use google webmaster tools, option view as googlebot and if it can display email address, then EMO failed.
  15. Bots are not (yet) clicking, so I ended up using this function, found somewhere on the net, modifed to my needs. function hide_email($email) { $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; $key = str_shuffle($character_set); $cipher_text = ''; $id = 'e'.mt_rand(1,999999999).mt_rand(1,999999); for ($i=0;$i<strlen($email);$i+=1) $cipher_text.= $key[strpos($character_set,$email[$i])]; $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d="";'; $script.= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; $script.= 'document.getElementById("'.$id.'").innerHTML="<a href=\\"mailto:"+d+"\\">"+d+"</a>";'; return "<span id='$id' onclick='$script'>[show email]</span>"; } Someone with better programming skills might do better job (jquery?)... Google captcha could be alternative.
  16. I have a template that list emails. I'm hiding emails with javascript (I could use Soma's EmailObfuscator), but javascript is no longer sufficient since bots execute javascript. I was thinking about captcha solution so that before the page is shown human "presence" is required. How could I do that? What are your solutions? Matjaž
  17. I can set datetime field to hold the current date when no value is entered while adding a new page. Is it possible to set default datetime field to something else than current date? Like current date + 3 days?
  18. Ahm, search before post? What's that? Sorry. Yes, I did double post, but sometimes I don't get answers if I ask on another thread, so I just tried my luck here. Hope you are not offended to much ...
  19. What is the difference between $a->add($item) and $a->append($item)? I know there are some speed improvements in 2.5.x (comparing to 2.4) but is there room for more? I'm using caching in templates, I can not use ProCache. Looking at timers in debug mode I see: boot: 0.2262 boot.load: 0.1925 boot.load.fieldgroups: 0.0506 What is going on between loading fieldgroups and load?
  20. Looking at the timers: boot 0.2320 - includes all boot timers boot.load 0.1985 - includes all boot.load timers boot.load.fieldgroups 0.0508 Is there room for further optimisation? What is taking so long between boot.load.fieldgroups and boot.load? There are 48 queries, 25 modules loaded (I installed PageListPin, ProcessPageDelete, ProcessPagePublish, SessionLdapAuth), no caching, 2.5.4 dev
  21. Soma, kixe (and others), thank you, but I don't understand what do you mean by "should work if called in a child page", "even if called from the page you are looking for", "even works when on the parent itself". I'm calling this from my template (template.php) that looks like this: <?php include_once("./functions.inc"); $content = $page->body; include("./default-page.inc"); default-page.inc <?php include("./header.inc"); ?> echo $content; $rootParent = $page->parent("parent=1001"); // where 1001 would be /foo/ echo $rootParent->id; //expected result 1001, it returns 0 <?php include("./footer.inc"); ?>
  22. Wow, lot of responses Let me summarize what works and what doesn't work: // it works $rootParent = $page; while($rootParent->parentID != 1361) { //while($rootParent->parentID != $pages->get("/foo/")->id) { $rootParent = $rootParent->parent; } //doesn' work $rootParent = $page->parent("parent=/foo/"); //doesn' work $rootParent = $page->parent("parent=1361"); //doesn't work $rootParent = $page->parent('parent=' . $page->rootParent); //works $rootParent = $page->closest("parent=$page->rootParent"); //doesn't work $rootParent = $page->parents->eq(1);
  23. I assume ProCache is not working on Windows/IIS web.config?
  24. $page->rootParent returns foo, not home, of course kixe, your solution works, I just replaced your while statement with: while($p->parentID != $pages->get("/foo/")->id) { (actually i just put my foo's id instead of 1). Thank you!
×
×
  • Create New...