You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/10/21 20:34:09 UTC

[GitHub] [netbeans-tools] matthiasblaesing opened a new pull request, #53: Add E-Mail sending option for Pluginportal Admins

matthiasblaesing opened a new pull request, #53:
URL: https://github.com/apache/netbeans-tools/pull/53

   The function looks like this:
   
   ![image](https://user-images.githubusercontent.com/2179736/197283923-520599e1-fe9f-40f0-b0cd-e489f67a74d6.png)
   
   The intention is, that he portal admins have an option to contact plugin authors and for example inform about new versions of NetBeans available for verification.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] matthiasblaesing merged pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
matthiasblaesing merged PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] jkovalsky commented on a diff in pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
jkovalsky commented on code in PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53#discussion_r1004735333


##########
pp3/module/Application/view/application/admin/email-sending.phtml:
##########
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+?>
+<?= $this->partial('_nav.phtml'); ?>
+<h4>E-mail sending</h4>
+<p>
+<?= $this->partial('layout/flash.phtml'); ?>
+</p>
+<?php if($this->successMessage) { ?>
+<div class="panel panel-success">
+  <div class="panel-heading">Worked!</div>
+  <div class="panel-body">
+    <?php echo $this->successMessage ?>
+  </div>
+</div>
+<?php } ?>
+<form class="" method="post" action="">
+  <div class="panel panel-default">
+    <div class="panel-heading">Limit NetBeans versions:</div>
+    <div class="panel-body">
+      <p><input type="checkbox" name="onlyVerified" id="onlyVerified" style="margin-right: 1ex" <?php if($this->onlyVerified) {echo 'checked="checked"';} ?>/><label for="onlyVerified">Only consider verified entries</label></p>

Review Comment:
   Should not this input field rather be of "radio" instead of "checkbox" type? Logically thinking you can either check this option or the versions listed below this field, cannot you?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] jkovalsky commented on a diff in pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
jkovalsky commented on code in PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53#discussion_r1009860260


##########
pp3/module/Application/view/application/admin/email-sending.phtml:
##########
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+?>
+<?= $this->partial('_nav.phtml'); ?>
+<h4>E-mail sending</h4>
+<p>
+<?= $this->partial('layout/flash.phtml'); ?>
+</p>
+<?php if($this->successMessage) { ?>
+<div class="panel panel-success">
+  <div class="panel-heading">Worked!</div>
+  <div class="panel-body">
+    <?php echo $this->successMessage ?>
+  </div>
+</div>
+<?php } ?>
+<form class="" method="post" action="">
+  <div class="panel panel-default">
+    <div class="panel-heading">Limit NetBeans versions:</div>
+    <div class="panel-body">
+      <p><input type="checkbox" name="onlyVerified" id="onlyVerified" style="margin-right: 1ex" <?php if($this->onlyVerified) {echo 'checked="checked"';} ?>/><label for="onlyVerified">Only consider verified entries</label></p>

Review Comment:
   Yes, makes sense now. Sorry, I probably didn't have enough coffee back then.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] matthiasblaesing commented on pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53#issuecomment-1298102858

   Thanks for the review - I merged the update and put it into production.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] jkovalsky commented on a diff in pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
jkovalsky commented on code in PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53#discussion_r1004729207


##########
pp3/module/Application/src/Application/Controller/AdminController.php:
##########
@@ -326,6 +343,124 @@ public function nbVersionsAction() {
         ]);
     }
 
+    public function emailSendingAction() {
+        $this->_checkAdminUser();
+        $req = $this->request;
+        $successMessage = false;
+
+        $onlyVerified = false;
+        $nbVersionId = [];
+        $subject = '[NetBeans PluginPortal] <SUBJECT>';
+        $emailText = '
+<html>
+<head><title></title></head>
+<body>
+<p>Dear %1$s,</p>
+
+<p>we have some news for you.</p>
+
+<p>&lt;Your message&gt;</p>
+
+<p>
+Your plugins:<br />
+%3$s
+</p>
+
+<p>Direct link to the plugin portal:<br />
+<a href="%2$s">%2$s</a>
+</p>
+
+<p>
+Best wishes<br />
+NetBeans development team
+</p>
+
+<p>P.S.: Please contact dev@netbeans.apache.org for questions.</p>
+</body>
+</html>';
+
+        if ($req->isPost() && ($this->params()->fromPost('sendEmail') || $this->params()->fromPost('sendPreview'))) {
+            $successMessage = '';
+            $onlyVerified = $this->params()->fromPost('onlyVerified');
+            $nbVersionId = $this->params()->fromPost('nbVersionId');
+            $subject = $this->params()->fromPost('subject');
+            $emailText = $this->params()->fromPost('emailText');
+
+            $users = [];
+
+            $plugins = $this->_pluginRepository
+                    ->getPluginsByNetBeansVersion($nbVersionId, $onlyVerified);
+
+            foreach ($plugins as $plugin) {
+                foreach ($plugin->getAuthors() as $author) {
+                    $email = $author->getEmail();
+                    if (!array_key_exists($email, $users)) {
+                        $users[$email] = [
+                            'email' => $email,
+                            'name' => $author->getName(),
+                            'plugins' => []
+                        ];
+                    }
+                    if (!in_array($plugin->getName(), $users[$email]['plugins'])) {
+                        $users[$email]['plugins'][] = $plugin->getName();
+                    }
+                }
+            }
+
+            $successMessage .= sprintf("Generating E-Mails for %d plugins and %d users<br>\n",
+                    count($plugins),
+                    count($users));
+
+            if ($this->params()->fromPost('sendPreview')) {
+                $successMessage .= "Only sending preview email!<br>\n";
+
+                /**
+                 * @var \Application\Entity\User
+                 */
+                $user = $this->_userRepository->find($this->getAuthenticatedUserId());
+                $users = [$user->getEmail() => [
+                    'email' => $user->getEmail(),
+                    'name' => $user->getName(),
+                    'plugins' => ['Demo plugin 1', 'Demo plugin 2']
+                ]];
+            }
+
+            $transport = new Mail\Transport\Sendmail();
+
+            $emailCount = 0;
+            foreach (array_values(($users)) as $entry) {
+                $emailCount++;
+                $list = "<ul>";
+                foreach($entry['plugins'] as $pluginName) {
+                    $list .= sprintf("<li>%s</li>", htmlspecialchars($pluginName));
+                }
+                $list .= "</ul>";
+
+                $mail = new Mail\Message();
+                $mail->setFrom('noreply@netbeans.apache.org', 'NetBeans webmaster');
+                $mail->setSubject($subject);
+                $mail->getHeaders()->addHeader(ContentType::fromString('Content-Type: text/html; charset=utf-8'));
+                $mail->setBody(sprintf($emailText,
+                                htmlspecialchars($entry['name']),
+                                htmlspecialchars($this->getHomeUrl()),
+                                $list
+                ));
+                $mail->addTo($entry['email']);
+                $transport->send($mail);
+            }
+
+            $successMessage .= "E-Mails were successfully send: " . $emailCount;

Review Comment:
   Typo. Should read "_E-mails were successfully sent:_"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] matthiasblaesing commented on a diff in pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on code in PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53#discussion_r1004768872


##########
pp3/module/Application/view/application/admin/email-sending.phtml:
##########
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+?>
+<?= $this->partial('_nav.phtml'); ?>
+<h4>E-mail sending</h4>
+<p>
+<?= $this->partial('layout/flash.phtml'); ?>
+</p>
+<?php if($this->successMessage) { ?>
+<div class="panel panel-success">
+  <div class="panel-heading">Worked!</div>
+  <div class="panel-body">
+    <?php echo $this->successMessage ?>
+  </div>
+</div>
+<?php } ?>
+<form class="" method="post" action="">
+  <div class="panel panel-default">
+    <div class="panel-heading">Limit NetBeans versions:</div>
+    <div class="panel-body">
+      <p><input type="checkbox" name="onlyVerified" id="onlyVerified" style="margin-right: 1ex" <?php if($this->onlyVerified) {echo 'checked="checked"';} ?>/><label for="onlyVerified">Only consider verified entries</label></p>

Review Comment:
   Actually the idea is that they do combine. Consider my test portal. There are 3 plugins:
   
   - **netbeans-builder-module**: no NetBeans version associated
   - **Upload Files Button**: 11.2 and 11.3 (both verified)
   - **Mozilla Rhino**: 11.3 (verified), 11.2 (unverified)
   
   This results in this email behavior:
   
   ![image](https://user-images.githubusercontent.com/2179736/197842154-f9dacb04-06ca-4d41-a471-63673b289db2.png)
   
   No filter: 3 plugins and 2 users (you and me) would be selected. I generated a preview email, so only one email is actually sent.
   
   ![image](https://user-images.githubusercontent.com/2179736/197842439-3443aecc-5fb8-4751-bcff-13b62d0d664e.png)
   
   Only consider plugins associated with NetBeans 11.2 gets you 2 plugins and 2 users **netbeans-builder-module** is not selected anymore
   
   ![image](https://user-images.githubusercontent.com/2179736/197842669-94f4c9c3-b07b-4935-a289-04595b56641b.png)
   
   Only consider plugins associated with NetBeans 11.2 and where the association is verified. This gets you 1 plugin and 1 user. The **Upload Files Button** plugin is the only plugin matching that and I'm listed as the only author.
   
   
   Does that make sense to you?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans-tools] matthiasblaesing commented on a diff in pull request #53: Add E-Mail sending option for Pluginportal Admins

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on code in PR #53:
URL: https://github.com/apache/netbeans-tools/pull/53#discussion_r1004770741


##########
pp3/module/Application/src/Application/Controller/AdminController.php:
##########
@@ -326,6 +343,124 @@ public function nbVersionsAction() {
         ]);
     }
 
+    public function emailSendingAction() {
+        $this->_checkAdminUser();
+        $req = $this->request;
+        $successMessage = false;
+
+        $onlyVerified = false;
+        $nbVersionId = [];
+        $subject = '[NetBeans PluginPortal] <SUBJECT>';
+        $emailText = '
+<html>
+<head><title></title></head>
+<body>
+<p>Dear %1$s,</p>
+
+<p>we have some news for you.</p>
+
+<p>&lt;Your message&gt;</p>
+
+<p>
+Your plugins:<br />
+%3$s
+</p>
+
+<p>Direct link to the plugin portal:<br />
+<a href="%2$s">%2$s</a>
+</p>
+
+<p>
+Best wishes<br />
+NetBeans development team
+</p>
+
+<p>P.S.: Please contact dev@netbeans.apache.org for questions.</p>
+</body>
+</html>';
+
+        if ($req->isPost() && ($this->params()->fromPost('sendEmail') || $this->params()->fromPost('sendPreview'))) {
+            $successMessage = '';
+            $onlyVerified = $this->params()->fromPost('onlyVerified');
+            $nbVersionId = $this->params()->fromPost('nbVersionId');
+            $subject = $this->params()->fromPost('subject');
+            $emailText = $this->params()->fromPost('emailText');
+
+            $users = [];
+
+            $plugins = $this->_pluginRepository
+                    ->getPluginsByNetBeansVersion($nbVersionId, $onlyVerified);
+
+            foreach ($plugins as $plugin) {
+                foreach ($plugin->getAuthors() as $author) {
+                    $email = $author->getEmail();
+                    if (!array_key_exists($email, $users)) {
+                        $users[$email] = [
+                            'email' => $email,
+                            'name' => $author->getName(),
+                            'plugins' => []
+                        ];
+                    }
+                    if (!in_array($plugin->getName(), $users[$email]['plugins'])) {
+                        $users[$email]['plugins'][] = $plugin->getName();
+                    }
+                }
+            }
+
+            $successMessage .= sprintf("Generating E-Mails for %d plugins and %d users<br>\n",
+                    count($plugins),
+                    count($users));
+
+            if ($this->params()->fromPost('sendPreview')) {
+                $successMessage .= "Only sending preview email!<br>\n";
+
+                /**
+                 * @var \Application\Entity\User
+                 */
+                $user = $this->_userRepository->find($this->getAuthenticatedUserId());
+                $users = [$user->getEmail() => [
+                    'email' => $user->getEmail(),
+                    'name' => $user->getName(),
+                    'plugins' => ['Demo plugin 1', 'Demo plugin 2']
+                ]];
+            }
+
+            $transport = new Mail\Transport\Sendmail();
+
+            $emailCount = 0;
+            foreach (array_values(($users)) as $entry) {
+                $emailCount++;
+                $list = "<ul>";
+                foreach($entry['plugins'] as $pluginName) {
+                    $list .= sprintf("<li>%s</li>", htmlspecialchars($pluginName));
+                }
+                $list .= "</ul>";
+
+                $mail = new Mail\Message();
+                $mail->setFrom('noreply@netbeans.apache.org', 'NetBeans webmaster');
+                $mail->setSubject($subject);
+                $mail->getHeaders()->addHeader(ContentType::fromString('Content-Type: text/html; charset=utf-8'));
+                $mail->setBody(sprintf($emailText,
+                                htmlspecialchars($entry['name']),
+                                htmlspecialchars($this->getHomeUrl()),
+                                $list
+                ));
+                $mail->addTo($entry['email']);
+                $transport->send($mail);
+            }
+
+            $successMessage .= "E-Mails were successfully send: " . $emailCount;

Review Comment:
   Fixed - thankss



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists