Jump to content

dotnetic

Members
  • Posts

    1,078
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by dotnetic

  1. @adrian It would be nice if you add an option to hide the "Action Code" fieldset. Maybe make it only visible to superusers. But I think an option to hide it for all users would be better. EDIT: Because it really is not important and irritating to normal users when this is being shown.
  2. I want to load a module or page in the ProcessWire Admin in a modal. Right now, I added a button on the Edit page and gave that button a class of "pw-modal". When I click this button, the modal opens with the provided URL, but then suddenly the browser redirects me to this URL. This is not how it should work. In the screencast you can see what´s happening. Here is the code that I use to add the button to the form: public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); } /** * Add a button besides "Save", which lets the user accept the application * */ public function addButtons($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $accept = $this->modules->get('InputfieldButton'); $accept->attr('id+name', 'hook_accept_application'); $accept->attr('href', 'http://localhost/winkelmann/www/bewerbertool-talents/admin/page/edit/?id=1479'); $accept->class .= ' ui-priority-secondary head_button_clone pw-modal'; $accept->attr('value', $this->_('Bewerbungsunterlagen anfordern')); $form->append($accept, $form->get("id")); } } 2017-03-21_10-20-51.mp4
  3. @adrian Your addition with the permission "admin-actions-hide-menu" hides the menuitem for the specific role/user, but it also disables the access to the module for this user group. I logged out and in again. If I remove the permission for the role, I can access the module.
  4. @adrianThank you for your help. Your addition works for me But this does not solve the overall question to hide pages from the menu for specific user groups. So if anyone has suggestions... well ... write them.
  5. @adrian Thanks for all your efforts to this point. I love this community. I try to help where I can as well.
  6. You understood it correctly. But how can I move the Lister Pro page? It is not a real page, but a saved Lister. The other problem with this approach is, that if I hide the pages in the Admin > Setup, they are not visible for superusers. But superusers should still see them.
  7. @adrian Hi Adrian, here are two thoughts how to improve this great module. Remove the "<p>The '.$actionName.' action was completed successfully.</p>" in line 250 or only print it, if no custom successMessage was set. Because one may only want to display his own messages. Use ProcessWires $this->message or $this->error function instead of an own messaging function, so it has the "native" ProcessWire behaviour that people are used to
  8. @adrian Thank you, I was completely unaware of this option. But it does not solve my first problem with hiding the "pages" menuitem, but showing the Lister Pro menuitem.
  9. I try to hide menu items in the Admin/Backend. Any suggestions, how to do this? The way I do it right now is this: public function init() { $this->addHookAfter('Page::viewable', $this, 'viewable'); } /** * Don't give users with custom-role access to Pages page */ public function viewable(HookEvent $event){ $page = $event->object; $user = $this->user; if($page->id == 3 && !$user->hasPermission('view-pagetree')){ $event->return = false; } if ($page->name == "admin-actions" && !$user->hasPermission('admin-actions')) { $event->return = false; } } But there are two problems with this approach: Because I return viewable = false for the "Page" menu my Lister Pro item also does not show up, because it resides in "Page". The second problem is, that viewable does revoke the right to view a page. I need for example the module "Admin Actions" to be viewable but the menuitem should be hidden. How can I accomplish this?
  10. EDIT: Solved this by myself, see bottom of the post. Hi @adrian First of all, this is a really great and useful module. I want to submit the id of a page to my custom module, but I don´t want to show up the id as a field that is being shown. Right now I call the module via admin-actions/options?action=BewerbungsunterlagenAnfordern&id=1514 And this is my defineOptions function protected function defineOptions() { $missingFiles = array(); foreach ($this->pages->get("/unterlagentypen")->children as $unterlage) { $missingFiles[$unterlage->id] = $unterlage->title(); } return array( array( 'name' => 'missingFiles', 'label' => 'Fehlende Unterlagen', 'description' => 'Wählen Sie aus, welche Unterlagen noch benötigt werden.', // 'notes' => 'Only use one of "Pages" or "User Roles"', 'type' => 'AsmSelect', 'options' => $missingFiles, 'required' => true, // 'requiredIf' => 'pages=""' ), array( 'name' => 'id', 'label' => 'ID der Bewerbung', 'description' => 'Bitte den Inhalt dieses Feldes nicht ändern.', 'type' => 'Text', 'required' => true, ), ); } How can I hide the ID Field? Just set the type to "hidden" and Voilá
  11. You were right, it was a permission problem. Logged in as admin and the bar showed up. Sorry for bothering you. Could have thought of this myself.
  12. Hey @adrian and others, I need your help. How can I use the Tracy Debug Bar on an external site, which includes ProcessWire´s core? Tracy is already defined when I include the ProcessWire core (where Tracy Debugger is installed), so I don´t include the standalone version of Tracy anymore. But the debug bar does not show up nor the needed HTML code gets added to the page. Here is what I do. How can I show this beautiful debug thingy? This does not work: require(__DIR__ . '/../myprocesswire-installation/index.php'); TD::barDump('Show a dump'); // This does nothing // This works if I don´t include ProcessWire, but I need it //require 'lib/tracy/src/tracy.php'; // use Tracy\Debugger; // // Debugger::enable(); // Debugger::$logSeverity = E_NOTICE | E_WARNING; // Debugger::barDump('test');
  13. Thank you for this great article. It should be in the official ProcessWire Docs.
  14. @modifiedcontent Did you see my PW 3 compatible module https://github.com/jmartsch/processwire-social-login? Maybe you want to use it instead? It has account validation/email confirmation and login via Facebook.
  15. @Thachakrit @JasonS @pwFoo To get the password validation working you need to add styles and scripts from ProcessWire Admin. The following is untested with this module but should work if you add it to the page where you do the output of the module: <script type="text/javascript" src="/wire/modules/Inputfield/InputfieldPassword/complexify/jquery.complexify.min.js"></script> <script type="text/javascript" src="/wire/modules/Inputfield/InputfieldPassword/complexify/jquery.complexify.banlist.js"></script> <script type="text/javascript" src="/wire/modules/Jquery/JqueryCore/xregexp.js?v=1466417387"></script> <script src="/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.min.js?v=101-1466417387"></script> EDIT: Forgot to add the stylesheet. It resides under /wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.css
  16. Thank you for your suggestions. @adrian was right, I wanted to have the same file in the files and images field. Now I changed my download function so that it can also accept files from the images field.
  17. If I try to upload the same file (an image) to the "files" field AND to the "image" field (for thumbnail generation) on a page. But if I do that I get an error which says: How can I tackle this problem? Is it somehow possible? Because I need the image for a thumbnail and the file from the files field can be downloaded.
  18. @gmclelland config.urls.root does not exist anymore. I also had this problem. Take a look at https://processwire.com/talk/topic/808-variable-for-domain-name/?p=93034
  19. If you use Tracy (which is excellent) then you could just do {{ bd(myVar) }} to dump a variable into the Tracy debug bar right from your twig template.
  20. I used a much simpler and faster method utilizing the pagefile class. My link looks like this: // Sorry for smarty language. but thats what I used {if $page->files|@count > 0} {foreach $page->files as $file} <p> {if $file->description} {$file->description} {else} {$file->name} {/if} <br> <a href="download/{$file->name}" class="link-icon">Download</a> | {$file->filesizeStr} </p> {*{/if}*} {/foreach} {/if} and then in my _init.php I used the following code if ($input->urlSegment1 == 'download') { $download_options = array( // boolean: halt program execution after file send 'exit' => true, // boolean|null: whether file should force download (null=let content-type header decide) 'forceDownload' => true, // string: filename you want the download to show on the user's computer, or blank to use existing. 'downloadFilename' => '', ); session_write_close(); if ($input->urlSegment2) { $pagefile = $page->files[$input->urlSegment2]; if($pagefile){ wireSendFile($pagefile->filename, $download_options); } } } EDIT: The downside when implementing this in the _init.php is, that you can´t send a Wire404Exception, because this file gets included (prepended) and PHP doesn´t like exeptions in included files. If you paste this code into one of your templates you could add trowing a Wire404Exception.
  21. @DedMoroz Did you see my PW 3 compatible module https://github.com/jmartsch/processwire-social-login? Maybe you want to use it instead?
  22. Thanks for these thoughts. They are almost the same, what I wish for the comments module.
  23. Maybe somebody can help me with this. I tried the following code for paginated comments: $commentLimit = 2; // comments to display per page $start = ($input->pageNum - 1) * $commentLimit; $desc = false; $selector = "page=$page, sort=-created, start=$start, limit=" . ($commentLimit + 1); // find the comments. replace "comments" with the name of your comments field // I also used the new find command and not the deprecated findComments $comments = FieldtypeComments::find("comments", $selector); in one of my template.php, but it throws an exeption: Class 'FieldtypeComments' not found What is wrong?
  24. @bernhard Did you release Alfred to the public? The gitlab page does not exist anymore and I can´t find it.
  25. Please update the download link on the website http://de.processwire.com as it points to an old ProcessWire 2.7 repository.
×
×
  • Create New...