Commit 89ae8c6d authored by Oliver Eglseder's avatar Oliver Eglseder
Browse files

[TASK] Add numberOfMails to configuration

parent 43cc9f45
......@@ -13,6 +13,7 @@ namespace TYPO3\Election\Controller;
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\Election\Domain\Model\ElectionCircular;
/**
......@@ -99,9 +100,19 @@ class BeElectionCircularController extends AbstractProtectedBeController
*/
public function sendAction(ElectionCircular $electionCircular)
{
$this->view->assign('isPluginInstalled', $this->isPluginInstalled());
$this->view->assign('electionCircular', $electionCircular);
}
/**
* @return bool
*/
protected function isPluginInstalled()
{
// TODO: actually search for an active plugin in the database where pid=configuration.pluginPid
return false;
}
/**
* @return string
*/
......
......@@ -44,6 +44,11 @@ class Configuration extends AbstractEntity
*/
protected $pluginPid = 0;
/**
* @var int
*/
protected $numberOfMails = 10;
/**
* @return int
*/
......@@ -108,6 +113,22 @@ class Configuration extends AbstractEntity
$this->pluginPid = $pluginPid;
}
/**
* @return int
*/
public function getNumberOfMails()
{
return $this->numberOfMails;
}
/**
* @param int $numberOfMails
*/
public function setNumberOfMails($numberOfMails)
{
$this->numberOfMails = $numberOfMails;
}
/**
* @return Configuration
*/
......@@ -118,6 +139,7 @@ class Configuration extends AbstractEntity
$clone->setElectionManagerGroup($this->getElectionManagerGroup());
$clone->setPollManagerGroup($this->getPollManagerGroup());
$clone->setPluginPid($this->getPluginPid());
$clone->setNumberOfMails($this->getNumberOfMails());
return $clone;
}
}
......@@ -118,6 +118,9 @@
<trans-unit id="model.configuration.field.plugin_pid">
<source>Plugin PID</source>
</trans-unit>
<trans-unit id="model.configuration.field.number_of_mails">
<source>Number of mails to send at once</source>
</trans-unit>
<!-- MODEL ABSTRACT PERSON -->
......@@ -324,6 +327,18 @@
<trans-unit id="view.be.election_circular.edit.save_and_send">
<source>Save and send</source>
</trans-unit>
<trans-unit id="view.be.election_circular.plugin_detected">
<source>Plugin detected</source>
</trans-unit>
<trans-unit id="view.be.election_circular.no_plugin_detected">
<source>No plugin detected</source>
</trans-unit>
<trans-unit id="view.be.election_circular.plugin_detected_message">
<source>There is an active election plugin on the configured page [%d]</source>
</trans-unit>
<trans-unit id="view.be.election_circular.no_plugin_detected_message">
<source>There is no active election plugin on the configured page [%d]. You will not be able to send out the circular.</source>
</trans-unit>
<!-- MODEL ELECTION CIRCULARS -->
......
<fieldset class="form-section">
<div class="form-group">
<label>
<f:translate key="model.configuration.field.number_of_mails">Number of Mails to send at once</f:translate>
</label>
<f:form.textfield class="form-control" property="numberOfMails"/>
</div>
</fieldset>
......@@ -5,3 +5,4 @@
<f:render partial="Model/Configuration/FormFields/PollManagerGroup"
arguments="{configuration:configuration,beUserGroups:beUserGroups}"/>
<f:render partial="Model/Configuration/FormFields/PluginPid" arguments="{configuration:configuration}"/>
<f:render partial="Model/Configuration/FormFields/NumberOfMails" arguments="{configuration:configuration}"/>
<f:if condition="{isPluginInstalled}">
<f:then>
<div class="alert alert-success">
<div class="media">
<div class="media-left">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-check fa-stack-1x"></i>
</span>
</div>
<div class="media-body">
<h4 class="alert-title"><f:translate key="view.be.election_circular.plugin_detected">Plugin detected</f:translate></h4>
<div class="alert-message"><f:translate key="view.be.election_circular.plugin_detected_message" arguments="{0:configuration.pluginPid}">There is an active election plugin on the configured page</f:translate></div>
</div>
</div>
</div>
</f:then>
<f:else>
<div class="alert alert-danger">
<div class="media">
<div class="media-left">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-exclamation fa-stack-1x"></i>
</span>
</div>
<div class="media-body">
<h4 class="alert-title"><f:translate key="view.be.election_circular.no_plugin_detected">no plugin detected</f:translate></h4>
<div class="alert-message"><f:translate key="view.be.election_circular.no_plugin_detected_message" arguments="{0:configuration.pluginPid}">There is no active election plugin on the configured page</f:translate></div>
</div>
</div>
</div>
</f:else>
</f:if>
<h1>Preview</h1>
<div style="border: 1px solid black; padding: 10px;">
......
......@@ -3,7 +3,8 @@
<f:layout name="Backend"/>
<f:section name="LeftToolBar">
<f:link.action class="btn btn-default" action="edit" controller="BeElectionCircular" arguments="{electionCircular:electionCircular}">
<f:link.action class="btn btn-default" action="edit" controller="BeElectionCircular"
arguments="{electionCircular:electionCircular}">
<core:icon identifier="actions-edit-rename"/>
</f:link.action>
</f:section>
......@@ -20,5 +21,6 @@
</f:section>
<f:section name="Main">
<f:render partial="Model/ElectionCircular/Send" arguments="{electionCircular:electionCircular}"/>
<f:render partial="Model/ElectionCircular/Send"
arguments="{electionCircular:electionCircular,isPluginInstalled:isPluginInstalled,configuration:configuration}"/>
</f:section>
......@@ -2,15 +2,16 @@
# Table structure for table 'tx_election_domain_model_configuration'
#
CREATE TABLE tx_election_domain_model_configuration (
uid INT(11) unsigned NOT NULL auto_increment,
pid INT(11) unsigned DEFAULT '0' NOT NULL,
creation_date INT(11) unsigned DEFAULT '0' NOT NULL,
creation_user INT(11) unsigned DEFAULT '0' NOT NULL,
administration_group INT(11) unsigned DEFAULT '0' NOT NULL,
election_manager_group INT(11) unsigned DEFAULT '0' NOT NULL,
poll_manager_group INT(11) unsigned DEFAULT '0' NOT NULL,
plugin_pid INT(11) unsigned DEFAULT '0' NOT NULL,
uid INT(11) unsigned NOT NULL auto_increment,
pid INT(11) unsigned DEFAULT '0' NOT NULL,
creation_date INT(11) unsigned DEFAULT '0' NOT NULL,
creation_user INT(11) unsigned DEFAULT '0' NOT NULL,
administration_group INT(11) unsigned DEFAULT '0' NOT NULL,
election_manager_group INT(11) unsigned DEFAULT '0' NOT NULL,
poll_manager_group INT(11) unsigned DEFAULT '0' NOT NULL,
plugin_pid INT(11) unsigned DEFAULT '0' NOT NULL,
number_of_mails INT(11) unsigned DEFAULT '10' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
......
......@@ -21,6 +21,7 @@ config.tx_extbase.persistence.classes {
election_manager_group.mapOnProperty = electionManagerGroup
poll_manager_group.mapOnProperty = pollManagerGroup
plugin_pid.mapOnProperty = pluginPid
number_of_mails.mapOnProperty = numberOfMails
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment