Jump to content

Luke Solar

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by Luke Solar

  1. Google Spent 2 Years Studying 180 Teams. The Most Successful Ones Shared These 5 Traits https://t.co/IvoU7MiSkB via @flipboard

  2. JIRA Tip of the day: How to define default values for create screens https://t.co/yeq7epBblK (with Workflow Essentials) @JIRA #jiratips

  3. I’m going to "Codemotion Berlin 2016"! Who’s joining? https://t.co/IOWmg1FcMn

  4. RT @samnewman: A very funny analysis of npm dependencies, via @2metres https://t.co/MHSj3loP8E

  5. The 5 Most Promising Frameworks of the First Half of 2016 https://t.co/i46jPe9mRm via @DZone

  6. RT @sjmaple: #IntelliJ finally overtakes #Eclipse in the war of the IDEs! //@jetbrains https://t.co/xEBbCeJ7Rt https://t.co/7DL6NLmcNM

  7. RT @TOABerlin: And we're live in 3..2..1. TOA16 is officially ON! Follow us on IG: TOABerlin, FB & Snapchat: TechOpenAir to keep updated on…

  8. For the Automatic Name I wrote another module. It adds "template_[id]" as the name. Only if its the only allowed template to add AND it has no template file associated. This is basically usefull to group entities. e.g. -- company -- address_list -- address_1 -- address_2 I hook into the ProcessPageAdd ___execute Method. Its the only hookable method in the Module. And all properties are protected. I didnt want to check allowedTemplates again with custom code so I made the function of the ProcessPageAdd Module "getAllowedTemplates()" public. The parent_id is also available in the ProcessPageAdd object could be better to write a getter for that property too but I didnt want to change the core module "ProcessPageAdd" too much. Any suggestions? public function init() { // add a hook after the Page/Add (= ProcessPageAdd.___execute()) $this->pages->addHookAfter('ProcessPageAdd::execute', $this, 'addNameAndProceed'); } /** * If we add a page to a EntityList * */ public function addNameAndProceed($event) { $pageAddObj = $event->object; $allowedTemplates = $pageAddObj->getAllowedTemplates(); $template = reset($allowedTemplates); // reset = first element in associative array // only execute if there is only 1 allowed template // AND it has no file associated (means not visible / no real url) if (count($allowedTemplates)!=1 || is_file($template->filename)){ return; } $parent_id = 0; if(isset($_POST['parent_id'])) { $parent_id = (int) $_POST['parent_id']; } else { $parent_id = isset($_GET['parent_id']) ? (int) $_GET['parent_id'] : 1; } //$event->replace = true; //$template = wire('templates')->get('engagement'); $page = new Page($template); $page->name = 'dummy123'.rand(); $page->parent = $parent_id; $page->save(); $page->name = $template . "_" . $page->id; $page->addStatus(Page::statusUnpublished); $page->save(); $this->message("Automatically added a Name (the id). Entity ready for edit."); $this->session->redirect("../edit/?id={$page->id}"); }
  9. Very nice - It was quite easy to add the 2 subpages. I added a Hook after 'save' and with $hookEvent->arguments[0] you get the page and add the Subpages if necessary Module Code: public function init() { // add a hook after the $pages->save $this->pages->addHookAfter('save', $this, 'createSubPagesForCompany'); } /** * Hook into the pages->save method and create two subpages if necessary * */ public function createSubPagesForCompany($event) { $page = $event->arguments[0]; $templates = wire('templates'); // only for template 'company' // create two subpages 'engagement_list' & 'address_list' if necessary if (!$page->isTrash && $page->template->name == 'company'){ if ($page->children('template=engagement_list')->count()==0){ // create engagement list $eng_list = new Page($templates->get('engagement_list')); $eng_list->parent = $page; $eng_list->name = 'engagements'; $eng_list->save(); $this->message("Engagement Liste erstellt."); } if ($page->children('template=address_list')->count()==0){ // create address list $addr_list = new Page($templates->get('address_list')); $addr_list->parent = $page; $addr_list->name = 'adressen'; $addr_list->save(); $this->message("Adressliste erstellt."); } } }
  10. I did not use repeaters for these reasons: I need to access lists of addresses and lists of projects with full access to their parents. Filter them with different criterias (project start date, address discrict,..) I found it not really convenient to "search" through repeater fieldtypes. E.g.: latest projects (showing also the company name etc), list of ALL addresses on google maps with infowindow including data from the parent (company). When I have more then 5-10 items its not really good usability to have such a huge form. Somewhere its said that repeaters are not "infinitly scalable" but I would need to store a lot of addresses and work with them independently. Would you agree on these points? Thanks for your comment. Hope to find a way to get rid of these repeating tasks to give a "name" to an address and create the placeholders for sub-pages just to structure them in the backend. Its annoying for the client. I hope that anyone has come across this....
  11. Hello, I have a page structure as follows: - Company (only this page has a corresponding php template to show data) - Adresses - Street/ZIP #1 (template "address" without php file) - Street/ZIP #2 - ... - Projects - Project #1 (template "project" without php file) - Project #2 I would like to have the following workflow: 1. When I create a new Company, the pages "Addresses", "Projects" (only placeholders to structure data) should be created automatically. 2. When I add a Project or Address, the first step (Setting a "name", Selecting the only allowed template) should be skipped, instead an empty address should be created with just an ID and the name should/can use the ID too. Anyone knows of a module which helps here? something like "Entities4Processwire". I really like the Idea of everything is a page, but for structure only sometimes Im missing an "Entity" with just an id and custom fields. I checked the core module ProcessPageAdd and probably the "___execute" method of the module would be the place to hook into, right?. Would be nice to hear your thoughts about this. Thanks!
  12. Yes, true. But I think it really depends what someone is doing what hooks are considered useful. Although I think hooks for "Page" could be more useful then for "Module", but that really depends. A somewhat extended documentation on hooks may be useful and some sort of cookbook as it can be found in the HelloWorldModule. What are popular things you write hooks for?
  13. Is there a List of recommended / popular hooks in the meanwhile somewhere? Sorry, found it http://processwire.com/api/hooks/
  14. Great module! Exactly what I was looking for. Thanks a lot.
  15. Hello! I have pages of "companies", each company can have multiple addresses and multiple projects. I add them as sub-pages. To distinguish them I would like to preceed them in the List with "Address: " and "Project: " - in order to better distinguish them. Is it possible? At the moment I just use "template" to output the template name but would be nicer for the client to customize it further. Anyone knows how? Something like: Audi - Address: Somestreet. 99, 12053 City - Address: Another street 99, 12053 City - Address: Yetanotherstreet. 99, 12053 City - Project: XY 2011 - Project: TT 2013 you get the idea I guess. How do you handle pages/entities with multiple different subpages of different types? I didnt want to use repeaters as its a little bit annoying when you have a lot of items. and the documentation says they are not "infinitly scalable"... thx for suggestions, good process!
  16. Thanks for your answers! Strange that you cannot reproduce it Soma, I use ProcessWire 2.2.9. To reproduce it maybe you have to set the ready items to a different number and then create an item in order to trigger the function which creates the items: Set the ready items to 3 (for example). then go to a page using the repeater, ADD an item (if you had set ready items to zero you have to save the page immediatly), well ADD the repeater item then save. 3 empty items are added. Access them with foreach($page->repeateritems as $repeateritem){ echo $repeateritem->titel; // empty for new items echo $repeateritem->id; // its set to a new page id echo $repeateritem->status; // returns 3073 for "ready items" } echo count($page->repeateritems); // count includes new "ready items" Thanks for comments.
  17. Good evening! I added a repeater field to a template of mine with "ready items" set to 1. So one item is always in the DB with a status 3073. I cannot find that status in the cheatsheet or anywhere else... seems its "unpublished" and "hidden" The problem is when I iterate over the items, the "empty" one is also included. Is this behaviour intended? How can I filter out the "unpublished" repeater items? foreach ($page->subitems as $item) { echo "id: {$item->id}<br/>"; echo "status: {$item->status}<br/>"; } My current solution is to do a $page->subitems->filter("status=1") Furthermore would be nice to know more about how to handle status in general and related to repeaters. I did a search of course but found not much. Thanks a lot!
  18. Would be awesome if the system could track these changes and save them to a sql file. These files could be under source control and when a user updates his code the admin interface could run theses queries. Just as an idea
  19. Hello Wirecommunity! Thanks for your answers. I only partly agree with "someone in your team should be the gatekeeper for these administration resources". While thats definitly true that someone (or a part of the team) should plan the database and architecture, change is unavoidable and even welcome nowadays in agile dev. When you change the name of a Field in the Object Model (when using a ORM) or Database (when using direct db access or xml) this change should easily be propageted to all teammembers/servers. Don't you think so? Second point: If I make a fieldtype "location" locally including lat/lng then I have to go (manually) to all installations and add the field via the backoffice? atm I'm just synching the whole db every time I switch from laptop to PC but that would be impossible when a teammember joins me. I mean the whole thing is planned but the implementation should be done simultaneously in the end. I will - for now - sync the db. For the team there will be a documentation how the different field names for each template are. BTW ryan, regarding the creation of fields (and structure data) what tables should be synched? I just wanted to open a discussion for best practices here - Thanks for your feedback and any further comments. good processing, have a nice day!
  20. Hello All! I would like to ask you how you manage to work in a team on a processwire project. This also applies to the case when you develop on different machines (e.g. laptop on the train and desktop office pc). For example: two different developers create 2 templates with various fields, then they push/commit their changes to a repository. both can update and merge the changes. but: to make the fields and templates available in the backend you still would have to add the database entries to the "fields" and "template" tables, right? What are solutions and best practices for team development? Thank you and keep on wiring!
  21. Developer Economics 2013: The tools report http://t.co/Qaz3QLNv via @VisionMobile

×
×
  • Create New...