Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
481616a0d6
|
@ -50,6 +50,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetMailServerEmailAddress($values["preferences_email_server"]["email"]);
|
Application_Model_Preference::SetMailServerEmailAddress($values["preferences_email_server"]["email"]);
|
||||||
Application_Model_Preference::SetMailServerPassword($values["preferences_email_server"]["ms_password"]);
|
Application_Model_Preference::SetMailServerPassword($values["preferences_email_server"]["ms_password"]);
|
||||||
Application_Model_Preference::SetMailServerPort($values["preferences_email_server"]["port"]);
|
Application_Model_Preference::SetMailServerPort($values["preferences_email_server"]["port"]);
|
||||||
|
Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
|
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||||
|
|
|
@ -41,6 +41,15 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'viewHelper'
|
'viewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->addElement('checkbox', 'msRequiresAuth', array(
|
||||||
|
'label' => 'Requires Authentication',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
|
||||||
|
'decorators' => array(
|
||||||
|
'viewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'mailServer', array(
|
$this->addElement('text', 'mailServer', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
@ -50,7 +59,9 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array('viewHelper'),
|
'decorators' => array('viewHelper'),
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array(
|
||||||
|
'configureMailServer' => '1'
|
||||||
|
))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -62,7 +73,10 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array('viewHelper'),
|
'decorators' => array('viewHelper'),
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array(
|
||||||
|
'configureMailServer' => '1',
|
||||||
|
'msRequiresAuth' => '1'
|
||||||
|
))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -74,7 +88,10 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||||
'decorators' => array('viewHelper'),
|
'decorators' => array('viewHelper'),
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new ConditionalNotEmpty(array('configureMailServer'=>'1'))
|
new ConditionalNotEmpty(array(
|
||||||
|
'configureMailServer' => '1',
|
||||||
|
'msRequiresAuth' => '1'
|
||||||
|
))
|
||||||
),
|
),
|
||||||
'renderPassword' => true
|
'renderPassword' => true
|
||||||
));
|
));
|
||||||
|
|
|
@ -13,23 +13,31 @@ class Application_Model_Email
|
||||||
public static function send($subject, $message, $tos, $from = null)
|
public static function send($subject, $message, $tos, $from = null)
|
||||||
{
|
{
|
||||||
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
||||||
|
$mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false;
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
if ($mailServerConfigured) {
|
if ($mailServerConfigured) {
|
||||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
|
||||||
$password = Application_Model_Preference::GetMailServerPassword();
|
|
||||||
$mailServer = Application_Model_Preference::GetMailServer();
|
$mailServer = Application_Model_Preference::GetMailServer();
|
||||||
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
$mailServerPort = Application_Model_Preference::GetMailServerPort();
|
||||||
if (!empty($mailServerPort)) {
|
if (!empty($mailServerPort)) {
|
||||||
$port = Application_Model_Preference::GetMailServerPort();
|
$port = Application_Model_Preference::GetMailServerPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = array(
|
if ($mailServerRequiresAuth) {
|
||||||
'auth' => 'login',
|
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||||
'ssl' => 'ssl',
|
$password = Application_Model_Preference::GetMailServerPassword();
|
||||||
'username' => $username,
|
|
||||||
'password' => $password
|
$config = array(
|
||||||
);
|
'auth' => 'login',
|
||||||
|
'ssl' => 'ssl',
|
||||||
|
'username' => $username,
|
||||||
|
'password' => $password
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$config = array(
|
||||||
|
'ssl' => 'ssl'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($port)) {
|
if (isset($port)) {
|
||||||
$config['port'] = $port;
|
$config['port'] = $port;
|
||||||
|
|
|
@ -1089,6 +1089,16 @@ class Application_Model_Preference
|
||||||
{
|
{
|
||||||
return self::getValue("mail_server_port");
|
return self::getValue("mail_server_port");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetMailServerRequiresAuth($value)
|
||||||
|
{
|
||||||
|
self::setValue("mail_server_requires_auth", $value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetMailServerRequiresAuth()
|
||||||
|
{
|
||||||
|
return self::getValue("mail_server_requires_auth");
|
||||||
|
}
|
||||||
/* User specific preferences end */
|
/* User specific preferences end */
|
||||||
|
|
||||||
public static function ShouldShowPopUp()
|
public static function ShouldShowPopUp()
|
||||||
|
|
|
@ -44,7 +44,13 @@
|
||||||
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
|
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
|
||||||
<span class="info-text-small">(Required)</span>:
|
<span class="info-text-small">(Required)</span>:
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label class="required" for="msRequiresAuth">
|
||||||
|
<?php echo $this->element->getElement('msRequiresAuth') ?>
|
||||||
|
<?php echo $this->element->getElement('msRequiresAuth')->getLabel() ?>
|
||||||
|
</label>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd id="mailServer-element" class="block-display">
|
<dd id="mailServer-element" class="block-display">
|
||||||
<?php echo $this->element->getElement('mailServer') ?>
|
<?php echo $this->element->getElement('mailServer') ?>
|
||||||
<?php if($this->element->getElement('mailServer')->hasErrors()) : ?>
|
<?php if($this->element->getElement('mailServer')->hasErrors()) : ?>
|
||||||
|
@ -56,6 +62,14 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt id="port-label" class="block-display">
|
||||||
|
<label class="required" for="port"><?php echo $this->element->getElement('port')->getLabel() ?>:
|
||||||
|
</label>
|
||||||
|
</dt>
|
||||||
|
<dd id="port-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('port') ?>
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt id="email-label" class="block-display">
|
<dt id="email-label" class="block-display">
|
||||||
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
|
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
|
||||||
<span class="info-text-small">(Required)</span>:
|
<span class="info-text-small">(Required)</span>:
|
||||||
|
@ -88,14 +102,6 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt id="port-label" class="block-display">
|
|
||||||
<label class="required" for="port"><?php echo $this->element->getElement('port')->getLabel() ?>:
|
|
||||||
</label>
|
|
||||||
</dt>
|
|
||||||
<dd id="port-element" class="block-display">
|
|
||||||
<?php echo $this->element->getElement('port') ?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -20,14 +20,19 @@ function setConfigureMailServerListener() {
|
||||||
var configMailServer = $("#configureMailServer");
|
var configMailServer = $("#configureMailServer");
|
||||||
configMailServer.click(function(event){
|
configMailServer.click(function(event){
|
||||||
setMailServerInputReadonly();
|
setMailServerInputReadonly();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
var msRequiresAuth = $("#msRequiresAuth");
|
||||||
|
msRequiresAuth.click(function(event){
|
||||||
|
setMsAuthenticationFieldsReadonly($(this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setEnableSystemEmailsListener() {
|
function setEnableSystemEmailsListener() {
|
||||||
var enableSystemEmails = $("#enableSystemEmail");
|
var enableSystemEmails = $("#enableSystemEmail");
|
||||||
enableSystemEmails.click(function(event){
|
enableSystemEmails.click(function(event){
|
||||||
setSystemFromEmailReadonly();
|
setSystemFromEmailReadonly();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSystemFromEmailReadonly() {
|
function setSystemFromEmailReadonly() {
|
||||||
|
@ -43,19 +48,36 @@ function setSystemFromEmailReadonly() {
|
||||||
function setMailServerInputReadonly() {
|
function setMailServerInputReadonly() {
|
||||||
var configMailServer = $("#configureMailServer");
|
var configMailServer = $("#configureMailServer");
|
||||||
var mailServer = $("#mailServer");
|
var mailServer = $("#mailServer");
|
||||||
var email = $("#email");
|
|
||||||
var password = $("#ms_password");
|
|
||||||
var port = $("#port");
|
var port = $("#port");
|
||||||
if ($(configMailServer).is(':checked')) {
|
var requiresAuthCB = $("#msRequiresAuth");
|
||||||
|
|
||||||
|
if (configMailServer.is(':checked')) {
|
||||||
mailServer.removeAttr("readonly");
|
mailServer.removeAttr("readonly");
|
||||||
email.removeAttr("readonly");
|
|
||||||
password.removeAttr("readonly");
|
|
||||||
port.removeAttr("readonly");
|
port.removeAttr("readonly");
|
||||||
|
requiresAuthCB.parent().show();
|
||||||
} else {
|
} else {
|
||||||
mailServer.attr("readonly", "readonly");
|
mailServer.attr("readonly", "readonly");
|
||||||
|
port.attr("readonly", "readonly");
|
||||||
|
requiresAuthCB.parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
setMsAuthenticationFieldsReadonly(requiresAuthCB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable/disable mail server authentication fields
|
||||||
|
*/
|
||||||
|
function setMsAuthenticationFieldsReadonly(ele) {
|
||||||
|
var email = $("#email");
|
||||||
|
var password = $("#ms_password");
|
||||||
|
var configureMailServer = $("#configureMailServer");
|
||||||
|
|
||||||
|
if (ele.is(':checked') && configureMailServer.is(':checked')) {
|
||||||
|
email.removeAttr("readonly");
|
||||||
|
password.removeAttr("readonly");
|
||||||
|
} else if (ele.not(':checked') || configureMailServer.not(':checked')) {
|
||||||
email.attr("readonly", "readonly");
|
email.attr("readonly", "readonly");
|
||||||
password.attr("readonly", "readonly");
|
password.attr("readonly", "readonly");
|
||||||
port.attr("readonly", "readonly");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,15 @@ class TestMMP(unittest.TestCase):
|
||||||
orga['MDATA_KEY_FTYPE'] = u'audioclip'
|
orga['MDATA_KEY_FTYPE'] = u'audioclip'
|
||||||
orig['MDATA_KEY_BITRATE'] = u'256000'
|
orig['MDATA_KEY_BITRATE'] = u'256000'
|
||||||
orga['MDATA_KEY_BITRATE'] = u'256000'
|
orga['MDATA_KEY_BITRATE'] = u'256000'
|
||||||
old_path = "/home/rudi/recorded/2012-08-21-11:29:00.ogg"
|
old_path = "/home/rudi/recorded/2012-08-21-11:29:00.ogg"
|
||||||
normalized = mmp.normalized_metadata(orig, old_path)
|
normalized = mmp.normalized_metadata(orig, old_path)
|
||||||
normalized['MDATA_KEY_BITRATE'] = u'256000'
|
normalized['MDATA_KEY_BITRATE'] = u'256000'
|
||||||
|
|
||||||
self.assertEqual( orga, normalized )
|
self.assertEqual( orga, normalized )
|
||||||
|
|
||||||
organized_base_name = "2012-08-21-11-29-00-record-256kbps.ogg"
|
organized_base_name = "2012-08-21-11-29-00-record-256kbps.ogg"
|
||||||
base = "/srv/airtime/stor/"
|
base = "/srv/airtime/stor/"
|
||||||
organized_path = mmp.organized_path(old_path,base, normalized)
|
organized_path = mmp.organized_path(old_path,base, normalized)
|
||||||
self.assertEqual(os.path.basename(organized_path), organized_base_name)
|
self.assertEqual(os.path.basename(organized_path), organized_base_name)
|
||||||
|
|
||||||
def test_normalized_metadata2(self):
|
def test_normalized_metadata2(self):
|
||||||
|
@ -72,14 +72,14 @@ class TestMMP(unittest.TestCase):
|
||||||
'title' : [u'18-11-00-Untitled Show'],
|
'title' : [u'18-11-00-Untitled Show'],
|
||||||
'artist' : [u'Airtime Show Recorder']
|
'artist' : [u'Airtime Show Recorder']
|
||||||
})
|
})
|
||||||
old_path = "/home/rudi/recorded/doesnt_really_matter.ogg"
|
old_path = "/home/rudi/recorded/doesnt_really_matter.ogg"
|
||||||
normalized = mmp.normalized_metadata(orig, old_path)
|
normalized = mmp.normalized_metadata(orig, old_path)
|
||||||
normalized['MDATA_KEY_BITRATE'] = u'256000'
|
normalized['MDATA_KEY_BITRATE'] = u'256000'
|
||||||
opath = mmp.organized_path(old_path, "/srv/airtime/stor/",
|
opath = mmp.organized_path(old_path, "/srv/airtime/stor/",
|
||||||
normalized)
|
normalized)
|
||||||
|
# TODO : add a better test than this...
|
||||||
self.assertTrue( len(opath) > 0 )
|
self.assertTrue( len(opath) > 0 )
|
||||||
|
|
||||||
|
|
||||||
def test_file_md5(self):
|
def test_file_md5(self):
|
||||||
p = os.path.realpath(__file__)
|
p = os.path.realpath(__file__)
|
||||||
m1 = mmp.file_md5(p)
|
m1 = mmp.file_md5(p)
|
||||||
|
|
Loading…
Reference in New Issue