Jump to content

blackeye1987

Members
  • Content Count

    37
  • Joined

  • Last visited

Everything posted by blackeye1987

  1. @LostKobrakai - this would miss the feel of having it in the settings tab, besides yes i could make a custom settingsTab, but this would also miss my approach. i am not looking for a quick solution more for a clean or even expandable solution. using @BitPoet's approach , i am more flexible and able to communicate with my team and the customer. having hidden fields through content tabs might give an irritational feel when working with customers
  2. Hi Everyone, i couldn't find a way to put a custom field into the settings tab i'd need that field only as a superuser, to hide pages from my own search engine. best would be a custom status, but a checkbox in the settingstab would be the smoothest solution i wasn't able to find anything like that in the forum so far. feel free to move the thread, if i am in the wrong subforum
  3. hey there great module, but i have kind of an issue with it: on creating a repeaterMatrix element with an icon-picker, i get a dropdown (create.PNG) after closing the element and reopening it (with the little arrow on the right side) i get the icon picker. (closeReopen.PNG) it seems so random, that i can't find an explanation for it. ever got this issue ?
  4. Hi, does anyone encounter the Same bug ? 1.i have multiple pages in PW 2.5.29 2.and some older ones i need to Upgrade from 2.5.21 in Case 1 as a Superuser i cannot change stuff in my Profile (e-mail / password / language do work, some custom fields dont (also roles doesn't)) in Case 2 as a Superuser i can change everything without a sweat. Greetings
  5. well i found the problem... so as the child generater does everything right. i was looking on the wrong spot. the customer comes from a sso page linked to me. there i am creating on the fly his institute (A) if not already in the system. this is the what happens in order. 1 customer clicks link 2. customer sends data with his post to our sso login 3. creating the institute on the fly 4. child generater creates all subpages (2 tabs a configuration and some other stuff) 4.1 configuration gets created 4.2 tabs get created (the konfiguration at this point does not have the reference which the institute B is! so at this point the tabs get created without the correct info (due to my superb skillz i already cought it if no config or institute found make them unpublished) 5. configuration gets filled with the infos needed like who is my institute B 6. login i added between 5 and 6 1 step //find all due they might be unpublished foreach($b->find('template=tab,include=all') as $t){ $t->setOutputFormatting(false); $t->save(); } now everything works as intended. thanks for everyone who read my code and didn't told me i am a crazy scientist good day everyone
  6. i found a possibility.. which has nothing to do with my code.. in some way.. if i know more i will tell you in this post. tab has a lower id in the child generator then the konfiguration, so there is an possibility that the tabs are getting created before the configuration so obviously the tab cannot find the config.
  7. well the code is very specific and throws more questions then it could provide answers. but there you go: i create the pages with my child generater public function createChildren($event){ $page = $event->arguments[0]; $query = $this->db->query("SELECT * FROM ".strtolower($this->className).";"); //foreach child creater object foreach($query as $cco){ $t = $cco['parent_template']; $ct = $cco['child_template']; $cn = $cco['child_name']; $ci = (int) $cco['child_numbers']; $c = ''; //will be used as new Page if($t == $page->template->id){ if($ci > 0){ for($i=1;$i <= $ci;$i++){ $c = new Page(); $c->template = $ct; $c->parent = $page; // set the parent //if only 1 entry do not add the 1 if($ci == 1){ $c->name = $cn; // give it a name used in the url for the page $c->title = $cn; // give it a name used in the url for the page } else { $c->name = $cn.$i; // give it a name used in the url for the page $c->title = $cn.$i; // give it a name used in the url for the page } $c->title = $c->name; $c->tab_position = $i; $c->outputFormatting(false); $c->save(); } } } } } you have to configure it in processwire. basically. i set a template. when this template is set -> create x pages with template n if($page->template == 'tab'){ $parent = $page->parent('include=all,template=a_temp'); if($parent->id > 0){ if($parent->a_conf->id > 0){ foreach($parent->a_conf->b_affinity->b_conf->tab_add as $ta){ if( ($ta->tab_position == 5 && $page->tab_position == 1) || ($ta->tab_position == 6 && $page->tab_position == 2) ){ if($page->is(Page::statusUnpublished)){ $page->removeStatus(Page::statusUnpublished); $page->save(); } return; } } } if(!$page->is(Page::statusUnpublished)){ $page->status = Page::statusUnpublished; $page->setOutputFormatting(false); $page->save(); } return; } } return; this is where "the magic" happens. i have an institute(a) which has tabs. this institute(a) is a subinstitute of another institute(b). b is allowed to tell a if they can publish tab 5 and 6 of their institute. content from b is always provided b can only add content. the problem is: institute a gets created and linked with instutite b institute b is already configured. so institute a gets its config basically preset. on creating institute a (no matter what config institute b has) tab 1 and 2 (on a side) are not published even if institude b allows them to use them (institute b has them on tab 5 and 6) like i said.. i think this whole thing is more confusing then my starting question.
  8. Hi, i got a weird problem and cannot find any answer. i have a module that creates pages when a certain template is set (posted it somewhere in the forum) and i have another module that if a page is saved it checks another page settings if the page is allowed to be published or unpublished. (this happens on page save and worked the last few weeks) now it seems like when the subpage gets created it is always unpublished. after saving it again, the original intended script works as programmed. so as you might know, i wonder if, there has been a change between creating a page and just saving / updating it. if there hasn't been any changes to this the problem might be somewhere else, but tbh i know that there is no other modules used / installed by me which are changing the status here.
  9. i made a workaround (pretty dirty) for the same topic. i set a value i want to sort by. 0 config 1 preview 2 statistic 3 formular 4 (here was my problem) i have 6 tabs. so i gave the tabs a value 1 - 6 and added that value to my sort mechanic. i have a litle hook after save to set the position again. $page->setOutputFormatting(false); $page->ssort = 4 + $page->tab_position; $page->save();
  10. hey hope i am not too late.. is there any possibility that following error will be available for translation ? in wire\modules\inputfield\inputfieldfile\inputfieldfile.js $fileList.append(errorItem(files[i].name, extension + ' is a invalid file extension, please use one of: ' + extensions));
  11. jeah i thought about this aswell. so far they are undecided. i am quiet sure they will not handle any real passwords to me. i will keep the double hash. thanks for the help. take my likes and feel free to close the thread
  12. well somewhat yes. i get a user object via xml <name>username</name> <password>password</password> and the password i recieve is already hashed in sha1 so it would be good if i wouldn't need to write an extra login for these people.
  13. Hi everyone, i want to create a user on the fly with sso, i recieve the password already hashed and want to save the user without having the password hashed by processwire afterwards. so far i could leave it rehashed in the database as long as the customer does not want to allow the users to use the direct loginmask. but if that changes, i would be in trouble. so is there a processwire way to do this or do i have to put the user in manually. i know we will have someone intelligent helping me out here
  14. wire('config')->urls->admin should also do the trick.
  15. with a hook for example. i used it for restricting users to certain pages. like he is only allowed to join on news. so he gets index/?id={id of news} so he will only see news and all subpages of news but nothing else. you can find the module somewhere in the forum
  16. i know saw that, in diffrent posts. but due to restrictions of users they are not able to set these. the unpublished state is used to indicate that they dont need to fill the topic. its complicated to explain. but thanks for the reminder
  17. i didn't ment to use "<?php exit; ?>" to extit the function. i already use return to get out it was depending on the published state of the page. since i could not set it anymore it was called again. it looks like this in my func if(!$page->is(Page::statusUnpublished)){ $page->of(false); $page->status = Page::statusUnpublished; $page->save(); } return; i just got into trouble because of the user ability to think straight
  18. well this would be a workaround but it wouldn't help since the page doesn't get saved... the status stays published. so even if i exit the function on second call the page stays without beeing edited. ahhhhh nevermind.. i found the error.. and it wasn't in the code i set the template settings to do not allow to unpublish pages, since i forgot what i was doing yesterday and testing today's frontent.. sooo.. jeah.. my bad.. nvm guys
  19. hi got a similar problem i have a hook on aftersave which does in the end if(!$page->is(Page::statusUnpublished)){ $page->of(false); $page->status = Page::statusUnpublished; $page->save(); } if i put out id: status(before change) status (after change) i get this: 1310:int(0) int(2048) in basically an endless loop. so it doesn't save the state, but why ?
  20. hi had the same issue with a customer atm. he WANTS this function so badly and does not want to use the middle mouse button or ctrl or the rightclick. so i got a workaround for it. i made a custom backend for them (which you probably need in some way) so i added following code at the bottom of the default.php of the admin theme (which i copied and then edited by my needs) $(document).ajaxComplete(function(){ addtargetblank(); }); function addtargetblank(){ $('li.PageListActionView a').each(function(){ if($(this).attr('target') == undefined){ $(this).attr('target','_blank'); } }); if($('#_ProcessPageEditView').attr('target') == undefined){ $('#_ProcessPageEditView').attr('target','_blank'); }} since PW does use jquery you can "hook" onto the ajaxComplete part (which is the part where you load all the page lists and kinda everything in PW). then you call my super awesome addtargetblank function which writes to all pagelistactionviews and the (in edit mode) viewtab an target blank if its not defined. hope that helped p.S.: please keep in mind this is a very trashy workaround which is not recommended, but it works.
  21. hi, i found a bug that sadly double the pagelist when id and open isset at the same time. yes i do know this may barely be the case. but i can only fix it when i overwrite some core material or luckyly do some css trick i actually do not know if that will work in any case nor if this will kill my view @ one point div.PageList > div.PageList:nth-last-child(2){ display:none !important; } but that seemed to work so far.
  22. couldn't you check if the option is already in your "size" category (page which contains all sizes so far typed by users) if not create a new page inside that category (category chosen by selectbox) the input can be exploded and then cycled through after posting the data. your structure should be then Product Categories -Color --red --black --green -size --m --s --xxl even if the answer is quiet late hope it helps anyway
  23. well.. seems like i found somewhat of a solution... i would love if someone could tell me if this is done the right way or if someone is going to hunt me down for this solution so what i did. public function init() { $this->addHookBefore('ProcessPageList::execute', $this, 'startpoint'); ****** $this->addHookBefore('ProcessPageAdd::executeTemplate',$this,'cancel_executeTemplate'); $this->addHookAfter('ProcessPageAdd::executeTemplate',$this,'executeTemplate'); ****** } Startpoint is getting 2 new Hooks 1 Before 1 After in the Before i check if the User has a page as Starting point. public function cancel_executeTemplate(HookEvent $event){ if(wire('user')->gsv_startingpoint->id > 0){ $event->replace = true; $event->return = ''; } } i set replace to true so the original function should not be called i remove the value from event return so otherwise it would be NULL on after: public function executeTemplate(HookEvent $event){ if($event->return === ''){ $templateID = (int) $this->input->get->template_id; if(!$templateID) throw new WireException("No template specified"); $template = $this->templates->get($templateID); if(!$template) throw new WireException("Unknown template"); $parentTemplates = $template->parentTemplates; $parentTemplate = $this->wire('templates')->get(reset($parentTemplates)); if(!$parentTemplate) throw new WireException("Unable to locate parent template " . reset($parentTemplates)); $parents = $this->wire('pages')->find("template=$parentTemplate, include=hidden, limit=500, sort=name, parent=".wire('user')->gsv_startingpoint->id); if(!count($parents)) throw new WireException("No usable parents match this template"); if(count($parents) == 1) $this->wire('session')->redirect("./parent_id=" . $parents->first()->id); $templateLabel = $template; $parentTemplateLabel = $parentTemplate; $form = $this->wire('modules')->get('InputfieldForm'); $form->description = $template; $form->method = 'get'; $form->action = './'; $form->attr('id', 'select_parent_form'); $f = $this->wire('modules')->get('InputfieldSelect'); $f->attr('name', 'parent_id'); $f->attr('id', 'select_parent_id'); $f->label = sprintf($this->_('Where do you want to add the new %s?'), strtolower($templateLabel)); $f->description = sprintf($this->_('Please select a parent %s page below:'), strtolower($parentTemplateLabel)); $options = array(); foreach($parents as $parent) { if(!$parent->addable()) continue; $key = $parent->parent->title ? $parent->parent->title . " - " . $parent->parent->path : $parent->parent->path; if(!isset($options[$key])) $options[$key] = array(); $options[$key][$parent->id] = $parent->get('title|name'); } ksort($options); foreach($options as $optgroupLabel => $optgroup) { $f->addOption($optgroupLabel, $optgroup); } $form->add($f); $f = $this->wire('modules')->get('InputfieldSubmit'); $f->attr('id', 'select_parent_submit'); $form->add($f); $event->return = $form->render(); } } i doublecheck if the return value is '' (i don't like checking against null in php) then using my own code for execute template (still i have almost the same code like ryan in his executeTemplate (ProcessPageAdd::executeTemplate)) as long as this code wont change i wont have a problem but as soon as, this could be problematic.. i tested this as superadmin and as user with sartingpoint and it seem to work properly. attention: of course you can use this code, but you need to change that one line ! public function cancel_executeTemplate(HookEvent $event){ //use YOUR startpoint variable name here !!!!! if(wire('user')->gsv_startingpoint->id > 0){ $event->replace = true; $event->return = ''; } }
  24. okay so this is what i got so far. public function executeTemplate($event){ //edit pageadd for startpoint //(otherwise user could use addnew to see other pages if(wire('user')->gsv_startingpoint->id > 0){ $event->replace = true; } $templateID = (int) $this->input->get->template_id; if(!$templateID) throw new WireException("No template specified"); $template = $this->templates->get($templateID); if(!$template) throw new WireException("Unknown template"); $parentTemplates = $template->parentTemplates; $parentTemplate = $this->wire('templates')->get(reset($parentTemplates)); if(!$parentTemplate) throw new WireException("Unable to locate parent template " . reset($parentTemplates)); $parents = $this->wire('pages')->find("template=$parentTemplate, include=hidden, limit=500, sort=name, parent=".wire('user')->gsv_startingpoint->id); if(!count($parents)) throw new WireException("No usable parents match this template"); if(count($parents) == 1) $this->wire('session')->redirect("./parent_id=" . $parents->first()->id); $templateLabel = $template; $parentTemplateLabel = $parentTemplate; $form = $this->wire('modules')->get('InputfieldForm'); $form->description = $template; $form->method = 'get'; $form->action = './'; $form->attr('id', 'select_parent_form'); $f = $this->wire('modules')->get('InputfieldSelect'); $f->attr('name', 'parent_id'); $f->attr('id', 'select_parent_id'); $f->label = sprintf($this->_('Where do you want to add the new %s?'), strtolower($templateLabel)); $f->description = sprintf($this->_('Please select a parent %s page below:'), strtolower($parentTemplateLabel)); $options = array(); foreach($parents as $parent) { if(!$parent->addable()) continue; $key = $parent->parent->title ? $parent->parent->title . " - " . $parent->parent->path : $parent->parent->path; if(!isset($options[$key])) $options[$key] = array(); $options[$key][$parent->id] = $parent->get('title|name'); } ksort($options); foreach($options as $optgroupLabel => $optgroup) { $f->addOption($optgroupLabel, $optgroup); } $form->add($f); $f = $this->wire('modules')->get('InputfieldSubmit'); $f->attr('id', 'select_parent_submit'); $form->add($f); return $form->render(); } my problem now is the return.. i cannot get the form into the content part of the page... sadly i just needed to change only 1 line of code to get ryans code to work how i want it so i have some dublication of already existing code. for those who want to know : $parents = $this->wire('pages')->find("template=$parentTemplate, include=hidden, limit=500, sort=name, parent=".wire('user')->gsv_startingpoint->id); line of code i changed. ( i added the startingpoint id from the user object (gsv_startingpoin is a variable i needed to add to the user page object to get all this to work)) any ideas what i need to change to get the page add to work as intended ? otherwise i will just remove the button, the work i put into this is getting out of hand...
  25. ahhhhhh... i think i found the reason myself. in ProcessPageAdd there is an execute and an executeTemplate function. since i hooked into executeTemplate it only works when ?template="something" is set $this->addHookBefore('ProcessPageAdd::executeTemplate',$this,'executeTemplate'); so i choose the right one by accident and wondered about it in the end
×
×
  • Create New...