Jump to content
adrian

Tracy Debugger

Recommended Posts

Hi @adrian thanks for the latest update to add autoload support (and to Ryan for putting it into the core this week) as I can now use Tracy in the preview tab in FormBuilder to do a little StreetAddress work. Much appreciated!

  • Like 3

Share this post


Link to post
Share on other sites
Just now, netcarver said:

Hi @adrian thanks for the latest update to add autoload support (and to Ryan for putting it into the core this week) as I can now use Tracy in the preview tab in FormBuilder to do a little StreetAddress work. Much appreciated!

Nice! Glad to hear it's already proving useful 🙂

  • Like 4

Share this post


Link to post
Share on other sites

New version adds some configurable settings for the ACE code editor used in the Console panel and the File Editor panel:

image.thumb.png.fb874897ac33c90b80e05205e0430e55.png

I went with the defaults I like, but adjust to suit your preferences - don't judge my use of spaces over tabs - it's mostly about consistency when pasting into web forums and other places, but if you need another reason: Developers Who Use Spaces Make More Money Than Those Who Use Tabs 🙂

I am also a big fan of 4 character indentation but I do know that some people prefer 2, so take your pick.

The one thing that is new is the intro of Show Invisibles being set to true. That results in the following which I find quite useful at times.

image.png.77b494b57658e3b9af77094bb1d68b0b.png

Note the highlighted (in pink) character at the end. That actually isn't due to the Show Invisibles setting, but I thought I'd include in this screenshot to bring attention to this thread: https://processwire.com/talk/topic/19995-changing-structure-of-pages/?do=findComment&comment=173671 and how the Console panel can be a useful tool in finding non-printable characters that are causing syntax errors in your code.

  • Like 4

Share this post


Link to post
Share on other sites
11 hours ago, adrian said:

finding non-printable characters that are causing syntax errors in your code

I use this app on my Mac: https://www.bluem.net/en/projects/plain-clip/ Press SHIFT when launching Plain Clip.app to see its preferences settings panel.

I use it by launching it with ctrl+option+command+V and afterwards my launcher app performs a paste operation by simulating command+V. This way I rarely run into copy/paste issues like that.

  • Like 3

Share this post


Link to post
Share on other sites

QcwPxOb.png

Did you read my mind or was that always there? I wanted to post this request yesterday but found all shortcuts in the docs... then I thought why bother adrian again with something that is already there 🙂 awesome! thx

  • Like 2

Share this post


Link to post
Share on other sites
37 minutes ago, bernhard said:

Did you read my mind or was that always there?

It's been there for about a week - pretty much just after all the new fullscreen and pane sizing shortcuts were added.

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

Latest version adds a new Inputfield Settings section to the RequestInfo panel when viewing a field in the admin. This is not turned on by default, so visit the module settings if you want to take it for a spin.

Speaking of the module settings, all relevant panels now have direct links to their section in the module config settings, eg:

image.png.7ef4266614601bb8d5ef5816a95ac518.png

The cog/gear icon at the bottom right will take you directly to this, which will hopefully make changes to panel settings much easier/quicker. Thanks to @bernhard for this suggestion.

image.thumb.png.7a771c2f1103d0fd40f5142cf146657e.png

 

  • Like 5

Share this post


Link to post
Share on other sites

Really great addition! Thank you!

I wonder what others think of having the icon left instead of right. I think it'd be an improvement. Maybe if others think the same it would be worth the effort. If not, I'm also happy to have it on the right side now 🙂  Thx again!

5bvDRxv.png

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, bernhard said:

I wonder what others think of having the icon left instead of right.

Sure.

I have just made the change and spent some time refactoring the generation of the panel footer area to make future changes much easier.

  • Thanks 1

Share this post


Link to post
Share on other sites

Hey @adrian thx again for the great panel settings shortcut. It already saved me from a lot of clicks 🙂 

For example today I added some todos in my code and activated the todo-panel. Then I had far too much todos indexed (from AOS and other modules) and I just clicked on the settings tab and added them to the list of not-to-index folders. Works great!

One thing I noticed is that when I reload the page after adding a folder to the ignored-list the Todo-Panel was not activated any more. I activated it via the checkbox in the panel selector and clicked "sticky". After saving the module's settings this setting was gone. Is this a bug? Or can I activate this panel in another way?

Thank you!

Share this post


Link to post
Share on other sites

Hey @bernhard - glad you're enjoying it.

Clearing of Tracy cookie settings (like sticky selected panels) when saving the module settings is intentional: https://github.com/adrianbj/TracyDebugger/commit/f26a46724f8d36b33a637835581128875b756e1e

The trouble is that I am not sure why I did it 🙂 I'll have to have a think about why I did this - I distinctly remember doing it for some reason but maybe that reason is no longer relevant due to other changes. I'll get back to you on this.

16 hours ago, bernhard said:

Or can I activate this panel in another way?

Of course you can enable the panel permanently in the config settings, but I am pretty sure that's not what you mean.

 

  • Like 1

Share this post


Link to post
Share on other sites

Some more keyboard shortcuts for the Console panel:

CTRL + SHFT + PageUp | One less line in code pane
CTRL + SHFT + PageDown | One more line in code pane

Unlike the other pane resizing shortcuts, these two save the position of the divider so that it will restore to this position after a page reload. This matches the behavior when you drag the divider with the mouse.

h42E7By0BE.thumb.gif.e17c7709e2d6c1f40715993887d81959.gif

  • Like 2

Share this post


Link to post
Share on other sites
On 9/28/2018 at 3:00 AM, adrian said:

Of course you can enable the panel permanently in the config settings, but I am pretty sure that's not what you mean.

Hm. Somehow it didn't feel right to do it that way. But it's totally fine of course 🙂 I was just curious of the reason...

Share this post


Link to post
Share on other sites

Apparently I have a compulsion for new keyboard shortcuts 🙂

Just added these:

SHFT + Enter Expand to fit all code and add new line (saves position)
SHFT + Backspace Contract to fit all code and remove line (saves position)

zSH3drB9bp.gif.083327acc82b5e18c24dc5104caa1aa3.gif

I have also modified the drag resizing to automatically snap to row heights.

 

  • Like 1

Share this post


Link to post
Share on other sites

Anyone have any thoughts for this new panel before I publish it?

image.png.4e26190fc373195aaadafd650b88e027.png


Pretty self-explanatory - it shows the status of the various permissions for the current page for all user roles. This should make it much easier to quickly check things if a client complains they don't have access to do a certain action on a specific page.

I'll probably commit tomorrow, but just wondering if you guys have any other ideas for this first.

Actually, I am now wondering if perhaps this should just be a new section in the RequestInfo panel, rather than a dedicated panel. Any thoughts on this?

Thanks!

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for the update @adrian

13 minutes ago, adrian said:

it shows the status of the various permissions for all user roles. This should make it much easier to quickly check things if a client complains they don't have access to do a certain action on a specific page.

For a task like this (wanting to check the a client's access RE a specific page), I'm thinking it would be more useful to actually see the permissions of that client in respect of the said page, rather than scrolling through a potentially long list of all roles (e.g. a large site). The difficulty I see is, obviously, the said client is not logged in when the admin is checking out the status ;-), so this may be wishful thinking. Just wondering...

Could the colours please, somewhere, match the current colour scheme of the other panels?

13 minutes ago, adrian said:

Actually, I am now wondering if perhaps this should just be a new section in the RequestInfo panel, rather than a dedicated panel. Any thoughts on this?

I'm 50/50 on this. If I was able to view a page, put a clients name or id in an input and Tracy returns the permission panel, I wouldn't mind it being separate.

 

Just my 2p.

Edited by kongondo
typos
  • Like 2

Share this post


Link to post
Share on other sites

Good idea adrian!

You might want to flip the table rows/columns?  roles listed horizontally, permissions listed vertically.  I was thinking that there will probably always be more permissions than roles.  I would rather scroll vertically than horizontally.

That is how Drupal's permission page works.  This shows it enhanced with the https://www.drupal.org/project/instantfilter module for instant permission filtering like the AdminOnSteriods module does in Processwire.

image.png.a6f2d731b83614eda684f9f7f35f19a5.png

  • Like 1

Share this post


Link to post
Share on other sites

Another idea for you:

Would it be possible on the Dumps and Dumps Recorder panels to auto expand the dump if there is only 1 dump?  That way someone doesn't have to click the plus sign or arrow to open the dump every-time the page is refreshed?  Currently by default it is always collapsed.

dumpsrecorder.jpg.23546d339d9cc52ff63d61e2703d919e.jpg

No worries if you can't, just a suggestion.  Appreciate all you do.

  • Like 3

Share this post


Link to post
Share on other sites
8 hours ago, adrian said:

it shows the status of the various permissions for the current page for all user roles.

Any chance of hints or links pointing to somewhere where superusers can get more info on how to adjust those permissions listed?

Share this post


Link to post
Share on other sites
8 minutes ago, szabesz said:

Any chance of hints or links pointing to somewhere where superusers can get more info on how to adjust those permissions listed?

Are you talking about a link to the docs or about shortcut links to the settings page of the template where the admin can adjust those permissions? The latter would be great! Maybe there could also be a section where it shows which template setting is responsible, eg:

path             | template     | active
-----------------|--------------|--------------------------------
/                | home         | yes
/foo             | basic-page   | yes
/foo/bar         | whatsoever   | no (inherited from basic-page)

The template strings could be linked to the access tab of the template settings.

Not sure how complicated that would be to implement, but I think it could be helpful 🙂 

+1 for some more thoughts on the colors! I think the red is too loud. It's not a warning imho - it's just telling there is no permission. I think the red could be removed completely. I'm fine with the green - although I think it could also be more quiet...

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, bernhard said:

or about shortcut links to the settings page of the template where the admin can adjust those permissions? The latter would be great! Maybe there could also be a section where it shows which template setting is responsible, eg:

I dared not write these down 😉

Share this post


Link to post
Share on other sites

Hi everyone,

Thanks for all the good thoughts and ideas!

10 hours ago, kongondo said:

For a task like this (wanting to check the a client's access RE a specific page), I'm thinking it would be more useful to actually see the permissions of that client in respect of the said page, rather than scrolling through a potentially long list of all roles (e.g. a large site). The difficulty I see is, obviously, the said client is not logged in when the admin is checking out the status ;-), so this may be wishful thinking. Just wondering...

There is of course the User Switcher panel which I use the all the time to check issues a client is having - that's the best way to see the site the way they are seeing it.

I have just added a new row at the top of the table that shows the permissions for the current user (in this case "ajones"), so this is either you, or if you are using the UserSwitcher panel then it will obviously be for that user. Does that help with what you are looking for?

image.png.fc58c48e826a46334ecc87e9c33829ac.png

 

10 hours ago, kongondo said:

Could the colours please, somewhere, match the current colour scheme of the other panels?

It is using the same colors as the other panels. The colors are all now defined as constants. in the main TracyDebugger class. I know it's a bit loud here, but the idea is for form over function in identifying which roles don't have a certain permission. That said, I'd also be ok with this if you guys prefer:

 image.png.472dea523fdfa82e7c9263932cc13e0e.png

 

8 hours ago, gmclelland said:

You might want to flip the table rows/columns?  roles listed horizontally, permissions listed vertically.  I was thinking that there will probably always be more permissions than roles.  I would rather scroll vertically than horizontally.

The key thing I think is that I know how many permissions there are and they easily fit on the width of the screen. I don't know how many roles there will be. Does anyone else have any thoughts on this?

 

6 hours ago, gmclelland said:

Would it be possible on the Dumps and Dumps Recorder panels to auto expand the dump if there is only 1 dump? 

Not sure if I can because the script that handles the dump doesn't actually know how many dumps are coming, but maybe it can be done with JS after the fact - I'll take a look.

 

2 hours ago, bernhard said:

Are you talking about a link to the docs or about shortcut links to the settings page of the template where the admin can adjust those permissions? The latter would be great! Maybe there could also be a section where it shows which template setting is responsible, eg:


path             | template     | active
-----------------|--------------|--------------------------------
/                | home         | yes
/foo             | basic-page   | yes
/foo/bar         | whatsoever   | no (inherited from basic-page)

The template strings could be linked to the access tab of the template settings.

I'll need to think about this some more - I feel like we are starting to get into the territory of this module: http://modules.processwire.com/modules/process-access-overview/ which is not really the goal here, or at least it wasn't. I'll let you guys chime back in on what you think would actually be most useful.

Thanks again for all the feedback - greatly appreciated!

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, adrian said:

There is of course the User Switcher panel which I use the all the time to check issues a client is having - that's the best way to see the site the way they are seeing it.

Of course! 😀. Shows you how precious little I know! The best I've been doing until recently is bd($foo, 'bar');! This week I started using the console, like seriously use it, yay! I've been blown away! Even a multi-line cursor! And bd() in the console! I was gonna ask @bernhard to recommend what else I should play with. I've been missing a lot!

7 minutes ago, adrian said:

The key thing I think is that I know how many permissions there are and they easily fit on the width of the screen.

So no custom permissions then?

8 minutes ago, adrian said:

That said, I'd also be ok with this if you guys prefer:

Looks better, thanks.

  • Like 2

Share this post


Link to post
Share on other sites
5 minutes ago, kongondo said:

This week I started using the console, like seriously use it, yay! I've been blown away!

Nice 🙂

 

1 minute ago, kongondo said:

And bd() in the console!

Typically in the Console, you are better off using d() which dumps to the results panel below.

 

2 minutes ago, kongondo said:

So no custom permissions then?

This isn't about permissions in the sense you are talking about. It's just for these page permissions:

https://github.com/processwire/processwire/blob/341342dc5b1c58012ae7cb26cffe2c57cd915552/wire/core/Page.php#L88-L107

Maybe it needs to be reimagined, but that was my initial goal for this. What does everyone think?

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Repeater Images
      Adds options to modify Repeater fields to make them convenient for "page-per-image" usage. Using a page-per-image approach allows for additional fields to be associated with each image, to record things such as photographer, date, license, links, etc.
      When Repeater Images is enabled for a Repeater field the module changes the appearance of the Repeater inputfield to be similar (but not identical) to an Images field. The collapsed view shows a thumbnail for each Repeater item, and items can be expanded for field editing.
      Screencast

      Installation
      Install the Repeater Images module.
      Setup
      Create an image field to use in the Repeater field. Recommended settings for the image field are "Maximum files allowed" set to 1 and "Formatted value" set to "Single item (null if empty)". Create a Repeater field. Add the image field to the Repeater. If you want additional fields in the Repeater create and add these also. Repeater Images configuration
      Tick the "Activate Repeater Images for this Repeater field" checkbox. In the "Image field within Repeater" dropdown select the single image field. You must save the Repeater field settings to see any newly added Image fields in the dropdown. Adjust the image thumbnail height if you want (unlike the core Images field there is no slider to change thumbnail height within Page Edit). Note: the depth option for Repeater fields is not compatible with the Repeater Images module.
      Image uploads feature
      There is a checkbox to activate image uploads. This feature allows users to quickly and easily add images to the Repeater Images field by uploading them to an adjacent "upload" field.
      To use this feature you must add the image field selected in the Repeater Images config to the template of the page containing the Repeater Images field - immediately above or below the Repeater Images field would be a good position.
      It's recommended to set the label for this field in template context to "Upload images" or similar, and set the visibility of the field to "Closed" so that it takes up less room when it's not being used. Note that when you drag images to a closed Images field it will automatically open. You don't need to worry about the "Maximum files allowed" setting because the Repeater Images module overrides this for the upload field.
      New Repeater items will be created from the images uploaded to the upload field when the page is saved. The user can add descriptions and tags to the images while they are still in the upload field and these will be retained in the Repeater items. Images are automatically deleted from the upload field when the page is saved.
      Tips
      The "Use accordion mode?" option in the Repeater field settings is useful for keeping the inputfield compact, with only one image item open for editing at a time. The "Repeater item labels" setting determines what is shown in the thumbnail overlay on hover. Example for an image field named "image": {image.basename} ({image.width}x{image.height})  
      https://github.com/Toutouwai/RepeaterImages
      https://modules.processwire.com/modules/repeater-images/
    • By EyeDentify
      Hello There Guys.

      I am in the process of getting into making my first modules for PW and i had a question for you PHP and PW gurus in here.

      I was wondering how i could use an external library, lets say TwitterOAuth in my PW module.
      Link to library
      https://twitteroauth.com/

      Would the code below be correct or how would i go about this:
      <?PHP namespace ProcessWire; /* load the TwitterOAuth library from my Module folder */ require "twitteroauth/autoload.php"; use Abraham\TwitterOAuth\TwitterOAuth; class EyeTwitter extends WireData,TwitterOAuth implements Module { /* vars */ protected $twConnection; /* extend parent TwitterOAuth contructor $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret); */ public function myTwitterConnection ($consumer_key, $consumer_secret, $access_token, $access_token_secret) { /* save the connection for use later */ $this->twConnection = TwitterOAuth::__construct($consumer_key, $consumer_secret, $access_token, $access_token_secret); } } ?> Am i on the right trail here or i am barking up the wrong tree?
      I don´t need a complete solution, i just wonder if i am including the external library the right way.
      If not, then give me a few hint´s and i will figure it out.

      Thanks a bunch.

      /EyeDentify
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "http://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


    • By kongondo
      FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup
       
      Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/
      GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup
      As of 11 May 2019 ProcessWire versions earlier than 3.x are not supported
      This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin).
       
      The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen.
       
      The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages.
       
      The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan!
       
      Warning/Consideration
      Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API
       
      Backend
      Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer.
       
      FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. 
       
      A very simple example.
      return 'Hello'; Simple example.
      return $page->title; Simple example with markup.
      return '<h2>' . $page->title . '</h2>'; Another simple example with markup.
      $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example.
      $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example.
      $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do:
      return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows:
      return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup')
       
      Access the field on the current page (just like any other field)
      echo $page->runtime_markup; Access the field on another page
      echo $pages->get('/about-us/')->runtime_markup; Screenshots
       
      Backend
       

       

       
      Frontend
       

×
×
  • Create New...