-
Posts
394 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Gadgetto
-
@flydev Thanks a lot for your code! I implemented your switcher CSS and tried to add transition to get a smooth state change. Looks great and and fits seamlessly into the UI. The checkbox label is also positioned correctly. The transition I added doesn't work as smooth as expected. It's a bit clumsy... It would also be nice if the toggle switch would be based on rem/em - not px. Size scaling would be much easier. Here is the updated pen with the actual HTML: https://codepen.io/gadgetto/pen/omRwXW
-
Hi, for my GroupMailer module I've created a custom Fieldtype + Inputfield module which provides multi-column field values. The first field column is a visible text field and there are some other columns which are not presented to user (they are rendered as hidden form fields). This is the database schema: $schema['data'] = 'text NOT NULL'; // we're using 'data' to represent our 'subject' field $schema['sendstatus'] = 'tinyint NOT NULL DEFAULT 0'; // message send status $schema['recipients'] = "int(10) unsigned NOT NULL DEFAULT 0"; // recipients counter $schema['sent'] = "int(10) unsigned NOT NULL DEFAULT 0"; // sent counter $schema['started'] = "int(10) unsigned NOT NULL DEFAULT 0"; // message sending start $schema['finished'] = "int(10) unsigned NOT NULL DEFAULT 0"; // message sending finished This are the ___wakeupValue and ___sleepValue methods: Now I try to extend this Fieldtype/Inputfield to provide multi language features. Only the first value ("data" which represents the "subject" field) should be/needs to be multi language! I had a look at the built in Fieldtypes (e.g FieldtypeText & FieldtypeTextLanguage) which provides multi language support but I couldn't find a similar case (multi-value field with language support). All built in Fieldtypes are single-value fields. I know this is a very "general" question but maybe somebody could push me in the right direction?
- 21 replies
-
- groupmailer
- fieldtype
-
(and 1 more)
Tagged with:
-
@bernhard I've already solved this by using an InputfieldCheckbox masked by CSS to get a toggle switch. The checkbox state is submitted by JavaScript and saved to module config. GroupMailer will have an asynchron process (which can start n parallel processes) running in background which handles the mail sending. If the toggle switch is turned off, all sending processes will immediately stop. This is in case of an emergency if something goes wrong sending out mails ... ?
-
@flydev Thanks for your hint, but I'm using @Chris Bennett's CSS only solution for now. Needs a bit of testing across different browsers but looks good so far! Only problem is, that it currently only works in UIKit admin theme. Needs a bit of rewrite for cross theme compatibility. I don't want to add a jQuery plugin only for changing checkboxes.
-
I'm looking for an ON/OFF Inputfield for my GroupMailer module I'm currently writing. (Preferably based on a core field, not 3rd party) I'd like to implement a quick ON/OFF switch to quickly enable/disable all sending process (an emergency stop!). The field should submit it's value immediately after state changes. Maybe a checkbox toggle or a kind of button which is able to change it's state. Found this forum thread for changing a checkbox field to toggle style with CSS - but it's only for UIKit admin theme: What would you recommend? Greetings, Martin
-
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Here is another progress report for development (early state) of my GroupMailer module: The dashboard and the message lister are nearly finished. Behind the scenes I created a custom field which holds all MessageMeta data. This special field can be attached to each template you like and will immediately make all corresponding pages a GroupMailer message. This allows to maintain the extreme flexibility of ProcessWire. More to come ... -
Which color themes are you using? I'm still looking for the perfect theme for VSCode. This was the theme I used in my previous editor (Coda2 from Panic.inc) - it's called "Panic Palette". Not perfect but it has vivid colors and high contrast. Until now I couldn't find a theme that matches my needs. The default VSCode theme is a bit too dim.
- 242 replies
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Sorry guys, problem fixed and my understanding of WireData set() and get() methods is kinda stable now! ? Setting the module property values from outside the module did in fact work as expected from the beginning (the correct values are represented in module data array). I simply updated the properties in the wrong place (after the Ajax part). To leave a reference for others I have to add/correct a few things I was told here (without stepping on anyone's toes): I'm not sure that this is correct (at least it doesn't matter). I simply can update properties from outside a module without extending the module class. I only need to instantiate the module. $mymodule = $this->wire('modules')->get('MyModule'); $mymodule->foo = 'bar'; // This correctly updates the property "foo" in MyModule! // Looking at the WireData class $mymodule->foo = 'bar'; // gets internally translated to $this->set('foo', 'bar'); So, If you like to have modules with simple configurable properties it seems to be the best to use the set() and get() methods of WireData instead of creating your own getter and setter methods. Please correct me if I'm wrong. And thanks all for your help!
-
Thanks, fixed! I wrote the code quickly from memory... But this is not related to my question/problem. I'd like to learn what set() exactly does in a module. And how to change a module property from outside the module. I'm probably looking in the wrong places, but I couldn't find detailed information what module properties are and how to handle them. I had a look at various other modules, but most of them are using their different ways. Especially the difference between: protected $foo = 'bar'; // defined a class property directly in class header and $this-set('foo', 'bar'); // In class constructor is not clear (for me).
-
This is the set() method of ProcessPageLister.module class - basically nothing special public function set($key, $value) { if($key == 'openPageIDs' && is_array($value)) { $this->openPageIDs = $value; return $this; } else if($key == 'parent' && !$value instanceof Page) { $value = $this->wire('pages')->get($value); } else if($key === 'finalSelector') { $this->finalSelector = $value; } return parent::set($key, $value); } public function get($key) { if($key === 'finalSelector') return $this->finalSelector; return parent::get($key); } The parent class "Process" has only a get() method: public function get($key) { if(($value = $this->wire($key)) !== null) return $value; return parent::get($key); } The parent class of Process is "WireData" - this is the set() method of "WireData": /** * Set a value to this object’s data * * ~~~~~ * // Set a value for a property * $item->set('foo', 'bar'); * * // Set a property value directly * $item->foo = 'bar'; * * // Set a property using array access * $item['foo'] = 'bar'; * ~~~~~ * * #pw-group-manipulation * * @param string $key Name of property you want to set * @param mixed $value Value of property * @return $this * @see WireData::setQuietly(), WireData::get() * */ public function set($key, $value) { if($key === 'data') { if(!is_array($value)) $value = (array) $value; return $this->setArray($value); } $v = isset($this->data[$key]) ? $this->data[$key] : null; if(!$this->isEqual($key, $v, $value)) $this->trackChange($key, $v, $value); $this->data[$key] = $value; return $this; } /** * Provides direct reference access to set values in the $data array * * @param string $key * @param mixed $value * return $this * */ public function __set($key, $value) { $this->set($key, $value); }
-
I built my samples exact the same way as in the following core module (ProcessPageSearch): ProcessPageSearch instantiates ProcessPageLister and sets some properties for PageLister the same way I did above. What is the difference? https://github.com/processwire/processwire/blob/649d2569abc10bac43e98ca98db474dd3d6603ca/wire/modules/Process/ProcessPageSearch/ProcessPageSearch.module#L210
-
Hello there, I'm currently confused about what exactly module properties are and how to change them from outside of the module. If I understand right I can set a new module property with the set() method. The property then internally lands in the "data" array of the module object. If you have a look at the simple module below I set two properties in class constructor. In the init() method I do something with the two properties and the execute method returns the result. This works as expected. If I now try to change the properties from outside of MyModule the changes aren't reflected when the execute method is called (please see other source below). <?php namespace ProcessWire; class MyModule extends Process { public static function getModuleInfo() { return array( 'title' => "My Module", 'version' => 1, ); } protected $fullName = ''; public function __construct() { $this->set('firstName', 'Han'); $this->set('lastName', 'Solo'); } public function init() { $this->fullName = $this->firstName . ' ' . $this->lastName; } public function ___execute() { return $this->fullName; } } class MyOtherModule extends Process { public static function getModuleInfo() { return array( 'title' => "My Other Module", 'version' => 1, ); } public function ___execute() { $modules = $this->wire('modules'); // Load MyModule module if ($modules->isInstalled('MyModule')) { $mymodule = $this->wire('modules')->get('MyModule'); } else { $this->error($this->_('MyModule module is not installed!')); } if (!$mymodule) return ''; // Change properties in MyModule (is this OK here?) $mymodule->firstName = 'Luke'; $mymodule->lastName = 'Skywalker'; return $mymodule->execute(); } } What is the problem here? Could it be I completely misunderstand how module properties are handled?
-
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
That's my plan. Do you know good modules for subscription management? It will take some time, but I will publish GroupMailer on GitHub. Active participation will then be possible. -
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
The page in the screenshot shows the GroupMailer dashboard (the main page of the module). This will be a live-view of all your newsletters/messages/mailings, where you can watch your mailings flying out. The subscribers overview will be another page! Yes, GroupMailer will be able to create full Emails including Subject and Body. How this will be achieved is another thing ... Simply using the CKEditor won't produce nice formatted mails which renders similar in all clients. I'm thinking of a kind of template system whose areas represent content blocks. These content blocks can then be filled by any fields you like. How exactly this will be implemented I still have to think about. Inline-styling will be built in (also had this in my GoodNews extra for MODX). Yep! This will be a sub-module. I know there are already some other modules available that use subscription models. But I want to avoid dependencies on other modules, because some/many of them are badly maintained or abandoned. You won't be bound to the pre-installed template. Using your own templates you will need to add a special GroupMailer field (pre-installed) which will hold the Message meta-data needed by the engine. In general I'd like to keep the development in such a way that I will release an executable version very early and take into account opinions as well as tips and suggestions from experienced developers like you. Fact is, I still have a long way to go. In particular, the incredible flexibility of ProcessWire requires a major rethink and increases the development effort to keep the flexibility. -
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Here is another status report for development (early state) of my GroupMailer module: I've setup the dashboard to list all GroupMailer messages found in pages tree. The question is how messages (pages) should be managed in general. I plan to make the whole thing as flexible as possible. You can create messages wherever you want, in the root - directly under "Home" or within a container page. In the upper area of the dashboard you can select the desired container and all messages of this container will be listed. Messages are identified by the template "groupmailer-message". A field containing meta data for the message (dispatch status, number of recipients, number of mails sent, etc.) is attached to this template. The Messages grid will show these values. The Messages grid itself is a rewrite of the ProcessPageLister module matching the requirements of GroupMailer. It will provide all features of the original PageLister module + specific GroupMailer functions. It will be a live view of the current state of all Newsletters (Messages). That means you can watch how mails are sent out and immediately stop/restart etc. the sending process. Here is a screenshot of the current state: (The columns are not the final ones and will be adjusted according to my needs.) What do you think? Am I on the right way or do you have any hints? -
I found a small problem with the search field on new PW Website: OS: MacOS Mojave Browser: Safari (latest version) & Chrome (latest version) Steps to reproduce: go to Docs click on Search icon enter search text The results popup is placed half outside the right browser window. I can't reproduce this every time. just open close the search field and delete/re-enter search-string...
-
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Sure, I'll setup on WireMail class so we can use all available extensions and services. And it can be "easily" extended. -
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
Our multi-processing engine runs server side. I don't see any advantages for running this client side. I'd like to start sending and then close browser. -
Progress report for development of my GroupMailer module
Gadgetto replied to Gadgetto's topic in Module/Plugin Development
I'll support both methods (probably "sending via server" in the first place).