Jump to content

Macrura

PW-Moderators
  • Posts

    2,776
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. so thanks to Soma, there will be a new version of this that doesn't require all of the jquery stuff; currently using soma's code and have it working for asm selects, so now just need to do the same for page list select and autocomplete...
  2. @mr fan - also there is something that needs to be fixed in the module: // attach js+css to the page only on edit page public function loadAssets($event) { if($this->process == 'ProcessPageEdit') { //load jQueryMagnific $this->modules->get('JqueryMagnific'); //load module scripts and styles for the list links $this->config->scripts->add($this->config->urls->ProcessPageSelectLinks . "ProcessPageSelectLinks.js"); $this->config->styles->add($this->config->urls->ProcessPageSelectLinks . "ProcessPageSelectLinks.css"); } } forgot the brackets after the conditional (copied original code from a module that only had 1 script after the conditional).. without this it will break the admin
  3. whoah - so how to enable.. ? guess that would make this module useless...
  4. @ozwim - thanks, again, yeah, sorry for being clueless about the name and how to load the magnific.. will work on fixing that - also if you have any suggestion for name let me know..
  5. yeah - open to suggestions, have no clue what to call this properly.. Use cases so far: - record label where there are albums and each album needs to have a page select for artists, but very often need fast access to edit that artist page. - during development when adding categories sometimes users misspell things, or maybe use the wrong word.. so easier to have that link right there rather than go click through the page tree - email app where a page is an email and users can be selected, but you might want to check that user's email address, or see/edit something..
  6. this is a work in progress... needs testing. in this module the edit links are added to the green boxes using 2 methods: jquery for the page list select and page auto complete, and the native asm select feature for asmSelects (thanks to Soma). Since the PageAutoComplete and PageListSelect are using the hover and icon from asmSelect, the asmSelect assets need to be loaded now on every page edit, in order to make the links look right. if you downloaded this before, please replace with the latest version, as there have been many changes, corrections/bugfixes and improvements. Please report any issues. Updated 12/6/14 at 10PM - please delete earlier versions due to issue with links being added on template editor. Updated 5/7/15: Module removed in anticipation of new official version release: https://processwire.com/talk/topic/9857-module-page-field-edit-links/?p=94599
  7. @Manol, thanks a lot, this helps to see that in context of something familiar.
  8. here it is... https://processwire.com/talk/topic/8477-processpageselectlinks/?p=82020
  9. @BernhardB - actually i think it would be easier to copy all of the necessary options right into the table select field selectable options; I'm doing that now on one site and it works, but you would need to update the selectable options manually... maybe there is a way to have a module use the api to update the selectable options, for example when a new page under a certain parent is added, this triggers an update of those selectable options...
  10. wish i had a remote concept of what AngularJS is/does and how it could be used with PW...
  11. @Michael Murphy - i know it sounds sort of Yoda, but perhaps don't delete the pages except with the pagetable? that would prevent that issue; don't give trash/delete permission to those roles that might see the error?
  12. pretty sure that this only works for children of the page (showing new pages that can be added)... but will need to test it to confirm... @Michael Murphy - this would basically be equivalent to my module in progress (currently an admin custom pages drop in), which would allow you to use regular page selects, but have the ability to access/edit them in a modal by clicking on the title.. you wouldn't be able to mix and match these with pagetables; i think of page table pages as pages that have to directly relate to to the page and can't be altered by any other page. https://processwire.com/talk/topic/7588-admin-custom-files/?p=81866 there are other ways you could achieve various functionality - for example write a module that clones the pages in a page select to new page table pages where you could then have contextual access to those new pages without the risk of affecting some other place that page is being used;
  13. yes - this is a texbook page table scenario...
  14. @Ivan, Part of my stock toolkit when building sites is a "save action". It is a simple way to run some action when the user saves; they select the save action, and click save, and the action runs. It usually hooks into SaveReady. It could be anything from calculating/validating/correcting/filling in blank fields to things like deleting children, renaming assets (images, files) etc.. I usually use a special select field for this, but you could use a checkbox. If I needed to create the functionality you are describing right at this moment, i would make the save action a checkbox and then have next to it After save: Create new classified Item; your module code would then simply create a new page under the specified parent and redirect the user to that edit page...
  15. @BernhardB - the way that i would attempt to do it (and this is just thinking out loud..) would be to create a page select field on that template, which i would then hide with css, from where to get the page ids and names; then i would use jquery to grab all of the page names and ids (into a js array) and use that data to create a selector (would probably use chosen) which i would place into all of the fields in the first column; it would need to store the page id in the field value, but then when viewing it, the chosen select would show the label..
  16. hey Martijn- that's another cool tip -thanks a lot!; in this case i'm loading the scripts in a module (sort of a site utility module that i use on all sites..) like this: $this->config->scripts->add($this->config->urls->JqueryMagnific . 'JqueryMagnific.js'); $this->config->styles->add($this->config->urls->JqueryMagnific . 'JqueryMagnific.css'); so seeing that the js is expecting their to be a modal script loaded, i think to make this more manageable i should just finish the support for page list selects and then make it a module...
  17. ok thanks - got it now.. here's a drop in i'm working on: AsmSelectLinks - which adds links so you can edit your Asm and Page Autocomplete pages by clicking on them.. this is a rough first version, but i think it can get better. The only major issue is with the loading of magnific which would be required; i guess this will probably need to be a module, so that it can load the magnific and the 2 files.. javascript: $(function(){ $('div.InputfieldPageAutocomplete').each(function(){ $('ol li', this).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>"); }); }); $('div.InputfieldAsmSelect').each(function(){ $('select option', this).each(function(){ id = $(this).val(); rel = $(this).attr('rel'); $('li.asmListItem[rel='+rel+']').find('span.asmListItemLabel').wrapInner(" <a class='edit-modal' href='"+config.urls.admin+"page/edit/?id="+id+"&modal=1' target='_blank'></a>"); }); }); $('div.InputfieldPageListSelectMultiple').each(function(){ $('ol li', this).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(){ $('a.edit-modal').magnificPopup({ type: 'iframe'}); }); css: .mfp-iframe-holder .mfp-content { max-width: 1200px!important; } a.edit-modal:hover { text-decoration: underline; } ... this feature has been a huge time saver because (especially during development) you often need to edit/access those pages that are being selected.. planning on also getting it to work with page list selects..
  18. @Martijn - i'm having trouble understanding what that means... so how would i get ProcessPageEditTruncate.js to load on my PageEdit process - do i need to create a new process?
  19. Module In Progress... working on an Inputfield which will allow the updating of the select description (for contextual description of the actual selected item) based on the selected option. This module is/was mostly written by netcarver, so i'm just getting the details together and some jquery for this to work... https://processwire.com/talk/topic/419-extending-inputfields/?p=76823 i'm thinking that the module title should probably be more specific?, like InputfieldSelectDataDescription... in case there were other 'extended' interpretations...? module so far: <?php class InputfieldSelectExtended extends InputfieldSelect { public static function getModuleInfo() { return array( 'title' => __('Select Extended', __FILE__), 'version' => 1, 'summary' => __('Selection with extended attributes. An enhancement to select', __FILE__), 'permanent' => false, ); } /** * inputfield is loaded */ public function init() { // append script needed for the inputfield $this->config->scripts->add($this->config->urls->InputfieldSelectExtended . 'InputfieldSelectExtended.js'); } /** * Adds an option with extended attributes that allow mutually exclusive groups. */ public function addOption($value, $label = null, array $attributes = null) { if ( is_null($value) || (is_string($value) && !strlen($value)) ) { return $this; } if (null === $attributes) { $attributes = array(); } $extra_atts = $this->extendAttributes($value, $label); $attributes = array_merge($attributes, $extra_atts); return parent::addOption($value, $label, $attributes); } /** * Hook this and return an array with whatever extended attributes you need. * */ public function ___extendAttributes($id, $value) { $atts = array(); $page = wire()->pages->get($id); $atts['data-description'] = $page->data_description; return $atts; } } the js, so far - works, but doesn't account for multiple selects yet. InputfieldSelectExtended/InputfieldSelectExtended.js $(document).ready(function() { var $default = $('.InputfieldSelectExtended').prev('p.description').html(); $('.InputfieldSelectExtended select').change(function(){ var $selected = $(this).find(':selected'); var $description = $('.InputfieldSelectExtended').prev('p.description'); if($selected.data('description') == null ) $($description).html($default); $($description).html($selected.data('description')); }).trigger('change'); }); once installed you would need to add this inputfield to the list; then select the inputfield on your page field your selectable pages would need a data_description field. here is the result, before option selected: after select: i guess once i get the module more advanced, there would be a way to get some of these things automatically setup.. also - for this to work, you need to set a description for the page select field, so there is something to replace...
  20. @owzim - thanks for the tips; good to know and i'll add that to the KB... oddly i'm using that code now and it works perfectly... but i do wonder what would happen if there was a colon in the string..
  21. another use i just found is for rapid prototyping of repeating content, prior to committing to real fields. for example i'm making a testimonials slider for a client, but they have been tentative about many things on their site, so i'm not setting up any fixed fields now until they commit to certain elements of the front end; example - author: William role: Client text: Integer eu libero sit amet nisl vestibulum semper. Fusce nec porttitor massa. In nec neque elit. Curabitur malesuada ligula vitae purus ornare onec etea magna diam varius. - author: James role: Hippie text: Posuere erat a ante venenatis dapibus posuere velit aliquet. Duis llis, est non coeammodo luctus, nisi erat porttitor ligula, egeteas laciniato odiomo sem.
  22. @hafa - this would need to be inside a module - maybe take a look at the helloworld module, or check this out: https://processwire.com/talk/topic/1908-automatically-generating-new-page-names/?p=48421 as far as uniqueid - you would want to use that if you don't care about anything with security, just for random numbers; if you wanted something more cryptographically sound, maybe try flourish fCryptography - there is a flourish autoloader module for processwire. - - - http://php.net/manual/en/function.uniqid.php
  23. @hafa - i would probably make a module that uses a different crypto library, maybe flourish although this looks like it might be in beta.. also found this.. http://www.gilfether.com/phpcrypt/ would be easy to make the module to generate the slug; i think examples were provided earlier in this thread
  24. @Kemal, maybe roll your own sitemap? it's super easy and then you can control what it includes by altering the selectors.. http://processwire.com/talk/topic/3846-how-do-i-create-a-sitemapxml/
  25. solved: i failed to put the full folder of the getid3, i had just copied only the main class file.. major facepalm @adrian - forgot to thank you for helping.. (was actually replying to your post when the solution dawned on me..) by the way, this is pretty awesome, now i can read id3 tags and create pages based on those tags; also prevent users from uploading mp3 files where the bitrate is too high (in order to keep the filesizes small we use 128 for streaming files)...
×
×
  • Create New...