Jump to content

dotnetic

Members
  • Posts

    1,038
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by dotnetic

  1. First of all: Great additions and exactly what I just need for a project. But somehow the new custom fields for images and files do not seem to work correctly. I integrated them into an existing PW project and the fields appear for the superuser, and also for other roles... But: the other roles don't see the text that the superuser entered. Then I tried saving a value to a custom field with another user, and the value isn't saved. So I thought, because I have a complicated setup with many hooks and restrictions that hook into ProcessPage::buildForm I try out the new feature on a completely fresh PW installation. But in the new installation the custom fields don't even appear. Am I doing something wrong? Is this a bug? Here is a little screencast of my existing project (with audio) And here is a fresh PW install, where it do the setup process of the custom field, and then it does not show up (without audio):
  2. Try setting it to off "$config->sessionFingerprint = 0;" and see if you experience any differences
  3. What did you write into your site/config.php?
  4. Yes. If you look into the file https://github.com/aik099/PhpStormProtocol/blob/master/PhpStorm Protocol (Win)/run_editor.js there are two variables you have to change and if you are using Jetbrain Toolbox to install and update your IDE, then even the paths in https://github.com/aik099/PhpStormProtocol/blob/master/PhpStorm Protocol (Win)/run_editor.js#L22 are completely different.
  5. It is up to you Adrian, but my solution is a native one and the other one is a hacky solution which also requires modifiying the .js file.
  6. Yeah thought often about it, but PHPStorm offers me features that VScode does not have (yet) or are not that comfortable and that are important for me. And I don't switch my editor/IDE just because of this small issue.
  7. Hello folks, I want to save the information which user uploaded a file and also a date in the PW admin. I thought I could use the description field for this information, but how do I set it via a hook and how do I prevent users from editing the description? I tried the following hook which does not set the content of the description field (seems to be not a property of the InputfieldFile, but an individual field). /** * if this is a fachbereich or abteilung add a hook to prevent file deletion * @param HookEvent $event */ public function hookPageFile(HookEvent $event) { // if ($this->user->isSuperuser() || $this->user->hasRole('restricted-admin')) { // return; // } $page = $event->object->getPage(); // Only use on pages with the raum template if (($page->template == 'fachbereich' || $page->template == 'abteilung') && !$page->isTrash()) { $this->addHookAfter('InputfieldFile::processInputFile', function(HookEvent $event) { // Get the object the event occurred on, if needed $InputfieldFile = $event->object; $InputfieldFile->description="no description"; bd($InputfieldFile, "processInputFile"); }); $this->addHookBefore('InputfieldFile::processInputDeleteFile', $this, 'preventFileDelete'); } } The hook should also be only executed on pages with a specific template, so that's why I use $this->addHookBefore('ProcessPageEdit::buildForm', $this, 'hookPageFile'); Is this even possible, or should I take a completely different route? Maybe save the inputfield_id, filename and created_user in a separate database table? But this would complicate things, because on the output side I have to query the custom database instead of using just the description field. Maybe I can use the just added custom fields for files/imags in ProcessWire 3.0.142 for this? But how do I set the values in the admin for them and prevent changing them by the user? Think I have to test this out. EDIT: Found a solution with the help of the nice guys in this forum. You can find it here: https://processwire.com/talk/topic/22411-how-to-add-user-and-date-to-an-uploaded-file-help-urgently-needed/?do=findComment&comment=192363
  8. @bernhard The first solutions you provided does the same as Nette's script.
  9. I also tried Nette's solution and it does work on Windows 10 (but with different paths, as I am Using Jetbrains Toolbox to install PHPStorm), there is an alert before opening the file. After clicking ok, its working fine, but I have to focus PHPStorm manually, as the title of the window is always different, depending on which file you have opened.
  10. @adrian The solution you linked to could work (not tested), I found a similar script that I tried, that didn't work. But the script utilizes the Windows Scripting host and requires you to put the path in the .js file, which is a detour. My solution provides a native way. Not saying, that this is the correct way, but one more way. You could add the syntax with a comment "For Windows and PHPStorm use the following syntax" to Tracy's settings. I think, this could help some people.
  11. Update August 2022: There finally now is a native way of opening the correct file, if tracy throws an error. You have to use Jetbrains Toolbox for this to work. Go to tracy's 'Editor links' setting and in the input write this, and replace projectname with the PHPStorms project name: jetbrains://php-storm/navigate/reference?project={projectname}&path=%file:%line Also if you are using a folder structure, where the PW installation lies not in the root, then you want to modify the "Local root path" setting in Tracy. Here is an example of my settings: Original post from 2019 Tracy Debugger offers an Editor protocol handler link so you can jump directly to a file from a Tracy Debugger dump message. Unfortunately this does not work on Windows, as the URI protocol handler isn't implemented in the Windows version (see link). However, all IDEA products (IntelliJ, PHPStorm, etc.) provide a REST API from which you can open files. The syntax is http://localhost:63342/api/file//absolute/path/to/file.kt for absolute pathnames (please note the double backslash behind "file") and http://localhost:63342/api/file/relative/to/module/root/path/to/file.kt for relative filenames. To use this, you have to set up Tracy with the following parameter: http://localhost:63342/api/file/%file:%line:0 If you click on a link now in Tracy, PHPStorm will focus and ask for permission to open the file. ATTENTION: PHPStorm has to be opened and also your project has to be opened (so PHPStorm knows the root for relative path). This is a little bit cumbersome, but better than nothing. Ping @adrian to bring this to your attention.
  12. How can I set the access toggles for a field I create via API? $f = new Field(); // create new field object $f->type = $this->modules->get("FieldtypeFloat"); // get a field type $f->name = 'price'; $f->precision = 2; $f->label = 'Price of the product'; Maybe @ryan can help?
  13. Hey folks, @kongondo asked me some questions about how I integrated vue.js into ModulesManager2. I was already planning to release a tutorial video of the integration process soon, but I don't have much time now as I am busy with customer work. So here is a quick roundup, which will be improved over time and become a full-blown tutorial. I hope to cover the basics and don't forget anything. How did you implement the integration? I created a new vue project via vue create . inside my site/modules/mymodule folder Do your assets still live under the Vue JS public folder? I don't exactly know what you mean with assets. Are you speaking of images? I don't use images atm. Where do your view files live, i.e. under your modules directory or in templates? As I mentioned in point one, they are in the modules directory. Here is a screenshot of my directory: As soon as I release the beta of ModulesManager2 you can go through the source code in github. Where is your index.xxx file and how are you serving it? vue-cli comes with a built in server and the index.html is automatically generated on-the-fly. The command for running the server with HMR (hot media reload) resides in the package.json and is run via npm run serve This is the standalone server. Anything else I should know (maybe .htaccess issues, etc)? Create a vue.config.js in your custom module's root directory and add following parameters to it, to disable filename hashing: const webpack = require("webpack"); module.exports = { runtimeCompiler: false, filenameHashing: false, pages: { main: { // entry for the page entry: 'src/main.js', // the source template template: 'public/index.html', // output as dist/index.html filename: 'index.html', // when using title option, // template title tag needs to be <title><%= htmlWebpackPlugin.options.title %></title> title: 'Index Page', } }, configureWebpack: { plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery', }) ] } }; Edit: After creating the config run npm run build Then you can reference these files in your module like I did here: $markup = '<div id="app"></div>'; $scriptPath = $this->config->urls->siteModules . $this->className; $markup .= "<script src='$scriptPath/dist/js/chunk-vendors.js'></script>"; $markup .= "<script src='$scriptPath/dist/js/main.js'></script>"; I added the configureWebpack part to have access to the $ and jQuery objects inside of my vue files. The install/uninstall overlay panel in MM2, is that something custom or a ProcessWire panel? Standard ProcessWire panels If it is a ProcessWire panel, did you have any difficulties implementing it into your Vue app? ProcessWire's panel init happens before vue is initiated or rendered, so pw-panel links inside of vue are not catched. To make pw-panel links inside of vue work, you have to defer (don't know if this is the correct term) the process to a body click event: $(document).on("click", "#app .pw-panel", function (e, el) { e.preventDefault(); let toggler = $(this); pwPanels.addPanel(toggler); toggler.click(); }); I hope this helps. If you have questions, please ask.
  14. Thanks for the feedback so far and even mentioning me in the pw.weekly issue ? In the standard ProcessModules section is also an input for entering the name of the module, which would download this module from the modules.processwire.com directory. ModulesManager2 simplifies and optimizes this process by providing the modules names in an autocomplete. I know that the modules directory is just ONE source, but that's how the standard in PW always was and I think we should have an official repository for modules. Think of it like the npm registry which is the main source for npm packages. Maybe in the future we could also add alternative module registries like in npm or other package managers, but I really don't know if this is needed. Options to upload a module zip file or provide a download URL like in the original ProcessModules will also be added soon. Partly I agree with you, but every user is different and if you only want to update one module you can search for its name and click the update button. I've been planning from the beginning, to also offer a table based view, or a view with reduced information to quickly scan the modules. As you can see in the latest update there is an example table layout (not even nearly finished) to showcase what is planned later. Also we have buttons for filtering the cards or table view to show only modules which can be updated. I personally think that I would even use the card view for updating my modules, but that's just me. That's your opinion, but others (including me) may see this differently. In the latest update the chosen layout mode is remembered so you don't have to switch. I am even thinking about providing a button to switch between compact and detailed information which would be available for the table and the card view. This would allow someone regardless of the layout to view all information or only the most important bits. This is very easy to accomplish with vue. Maybe I hack something together, because I really like the idea. I have to disagree on this point with you. I think the "discovery" process is good for all users, even powerusers like us. Sometimes I just don't remember a module's name but with MM2 allows me, to search for a term, which might be in the description and I find my module. That's just one example. Another one is that users might not even be aware what great extensions exist and with the modules directory integration they can get an overview. This is something that other CMS or ecommerce systems (like PrestaShop or Shopware) have integrated by default (not at least to earn money, but that's a different topic). But however, if someone does not like the card view or detailed information, he can switch and forget about it. One doesn't need to use all the features. I hope my reaction will not be seen as an offensive, because that is not my intention. Unfortunately, it can often seem that way when written. And of course it is also the case that one can have different opinions on a topic. Whereby anybody can be right. So you guys see, a lot of stuff is still planned, but before I integrate more and more stuff, I am working on the main features for the card view, then release the module and you guys can try it out, provide feedback or pull requests to make it even better.
  15. Here is a little update. Not much to see on the frontend side, but I added a whole build setup which generates the JavaScripts and stylesheets from a .vue file. These files will later be embedded into the module. This step allows me to develop quicker with hot media reloading and better debugging possibilities for vue. I don't even need a ProcessWire environment to make updates to the view, so this enables others to quickly jump in on this and help me with development. Added functions that remember the category or the module name. So you can even provide links for users, to guide them to a special module or category like so: http://localhost:8080/processwire/module/edit/?module=process404-logger Added a switch to switch between card and table layout. This is even remembered and restored after you close your tab or browser. The table layout is something that I plan to integrate at a later point when the main functions work correctly. As I am very busy right now with customer requests I don't have an official date for releasing the module yet. I hope that I can work on the weekend on it.
  16. @bernhard Do you sleep sometimes?
  17. @louisstephens I had this discussion in the inital topic "Revamped module install interface" and @kongondo replied but I am still not convinced and think active and inactive would be better labels. What do you other guys think?
  18. Did you fix it? I am getting a success message: First you should install TracyDebugger. If you are logged in as a superuser, it will provide a nice debug bar, which catches and reports errors. Secondly you can look at Setup > Logs. There you have an error and an exceptions log.
  19. @Peter Knight The filters for installed uninstalled could be also seen as a category and I think I will integrate them into the category select. "Show only uninstalled" are modules that are already downloaded but not yet installed. I am not even sure if this option makes any sense. Picked, is not an option. It was just a demo, which of the filter I selected.
  20. Possible concern about including the module in the core: The module depends on vue.js which adds a new library to the ProcessWire ecosystem. I am biased about using vue.js as it allows two-way-data-binding. So when something changes in the module JSON file, changes can be reflected instantly without reloading or rerendering the whole view. It also allows to quickly filter modules, much quicker than it was possible with HTML which is in the DOM.
  21. Hey Peter, feedback can be provided here, so everyone is on the same page and can discuss together. I am sure you guys will find some more things to talk about, as soon as I publish the module. There is a thing that I am not really happy with, but have to find a better solution: The vue template is embedded right in the module's php, and I would like to change that, so an external automatically genererated (vue-cli) HTML file will be included. Maybe some of you are experienced with this and can help me out. I hope to find time at the weekend to publish the current state of the module.
  22. Because Soma's module is called ModulesManager. This module is meant as a successor to ModulesManager. Regarding question two: Yes this is possible. The option to download a module from a URL will be added also.
×
×
  • Create New...