Jump to content

Macrura

PW-Moderators
  • Posts

    2,765
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. is this not the support forum? https://processwire.com/talk/topic/6727-field-generator/ in the video it clearly shows 'name' as the field being targeted. Could be a compatibility issue if it is not working.. maybe you have to check OpenSSL dependency? you could easily write a much simpler module (see example code below), or use processwire's new automatic page name feature (i'm using it a lot).. here is an example of a simple module to create a randomy page name, using PHP uniqid() function (untested): <?php public function generateRandomName() { if ($this->input->get->parent_id == 1019) { // 1019 = some page where we want to auto-generate child page names $page = new Page(); $page->parent = $this->input->get->parent_id; $page->template = 'child-template-name'; $page->name = uniqid(); $page->addStatus(Page::statusUnpublished); $page->save(); $this->session->redirect("../edit/?id=$page"); } }
  2. yes, would be pretty easy, but not sure what you mean about categories and tags; are those in a spreadsheet, or part of the filename? mass upload of files and then import to pages could be done with a small utility module that could be run on the page after you save, if this is a functionality that needs to be performed on a regular basis; foreach($page->images as $image) { $newImage = new Page(); $newImage->template = 'image'; // or whatever the template is $newImage->parent = 'whereever_you_are_keeping_these'; $newImage->title = 'some_title'; $newImage->save(); // Show message // if using in a module: $this->message("Image added: {$newImage->title}"); //or if running the api: echo "Image added: {$newImage->title}"; } // end foreach if you don't need something that can be run anytime from the admin, then you could just use a CSV file with a folder of images
  3. you mean like this? if( $user->hasRole('user') && !$user->hasRole('editor') && !$user->hasRole('admin') && !$user->hasRole('superadmin')) { //password reset stuff here }
  4. @onjegolders, thanks for starting this topic. I've been working a lot on my email thingy, it has ballooned into a fledgling CRM now, and can do all kinds of neat tricks.. lately i have been implementing HTML templates, and i'm trying to keep it dead-simple; this is still sort of a WIP, but in short: the template (email-template) has fields: title body, ckeditor - specially configured to accept almost all markup; body_atts (for example [bgcolor=#161616" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0]) images custom_css (for example [a:link {color: #61c7dd;}a:hover {color: #59b8cc;}] ) // If using a template, if($message->template_select) { $bodyatts = $message->template_select->body_atts ? ' ' . $message->template_select->body_atts : ''; $body = " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'> <html lang='en'> <head> <title>{$message->title}</title> <meta content='text/html; charset=utf-8' http-equiv='Content-Type'> <style type='text/css'>{$message->custom_css}</style> </head> <body$bodyatts> "; $body .= $message->body; $body .= "</body> </html>"; $body = str_replace('/site/assets/files/', $base_url . '/site/assets/files/', $body); $mail->bodyHTML($body); } now i'm thinking of making it more flexible and having a field for the head since some of the templates i have tried to use more recently needed different head markup... how this works is that when you crate a new message, my system clones all of the fields from the template into the new message and then you edit from that clone; so there is a module running on save of the email that checks to see if a template is selected and then replaces the body of the current email you are editing (and the other fields) from the template, but leaves the image references in tact, so that the images used in an html template are still stored with the template, but the body, css, and body_atts can be adjusted if necessary on a per-email level..
  5. @Zeka, There would be several ways to do what you want and it will depend on some factors. I would guess that the majority of PW sites that configure products would be using pages to store the products (1 product per page); Your product template would contain these fields: product_name qty_per_unit unit_price You could either use the ProFields lister to make your list as above, or create a page-table on the parent page of the products and then when you view the product parent page you would see that list. - - - - However, if your needs are simpler, then you could use ProFields Table to make a table like you have, and then you would actually be able to edit the fields inline like that. With pages you would have to click to get a modal and then edit the 3 fields. - - - - And then there is yet another way you could do it using a hybrid of both things described above; I'm actually doing this 3rd approach on a site now (and the reason is to save time on entering many rows really fast, but we need the products to be pages for other reasons..) 1.) setup the ProFields table with the fields (and it would look almost identical to your screenshot) 2.) write a simple module to create products (using pages) when you save the page containing the table. The module would cycle through the table and check to see if the product already exists, and if it doesn't it would create the product; it would also check each page-product for changes/edits to the fields and update as necessary; so your Table would become sort of a proxy entry-instrument for the product-pages;
  6. @Chris White, I would post any issues about ProFields on the ProFields forum. Also, make sure that you have fully installed the ProFields and see if that error persists. Regarding the upgrade, i'm not sure that you can update ProFields from the admin; Once you make the table field, you do need to configure the column names and types
  7. this is always the hardest part of delivering a site... people will not want to look dumb and consequently will gloss over things they don't understand (and maybe complain later when they get stuck...) to prevent possible issues and allay confusion, I try and provide tons of inline help, and i sometime use the (joss mentioned) help tab module; I've now become accustomed to fairly verbose descriptions on all fields, and users do tend to notice/read those before inputting/selecting/checking stuff.. Another recent development that was discussed here is about showing additional description for things like selects, using an added data-description field on the select page: https://processwire.com/talk/topic/419-extending-inputfields/?p=76861 Delivering PW sites always feels better than on any other CMS, because at least you have really good control over things and you can make it relatively hard for the site to break.. contrast this will WP.. just worked on a site where the owner broke the homepage in 1 day (can't even remember what they did...)
  8. Jan Romero - thank you! ... this totally works... thanks for fixing my logic!
  9. Hi, I have a frontend menu which is built using pages and a page select; it is output using a function that cycles through the pages and creates the menu; for this menu I wanted to also have the ability to select on some menu items which roles can see those items; I made a new field called menu_roles which selects the role; I didn't use built in roles field because it is permanent and i couldn't get rid of it off one of my templates once i added it. When i'm cycling through the pages, i'm using this to check if the current user should see the menu: $menuVis = true; if($child->menu_roles->count()) { foreach($child->menu_roles as $cmr) { $menuVis = true; $cmrRole = wire('roles')->get("$cmr->name"); if (!wire("user")->hasRole("$cmrRole") ) $menuVis = false; } } if($menuVis == false) continue; Edit: this sort of doesn't work... i can't figure out how to check multiple roles against a user at once, to get the visibility variable to be correct...Aarrgh! logic
  10. i just upgraded this module and installed the helper module, but i don't get a field to select a template do i need to also add ACP scripts to the admin template? ... edit: i uninstalled the main module and then reinstalled, and it added the necessary field to the admin template.. it's all working now... btw - thanks Nico for working on this, it's great to be able to use the custom pages with the new admin themes..
  11. @adrian - thanks for the api clone.. just saved me a lot of searching!
  12. yeah, i actually asked about this over on the pagetable documentation thread https://processwire.com/talk/topic/6546-pagetable-documentation/?p=76627
  13. thanks everyone! actually the original code was close, i was using the wrong magnific popup type (ajax).. (magnific popup is already loaded on page edit) added the &modal=1 to the link.. so this is the final custom js file to accomplish this: $(function(){ $('div.InputfieldPageAutocomplete ol li').each(function(){ var id = $(this).find('span.itemValue').text(); $(this).find('span.itemLabel').wrapInner(" <a class='edit-modal' href='"+config.urls.admin+"page/edit/?id="+id+"&modal=1' target='_blank'></a>"); }); }); $(document).ready(function(){ $('span.itemLabel a').magnificPopup({ type: 'iframe'}); }); As far as a module, yes i think it would be cleaner to have a configurable module where you could somehow set the behavior of the link (new window, lightbox etc.) and then that module could output the linked title for the page select... also I think this code only works on page Autocomplete fields since it targets that particular structure which is an ol > li > span.. it does seem like being able to optionally link the title of any page select item to an editor for that item would be a huge time saver in many instances.. right now this is saving me a ton of time!
  14. @netcarver - yes, that's what I was thinking, and have been sort of studying that now for a few hrs; i came up with a quick solution using jquery for now.. ( https://processwire.com/talk/topic/8005-page-select-edit-links/?p=77312 ) but it would be nice if there could be a simple toggle on every page select field, like "title links to edit" ..
  15. I need to make a quick and easy way to access the edit page for page selects, usually with AsmSelect; so far i have been able to use this jquery to turn the label for the AsmSelect into a link to the page editor for that selected page, but i can't figure any easy way to make it into a modal.. anyone else tried to do this yet? $(function(){ $('div.InputfieldPageAutocomplete ol li').each(function(){ var id = $(this).find('span.itemValue').text(); $(this).find('span.itemLabel').wrapInner(" <a class='edit-modal' href='"+config.urls.admin+"page/edit/?id="+id+"' target='_blank'></a>"); }); }); adding this with the AdminCustomFiles assigned to process page edit..
  16. Here's an example of how I used the module that netcarver posted: before something is selected: after selection: i also had an idea for extending AsmSelect to make the selected items clickable and brings up a modal editor for that selected page; has anyone done something like that yet? For example with this site I'm working on, you can add composers to a track, but it would be cool if after you add new items to the page you could click on them to make some edits (bio, website for ex), without having to go and find that page in the tree..
  17. @netcarver - can't thank you enough -this completely works!! I added a js file to populate my description field above the select, and changed the module name to be select, not multiple.. will have to do a screenshot/screencast; this module should be made available in some form on the directory, as i think it has some great use cases for data- attributes on selects... maybe both versions, select and select multiple
  18. w.o.w. ! netcarver - thanks -this is going to be amazing, and i don't think i could have figured this out, at least not for a while.. so (this being the first time i'm doing this more advanced sort of module), could you possibly explain a tiny bit more about how to extend the class (say for InputfieldSelect) - where or what sort of module would i create to place that code? TIA
  19. I'm trying to create a slightly enhanced page select, whereby the only difference to the output would be adding a data-description to each option, which would be populated by looking up the value of a data-description field on that selectable page; I know where (renderOptions function) to make the change, but not sure how to hook in there and replace that function, or should i make a new inputfield for this? I did try copying the InputfieldSelect and making some changes (calling it InputfieldSelectEnhanced), and but i'm not clear how to get this new inputfield to show up in the list of options for the Fieldtype Page... ultimately the goal would be to use javascript to replace the description area below the page select with the data for that particular select; for a simple example, say I have a select on a page that specifies actions that will take place on save (like importing files, or deleting files from the page etc..), i would like to have a more descriptive paragraph about what exactly my save action will do.. this would be sort of useful just about anytime you needed to show the user more information about what they have selected, beyond just the title, and where that info is going to be a little verbose (and wouldn't work as the option label).. thanks!
  20. I'm wondering about the page tables and how it closes when you hit save - i think it would be better if this behavior was configurable, because some of my templates run actions on save, so i sometimes need to save a page a few times when editing.. but then the modal window closes every time i hit save, so i basically end up going over to the child pages tab and editing directly on the page to avoid editing in the modal with the close issue...
  21. I'm pretty sure you could write a module that would do this, and would dynamically set the name and title according to the template and your rules... so you wouldn't use the auto page name feature, but would write your own, sort of like this: https://processwire.com/talk/topic/1648-ok-to-change-page-name-path-after-save/?p=15232
  22. Wondering if anyone has had any luck configuring templates for ckeditor?... the plugin is included with the default package, and enabling it was easy enough, but setting the config to recognize the path to the custom templates is not working... i could edit the default in the wire/ckeditor. but somehow there must be a way for the system to allow for the setting of the custom templates js file i tried adding this to my additional config options templates_files:/site/templates/js/mytemplates.js but am getting js errors of all sorts.. and the template popup is blank also tried adding this to the config.js in /site/modules/InputfieldCKEditor CKEDITOR.editorConfig = function( config ) { config.templates_files = [ '/site/templates/assets/js/mytemplates.js' ]; }; but that didn't work either... Edit: Decided to go a different route, and simply create a module that will append stuff to the current page body, based on a page select field; this way I can create my templates (which i call boilerplates) in processwire and then insert those boilerplates right into the editor and make modifications from there... using it for text mostly but could be use for almost any content you might need to reuse in an RTE... here's the gist.. https://gist.github.com/outflux3/cf5807ddedfaa5c0d425#file-gistfile1-php if anyone is interested and looks at it, let me know if you see any issues or potential problems; this will always append the body fields of the selected pages to the current page body field and then remove those from the page select field... working well in some initial tests
  23. actually looks like fontawesome has word, audio and video
  24. @Blad - great module! - wondering how hard it would be to make the icon classes and file extensions into a configurable table, so you could add stuff like mp3 audio icons, video files, and even have different icons for doc, or txt, etc..
  25. cool - this totally worked... I see the Soma wisdom.. a light has turned on! ( this is in the custom php code to find selectable pages..) $album = $pages->get("template=album, album_tracks_pt=$page"); return $album->album_tracks_pt->find("track_group=2194"); i guess the thing that i wasn't getting is the selector for looking in an array; in the api usage i'm always using has($page), but in selectors it seems the = sign does the same thing, interpreted as 'has' for pagearrays
×
×
  • Create New...