Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
voting.typo3.org
extensions
election
Commits
078e4d9f
Commit
078e4d9f
authored
Dec 23, 2015
by
Oliver Eglseder
Browse files
[TASK] Detect plugin and fix test send
parent
38376929
Changes
10
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/BeElectionCircularController.php
View file @
078e4d9f
...
...
@@ -13,6 +13,8 @@ namespace TYPO3\Election\Controller;
*
* The TYPO3 project - inspiring people to share!
*/
use
TYPO3\CMS\Backend\Utility\BackendUtility
;
use
TYPO3\CMS\Core\Database\DatabaseConnection
;
use
TYPO3\Election\Domain\Model\ElectionCircular
;
use
TYPO3\Election\Domain\Model\Elector
;
use
TYPO3\Election\Utility\MailUtility
;
...
...
@@ -123,6 +125,12 @@ class BeElectionCircularController extends AbstractProtectedBeController
$elector
,
$this
->
configuration
);
$this
->
redirect
(
self
::
ACTION_PREVIEW
,
self
::
CONTROLLER_NAME
,
'election'
,
[
'electionCircular'
=>
$electionCircular
]
);
}
/**
...
...
@@ -130,8 +138,13 @@ class BeElectionCircularController extends AbstractProtectedBeController
*/
protected
function
isPluginInstalled
()
{
// TODO: actually search for an active plugin in the database where pid=configuration.pluginPid
return
false
;
$extendedDeleteClause
=
BackendUtility
::
BEenableFields
(
'tt_content'
);
$count
=
$this
->
getDatabaseConnection
()
->
exec_SELECTcountRows
(
'uid'
,
'tt_content'
,
'CType LIKE "list" AND list_type LIKE "election_pi1" AND hidden=0 '
.
$extendedDeleteClause
);
return
$count
>
0
;
}
/**
...
...
@@ -161,4 +174,12 @@ class BeElectionCircularController extends AbstractProtectedBeController
{
return
$this
->
configuration
->
getElectionManagerGroup
();
}
/**
* @return DatabaseConnection
*/
protected
function
getDatabaseConnection
()
{
return
$GLOBALS
[
'TYPO3_DB'
];
}
}
Classes/Domain/Model/ElectionInvitation.php
0 → 100644
View file @
078e4d9f
<?php
namespace
TYPO3\Election\Domain\Model
;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Class ElectionInvitation
*/
class
ElectionInvitation
extends
AbstractEntity
{
/**
* @var string
*/
protected
$secret
=
''
;
/**
* @var \TYPO3\Election\Domain\Model\Election
*/
protected
$election
=
null
;
/**
* @var \TYPO3\Election\Domain\Model\Elector
*/
protected
$elector
=
null
;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\Election\Domain\Model\ElectionToken>
*/
protected
$electionTokens
=
[];
/**
* @return string
*/
public
function
getSecret
()
{
return
$this
->
secret
;
}
/**
* @param string $secret
*/
public
function
setSecret
(
$secret
)
{
$this
->
secret
=
$secret
;
}
/**
* @return Election
*/
public
function
getElection
()
{
return
$this
->
election
;
}
/**
* @param Election $election
*/
public
function
setElection
(
$election
)
{
$this
->
election
=
$election
;
}
/**
* @return Elector
*/
public
function
getElector
()
{
return
$this
->
elector
;
}
/**
* @param Elector $elector
*/
public
function
setElector
(
$elector
)
{
$this
->
elector
=
$elector
;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public
function
getElectionTokens
()
{
return
$this
->
electionTokens
;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $electionTokens
*/
public
function
setElectionTokens
(
$electionTokens
)
{
$this
->
electionTokens
=
$electionTokens
;
}
}
Classes/Domain/Model/Elector.php
View file @
078e4d9f
<?php
namespace
TYPO3\Election\Domain\Model
;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use
TYPO3\CMS\Extbase\Persistence\ObjectStorage
;
/**
...
...
Classes/Utility/MailUtility.php
View file @
078e4d9f
...
...
@@ -35,13 +35,11 @@ class MailUtility
Elector
$elector
,
Configuration
$configuration
)
{
if
(
GeneralUtility
::
makeInstance
(
MailMessage
::
class
)
GeneralUtility
::
makeInstance
(
MailMessage
::
class
)
->
setSubject
(
$electionCircular
->
getSubject
())
->
setFrom
(
array
(
$configuration
->
getFromEmail
()
=>
$configuration
->
getFromName
()))
->
setTo
(
array
(
$elector
->
getEmail
()
=>
$elector
->
getFullName
()))
->
setBody
(
$electionCircular
->
getRenderedBody
(
$elector
))
->
send
()
===
1
)
{
$elector
->
getElectionTokensForElection
(
$electionCircular
->
getElection
())
->
setEmailSent
(
true
);
}
->
send
();
}
}
Resources/Private/Language/locallang.xlf
View file @
078e4d9f
...
...
@@ -348,6 +348,9 @@
<trans-unit
id=
"view.be.election_circular.preview.send_to_test_email"
>
<source>
Send test
</source>
</trans-unit>
<trans-unit
id=
"view.be.election_circular.preview.send_invitations"
>
<source>
Send invitations
</source>
</trans-unit>
<!-- MODEL ELECTION CIRCULARS -->
...
...
Resources/Private/Templates/BeElectionCircular/Preview.html
View file @
078e4d9f
...
...
@@ -7,6 +7,21 @@
arguments=
"{electionCircular:electionCircular}"
>
<core:icon
identifier=
"actions-edit-rename"
/>
</f:link.action>
<f:if
condition=
"{isPluginInstalled}"
>
<f:then>
<f:link.action
class=
"btn btn-default"
action=
"send"
controller=
"BeElectionCircular"
arguments=
"{electionCircular:electionCircular}"
>
<core:icon
identifier=
"actions-system-list-open"
/>
<f:translate
key=
"view.be.election_circular.preview.send_invitations"
>
Send invitations
</f:translate>
</f:link.action>
</f:then>
<f:else>
<a
disabled=
"disabled"
class=
"btn btn-default"
>
<core:icon
identifier=
"actions-system-list-open"
state=
"disabled"
/>
<f:translate
key=
"view.be.election_circular.preview.send_invitations"
>
Send invitations
</f:translate>
</a>
</f:else>
</f:if>
</f:section>
<f:section
name=
"RightToolBar"
>
...
...
ext_localconf.php
View file @
078e4d9f
...
...
@@ -7,3 +7,13 @@ if (!defined('TYPO3_MODE')) {
\
TYPO3\CMS\Extbase\Utility\ExtensionUtility
::
registerTypeConverter
(
\
TYPO3\Election\Property\TypeConverter\UploadedFileReferenceConverter
::
class
);
\
TYPO3\CMS\Extbase\Utility\ExtensionUtility
::
configurePlugin
(
'TYPO3.election'
,
'pi1'
,
array
(
'FeDashboard'
=>
'index'
,
),
array
(
'FeDashboard'
=>
'index'
,
)
);
ext_tables.php
View file @
078e4d9f
...
...
@@ -37,6 +37,7 @@ call_user_func(
'labels'
=>
'LLL:EXT:election/Resources/Private/Language/locallang.xlf'
,
)
);
\
TYPO3\CMS\Extbase\Utility\ExtensionUtility
::
registerPlugin
(
'Election'
,
'pi1'
,
'TYPO3 Election tool plugin'
);
},
'TYPO3'
,
$_EXTKEY
...
...
ext_tables.sql
View file @
078e4d9f
...
...
@@ -135,6 +135,23 @@ CREATE TABLE tx_election_domain_model_electioncircular (
KEY
parent
(
pid
)
);
#
#
Table
structure
for
table
'tx_election_domain_model_electioninvitation'
#
CREATE
TABLE
tx_election_domain_model_electioninvitation
(
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
,
secret
VARCHAR
(
255
)
DEFAULT
''
NOT
NULL
,
election
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
elector
INT
(
11
)
unsigned
DEFAULT
'0'
NOT
NULL
,
PRIMARY
KEY
(
uid
),
KEY
parent
(
pid
)
);
#
#
Table
structure
for
table
'tx_election_domain_model_electorate_elector_mm'
#
...
...
ext_typoscript_setup.txt
View file @
078e4d9f
...
...
@@ -147,4 +147,28 @@ config.tx_extbase.persistence.classes {
}
}
}
TYPO3\Election\Domain\Model\ElectionInvitation < temp.abstractEntity
TYPO3\Election\Domain\Model\ElectionInvitation {
mapping {
tableName = tx_election_domain_model_electioninvitation
columns {
secret.mapOnProperty = secret
election {
mapOnProperty = election
config {
type = select
foreign_table = tx_election_domain_model_election
}
}
elector {
mapOnProperty = elector
config {
type = select
foreign_table = tx_election_domain_model_elector
}
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment