Jump to content

dragan

Members
  • Posts

    2,007
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by dragan

  1. https://www.discogs.com/developers/index.html (untested)
  2. $this->addHookAfter('Page::render', function ($event) { if ($this->page->template != 'admin') { $event->return = str_replace("<iframe", "\n<div class='videoWrapper'><iframe", $event->return); $event->return = str_replace("</iframe>", "</iframe></div>", $event->return); $event->return = str_replace("<table", "\n<div class='scrollTable'><table", $event->return); $event->return = str_replace("</table>", "</table></div>", $event->return); } }); fwiw, here's the hook how it should have been from the get-go. I omitted the page template if condition (if there's a more recommended way of doing such stuff, I'm all ears).
  3. I was focussing on the network panel in Google Chrome, and this didn't show anything. Now I was actually clicking (inside console) on the VM:xxx link that Chrome also provides. This actually showed me the response. Weird (but then again, I don't claim to be a JS debugger guru by any means...)
  4. Whoa, I think I found the culprit... It seems like one of my hooks is being triggered also in the backend... [{"error":false,"message":"Added file: tumblr_omeiihbv8g1tu3avjo1_1280.jpg","file":"\/site\/assets\/files\/11482\/tumblr_omeiihbv8g1tu3avjo1_1280.jpg","size":203248,"markup":"<li id='file_5f68e2495aab81b39cb738510564e6dd' class='ImageOuter gridImage ui-widget'><span class=\"aos_moveAssets\"><i title=\"Move to last\" class=\"fa fa-step-backward\" data-down><\/i><i title=\"Move to first\" class=\"fa fa-step-forward\" data-up><\/i><\/span><div class='gridImage__tooltip'> <div class='scrollTable'><table><tr><th>Dimensions<\/th><td>1280x854<\/td><\/tr><tr><th>Filesize<\/th><td>198&nbsp;kB<\/td><\/tr><tr><th>Variations<\/th><td>0<\/td><\/tr><\/table><\/div>\n\t\t\t<div class='gridImage__overflow'>\n\t\t\t\t<img src=\"\/site\/assets\/files\/11482\/tumblr_omeiihbv8g1tu3avjo1_1280.0x260.jpg?nc=1535996482\" alt=\"\" data-w=\"1280\" data-h=\"854\" data-original=\"\/site\/assets\/files\/11482\/tumblr_omeiihbv8g1tu3avjo1_1280.jpg?nc=10\" data-focus=\"50 50 0\" \/>\n\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='gridImage__hover'>\n\t\t\t\t\t<div class='gridImage__inner'>\n\t\t\t\t\t\t<label for='' class='gridImage__trash'>\n\t\t\t\t\t\t\t<input class='gridImage__deletebox' type='checkbox' name='delete_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' value='1' title='Delete' \/>\n\t\t\t\t\t\t\t<span class='fa fa-trash-o'><\/span>\n\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t<a class='gridImage__edit'>\n\t\t\t\t\t\t\t<span>Edit<\/span>\n\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='ImageData'>\n\t\t\t\t\t<h2 class='InputfieldImageEdit__name'><span contenteditable='true'>tumblr_omeiihbv8g1tu3avjo1_1280<\/span>.jpg<a href=\"\/site\/assets\/files\/11482\/tumblr_omeiihbv8g1tu3avjo1_1280.jpg\" target=\"_blank\" class=\"aos_downloadAsset\" download title=\"Download\"><i class=\"fa fa-download\"><\/i><\/a><\/h2>\n\t\t\t\t\t<span class='InputfieldImageEdit__info'>198&nbsp;kB, 1280&times;854 <\/span>\n\t\t\t\t\t<div class='InputfieldImageEdit__errors'><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__buttons'><small><a href=\"\/site\/assets\/files\/11482\/tumblr_omeiihbv8g1tu3avjo1_1280.jpg\" target=\"_blank\" class=\"aos_downloadAsset\" download title=\"Download\"><i class=\"fa fa-download\"><\/i><\/a><button type='button' data-href='\/backstage\/page\/image\/edit\/?id=11482&file=11482,tumblr_omeiihbv8g1tu3avjo1_1280.jpg&rte=0&field=gallery' class='InputfieldImageButtonCrop uk-button uk-button-small uk-button-text uk-margin-small-right pw-modal-large pw-modal' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'><i class='fa fa-crop'><\/i> Crop<\/button><button type='button' class='InputfieldImageButtonFocus uk-button uk-button-small uk-button-text uk-margin-small-right'><i class='fa fa-circle-o' data-toggle='fa-circle-o fa-dot-circle-o'><\/i> Focus<\/button><button type='button' data-href='\/backstage\/page\/image\/variations\/?id=11482&file=tumblr_omeiihbv8g1tu3avjo1_1280.jpg&modal=1&varcnt=varcnt_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' class='uk-button uk-button-small uk-button-text uk-margin-small-right pw-modal-large pw-modal' data-buttons='button'><i class='fa fa-files-o'><\/i> Variations <span class='ui-priority-secondary'>(0)<\/span><\/button><\/small> <select class='uk-select uk-form-small InputfieldFileActionSelect' name='act_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd'><option value=''>Actions<\/option><option value='dup'>Duplicate<\/option><option value='fv'>Flip vert<\/option><option value='fh'>Flip horiz<\/option><option value='fb'>Flip both<\/option><option value='r90'>Rotate 90&deg;<\/option><option value='r180'>Rotate 180&deg;<\/option><option value='r270'>Rotate 270&deg;<\/option><option value='r-90'>Rotate -90&deg;<\/option><option value='r-180'>Rotate -180&deg;<\/option><option value='r-270'>Rotate -270&deg;<\/option><option value='bw'>B&amp;W<\/option><option value='sep'>Sepia<\/option><\/select> <span class='InputfieldFileActionNote detail'>Action applied at save.<\/span><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__core'><div class='hasLangTabs langTabsContainer'><div class='langTabs'><ul uk-tab><li><a data-lang='1010' class='langTab1010' href='#langTab_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd__1010'>English<\/a><\/li><li><a data-lang='10189' class='langTab10189' href='#langTab_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd__10189'>Deutsch<\/a><\/li><\/ul><div class='InputfieldFileDescription LanguageSupport' data-language='1010' id='langTab_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd__1010'><label for='description_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' class='detail LanguageSupportLabel'>English<\/label><input type='text' name='description_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' id='description_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' value='' \/><\/div><div class='InputfieldFileDescription LanguageSupport' data-language='10189' id='langTab_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd__10189'><label for='description10189_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' class='detail LanguageSupportLabel'>Deutsch<\/label><input type='text' name='description10189_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' id='description10189_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' value='' \/><\/div><\/div><\/div><script>setupLanguageTabs($('#wrap_Inputfield_gallery_repeater11482'));<\/script><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__additional'><\/div>\n\t\t\t\t\t<input class='InputfieldFileSort' type='text' name='sort_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' value='0' \/>\n\t\t\t\t\t<input class='InputfieldFileReplace' type='hidden' name='replace_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' \/>\n\t\t\t\t\t<input class='InputfieldFileRename' type='hidden' name='rename_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' \/>\n\t\t\t\t\t<input class='InputfieldImageFocus' type='hidden' name='focus_gallery_repeater11482_5f68e2495aab81b39cb738510564e6dd' value='50 50 0' \/>\n\t\t\t\t<\/div>\n\t\t\t<\/li>","replace":false,"overwrite":0}] This part clearly shouldn't be here: <div class='scrollTable'><table> That was meant to be injected only in the frontend (to make big tables responsive and simply add a wrapper). Thanks a lot @adrian for your patience. Gonna re-write that hook. At least I found the culprit now (my own stupidity)
  5. I've disabled now ALL modules with Tracy, and nothing changed. Problem is: Sometimes the images are in fact getting saved, sometimes not. The JS errors remain. It's really quite frustrating... I mean, the JS file that apparently triggers the error is a PW core file, not some extra-module. I even tried with or without SessionHandlerDB - doesn't seem to make a difference (like it was suggested in the other forum thread). (I also made sure my ad-blocker doesn't accidentally block resources, btw)
  6. unexpected token I'm confused too, especially since I came across that same error ages ago, but I can't remember what I did to resolve it. I deinstalled the Image Extra fieldtypes / modules, and tried again. *sigh* Guess I'll have to manually deactivate modules till I find the culprit...
  7. Yes, that's where I was looking. I have SessionHandlerDB installed and running. I get the same error as you mentioned in that forum thread you linked (your last post).
  8. All of a sudden image-upload seems broken. No matter if I want to upload one single image or several images. Chrome console says: Uncaught SyntaxError: Unexpected token in JSON at position 414 at JSON.parse (<anonymous>) at Function.parseJSON (JqueryCore.js?v=1535110864:2) at XMLHttpRequest.<anonymous> (InputfieldImage.js?v=122-1535110864:1973) // File uploaded: called for each file xhr.addEventListener("load", function() { xhr.getAllResponseHeaders(); var response = $.parseJSON(xhr.responseText); // line 1973 The spinning animation GIF keeps on spinning forever... I thought I have seen a forum thread about such an error, but I can't find it anymore. If I inspect https://dev.mysite.com/backstage/page/edit/?&amp;id=11203&amp;InputfieldFileAjax=1 I only see headers, no content. content-type: application/octet-stream (in request header) in response headers: x-tracy-ajax: 1 x-xss-protection: 1; mode=block Does anyone know what could cause this? PW 3.0.111 / PHP 7.2.8
  9. Most probably the file-paths of your WP site and your PW install don't match. You can't do a copy+paste action like that without adjusting the file-paths/URLs. (doesn't matter from where to where)
  10. Same here with PHP 7.1.9 + PW 3.0.106 It would make sense to show which required dependencies exactly are not met.
  11. I'm getting the same error message as pwFoo above, but I'm using* the regular image-upload in the backend. Tracy reports: PHP Warning: filemtime(): stat failed for foo/site/assets/files/1459/__filename___79169f6b6105acbc1299f65e8379b54c54ab3907.titelbild.jpg___description___bildbeschreibung_slide_bild_3___modified__1534175094__created__1518532723__tags_____ in /foo/wire/core/Pagefile.php:521 @ https://dev.foo.com/ That filename is weird. Does anyone know what could cause this? * Actually, the client was uploading files, not me. I just got a notification via email today...
  12. I know it exists, but have never used it myself. Perhaps this Pro module would help? https://processwire.com/api/modules/prodrafts/
  13. PW can in fact do that. It's entirely up to the developer what PW should output. JSON, XML, CSVs, HTML... re: Vue.js If you search here for Vue you'll find a few forum topics with tips and project insights, e.g. https://medium.com/icf-church-developers/processwire-vue-js-a-lovestory-d4d5bca365
  14. Un-tick the active checkbox on pages, not the language itself. Use the ChildBatchEditor or AdminActions module to quickly activate or de-activate pages and entire trees/nodes at once.
  15. You could probably use unique(): http://cheatsheet.processwire.com/pagearray-wirearray/getting-items/a-unique/ Either way, I would avoid doing a find() in every foreach - that's inefficient. Define a variable for the results before your foreach. $results = $events_pages->events->find($filter.", sort=event_start"); $unique = $results->unique(); foreach($unique as $e) // etc.
  16. OK, so as promised, for a use-case with Functional Fields, here's a simple code example and a screenshot how it might look like in the backend: __fieldset('plain,textarea,rich,hello', 'jsStrings', 'Javascript Strings'); // $pages->get(1044)->functional->plain // how you would get it from anywhere in your templates and pages echo "<p>" . __text('your plain text', 'plain', 'Label Text for Plain Text String') . "</p>"; // $pages->get(1044)->functional->textarea // how you would get it from anywhere in your templates and pages echo "<p>" . nl2br(__textarea('your textarea text', 'textarea', 'Label Text for Textarea')) . "</p>"; // $pages->get(1044)->functional->rich // how you would get it from anywhere in your templates and pages echo "<div>" . __richtext('<p>your richtext</p>', 'rich', 'Label for WYSIWYG') . "</div>"; echo "<div>" . __richtext('<p>Hello Wörld!!!</p>', 'hello', 'Label for Hello World') . "</div>"; This is how it looks like in the backend. The big advantage imho is that you have the familiar user interface you're used to when you are also in charge of creating or editing PW-pages. It all seems familiar, and if you have a multi-lang setup, you can edit it all without page-reloads and navigating to another language.
  17. I would probably do something like this: Have a "stats" page somewhere (hidden), with one big raw textarea field. Each visit would add one line to that field: 1234,guest,username,1535646198 = page-id,user-role,username,unix-timestamp You could get fancy and install a geo-IP-lookup PHP library and add lat/long infos as well. Instead of using a comma-separated list for each item, you could save it as JSON. But I guess this would mean a slight performance hint on a bigger site (the bigger it gets, the more time it takes to transform JSON into an PHP array, add one item, and use json_encode again). I've used a similar approach, when I played around with chatbots and certain API calls back and forth. It would be quite easy to output some sort of stats / infographics from such raw data. And of course easy to export it to Excel or somesuch... The only thing I would make sure and investigate some time before going that route: Check if there are some size-restrictions, i.e. how much data can actually be stored in a PW textarea field? Even this could be easily solved: Create a new stats-field for each year/month...
  18. I'm afraid you do ? What you do, is define all the strings in one template. Then create a page with said template, and you'll see that for each string PW creates input fields. The name "Functional Fields" is perhaps a bit misleading. PW doesn't create a field for each string. I'll post some screenshots / code examples a bit later...
  19. You probably have to change something in your .htaccess file (mod_rewrite). A workaround would be to simply use an empty new template and include() your custom PHP file, then use the PW-generated URL / page-slug to access it.
  20. As I mentioned before, the whole setup is not clear to me. It seems as if you have a one-to-many situation here, i.e. you have several av_dates that point (relate) to one "parent" (page). That's all perfectly doable, but if you don't explain your whole setup any better, we're all just guessing here and stabbing in the dark. The first step to getting a constructive + helpful answer is to phrase your problem as best as you can. This seems to suggest you are still saving data in extra DB tables - whereas I was suggesting to save that right inside your related PW pages instead.
  21. I'm afraid I don't understand the whole scenario/setup. It would help if you'd explain a bit more in detail what these DB fields actually contain and how they relate to PW-content. I'm sure we'll find a way to solve this, but right now, the issue (for me) is a bit foggy... Oh, and btw, welcome to the forum ?
  22. Why don't you create those fields av_date and av_status in your PW templates, and then populate / update these fields inside PW with your cron job? This would make it easier to query such things.
×
×
  • Create New...