Jump to content

Spica

Members
  • Posts

    122
  • Joined

  • Last visited

Everything posted by Spica

  1. How to put the condition for a required field for publish and save + keep unpublished, but not for save a unpublished page? Something like Page::statusUnpublished=0
  2. I already have a hook to prevent settings tab for roles. https://processwire.com/talk/topic/9166-prevent-settings-tab-in-page-edit/ Now I have a addtional tab as a field + field_end. How to prevent this tab as there is noSettings setting?
  3. great, this is it function saveButtonText(HookEvent $event) { $form = $event->return; $submitbutton = $form->get('submit_save'); $submitbutton->attr('value', 'myButtonText'); }
  4. want to change it role based. so its getting complicated with jquery.
  5. Sorry, but dont get it to work. Tried this. function saveButtonText(HookEvent $event) { $form = $event->return; $submitbutton = $form->get('submit_save_unpublished'); $submitbutton->attr('value', 'myButtonText'); } And actually I want to change only the text of the button. Realized that I am adressing the value, which should stay for the propper functionality of the form.
  6. How to change the buttons value. Have the hook, $this->addHookBefore('ProcessPageEdit::buildForm', $this, 'pButton'); but dont find any hint how to adress the value of the button which is defined in line 387 in processPageEdit $submit2->attr('value', $this->_('Save + Keep Unpublished')); // Button: save unpublished
  7. Found it. The pages with resticted permissions were published. Role did not have publish permission, which also seems to withdraw the editing permission.
  8. Is it supposed to be fixed in the module already? Still have that problem. Use now this $data[$page->title." "] = $config->urls->admin."page/edit/?id=".$page->id; But its not nice to must have it fixed manually each time.
  9. Thats the way I would expect it. But why do I have pages with same template with same roles with different permissions documented in the settings tab?
  10. rolebased permissions, are they written into a page by creation? After changeging permissions for roles old pages still stick to old permissions.
  11. Have created a permission page-publish and assigned to a role. In pageedit the role cannot publish anymore, but still gets the publish button and save + keep unpublished. Is that ment to be that way? How to just get a save button for that role, that does not publish?
  12. Nice solution. Ended up with this as a autoload module <?php class Helloworld extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hello World', 'version' => 1, 'singular' => true, 'autoload' => true, 'summary' => 'Anpassungen', 'icon' => 'smile-o', ); } public function init() { $this->addHookBefore('ProcessPageEdit::buildForm', $this, 'hideSettingsTab'); } function hideSettingsTab(HookEvent $event) { if($this->user->hasRole("presenter")) { $page = $event->object->getPage(); $page->template->set('noSettings', 1); } } }
  13. I want to prevent the settings tab for specific roles. Is it a good way to do that in an admin template with a hook to ProcessPageEdit and set the $useSettings = false; Do I better use a before or after hook and how best to write it?
  14. Yes. But this does set global permission to the module. I want a different admin page for different roles, that do not have access to e.g. the tree. I now build a whole admin theme where roles get different outputs, e.g. just get access to own pages. This is the only way I see at the moment.
  15. Ok. Maybe I got a bit misled. Was using Admin Custom Pages Process Module. Now building up an own admin module.
  16. I already do use a custom admin page. May I put my question differently. How to disable the page tab for roles, so that they cannot access the tree list, even not with url manipulation?
  17. As I am quite new to PW I do not fully understand the permission concept. So I put just some Questions. 1. How does page-edit-created permission work. Is it ment to give only creators edit permission to ther own pages? And how is it drawn to a role or template? 2. How to withdraw pagebased the edit permission for users/creators, reflecting the page-edit-created permission? 3. How do I customize rolebased the access to e.g the settings tab in page edit mode? 4. Is there a way do differentiate page-edit and page-publish permission?
  18. I want to build a rolebased admin page. Actually I use a custom admin page to which the user is redirected after BE login, which is nice so far. So the user is put to something like processwire/page/rolebasedpage with a template myadmin.php. I want now, to replace the pageoutput for processwire/page instead. I tried this in admin.php if($this->user->hasRole("myrole")) { require($config->paths->adminTemplates . 'controller.php'); return $this->page->render("myadmin.php"); } else { require($config->paths->adminTemplates . 'controller.php'); } Is this a good way. And, as it does not work yet, how to do it right. Am I referencing the template uncorrect or is there a more fundamental misconception?
  19. Did something like $table->action(array( 'New' => $this->config->urls->admin . 'page/add/?parent_id=1021', )); Which is ok for me now. Originaly I wondered how to get the edit/view/new/edit template Buttons after a click on a line. Isn't it a build in and reusable function. Would be good to know for the future.
  20. Great. To use it in a AdminTemplate I had to change it to $table = $modules->get("MarkupAdminDataTable"); $table->headerRow( ["Title", "ID", "Created", "User"] ); foreach($pages->find("created_users_id=".$user->id) as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, $page->id, date("F j, Y", $page->created), $page->createdUser->name ); $table->row($data); } // $table->footerRow( $someArray ); echo $table->render(); and ad a missing $ Or would you recommend to use it as a modul over a custom admin template? And how to integrate the view/edit etc Buttons as in the tree view?
  21. Thanx. Have already searched for MarkupAdminDataTable but could not find any good starting point. Is it documented somewhere?
  22. Just moved to Processwire. I wonder, how to customize the lister of the core with a customadminpage. Id like to filter a pagelist by creator-id. Lister does that job perfect. But what I need is a custom admin page with the list, but no lister configuration/dropdowns. So the user just gets a predefined list of certain pages. So far I managed two basic things in the custom admin template $pl = $this->modules->get("ProcessPageList"); $pl->set('id',1001); echo $pl->execute(); processes me a tree, but I cant figure out how to filter for creationid $items = $pages->find("created_users_id=".$user->id ); $out = "<table width='100%'>"; $out .= "<thead>"; $out .= "<th>Title</th>"; $out .= "<th>Date Created</th>"; $out .= "<th>User</th>"; $out .= "<thead>"; $out .= "<tbody>"; if ($items != ""){ foreach ($items as $item) { $out .= "<tr>"; $out .= "<td><a href=". $config->urls->admin . "page/edit/?id=" . $item->id .">" .$item->title . "</a></td>"; // title $out .= "<td>" . date("F j, Y", $item->created) . "</td>"; // date created $out .= "<td>" . $item->createdUser->name. "</td>"; // user that created $out .= "</tr>"; } } else { // empty pageArray message $out = "<tr><td>No pages matching your criteria were found.</td></tr>"; } $out .= "</tbody>"; $out .= "</table>"; echo $out; This gives me nearly the list I want. But its generated with the pages object and a more static result list. What would you recommend, what is the best way to follow.
×
×
  • Create New...