Jump to content

apeisa

Moderators
  • Posts

    4,632
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by apeisa

  1. I thought about that and it would work nicely on first case (ie. support logins), but would fail on additional 3rd party login options.
  2. Doesn't work on FF/Win7 either. It seems to fail loading swfobject.js:
  3. There are often situations when it would be valuable to login using client's credentials. It is slow to create new user with same roles and test that way. It would be great to have a module which allows to login using any username and without changing the password (of course security of that module needs to be top notch). Other use case is when adding additional login methods (like fb, google account, github... etc). If I have understood correctly, currently we always need to know (or change) the password to be able to login. So what I am looking for is something like: $session->forceLogin($username);
  4. Or just use page reference field (instead of select module) and unleash the demon!
  5. This is the embed code from youtube: <iframe width="560" height="315" src="https://www.youtube.com/embed/YsCpDaSooWA?rel=0" frameborder="0" allowfullscreen></iframe> So it does go into url in iFrame tag. I think only other relevant option might be privacy mode. This is the embed code for privacy mode and no for related videos combined: <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/YsCpDaSooWA?rel=0" frameborder="0" allowfullscreen></iframe>
  6. Commenting on related blog posts is very effective and easy way to promote ProcessWire, good job. I recently noticed this comment by Mindplay too: http://www.sitepoint.com/whatamp039s-your-favorite-content-management-system/#comment-1060340
  7. I should really start using this. My current method is to use Chrome's inspector to see the real field name from source html...
  8. I guess your only option is to loop through $template->fields() and generate your own markup for each field.
  9. Nico, input->get ain't safe, you need to sanitize data before using it in your selectors.
  10. Does it work on other sites on same server? Dev or stable version?
  11. What does your JS-console say?
  12. Thanks Nik, that did the trick! Here is the current version, which seems to work nicely. It duplicates the renderList() and executeList() methods until Ryan makes those two improvements to the renderList() method. This allows to search users (username requires direct hit, other fields use ^= operator). It searches those fields that are chosen from module settings (the same ones that are visible). You can also combine text search and role filters. To try this out, just install the module and then edit your /processwire/access/users/ page and change the process to ProcessUserExtended (page is locked by default, so open the lock). You cannot create new page with different name (like users-extended) and try it there, since ProcessPageType excepts to have pageName which is also fuel (like users, roles etc). Grab the code: <?php class ProcessUserExtended extends ProcessUser { static public function getModuleInfo() { return array( 'title' => __('Users extended', __FILE__), // getModuleInfo title 'version' => 100, 'summary' => __('Extended view for user management', __FILE__), // getModuleInfo summary 'permanent' => false, 'permission' => 'user-admin', ); } public function ___execute() { $out = ''; $wrapper = new InputfieldWrapper; $fields = $this->modules->get("InputfieldFieldset"); $form = $this->modules->get("InputfieldForm"); $form->attr('method', 'get'); $form->attr('id', 'userSearch'); $form->label = $this->_("Filter users"); if (!$this->input->get->roles && !$this->input->get->search) { $form->collapsed = Inputfield::collapsedYes; } $field = $this->modules->get("InputfieldText"); $field->attr('name', 'search'); $field->label = $this->_("Search"); if ($this->input->get->search) { $this->input->whitelist('search', $this->input->get->search); $field->attr('value', htmlentities($this->input->get->search, ENT_QUOTES, 'UTF-8')); } $form->add($field); $field = $this->modules->get("InputfieldCheckboxes"); $field->attr('name', 'roles'); $field->optionColumns = 5; foreach(wire('roles') as $role) { if ($role->name == "guest") continue; $attrs = array(); $this->input->whitelist("roles", $this->input->get->roles); if (is_array($this->input->get->roles)) { if(in_array($role->name, $this->input->get->roles)) { $attrs['selected'] = 'selected'; } } $field->addOption($role->name, $role->get('title|name'), $attrs); } $field->label = $this->_("Filter by role"); $form->add($field); $field = $this->modules->get("InputfieldSubmit"); $field->attr('value', $this->_("Search")); $form->add($field); $fields->add($form); $out .= $fields->render(); $selector = "limit=10, status<" . Page::statusMax; if ($this->input->get->roles) { $roles = new PageArray; foreach($this->input->get->roles as $roleName) { $roles->add($this->roles->get($roleName)); } if ($role->id) $selector .= ", roles=$roles"; } if ($this->input->get->search) { $fieldNames = implode("|", array_diff($this->showFields, array('name', 'created', 'modified', 'roles'))); $search = $this->sanitizer->selectorValue($this->input->get->search); $directHit = $this->pages->get("name=$search"); if ($directHit->id) $out .= "<h3>". $this->_('Found by username') .": <a href='./edit/?id=$directHit->id'>$directHit->name</a></h3>"; $selector .= ", $fieldNames^=$search"; } return $out . $this->renderList($selector, array("arrayToCSV" => false)); } public function ___executeList() { return $this->renderList("limit=25, status<" . Page::statusMax); } protected function renderList($selector, $pagerOptions = null) { $out = ''; if(!$this->pages->getTemplate()) { $form = $this->getTemplateFilterForm(); $out = $form->render(); } $table = $this->modules->get("MarkupAdminDataTable"); $table->setEncodeEntities(false); $fieldNames = $this->showFields; $fieldLabels = $fieldNames; foreach($fieldLabels as $key => $name) { if($name == 'name') { $fieldLabels[$key] = $this->_('Name'); // Label for 'name' field continue; } $field = wire('fields')->get($name); $languageID = wire('user')->language ? wire('user')->language->id : ''; $label = $field->get('label' . $languageID); if(!$label) $label = $field->label; if(!$label) $label = $name; $fieldLabels[$key] = htmlentities($label, ENT_QUOTES, "UTF-8"); } $table->headerRow($fieldLabels); $pages = $this->pages->find($selector); foreach($pages as $page) { if(!$page->editable()) continue; $n = 0; $row = array(); foreach($fieldNames as $name) { if(!$n) $row[$page->get($name) . ' '] = "edit/?id={$page->id}"; else $row[] = $this->renderListFieldValue($name, $page->get($name)); $n++; } $table->row($row); } if($this->page->addable()) $table->action(array($this->_('Add New') => 'add/')); if($pages->getTotal() > count($pages)) { $pager = $this->modules->get("MarkupPagerNav"); $out .= $pager->render($pages, $pagerOptions); } $out .= $table->render(); return $out; } }
  13. There seems to be a way to add array like this: $this->input->whitelist($array); but of course that doesn't work, since it produces get params like 1=rolename1&2=rolename2 etc...
  14. I'm building the user search and I have filter for role filters. Wanted to build it using multiple selections, so one could search for all "editors" and "members" with one search. Since I need pagination I want to use $input->whitelist. But for some reason I cannot figure how to whitelist arrays properly. I have tried these: // Whole array $this->input->whitelist('roles[]', $this->input->get->roles); // Whole array (without []) $this->input->whitelist('roles', $this->input->get->roles); // Each on their own foreach(...) { $this->input->whitelist('roles[]', $roleName); } // etc... All I try produce get params like this (after clicking pagination): roles[]=rolename1%2Crolename2 etc... or the looping one leaves only the last value, like: roles[]=rolename2 What I need is the same like the form submit, ie: roles[]=rolename1&roles[]=rolename2 etc Is this shortcoming using whitelist or am I doing this wrong?
  15. Martijn: IE7 and lower are already blocked. IE8 is currently lowest allowed and hopefully Win XP just fades away soon enough so that we can forget about it. Or MS makes the IE9 to work in XP too (which I very much doubt, it would have happened already).
  16. Oh yes, that would be a perfect solution! I make that change already on my code, so I can keep the ball rolling.
  17. https://github.com/apeisa/CustomPageRoles/blob/master/CustomPageRoles.module It will soon be on the modules directory also, but want to write some readme and test it a little more. Yeah, that is true. What would be supernice is that the module itself would have ready translations for few languages (well, at least for Finnish). But to make that rock I would need to know how each language is called. And since we don't require strict naming conventions (which is good, we are already using different customers as languages on our help site) I don't have any way to know. This is very minor thing, but it is boring to do translation each time this module is installed.
  18. Now that I got first obstacle tackled with Nik's help, I hit another. It seems that renderList() function isn't hookable and also it doesn't allow any modifications to it's selector (https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessPageType/ProcessPageType.module#L100). Would it be a bad idea to take that selector part to it's own hookable method, so I wouldn't need to duplicate the whole renderList() method?
  19. Pete: Well, it doesn't work that well after 100 user, so improvements are definitely required with tens of thousands users.
  20. Thanks Nik! I do understand it now. I am happy how it turned out (I thought that my humble understanding of OO-programming was all wrong...). Actually how I was thinking of building this in first place would be that installing the module would change the process on current /users/ page, so it would actually work very nicely. I think why it is that way is to scope the pages to just the relevant ones - but it actually might be a good idea to be less strict with that. Pete: I am soon gonna import 40 000+ users into processwire, so some improvements are definitely coming to that area
  21. Nico, this has been discussed before: http://processwire.com/talk/topic/1157-prefixed-pw-database-tables/page__hl__prefix
  22. Not sure if this is related, but strange behavior between latest and older version, see screenshots (this is page delete view in Finnish): 2.2.6: 2.2.9: Latest version shows page id instead of translated string.
  23. You aren't using the dev branch where there is updated jQuery version?
  24. Hmm.. I'm not able to reproduce this and running the latest 2.2.9. version. Any 3rd party modules installed?
  25. I am gonna build simple module that will add role filters and maybe a user search to help manage hundreds and more users through PW-admin. My first idea was to extend current ProcessUser module to create a new process, but stumbled on the very first step. This is my module (or part of it, but that is the part that is causing problems): <?php class ProcessUserExtended extends ProcessUser { static public function getModuleInfo() { return array( 'title' => __('Users extended', __FILE__), // getModuleInfo title 'version' => 100, 'summary' => __('Extended view for user management', __FILE__), // getModuleInfo summary 'permanent' => false, 'permission' => 'user-admin', ); } public function ___execute() { $out = ''; foreach(wire('roles') as $role) { $out .= $role->name . " "; } return $out . $this->renderList(); } } And running it gives me this error: Method Pages::getTemplate does not exist or is not callable in this context I have other options also (like hooking), but I would like to understand why this happens?
×
×
  • Create New...