This commit is contained in:
jerome 2014-04-23 16:09:45 +02:00 committed by Pepijn Over
parent b120a8eaf4
commit d79ba42e85
17 changed files with 264 additions and 99 deletions

View File

@ -412,6 +412,47 @@ function psm_build_mail($from_name = null, $from_email = null) {
return $phpmailer;
}
/**
* Prepare a new SMS util.
*
* @return \psm\Txtmsg\TxtmsgInterface
*/
function psm_build_sms() {
$sms = null;
// open the right class
// not making this any more dynamic, because perhaps some gateways need custom settings (like Mollie)
switch(strtolower(psm_get_conf('sms_gateway'))) {
case 'mosms':
$sms = new \psm\Txtmsg\Mosms();
break;
case 'inetworx':
$sms = new \psm\Txtmsg\Inetworx();
break;
case 'mollie':
$sms = new \psm\Txtmsg\Mollie();
$sms->setGateway(1);
break;
case 'spryng':
$sms = new \psm\Txtmsg\Spryng();
break;
case 'clickatell':
$sms = new \psm\Txtmsg\Clickatell();
break;
case 'textmarketer':
$sms = new \psm\Txtmsg\Textmarketer();
break;
}
// copy login information from the config file
if($sms) {
$sms->setLogin(psm_get_conf('sms_gateway_username'), psm_get_conf('sms_gateway_password'));
$sms->setOriginator(psm_get_conf('sms_from'));
}
return $sms;
}
/**
* Generate a new link to the current monitor
* @param array $params key value pairs

View File

@ -194,6 +194,7 @@ $sm_lang = array(
'log_email' => 'Да се пази ли лог на изпратените имейли от системата',
'log_sms' => 'Да се пази ли лог на изпратените SMS съобщения от системата',
'updated' => 'Настройките са обновени успешно.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Имейл',
'tab_sms' => 'SMS',
'tab_log' => 'Логове',
@ -208,6 +209,15 @@ $sm_lang = array(
'Времето е в секунди, ако е 0 страницата няма да се обновява.'.
'</span>',
'seconds' => 'секунди',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// За нов ред в имейл съобщението, моля използвайте тага <br/>
'notifications' => array(

View File

@ -193,6 +193,7 @@ $sm_lang = array(
'log_email' => 'Email Log per Script senden?',
'log_sms' => 'SMS Log per Script senden?',
'updated' => 'Die Einstellungen wurden gespeichert.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Log',
@ -207,6 +208,15 @@ $sm_lang = array(
'Time in seconds, if 0 the page won\'t refresh.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -193,6 +193,7 @@ $sm_lang = array(
'log_email' => 'Log emails sent by the script',
'log_sms' => 'Log text messages sent by the script',
'updated' => 'The configuration has been updated.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Log',
@ -207,6 +208,15 @@ $sm_lang = array(
'Time in seconds, if 0 the page won\'t refresh.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -191,6 +191,7 @@ $sm_lang = array(
'log_email' => 'Enviar Log via email?',
'log_sms' => 'Enviar Log via SMS ?',
'updated' => 'Configuración guardada.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Log',
@ -205,6 +206,15 @@ $sm_lang = array(
'Tiempo en segundos, indicar "0" para no actualizar.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -192,6 +192,7 @@ $sm_lang = array(
'log_email' => 'Enregistrer tout les emails envoyés',
'log_sms' => 'Enregistrer tout les SMS envoyés',
'updated' => 'La configuration a été mise à jour.',
'nochanges' => 'La configuration n\'a pas été modifiée.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Événements',
@ -206,6 +207,15 @@ $sm_lang = array(
'Temps en secondes. Si 0, la page n\'est pas rafraîchie.'.
'</span>',
'seconds' => 'secondes',
'test' => 'Tester',
'test_email' => 'Un email va vous être envoyé à l\'adresse définie dans votre profil utilisateur.',
'test_sms' => 'Un SMS va vous être envoyé au numéro défini dans votre profil utilisateur.',
'send' => 'Envoyer',
'test_message' => 'Message de test',
'email_sent' => 'Email envoyé',
'email_error' => 'Erreur lors de l\'envoie de l\'email',
'sms_sent' => 'Sms envoyé',
'sms_error' => 'Erreur lors de l\'envoie du sms',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -191,6 +191,7 @@ $sm_lang = array(
'log_email' => 'Registra email inviate dallo script.',
'log_sms' => 'Registra SMS inviati dallo script.',
'updated' => 'La configurazione è stato aggiornata.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Log',
@ -205,6 +206,15 @@ $sm_lang = array(
'Tempo in secondi, se impostato a 0 la pagina non si aggiornerà.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -191,6 +191,7 @@ $sm_lang = array(
'log_email' => '이메일로 로그를 전송하시겠습니까?',
'log_sms' => 'SMS로 로그를 전송하시겠습니까?',
'updated' => '설정이 수정되었습니다.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => '로그',
@ -205,6 +206,15 @@ $sm_lang = array(
'시간은 초(sec)로 설정을 하고, 0은 새로고침을 하지 않습니다.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -192,6 +192,7 @@ $sm_lang = array(
'log_email' => 'Log emails verstuurd bij het script?',
'log_sms' => 'Log sms berichten verstuurd bij het script?',
'updated' => 'De configuratie is gewijzigd.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_log' => 'Log',
@ -206,6 +207,15 @@ $sm_lang = array(
'Tijd in seconden, als de tijd 0 is wordt de pagina niet ververst.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -193,6 +193,7 @@ $sm_lang = array(
'log_email' => 'Registrar no Log os envios de email feitos pelo script?',
'log_sms' => 'Registrar no Log os envios de mensagens de texto feitos pelo script?',
'updated' => 'A configuração foi atualizada.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => 'Email',
'tab_sms' => 'Texto',
'tab_log' => 'Logs',
@ -207,6 +208,15 @@ $sm_lang = array(
'Tempo em segundos, Se 0 a página não será atualizada.'.
'</span>',
'seconds' => 'segundos',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -192,6 +192,7 @@ $sm_lang = array(
'log_email' => '记录脚本所发邮件?',
'log_sms' => '记录脚本所发短信SMS?',
'updated' => '设置已更新.',
'nochanges' => 'The configuration didn\'t change.',
'tab_email' => '邮件发送设置',
'tab_sms' => '短信发送设置',
'tab_log' => '日志设置',
@ -206,6 +207,15 @@ $sm_lang = array(
'单位为秒, 设置为0则不自动刷新.'.
'</span>',
'seconds' => 'seconds',
'test' => 'Test',
'test_email' => 'An email will be sent to the address specified in your user profile.',
'test_sms' => 'A SMS will be sent to the phone number specified in your user profile.',
'send' => 'Send',
'test_message' => 'Test message',
'email_sent' => 'Email sent',
'email_error' => 'Error in email sending',
'sms_sent' => 'Sms sent',
'sms_error' => 'Error in sms sending',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -61,6 +61,8 @@ class ConfigController extends AbstractController {
'sms_gateway_password',
'sms_from',
);
private $default_tab = 'general';
function __construct(Database $db, Template $tpl) {
parent::__construct($db, $tpl);
@ -117,6 +119,20 @@ class ConfigController extends AbstractController {
$tpl_data[$input_key] = (isset($config[$input_key])) ? $config[$input_key] : '';
}
$tpl_data[$this->default_tab . '_active'] = 'active';
$modal = new \psm\Util\Module\Modal($this->tpl, 'testEmail', \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('servers', 'send_email'));
$modal->setMessage(psm_get_lang('config', 'test_email'));
$modal->setOKButtonLabel(psm_get_lang('config', 'send'));
$modal = new \psm\Util\Module\Modal($this->tpl, 'testSMS', \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$this->addModal($modal);
$modal->setTitle(psm_get_lang('servers', 'send_sms'));
$modal->setMessage(psm_get_lang('config', 'test_sms'));
$modal->setOKButtonLabel(psm_get_lang('config', 'send'));
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
}
@ -143,9 +159,11 @@ class ConfigController extends AbstractController {
}
// save all values to the database
$changed = false;
foreach($clean as $key => $value) {
// check if key already exists, otherwise add it
if(psm_get_conf($key) === null) {
$old_value = psm_get_conf($key);
if($old_value === null) {
// not yet set, add it
$this->db->save(
PSM_DB_PREFIX . 'config',
@ -154,22 +172,67 @@ class ConfigController extends AbstractController {
'value' => $value,
)
);
} else {
$changed = true;
} else if($value != $old_value) {
// update
$this->db->save(
PSM_DB_PREFIX . 'config',
array('value' => $value),
array('key' => $key)
);
$changed = true;
}
}
$this->addMessage(psm_get_lang('config', 'updated'), 'success');
if($changed) {
$this->addMessage(psm_get_lang('config', 'updated'), 'success');
}
if(!empty($_POST['test_email'])) {
// build mail object
$mail = psm_build_mail();
$message = psm_get_lang('config', 'test_message');
$mail->Subject = $message;
$mail->Priority = 1;
$mail->Body = $message;
$mail->AltBody = str_replace('<br/>', "\n", $message);
$user = $this->user->getUser();
$mail->AddAddress($user->email, $user->name);
if($mail->Send()) {
$this->addMessage(psm_get_lang('config', 'email_sent'), 'success');
} else {
$this->addMessage(psm_get_lang('config', 'email_error') . ': ' . $mail->ErrorInfo, 'error');
}
} elseif(!empty($_POST['test_sms'])) {
// build sms object
$sms = psm_build_sms();
if($sms) {
$user = $this->user->getUser();
$sms->addRecipients($user->mobile);
if($sms->sendSMS(psm_get_lang('config', 'test_message'))) {
$this->addMessage(psm_get_lang('config', 'sms_sent'), 'success');
} else {
$this->addMessage(psm_get_lang('config', 'sms_error'), 'error');
}
}
} elseif(!$changed) {
$this->addMessage(psm_get_lang('config', 'nochanges'));
}
if($clean['language'] != psm_get_conf('language')) {
header('Location: ' . $_SERVER['REQUEST_URI']);
die();
}
if(isset($_POST['general_submit'])) {
$this->default_tab = 'general';
} elseif(isset($_POST['email_submit']) || !empty($_POST['test_email'])) {
$this->default_tab = 'email';
} elseif(isset($_POST['sms_submit']) || !empty($_POST['test_sms'])) {
$this->default_tab = 'sms';
} elseif(isset($_POST['logging_submit'])) {
$this->default_tab = 'logging';
}
}
$this->initializeAction('index');
}
@ -223,6 +286,7 @@ class ConfigController extends AbstractController {
'label_auto_refresh_servers' => psm_get_lang('config', 'auto_refresh_servers'),
'label_seconds' => psm_get_lang('config', 'seconds'),
'label_save' => psm_get_lang('system', 'save'),
'label_test' => psm_get_lang('config', 'test'),
)
);

View File

@ -125,52 +125,9 @@ class Modal implements ModalInterface {
$tpl_id = 'main_modal_container';
$this->tpl->newTemplate($tpl_id, 'main_modal.tpl.html');
$buttons = array();
switch($this->type)
{
case self::MODAL_TYPE_OK:
$buttons[] = array(
'modal_button_class' => 'modalOKButton',
'modal_button_type' => 'primary',
'modal_button_dismiss' => '',
'modal_button_label' => empty($this->ok_label) ? psm_get_lang('system', 'ok') : $this->ok_label,
);
break;
case self::MODAL_TYPE_OKCANCEL:
$buttons[] = array(
'modal_button_class' => 'modalCancelButton',
'modal_button_type' => 'default',
'modal_button_attr' => 'data-dismiss="modal"',
'modal_button_label' => psm_get_lang('system', 'cancel'),
);
$buttons[] = array(
'modal_button_class' => 'modalOKButton',
'modal_button_type' => 'primary',
'modal_button_attr' => '',
'modal_button_label' => empty($this->ok_label) ? psm_get_lang('system', 'ok') : $this->ok_label,
);
break;
case self::MODAL_TYPE_DANGER:
$buttons[] = array(
'modal_button_class' => 'modalCancelButton',
'modal_button_type' => 'default',
'modal_button_attr' => 'data-dismiss="modal"',
'modal_button_label' => psm_get_lang('system', 'cancel'),
);
$buttons[] = array(
'modal_button_class' => 'modalOKButton',
'modal_button_type' => 'danger',
'modal_button_attr' => '',
'modal_button_label' => empty($this->ok_label) ? psm_get_lang('system', 'ok') : $this->ok_label,
);
break;
}
if(sizeof($buttons)) {
$this->tpl->addTemplateDataRepeat($tpl_id, 'buttons', $buttons);
}
$has_cancel = ($this->type == self::MODAL_TYPE_OK) ? false : true;
$button_type = ($this->type == self::MODAL_TYPE_DANGER) ? 'danger' : 'primary';
$button_label = empty($this->ok_label) ? psm_get_lang('system', 'ok') : $this->ok_label;
$message = !empty($this->message) ? $this->message : '';
$matches = array();
@ -181,9 +138,13 @@ class Modal implements ModalInterface {
}
$this->tpl->addTemplateData($tpl_id, array(
'modal_id' => $this->modal_id,
'modal_title' => !empty($this->title) ? $this->title : psm_get_lang('system', 'title'),
'modal_body' => $message,
'modal_id' => $this->modal_id,
'modal_title' => !empty($this->title) ? $this->title : psm_get_lang('system', 'title'),
'modal_body' => $message,
'?has_cancel' => $has_cancel,
'label_cancel' => psm_get_lang('system', 'cancel'),
'modal_button_type' => $button_type,
'modal_button_label'=> $button_label,
));

View File

@ -223,37 +223,14 @@ class StatusNotifier {
return false;
}
$sms = psm_build_sms();
if(!$sms) {
return false;
}
// we have to build an userlist for the log table..
$userlist = array();
// open the right class
// not making this any more dynamic, because perhaps some gateways need custom settings (like Mollie)
switch(strtolower(psm_get_conf('sms_gateway'))) {
case 'mosms':
$sms = new \psm\Txtmsg\Mosms();
break;
case 'inetworx':
$sms = new \psm\Txtmsg\Inetworx();
break;
case 'mollie':
$sms = new \psm\Txtmsg\Mollie();
$sms->setGateway(1);
break;
case 'spryng':
$sms = new \psm\Txtmsg\Spryng();
break;
case 'clickatell':
$sms = new \psm\Txtmsg\Clickatell();
break;
case 'textmarketer':
$sms = new \psm\Txtmsg\Textmarketer();
break;
}
// copy login information from the config file
$sms->setLogin(psm_get_conf('sms_gateway_username'), psm_get_conf('sms_gateway_password'));
$sms->setOriginator(psm_get_conf('sms_from'));
// add all users to the recipients list
foreach ($users as $user) {
$userlist[] = $user['user_id'];

View File

@ -1,13 +1,13 @@
<!--%tpl_config-->
<form class="form-horizontal" action="index.php?mod=config&action=save" id="edit_config" method="post">
<form class="form-horizontal" name="edit_config" action="index.php?mod=config&action=save" id="edit_config" method="post">
<ul class="nav nav-tabs">
<li class="active"><a href="#config-general" data-toggle="tab">{label_general}</a></li>
<li><a href="#config-email" data-toggle="tab">{label_tab_email}</a></li>
<li><a href="#config-sms" data-toggle="tab">{label_tab_sms}</a></li>
<li><a href="#config-logging" data-toggle="tab">{label_tab_log}</a></li>
<li class="{general_active}"><a href="#config-general" data-toggle="tab">{label_general}</a></li>
<li class="{email_active}"><a href="#config-email" data-toggle="tab">{label_tab_email}</a></li>
<li class="{sms_active}"><a href="#config-sms" data-toggle="tab">{label_tab_sms}</a></li>
<li class="{logging_active}"><a href="#config-logging" data-toggle="tab">{label_tab_log}</a></li>
</ul>
<div class="tab-content well">
<div id="config-general" class="tab-pane active">
<div id="config-general" class="tab-pane {general_active}">
<fieldset>
<legend>{label_general}</legend>
<div class="control-group">
@ -46,11 +46,11 @@
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="general_submit">{label_save}</button>
</div>
</fieldset>
</div>
<div id="config-email" class="tab-pane">
<div id="config-email" class="tab-pane {email_active}">
<fieldset>
<legend>{label_settings_email}</legend>
<div class="control-group">
@ -94,12 +94,18 @@
<input type="password" id="email_smtp_password" name="email_smtp_password" value="{email_smtp_password}" maxlength="100" placeholder="{label_email_smtp_noauth}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testEmail">{label_test}</button>
<input type="hidden" name="test_email" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="email_submit" >{label_save}</button>
</div>
</fieldset>
</div>
<div id="config-sms" class="tab-pane">
<div id="config-sms" class="tab-pane {sms_active}">
<fieldset>
<legend>{label_settings_sms}</legend>
<div class="control-group">
@ -138,12 +144,18 @@
<input type="text" id="sms_from" name="sms_from" value="{sms_from}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testSMS">{label_test}</button>
<input type="hidden" name="test_sms" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="sms_submit">{label_save}</button>
</div>
</fieldset>
</div>
<div id="config-logging" class="tab-pane">
<div id="config-logging" class="tab-pane {logging_active}">
<fieldset>
<legend>{label_settings_log}</legend>
<div class="control-group">
@ -157,7 +169,7 @@
<label class="checkbox"><input type="checkbox" id="log_sms" name="log_sms[]" {log_sms_checked} /> {label_log_sms}</label>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<button class="btn btn-success" type="submit" name="logging_submit">{label_save}</button>
</div>
</fieldset>
</div>

View File

@ -7,10 +7,8 @@
<p>{modal_body}</p>
</div>
<div class="modal-footer">
<!--%tpl_repeat_buttons-->
<a href="#" class="btn btn-{modal_button_type} {modal_button_class}" {modal_button_attr}>{modal_button_label}</a>
<!--%%tpl_repeat_buttons-->
{buttons}
<!--?has_cancel--><button class="btn btn-default" data-dismiss="modal" aria-hidden="true">{label_cancel}</button><!--??has_cancel-->
<button class="btn btn-{modal_button_type} modalOKButton" >{modal_button_label}</button>
</div>
</div>
<!--%%tpl_main_modal_container-->

View File

@ -6,9 +6,8 @@ $().ready(function() {
}
var $modal_id = $this.attr('data-modal-id') || 'main';
var $modal = $('#' + $modal_id + 'Modal');
var href = $this.attr('href');
if($modal.length) {
$modal.find('.modalOKButton').attr('href', href);
$modal.find('.modalOKButton').data('modal-origin', $this);
var param = $this.attr('data-modal-param');
if(param) {
@ -18,6 +17,7 @@ $().ready(function() {
$($modal).find('span.modalP' + (index+1)).text(value);
}
}
scroll(0, 0);
$modal.modal('show');
} else {
// Just in case we forgot the dialog box
@ -28,6 +28,18 @@ $().ready(function() {
}
return false;
});
$('.modalOKButton').click(function(e) {
var $this = $(this);
var $origin = $this.data('modal-origin');
if ($origin.is('a')) {
window.location = $origin.attr('href');
} else {
$origin.next('input[type=hidden]').attr('value', 1);
$origin.closest('form').submit();
}
return false;
});
psm_flash_message();
psm_tooltips();