Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Neeks

  1. Updated the module to to fix the following issues: - missing $sTable variable warning in debug mode. - module now requires you to have PagePathHistory module installed - I simplified SQL, hoping that got rid of the SQL errors, though I could not reproduce them. - remove trailing slashes on "redirect from urls" since PagePathHistory requires them to be missing for redirects to work.
  2. This module both lets you create new redirects that never existed, and delete old redirects one would no longer like to have operational any more. The user story for this project was: "As an SEO specialist I want to be able to manage redirects for news articles without developer involvement." Giving them a simple tool that did not require knowledge regex seemed like the safest way to not have future developer involvement.
  3. Page Path History Central Manager Manage all page paths history redirects in a single locations. This module is user interface for the processwrie PagePathHistory module, that creates redirects automatically every time a page is moved/renamed. These redirects do not contain regex's and they will not redirect a user away from a published page making them safe for not technical editors to create. Features Include: Ability to create new redirects Ability to remove old redirects View all the automatically created page path history redirects in your system, and delete any ones that no are no longer needed. Git repo: https://github.com/hagcin/ProcessPathHistoryCentralManager Viewing all existing redirects: Adding New Redirect: Tested on: Processwire 2.6, 3.0 Install Install the module PagePathHistory from within the Processwire admin. PagePathHistory is included in core but not installed by default. Install the module ProcessPathHistoryCentralManager by cloning this repo into site/modules/ in your processwire install. Install the module in the admin interface. You can now manage redirects under setup > page path history central manager Similar to and is compatible with PagePathHistoryManager which lets you manage page path history redirects on a specific page on the settings tab.
  4. Tything to get the processwire version 3 of the module working correctly. Admin: Data Providers Name Space : "pwire\DataProviders " Data Provider Base Path : "site/templates/dataproviders/" site/template/home.php (template) site/template/dataproviders/pwire/HomePageDataProvider.php (data provider) namespace pwire; class HomePage extends \nw\DataProviders\PageDataProvider { public function populate() { echo "you made it here "; die(); } } Do I also need to any something to my composer file to get the class to autoload, or just put it in the correct directory?
  5. Bug report: When adding the permission "page-publish" , and logging in as a user that does not have that permission, the publish button will be removed, but only part way, and a set of links belonging to that button will still show. System: Clean install with pro drafts, and croppable image 3. ProcessWire 3.0.62 Browser: Safari Use Case: Setting up a workflow where users can draft pages, but not publish them. (so that all content can be reviewed first)
  6. The one module I didn't uninstall because it was so simple it could not possibly break anything was causing the problem. Added a name space to the module, and everything works like magic. I think the module compiler just had an issue that that module for some reason. Thanks for suggestions.
  7. This one has me stumped. When I login into the admin with any user but a super user I get this error: Unknown Selector operator: '' -- was your selector value properly escaped? field='Array', value='', selector: 'Array, parent_id=31, templates_id=5 Parent=31 is the Admin > Access > Roles page templates_id=5 is the permission template Other than that I have so idea why selector is showing up empty and crashing the site. I have uninstalled almost all the none-core modules in my system. Full Stack trace: Notice: Array to string conversion in /home/www/processwire/wire/core/User.phpon line 203 Warning: Illegal offset type in isset or empty in /home/www/processwire/wire/core/Permissions.phpon line 83 Warning: Illegal offset type in isset or empty in /home/www/processwire/wire/core/User.phpon line 219 Notice: Array to string conversion in /home/www/processwire/wire/core/PagesType.phpon line 283 Notice: Array to string conversion in /home/www/processwire/wire/core/PagesType.phpon line 287 Warning: strpos() expects parameter 1 to be string, array given in /home/www/processwire/wire/core/PagesType.phpon line 301 Notice: Array to string conversion in /home/www/processwire/wire/core/PagesType.phpon line 158 Warning: strpos() expects parameter 1 to be string, array given in /home/www/processwire/wire/core/PagesType.phpon line 159 Notice: Array to string conversion in /home/www/processwire/wire/core/PagesType.phpon line 169 Fatal error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='Array', value='', selector: 'Array, parent_id=31, templates_id=5' (in /home/www/processwire/wire/core/Selectors.php line 396) #0 /home/www/processwire/wire/core/Selectors.php(439): ProcessWire\Selectors->create('Array', '', '') #1 /home/www/processwire/wire/core/Selectors.php(159): ProcessWire\Selectors->extractString('Array, parent_i...') #2 /home/www/processwire/wire/core/Selectors.php(145): ProcessWire\Selectors->setSelectorString('Array, parent_i...') #3 /home/www/processwire/wire/core/PagesLoader.php(217): ProcessWire\Selectors->init('Array, parent_i...') #4 /home/www/processwire/wire/core/Pages.php(232): ProcessWire\PagesLoader->find('Array, parent_i...', Array) #5 /home/www/processwire/wire/core/Wire.php(386): ProcessWire\Pages->___find('Array, parent_i...', Array) #6 /home/www/processwire/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___find', Array) #7 /home/www/processwire/wire/core/Wire.php( in /home/www/processwire/index.phpon line 64
  8. Just want to give a big thanks you to the processwire team! And all the hard work that has gone into the PW this year! Really grateful for how well this project has been developing and how much thought and handwork goes in behind the scenes. I am really looking forward to those native import / export features! As far as JavaScript rest $page API's goes you might also want to look into a GraphQL implementation, it seems like an ideal way to cut down on the network chatter for headless CMS's, and is becoming an emerging standard. also see:
  9. I'm finding a compatibility issues with CroppableImage and ImagikResizer/PageimageSizerImagick V0.31 plugin. I am wondering if any one else is having issues? The Issue: When both plugins are installed croppableImage stops working properly. It will crop the image but always in the center, and ignores the selection tool that lets specify what part of the image to crop from. Versions: Processwire: 2.6.0 PageimageSizerImagick: 0.31 CroppableImage: 0.84 Note: I wanted to try to put in an issue on the Git page, but it is 404ing right now. https://github.com/horst-n/PageimageSizerImagick
  10. What would be the best way to add an existing field right before the ending of an existing feildset? IE. I already have a fieledset called seo and I want to add a field right before the closing for "sitemap_ignore" via the API.
  11. Amazing work with this module. Image magik is light years ahead of GD in terms of how will it sizes PNG files. Especially logos where you need to see hard clean lines. I have noticed that of the 30 logos I have sized with image magik 4 of them came out looking like this. if I save the file again in photoshop it totally fixes the issue. might be the images have some kind of bad data that only image magic picks up and GD doesn't? Or it might be the module...I just wanted to bring it to your attention, just in case it's helpful. Here is the original: Again, amazing module!
  12. Solved it by reading how $pages->clone() does it, and just doing that.... I also see that $pages->clone() has the ability to set an argument to specify a page ID which solves my issue of cloning a page and not having the the page ID I want after the clone. //copies the fields of one page to replace the fields of another page. function copyFields ($sourcePage, $destinationPage) { //Copy Fields between pages $destinationPage->of(false); $sourcePage->of(false); foreach ($destinationPage->template->fieldgroup as $field){ if($field->type instanceOf FieldtypeTable){ //You get duplicare SQL index errors if you don't use clone. $destinationPage->$field = clone $sourcePage->$field; }elseif($field->type instanceOf FieldtypeTextarea){ //Update image an file links in rich text fields $destinationPage->$field = str_replace("/files/{$sourcePage->id}/","/files/{$destinationPage->id}/",$sourcePage->$field); }else{ $destinationPage->$field = $sourcePage->$field; } } // Copy $sourcePage's files over to new page if(PagefilesManager::hasFiles($sourcePage)) { $destinationPage->filesManager->init($destinationPage); $sourcePage->filesManager->copyFiles($destinationPage->filesManager->path()); } return $destinationPage; }
  13. I want to copy all the content from one $page to another $page. The use case: To create drafting workflows. The contents of one page needs to be copied to replace another. The problem points: images and files don't copy with my current approach. So far it looks like you have to: copy the files /assets/your-page-id/ to /assets/your-new-page-id/, then do a search and replace on any Rich Text Fields fields that contained the paths for those images. (easy search and replace) Are there any system tools for migrating images and files from one page to another. It seems like clone does this all automatically. I would love to leverage existing tools if they exist before trying to build my own. Also I wonder if this is the correct way to copy the non-filesystem based data : $pageA->image = $pageB->image; $pageA->save()? Method #1: for copying fields from one page to another: (thanks to some tips from Soma, it works great, but does not yet work on image fields, or files) public function copyFields ($sourcePage, $destinationPage) { //Copy Fields between pages $destinationPage->of(false); $sourcePage->of(false); $debugMsg = ''; foreach ($destinationPage->template->fieldgroup as $field) { if ($destinationPage->$field != $sourcePage->$field) { $destinationPage->$field = $sourcePage->$field; $debugMsg .= $field . ","; } } $this->message("Fields Copied: $debugMsg", Notice::debug); return $destinationPage; } (If there are any system tools for dealing with, the migration of images and files from one page to another id love to learn about them, even if they are low level like "the process wire method for creating asset folders, and copying files" if such functions exist...otherwise ill use the basics.) Can't you just clone the page? I tried cloning the page. It works AWSOME!!! except! I am unable to transfer the ID from the page being replaced by the clone, to the clone. When Id's Change page relationships can break. While clone works awesome at copying data between pages, not being able to change the ID of a page post clone, makes me think it might not be a viable option for copying data of one page with another. If any one wants to look at my simple method for replacing a page with a clone and offer a suggestions... Method #2 Cloning a draft page to replace original content page private function pushDraft ($draft) { $page = $this->getSourceFromDraft($draft); //Backup important fields before we delete our Original page. $pageOriginalParent = $page->parent; $pageOriginalName = $page->name; $pageOriginalId = $page->id; //store revision history on draft page just so it does not get deleted $this->movePathHisory($pageOriginalId, $draft->id); //delete original page wire('pages')->delete($page); //Clone a copy of draft to replace original page //we save a copy of the draft page and original page else where in case we need to revert. $replacementPage = wire('pages')->clone($draft, $pageOriginalParent); $replacementPage->name = $pageOriginalName; $replacementPage->id = $pageOriginalId; //This is the part that does not work as It might. //The assignment happens in memory but not in the database of file system on save. //there might be a really good reason for this though, I don't imagine people need //change page ids that often. $replacementPage->save(); $this->moveRevisionHistory($draft->id, $replacementPage->id); return $replacementPage; }
  14. @Teppo, thanks for confirming that is how it should work...I stepped away from my code and tried it with straight SQL and with hard coded page ID's and it worked. I did try this earlier, but I must have been working with not enough sleep (I was on the wrong server writing SQL and watching for results in the admin of another...sigh...)
  15. I'm looking for a way to move all the version control data from one page to another. use case: pageA= a draft page pageB= source draft was cloned from pageB need to replace pageA at some point but it has a shallow history. pageA has a long and wonderful page history, but its going to get replaced by pageB and will lose it all. OH NO! (pageA will be deleted) Trying to make a function that can copy the history from one page to another, got stuck on how to write the SQL. Wondering if you can give any tips. private function moveRevisionHistory($sourcePageId, $destinationPageId) { $database = $this->wire('database'); $this->message("UPDATE version_control__revisions SET pages_id=$sourcePageId WHERE pages_id=$destinationPageId"); $query = $database->prepare("UPDATE version_control__revisions SET pages_id=$sourcePageId WHERE pages_id=$destinationPageId"); $query->execute(); $query->closeCursor(); } This just changing the pages_id seems to break things, any tips on what else I need to update to move a page? there are a hand full of id's spanning across a few tables not sure what other id fields are storing "pages_id" information that would need to be updated. Maybe I have to update the parent field as well? Update: Simplified way talking about it. I am trying to move a history from one page to another page. I am updating the pages_id, but that does not seem to do it. Do I also need to update the "parent" field some how? Example SQL: UPDATE version_control__revisions SET pages_id=$new_page_id_of_page_with_same_template WHERE pages_id=$page_id_to_update ;
  16. @Soma , your words are starting to sound more and more like wisdom. at runtime copying all the feilds from one page to another is great. This method falls apart when you try to need to save the page after run time. I found complications with pages with Images....Ckeditor with references to the images. Page Tables, etc. Had to learn the hard way, but page cloning is really the way to go.
  17. It would be awesome users could size their images for the RTE (rich text editor) using preset cropping sizes. This could really help ensure consistency across a site for editors that need to add images and reduce the amount of training needed when dealing with images. third part image crop fields do this really well, but do not offer a way to use the crops in the RTE. Image: Look next to the cancel button, there is a pulldown for image size presets. Drop down menus allows users the ability to select some preset image cropping dimensions. Crop guides would keep the aspect ratio, and return the desired image size. Pick custom size and the cropping guides would work as they normally do (free form) Other approaches: ProcessPageImageSelect could be made hookable in a way that images from third party image modules can add images to the RTE image selection page. i've been trying to get a preset image crop sizes into the RTE editor for a while now. I tried to use the hooks in ProcessPageImageSelect in-combination with the CroppableImage module but there is no hooks for this as (as far as I know). $this->addHookAfter('ProcessPageEditImageSelect::execute', $this, 'HookPageImageSelect'); The hook above will allow me to add images to the image selection modal, but I still can't get images that image to be addable to the Rich Text Editor on click. I was able to get the desired functionality by modifying core module ProcessPageImageSelect. Maybe if ProcessPageEditImageSelect->getImages() was hookable images from other modules could be added without modifying core modules.
  18. This field seems to be hidden in processwire 2.6 to non super users. How do you allow none super users to change the page author? Also does anyone know if there is a way to collapse some of the fields on settings page? the feild set "Who can access this page" for example runs on for a really long if you have a lot permissions and users.
  19. i'm trying to get a list of valid crop images for the current page so that when I encode some pages in JSON using the JsonPages module the images will have the cropImage image URL's associated with the JSON payload as well as the standard image URL. //from the JsonPages module include('../CroppableImage/classes/CroppableImageCropSettings.class'); $cropSettings = new CroppableImageCropSettings(); $cropSettings->getCropSettingsForTemplate($page->template); print_r($cropSettings); result: CroppableImageCropSettings Object ( [items] => Array ( ) [names] => Array ( ) [invalidLines] => Array ( ) [templateNames] => Array ( ) [duplicates] => Array ( ) ) My test has a CroppableImage field, with a single thumbnail crop variation. It could also be nice to build a function into the $image or the module for getting field names, what do you think?. UPDATE: I got it working this way, by modifying the fieldType for CropImage . $this->addHook('Pageimage::getCropSettings', $this, 'getCropSettings'); //.... public function getCropSettings(HookEvent $event) { $inputFieldInstance = $this->_getInputFieldInstance($event); $cropSettings = new CroppableImageCropSettings($inputFieldInstance->cropSetting); $settings = $cropSettings->getCropSettingsForTemplate($event->object->page->template); $event->return = $settings; return true; } //... $settings = $image->getGropSettings(); Is this a good place to put this function? update again: A function returns all the cropImages with the crop name would probably the must useful to other people. $images = $image->getcrops();? //returns all the crop image variations "portrait, landscape, etc." and add a variable to the image object. $image->cropname...or something like that. If that feature would be good, ill be happy to submit it to the project. I have not worked on any open source projects before, so forgive me if I'm being awkward in how i'm going about trying to contribute, and communicate about it.
  20. Thanks adrian. So I was trying to figure out how I was not able to find that information in the cheat sheet, or in my google searches and I realized that the: http://cheatsheet.processwire.com/ has a little button called "advanced" and it includes system functions like the one you where kind enough to mention above! I guess I was not feeling that "advanced" when I was doing my searching ;-) Thanks again.
  21. I'm trying to figure out the correct way to set page statuses. if I do this: $page->status = Page::statusUnpublished; $page->save(); Then change your page status to published in the admin to published. The new pages status becomes = 0; it should be 1. if ($page->is(Page::statusOn)) { //Page::statusOn = 1 //do somthing } The above code will fail to make it inside the if statement. I am trying to figure out how to test if a page is published or not and set page statuses that play nice with the Admin. Since I don't understand these bitmasks, if any one can show example of how you add these page statuses together and remove page status without loosing them, that would be supper helpful.
  22. I managed to get cropped images working in CKeditor. Here is the code, in case any one is interested in such a hack. If you know a better way to do this, let em know. It would be cool to dynamically get this list of crop settings (thumb, portrait, etc) from the croppedImage field, but, all in all, this seems to work surprisingly well. Using the latest dev branch of processwire: 2.5.27 Copy: /wire/modules/Process/ProcessPageEditImageSelect/ to /site/modules/ProcessPageEditImageSelect/ Made these changes: //CHANGES TO ALLOWS IMAGE SIZES FROM CROP IMAGE IN RTE $acceptedCropImageSets = ['thumb','portrait','landscape','thumb']; foreach($images as $image){ list($imgBase,$ext) = explode(".", $image->basename); foreach($acceptedCropImageSets as $set) { $cropedImagePath = wire('config')->paths->files."{$page->id}/{$imgBase}.-{$set}.{$ext}"; if(file_exists($cropedImagePath)) { $images->add($cropedImagePath); } } $cropImagesGlobSearch = wire('config')->paths->files."{$page->id}/{$imgBase}.-thumb.{$ext}"; } //CROP IMAGE CHANGES - END foreach($images as $image) { $numImages++; $key = $page->id . ',' . $image->basename; // page_id,basename for repeater support $allImages[$key] = $image; }
  23. I have tried the new dev branch, with all the crop and sizing magic. It's pretty flexible, and fast, and easy for some one who knows how to edit images. The concern I'm getting from my client is they don't trust their editors to size their images correctly, to remember the pixel dimensions for a medium sized portrait for example. (anything can be fixed with enough training though) My client however wants their editors to be able to select from a few preset sizes of images that they can drop into the content area: landscape, portrait, banner, etc. It seems like the new dev-branch of processwire could be rigged to work with some preset sizes, but thats that all requires a level of javascript which is not my strong point. CroppableImages on the other hand seems to have 95% of everything I need just does not have the ability to select the images from the RTE. The new image features in the dev branch also do not let you select images that have already been sized in the image fields. I think allowing users to select the different sizes of an image would be beneficial for both CroppableImage and the new image management tools created by Ryan. I'll take a crack at it, and see what happens.
  24. is it possible to select the cropped images from my CKeditor image select popup? I if I was going to try to implement it the correct module might be: /wire/modules/Process/ProcessPageEditImageSelect/ProcessPageEditImageSelect.module. Would copying that to /site/modules/, and modifying it be the sensible way to allow cropped images to be selected from CKeditor? Or is there already a setting that already exists for showing more images than just the original (uncroped images) in CKeditor?
  • Create New...