Revize 2017
Přidáno uživatelem David Raška před více než 11 roky(ů)
freenetis/branches/1.1/application/controllers/js.php | ||
---|---|---|
{
|
||
$this->ip_addresses_complete();
|
||
}
|
||
|
||
private function _js_mail_write_message()
|
||
{
|
||
// load users for autocomplete
|
||
$um = new User_Model();
|
||
|
||
$user_list = $um
|
||
->select_list('login', "CONCAT(surname, ' ', COALESCE(name,''), ' - ', login)", 'surname');
|
||
|
||
$result = array();
|
||
|
||
foreach ($user_list AS $login => $user)
|
||
{
|
||
$result[] = array(
|
||
'login' => $login,
|
||
'value' => $user
|
||
);
|
||
}
|
||
|
||
private function _js_members_add()
|
||
$this->views['mail_write_message'] = View::factory('js/mail_write_message');
|
||
$this->views['mail_write_message']->users_list = json_encode($result);
|
||
}
|
||
|
||
private function _js_members_add()
|
||
{
|
||
$this->address_point_streets();
|
||
$this->address_point_gps();
|
freenetis/branches/1.1/application/controllers/mail.php | ||
---|---|---|
$form = new Forge(url::base(TRUE).url::current(TRUE));
|
||
|
||
$form->input('to')
|
||
->class('mail_to_field')
|
||
->class('mail_to_field autocomplete')
|
||
->rules('required')
|
||
->value($to_value)
|
||
->callback(array($this, 'valid_to_field'))
|
||
... | ... | |
{
|
||
$form_data = $form->as_array(FALSE);
|
||
|
||
$recipients = explode(',', trim($form_data['to']));
|
||
|
||
$recipients = explode(',', trim(trim($form_data['to']), ','));
|
||
|
||
$user_model = new User_Model();
|
||
|
||
try
|
||
... | ... | |
Log::add_exception($e);
|
||
}
|
||
}
|
||
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Write new message');
|
||
$view->content = new View('mail/main');
|
freenetis/branches/1.1/application/views/js/base.php | ||
---|---|---|
|
||
$.validator.addMethod('to_field', function(value)
|
||
{
|
||
return value.match(/^([a-z][a-z0-9]*[_]{0,1}[a-z0-9]+),?[ ]*(([a-z][a-z0-9]*[_]{0,1}[a-z0-9]+),?[ ]*)*$/);
|
||
<?php $regex = Settings::get('username_regex') ?>
|
||
|
||
var usernames = explode(',', trim(trim(value), ','));
|
||
|
||
var match = true;
|
||
var index;
|
||
|
||
for (index = 0; index < usernames.length; index++)
|
||
{
|
||
if (!(trim(usernames[index]).match(<?php echo $regex ?>)))
|
||
{
|
||
match = false;
|
||
}
|
||
}
|
||
|
||
return match;
|
||
}, '<?php echo __('Invalid value') ?>');
|
||
|
||
$.validator.addMethod('suffix', function(value)
|
freenetis/branches/1.1/application/views/js/mail_write_message.php | ||
---|---|---|
<?php
|
||
/**
|
||
* Mail write message javascript view.
|
||
*/
|
||
|
||
// IDE complementation
|
||
if (FALSE): ?><script type="text/javascript"><?php endif
|
||
|
||
?>
|
||
// list of users
|
||
var users_list = <?php echo $users_list ?>;
|
||
|
||
function split( val )
|
||
{
|
||
return val.split( /,\s*/ );
|
||
}
|
||
|
||
function extractLast( term )
|
||
{
|
||
return split( term ).pop();
|
||
}
|
||
|
||
// add jQuery UI autocomplete
|
||
$('#to.autocomplete')
|
||
.bind('keydown', function(event)
|
||
{
|
||
if (event.keyCode === $.ui.keyCode.TAB &&
|
||
$(this).data('ui-autocomplete').menu.active)
|
||
{
|
||
event.preventDefault();
|
||
}
|
||
})
|
||
.autocomplete(
|
||
{
|
||
minLength: 0,
|
||
source: function(request, response)
|
||
{
|
||
response ($.ui.autocomplete.filter(
|
||
users_list, extractLast(request.term)));
|
||
},
|
||
focus: function()
|
||
{
|
||
return false;
|
||
},
|
||
select: function(event, ui)
|
||
{
|
||
// add multiple labels
|
||
var labels = split(this.value);
|
||
labels.pop();
|
||
labels.push(ui.item.login);
|
||
labels.push("");
|
||
this.value = labels.join(", ");
|
||
|
||
return false;
|
||
}
|
||
});
|
||
|
||
|
Také k dispozici: Unified diff
Nove:
- closes #653 - implementace inteligentniho adresniho radku pri odeslani vnitrni posty