예제 #1
0
파일: Groups.php 프로젝트: juniortux/jaws
 /**
  * Prepares list of groups for datagrid
  *
  * @access  public
  * @param   bool    $enabled    Status of the group
  * @param   int     $offset     Offset of data array
  * @return  array   Grid data
  */
 function GetGroups($enabled, $offset = null)
 {
     $uModel = new Jaws_User();
     $groups = $uModel->GetGroups(0, $enabled, 'title', 12, $offset);
     if (Jaws_Error::IsError($groups)) {
         return array();
     }
     $retData = array();
     foreach ($groups as $group) {
         $grpData = array();
         $grpData['title'] = $group['title'];
         $grpData['name'] = $group['name'];
         $actions = '';
         if ($this->gadget->GetPermission('ManageGroups')) {
             $link =& Piwi::CreateWidget('Link', _t('GLOBAL_EDIT'), "javascript: editGroup(this, '" . $group['id'] . "');", STOCK_EDIT);
             $actions .= $link->Get() . ' ';
         }
         if ($this->gadget->GetPermission('ManageGroupACLs')) {
             $link =& Piwi::CreateWidget('Link', _t('USERS_ACLS'), "javascript: editACL(this, '" . $group['id'] . "', 'GroupACL');", 'gadgets/Users/Resources/images/acls.png');
             $actions .= $link->Get() . ' ';
         }
         if ($this->gadget->GetPermission('ManageGroups')) {
             $link =& Piwi::CreateWidget('Link', _t('USERS_GROUPS_MEMBERS'), "javascript: editGroupUsers(this, '" . $group['id'] . "');", 'gadgets/Users/Resources/images/groups_mini.png');
             $actions .= $link->Get() . ' ';
         }
         if ($this->gadget->GetPermission('ManageGroups')) {
             $link =& Piwi::CreateWidget('Link', _t('USERS_GROUPS_DELETE'), "javascript: deleteGroup(this, '" . $group['id'] . "');", STOCK_DELETE);
             $actions .= $link->Get() . ' ';
         }
         $grpData['actions'] = $actions;
         $retData[] = $grpData;
     }
     return $retData;
 }
예제 #2
0
파일: Share.php 프로젝트: juniortux/jaws
 /**
  * Fetches list of system user groups
  *
  * @access  public
  * @return  array   Array of groups or an empty array
  */
 function ShareForm()
 {
     $tpl = $this->gadget->template->load('Share.html');
     $tpl->SetBlock('share');
     $tpl->SetVariable('lbl_shared_for', _t('DIRECTORY_SHARED_FOR'));
     $tpl->SetVariable('lbl_public', _t('DIRECTORY_FILE_PUBLIC_URL'));
     $tpl->SetVariable('lbl_make_public', _t('DIRECTORY_FILE_MAKE_PUBLIC'));
     // Edit UI
     if ($this->gadget->GetPermission('ShareFile')) {
         $tpl->SetBlock('share/edit');
         $tpl->SetVariable('lbl_groups', _t('DIRECTORY_GROUPS'));
         $tpl->SetVariable('lbl_users', _t('DIRECTORY_USERS'));
         $uModel = new Jaws_User();
         $groups = $uModel->GetGroups(true, 'title');
         if (!Jaws_Error::IsError($groups)) {
             $combo =& Piwi::CreateWidget('Combo', 'groups');
             $combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)');
             $combo->AddOption('All Users', 0);
             foreach ($groups as $group) {
                 $combo->AddOption($group['title'], $group['id']);
             }
             $tpl->SetVariable('groups', $combo->Get());
         }
         $tpl->ParseBlock('share/edit');
         $tpl->SetBlock('share/actions');
         $tpl->SetVariable('lbl_ok', _t('GLOBAL_OK'));
         $tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL'));
         $tpl->ParseBlock('share/actions');
     }
     $tpl->ParseBlock('share');
     return $tpl->Get();
 }
예제 #3
0
파일: Share.php 프로젝트: juniortux/jaws
 /**
  * Builds sharing UI
  *
  * @access  public
  * @return  string  XHTML UI
  */
 function ShareNote()
 {
     // Fetch note
     $id = (int) jaws()->request->fetch('id', 'get');
     $model = $this->gadget->model->load('Notepad');
     $uid = (int) $GLOBALS['app']->Session->GetAttribute('user');
     $note = $model->GetNote($id, $uid);
     if (Jaws_Error::IsError($note) || empty($note) || $note['user'] != $uid) {
         return;
     }
     $this->AjaxMe('site_script.js');
     $tpl = $this->gadget->template->load('Share.html');
     $tpl->SetBlock('share');
     $tpl->SetVariable('id', $id);
     $tpl->SetVariable('UID', $uid);
     $tpl->SetVariable('note_title', $note['title']);
     $tpl->SetVariable('title', _t('NOTEPAD_SHARE'));
     $tpl->SetVariable('lbl_users', _t('NOTEPAD_USERS'));
     $tpl->SetVariable('notepad_url', $this->gadget->urlMap('Notepad'));
     // User groups
     $uModel = new Jaws_User();
     $groups = $uModel->GetGroups(true, 'title');
     if (!Jaws_Error::IsError($groups)) {
         $combo =& Piwi::CreateWidget('Combo', 'sys_groups');
         $combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)');
         $combo->AddOption(_t('NOTEPAD_ALL_USERS'), 0);
         foreach ($groups as $group) {
             $combo->AddOption($group['title'], $group['id']);
         }
         $tpl->SetVariable('groups', $combo->Get());
     }
     $tpl->SetVariable('lbl_groups', _t('NOTEPAD_GROUPS'));
     // Note users
     $model = $this->gadget->model->load('Share');
     $combo =& Piwi::CreateWidget('Combo', 'note_users');
     $combo->SetSize(10);
     $users = $model->GetNoteUsers($id);
     if (!Jaws_Error::IsError($users) && !empty($users)) {
         foreach ($users as $user) {
             if ($user['user_id'] != $uid) {
                 $combo->AddOption($user['nickname'] . ' (' . $user['username'] . ')', $user['user_id']);
             }
         }
     }
     $tpl->SetVariable('note_users', $combo->Get());
     $tpl->SetVariable('lbl_note_users', _t('NOTEPAD_SHARED_FOR'));
     // Actions
     $tpl->SetVariable('lbl_ok', _t('GLOBAL_OK'));
     $tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL'));
     $tpl->SetVariable('url_back', $this->gadget->urlMap('Notepad'));
     $tpl->ParseBlock('share');
     return $tpl->Get();
 }
예제 #4
0
 /**
  * Builds sharing UI
  *
  * @access  public
  * @return  string  XHTML UI
  */
 function ShareEvent()
 {
     // Fetch event
     $id = (int) jaws()->request->fetch('id', 'get');
     $model = $this->gadget->model->load('Event');
     $uid = (int) $GLOBALS['app']->Session->GetAttribute('user');
     $event = $model->GetEvent($id, $uid);
     if (Jaws_Error::IsError($event) || empty($event) || $event['user'] != $uid) {
         return;
     }
     $this->AjaxMe('site_script.js');
     $tpl = $this->gadget->template->load('ShareEvent.html');
     $tpl->SetBlock('share');
     $tpl->SetVariable('title', _t('EVENTSCALENDAR_SHARE'));
     $tpl->SetVariable('id', $id);
     $tpl->SetVariable('UID', $uid);
     $tpl->SetVariable('subject', $event['subject']);
     $tpl->SetVariable('lbl_users', _t('EVENTSCALENDAR_USERS'));
     $tpl->SetVariable('events_url', $this->gadget->urlMap('ManageEvents'));
     // User groups
     $uModel = new Jaws_User();
     $groups = $uModel->GetGroups($uid, true, 'title');
     if (!Jaws_Error::IsError($groups)) {
         $combo =& Piwi::CreateWidget('Combo', 'sys_groups');
         $combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)');
         $combo->AddOption(_t('EVENTSCALENDAR_ALL_USERS'), 0);
         foreach ($groups as $group) {
             $combo->AddOption($group['title'], $group['id']);
         }
         $tpl->SetVariable('groups', $combo->Get());
     }
     $tpl->SetVariable('lbl_groups', _t('EVENTSCALENDAR_GROUPS'));
     // Event users
     $model = $this->gadget->model->load('Share');
     $combo =& Piwi::CreateWidget('Combo', 'event_users');
     $combo->SetSize(10);
     $users = $model->GetEventUsers($id);
     if (!Jaws_Error::IsError($users) && !empty($users)) {
         foreach ($users as $user) {
             if ($user['user'] != $uid) {
                 $combo->AddOption($user['nickname'] . ' (' . $user['username'] . ')', $user['user']);
             }
         }
     }
     $tpl->SetVariable('event_users', $combo->Get());
     $tpl->SetVariable('lbl_event_users', _t('EVENTSCALENDAR_SHARED_FOR'));
     // Actions
     $tpl->SetVariable('lbl_ok', _t('GLOBAL_OK'));
     $tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL'));
     $tpl->SetVariable('url_back', $this->gadget->urlMap('ViewEvent', array('id' => $id)));
     $tpl->ParseBlock('share');
     return $tpl->Get();
 }
예제 #5
0
파일: Groups.php 프로젝트: juniortux/jaws
 /**
  * Prepares a form for manage user's groups
  *
  * @access  public
  * @return  string  XHTML template of a form
  */
 function Groups()
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
     }
     $this->gadget->CheckPermission('ManageUserGroups');
     $this->AjaxMe('index.js');
     $response = $GLOBALS['app']->Session->PopResponse('Users.Groups');
     $user = $GLOBALS['app']->Session->GetAttribute('user');
     $jUser = new Jaws_User();
     $groups = $jUser->GetGroups($user);
     // Load the template
     $tpl = $this->gadget->template->load('Groups.html');
     $tpl->SetBlock('groups');
     if (!empty($response)) {
         $tpl->SetVariable('type', $response['type']);
         $tpl->SetVariable('text', $response['text']);
     }
     $tpl->SetVariable('title', _t('USERS_GROUPS'));
     $tpl->SetVariable('menubar', $this->MenuBar('Groups'));
     $tpl->SetVariable('submenubar', $this->SubMenuBar('Groups', array('Groups', 'AddGroup')));
     $tpl->SetVariable('base_script', BASE_SCRIPT);
     $tpl->SetVariable('lbl_name', _t('GLOBAL_NAME'));
     $tpl->SetVariable('lbl_title', _t('GLOBAL_TITLE'));
     foreach ($groups as $group) {
         $tpl->SetBlock('groups/group');
         $tpl->SetVariable('id', $group['id']);
         $tpl->SetVariable('url', $this->gadget->urlMap('ManageGroup', array('gid' => $group['id'])));
         $tpl->SetVariable('name', $group['name']);
         $tpl->SetVariable('title', $group['title']);
         $tpl->ParseBlock('groups/group');
     }
     $tpl->SetVariable('lbl_actions', _t('GLOBAL_ACTIONS'));
     $tpl->SetVariable('lbl_no_action', _t('GLOBAL_NO_ACTION'));
     $tpl->SetVariable('lbl_delete', _t('GLOBAL_DELETE'));
     $tpl->SetVariable('icon_filter', STOCK_SEARCH);
     $tpl->SetVariable('icon_ok', STOCK_OK);
     $tpl->SetVariable('lbl_add_group', _t('USERS_ADD_GROUP'));
     $tpl->SetVariable('url_add_group', $this->gadget->urlMap('UserGroupUI'));
     $tpl->ParseBlock('groups');
     return $tpl->Get();
 }
예제 #6
0
파일: Compose.php 프로젝트: juniortux/jaws
 /**
  * Display Compose page
  *
  * @access  public
  * @return  string XHTML template content
  */
 function Compose()
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         return Jaws_HTTPError::Get(401);
     }
     $this->gadget->CheckPermission('SendMessage');
     $user = $GLOBALS['app']->Session->GetAttribute('user');
     $this->AjaxMe('site_script.js');
     $data = jaws()->request->fetch(array('id', 'user', 'reply', 'users:array'));
     $id = $data['id'];
     $userModel = new Jaws_User();
     $model = $this->gadget->model->load('Message');
     $tpl = $this->gadget->template->load('Compose.html');
     $tpl->SetBlock('compose');
     // Menubar
     $tpl->SetVariable('menubar', $this->MenuBar('Compose'));
     $body_value = "";
     $recipient_users = array();
     $recipient_groups = array();
     $show_recipient = true;
     // draft or reply
     if (!empty($id)) {
         $message = $model->GetMessage($id, true, false);
         // Check permissions
         if (!($message['from'] == $user && $message['to'] == 0) && $message['to'] != $user) {
             return Jaws_HTTPError::Get(403);
         }
         // open draft
         if (empty($data['reply'])) {
             // Check draft status
             if ($message['folder'] != PrivateMessage_Info::PRIVATEMESSAGE_FOLDER_DRAFT) {
                 return Jaws_HTTPError::Get(404);
             }
             $tpl->SetVariable('title', _t('PRIVATEMESSAGE_COMPOSE_MESSAGE'));
             $tpl->SetVariable('id', $id);
             $recipient_users = array_map('intval', explode(',', $message['recipient_users']));
             $recipient_groups = array_map('intval', explode(',', $message['recipient_groups']));
             $body_value = $message['body'];
             $tpl->SetVariable('subject', $message['subject']);
             $tpl->SetVariable('lbl_attachments', _t('PRIVATEMESSAGE_MESSAGE_ATTACHMENTS'));
             $tpl->SetVariable('attachment_ui', $this->GetMessageAttachmentUI($id));
             // reply a message
         } else {
             if (!empty($data['reply']) && $data['reply'] == 'true') {
                 $date_format = $this->gadget->registry->fetch('date_format');
                 $date = Jaws_Date::getInstance();
                 $usrModel = new Jaws_User();
                 $show_recipient = false;
                 $body_value = '[quote]' . $message['body'] . "[/quote]\r\n";
                 // show parent message
                 $tpl->SetBlock('compose/parent_message');
                 $tpl->SetBlock('compose/parent_message/message');
                 $tpl->SetVariable('confirmDelete', _t('PRIVATEMESSAGE_MESSAGE_CONFIRM_DELETE'));
                 $tpl->SetVariable('lbl_from', _t('PRIVATEMESSAGE_MESSAGE_FROM'));
                 $tpl->SetVariable('lbl_send_time', _t('PRIVATEMESSAGE_MESSAGE_SEND_TIME'));
                 $tpl->SetVariable('lbl_subject', _t('PRIVATEMESSAGE_MESSAGE_SUBJECT'));
                 $tpl->SetVariable('lbl_body', _t('PRIVATEMESSAGE_MESSAGE_BODY'));
                 $tpl->SetVariable('from', $message['from_nickname']);
                 $tpl->SetVariable('username', $message['from_username']);
                 $tpl->SetVariable('nickname', $message['from_nickname']);
                 $tpl->SetVariable('send_time', $date->Format($message['insert_time'], $date_format));
                 $tpl->SetVariable('subject', $message['subject']);
                 $tpl->SetVariable('body', $message['body']);
                 // user's avatar
                 $tpl->SetVariable('avatar', $usrModel->GetAvatar($message['avatar'], $message['email'], 80));
                 // user's profile
                 $tpl->SetVariable('user_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Profile', array('user' => $message['from_username'])));
                 if (!empty($message['attachments'])) {
                     $tpl->SetBlock('compose/parent_message/message/attachment');
                     $tpl->SetVariable('lbl_attachments', _t('PRIVATEMESSAGE_MESSAGE_ATTACHMENTS'));
                     foreach ($message['attachments'] as $file) {
                         $tpl->SetBlock('compose/parent_message/message/attachment/file');
                         $tpl->SetVariable('lbl_file_size', _t('PRIVATEMESSAGE_MESSAGE_FILE_SIZE'));
                         $tpl->SetVariable('file_name', $file['title']);
                         $tpl->SetVariable('file_size', Jaws_Utils::FormatSize($file['filesize']));
                         $tpl->SetVariable('file_download_link', $file['title']);
                         $file_url = $this->gadget->urlMap('Attachment', array('uid' => $message['to'], 'mid' => $message['id'], 'aid' => $file['id']));
                         $tpl->SetVariable('file_download_link', $file_url);
                         $tpl->ParseBlock('compose/parent_message/message/attachment/file');
                     }
                     $tpl->ParseBlock('compose/parent_message/message/attachment');
                 }
                 $tpl->ParseBlock('compose/parent_message/message');
                 $tpl->ParseBlock('compose/parent_message');
                 //
                 $tpl->SetVariable('parent', $id);
                 $tpl->SetVariable('title', _t('PRIVATEMESSAGE_REPLY'));
                 $tpl->SetVariable('subject', _t('PRIVATEMESSAGE_REPLY_ON', $message['subject']));
                 $tpl->SetVariable('recipient_user', $message['from']);
                 $recipient_users = array($message['from']);
                 $tpl->SetVariable('lbl_attachments', _t('PRIVATEMESSAGE_MESSAGE_ATTACHMENTS'));
                 $tpl->SetVariable('attachment_ui', $this->GetMessageAttachmentUI($id, false));
                 // forward a message
             } else {
                 if (!empty($data['reply']) && $data['reply'] == 'false') {
                     $tpl->SetVariable('title', _t('PRIVATEMESSAGE_FORWARD_MESSAGE'));
                     $body_value = $message['body'];
                     $tpl->SetVariable('subject', _t('PRIVATEMESSAGE_FORWARD_ABBREVIATION') . ' ' . $message['subject']);
                     $tpl->SetVariable('lbl_attachments', _t('PRIVATEMESSAGE_MESSAGE_ATTACHMENTS'));
                     $tpl->SetVariable('attachment_ui', $this->GetMessageAttachmentUI($id));
                 }
             }
         }
     } else {
         if (!empty($data['users'])) {
             $recipient_users = $data['users'];
         } else {
             if (!empty($data['user'])) {
                 $recipient_users = array($data['user']);
             }
         }
         $tpl->SetVariable('title', _t('PRIVATEMESSAGE_COMPOSE_MESSAGE'));
         $tpl->SetVariable('attachment_ui', $this->GetMessageAttachmentUI());
     }
     $body =& $GLOBALS['app']->LoadEditor('PrivateMessage', 'body', $body_value);
     $body->TextArea->SetRows(8);
     $body->setID('body');
     $body->SetWidth('100%');
     $tpl->SetVariable('body', $body->Get());
     if ($show_recipient) {
         $tpl->SetBlock('compose/recipients');
         $tpl->SetVariable('lbl_recipient', _t('PRIVATEMESSAGE_MESSAGE_RECIPIENTS'));
         $tpl->SetVariable('lbl_recipient_users', _t('PRIVATEMESSAGE_MESSAGE_RECIPIENT_USERS'));
         if (!empty($recipient_users)) {
             foreach ($recipient_users as $userId) {
                 $user_info = $userModel->GetUser($userId, true);
                 $tpl->SetBlock('compose/recipients/user');
                 $tpl->SetVariable('title', $user_info['nickname']);
                 $tpl->SetVariable('value', $user_info['id']);
                 $tpl->ParseBlock('compose/recipients/user');
             }
         }
         // Group List
         $bGroups =& Piwi::CreateWidget('Combo', 'recipient_groups');
         $bGroups->SetID('recipient_groups');
         $bGroups->setMultiple(true);
         $groups = $userModel->GetGroups($user, true);
         foreach ($groups as $group) {
             $bGroups->AddOption($group['title'], $group['id']);
         }
         $bGroups->setDefault($recipient_groups);
         $tpl->SetVariable('lbl_recipient_groups', _t('PRIVATEMESSAGE_MESSAGE_RECIPIENT_GROUPS'));
         $tpl->SetVariable('recipient_groups_opt', $bGroups->Get());
         $tpl->ParseBlock('compose/recipients');
     } else {
         $tpl->SetBlock('compose/recipient');
         $tpl->SetVariable('lbl_recipient', _t('PRIVATEMESSAGE_MESSAGE_RECIPIENTS'));
         $user_info = $userModel->GetUser($recipient_users[0]);
         // user's profile
         $tpl->SetVariable('recipient_user_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Profile', array('user' => $user_info['username'])));
         $tpl->SetVariable('recipient_user', $user_info['nickname']);
         $tpl->ParseBlock('compose/recipient');
     }
     $tpl->SetVariable('lbl_subject', _t('PRIVATEMESSAGE_MESSAGE_SUBJECT'));
     $tpl->SetVariable('lbl_body', _t('PRIVATEMESSAGE_MESSAGE_BODY'));
     $tpl->SetVariable('lbl_attachments', _t('PRIVATEMESSAGE_MESSAGE_ATTACHMENTS'));
     $tpl->SetVariable('lbl_save_draft', _t('PRIVATEMESSAGE_SAVE_DRAFT'));
     $tpl->SetVariable('lbl_send', _t('PRIVATEMESSAGE_SEND'));
     $tpl->SetVariable('lbl_back', _t('PRIVATEMESSAGE_BACK'));
     $tpl->SetVariable('lbl_file', _t('PRIVATEMESSAGE_FILE'));
     $tpl->SetVariable('lbl_add_file', _t('PRIVATEMESSAGE_ADD_ANOTHER_FILE'));
     $tpl->SetVariable('back_url', $this->gadget->urlMap('Messages', array('folder' => PrivateMessage_Info::PRIVATEMESSAGE_FOLDER_INBOX)));
     $tpl->SetVariable('icon_add', STOCK_ADD);
     $tpl->SetVariable('icon_remove', STOCK_REMOVE);
     $tpl->ParseBlock('compose');
     return $tpl->Get();
 }
예제 #7
0
파일: Mailer.php 프로젝트: Dulciane/jaws
 /**
  * Builds Mailer UI
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function Mailer()
 {
     $this->gadget->CheckPermission('AccessToMailer');
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Mailer.html');
     $tpl->SetBlock('mailer');
     // Menu bar
     $tpl->SetVariable('menubar', $this->MenuBar('Mailer'));
     // Options
     $radio =& Piwi::CreateWidget('RadioButtons', 'options', 'horizontal');
     $radio->AddOption(_t('CONTACT_MAILER_SEND_TO_USERS'), 1);
     $radio->AddOption(_t('CONTACT_MAILER_SEND_TO_ADDRESS'), 2);
     $radio->SetDefault(1);
     $radio->AddEvent(ON_CLICK, 'switchEmailTarget(this.value);');
     $tpl->SetVariable('options', $radio->Get());
     $userModel = new Jaws_User();
     // Group
     $groups = $userModel->GetGroups();
     $combo =& Piwi::CreateWidget('Combo', 'groups');
     $combo->AddEvent(ON_CHANGE, 'updateUsers(this.value)');
     $combo->AddOption(_t('CONTACT_MAILER_ALL_GROUPS'), 0);
     foreach ($groups as $group) {
         $combo->AddOption($group['title'], $group['id']);
     }
     $tpl->SetVariable('groups', $combo->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_GROUP'), $combo);
     $label->SetID('');
     $tpl->SetVariable('lbl_group', $label->Get());
     // Users
     $users = $userModel->GetUsers();
     $combo =& Piwi::CreateWidget('Combo', 'users');
     $combo->AddOption(_t('CONTACT_MAILER_ALL_GROUP_USERS'), 0);
     foreach ($users as $user) {
         $combo->AddOption($user['nickname'], $user['id']);
     }
     $tpl->SetVariable('users', $combo->Get());
     $tpl->SetVariable('target_user', count($users));
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_USER'), $combo);
     $label->SetID('');
     $tpl->SetVariable('lbl_user', $label->Get());
     // To
     $entry =& Piwi::CreateWidget('Entry', 'to');
     $tpl->SetVariable('to', $entry->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_TO'), $entry);
     $label->SetID('');
     $tpl->SetVariable('lbl_to', $label->Get());
     // Cc
     $entry =& Piwi::CreateWidget('Entry', 'cc');
     $tpl->SetVariable('cc', $entry->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_CC'), $entry);
     $label->SetID('');
     $tpl->SetVariable('lbl_cc', $label->Get());
     // Bcc
     $entry =& Piwi::CreateWidget('Entry', 'bcc');
     $tpl->SetVariable('bcc', $entry->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_BCC'), $entry);
     $label->SetID('');
     $tpl->SetVariable('lbl_bcc', $label->Get());
     // From
     $from_title = $this->gadget->registry->fetch('gate_title', 'Settings');
     $from_email = $this->gadget->registry->fetch('gate_email', 'Settings');
     if (!empty($from_email)) {
         $from = !empty($from_title) ? "{$from_title} <{$from_email}>" : $from_email;
     } else {
         $from = '';
     }
     $entry =& Piwi::CreateWidget('Entry', 'from', $from);
     $entry->SetEnabled(false);
     $tpl->SetVariable('from', $entry->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_FROM'), $entry);
     $label->SetID('');
     $tpl->SetVariable('lbl_from', $label->Get());
     // Subject
     $entry =& Piwi::CreateWidget('Entry', 'subject');
     $tpl->SetVariable('subject', $entry->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_SUBJECT'), $entry);
     $label->SetID('');
     $tpl->SetVariable('lbl_subject', $label->Get());
     // Attachment
     $entry =& Piwi::CreateWidget('FileEntry', 'attachment', '');
     $entry->SetID('attachment');
     $entry->SetSize(1);
     $entry->AddEvent(ON_CHANGE, 'uploadFile();');
     $tpl->SetVariable('attachment', $entry->Get());
     $button =& Piwi::CreateWidget('Button', 'btn_upload', _t('CONTACT_MAILER_ADD_ATTACHMENT'));
     $tpl->SetVariable('btn_upload', $button->Get());
     $link =& Piwi::CreateWidget('Link', _t('CONTACT_MAILER_REMOVE_ATTACHMENT'), 'javascript:removeAttachment();', 'images/stock/cancel.png');
     $tpl->SetVariable('remove', $link->get());
     // Message
     $editor =& $GLOBALS['app']->LoadEditor('Contact', 'message');
     $editor->setID('message');
     $editor->SetWidth('1000px');
     $tpl->SetVariable('message', $editor->Get());
     $label =& Piwi::CreateWidget('Label', _t('CONTACT_MAILER_MESSAGE'), $editor->TextArea);
     $label->SetID('');
     $tpl->SetVariable('lbl_message', $label->Get());
     // Actions
     $button =& Piwi::CreateWidget('Button', 'btn_new', _t('CONTACT_MAILER_BUTTON_NEW'), 'gadgets/Contact/Resources/images/contact_mini.png');
     $button->AddEvent(ON_CLICK, 'newEmail();');
     $tpl->SetVariable('btn_new', $button->Get());
     $button =& Piwi::CreateWidget('Button', 'btn_preview', _t('CONTACT_MAILER_BUTTON_PREVIEW'), 'gadgets/Contact/Resources/images/email_preview.png');
     $button->AddEvent(ON_CLICK, 'previewMessage();');
     $tpl->SetVariable('btn_preview', $button->Get());
     $button =& Piwi::CreateWidget('Button', 'btn_send', _t('CONTACT_MAILER_BUTTON_SEND'), 'gadgets/Contact/Resources/images/email_send.png');
     $button->AddEvent(ON_CLICK, 'sendEmail();');
     $tpl->SetVariable('btn_send', $button->Get());
     $tpl->SetVariable('lblAllGroupUsers', _t('CONTACT_MAILER_ALL_GROUP_USERS'));
     $tpl->SetVariable('groupHasNoUser', _t('CONTACT_ERROR_GROUP_HAS_NO_USER'));
     $tpl->SetVariable('incompleteMailerFields', _t('CONTACT_INCOMPLETE_FIELDS'));
     $tpl->ParseBlock('mailer');
     return $tpl->Get();
 }
예제 #8
0
파일: Properties.php 프로젝트: uda/jaws
 /**
  * Builds admin properties UI
  *
  * @access  public
  * @return  string  XHTML form
  */
 function Properties()
 {
     $this->gadget->CheckPermission('ManageProperties');
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Properties.html');
     $tpl->SetBlock('Properties');
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Users'));
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'SaveProperties'));
     $authtype =& Piwi::CreateWidget('Combo', 'authtype');
     $authtype->SetTitle(_t('GLOBAL_AUTHTYPE'));
     foreach ($GLOBALS['app']->GetAuthTypes() as $method) {
         $authtype->AddOption($method, $method);
     }
     $authtype->SetDefault($this->gadget->registry->fetch('authtype'));
     $authtype->SetEnabled($this->gadget->GetPermission('ManageAuthenticationMethod'));
     $anonRegister =& Piwi::CreateWidget('Combo', 'anon_register');
     $anonRegister->SetTitle(_t('USERS_PROPERTIES_ANON_REGISTER'));
     $anonRegister->AddOption(_t('GLOBAL_YES'), 'true');
     $anonRegister->AddOption(_t('GLOBAL_NO'), 'false');
     $anonRegister->SetDefault($this->gadget->registry->fetch('anon_register'));
     $anonactivate =& Piwi::CreateWidget('Combo', 'anon_activation');
     $anonactivate->SetTitle(_t('USERS_PROPERTIES_ANON_ACTIVATION'));
     $anonactivate->AddOption(_t('USERS_PROPERTIES_ACTIVATION_AUTO'), 'auto');
     $anonactivate->AddOption(_t('USERS_PROPERTIES_ACTIVATION_BY_USER'), 'user');
     $anonactivate->AddOption(_t('USERS_PROPERTIES_ACTIVATION_BY_ADMIN'), 'admin');
     $anonactivate->SetDefault($this->gadget->registry->fetch('anon_activation'));
     $userModel = new Jaws_User();
     $anonGroup =& Piwi::CreateWidget('Combo', 'anon_group');
     $anonGroup->SetID('anon_group');
     $anonGroup->SetTitle(_t('USERS_PROPERTIES_ANON_GROUP'));
     $anonGroup->AddOption(_t('USERS_GROUPS_NOGROUP'), 0);
     $groups = $userModel->GetGroups(null, 'title');
     if (!Jaws_Error::IsError($groups)) {
         foreach ($groups as $group) {
             $anonGroup->AddOption($group['title'], $group['id']);
         }
     }
     $anonGroup->SetDefault($this->gadget->registry->fetch('anon_group'));
     $passRecovery =& Piwi::CreateWidget('Combo', 'password_recovery');
     $passRecovery->SetTitle(_t('USERS_PROPERTIES_PASS_RECOVERY'));
     $passRecovery->AddOption(_t('GLOBAL_YES'), 'true');
     $passRecovery->AddOption(_t('GLOBAL_NO'), 'false');
     $passRecovery->SetDefault($this->gadget->registry->fetch('password_recovery'));
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet('');
     $fieldset->SetTitle('vertical');
     $fieldset->Add($authtype);
     $fieldset->Add($anonRegister);
     $fieldset->Add($anonactivate);
     $fieldset->Add($anonGroup);
     $fieldset->Add($passRecovery);
     $form->Add($fieldset);
     $buttons =& Piwi::CreateWidget('HBox');
     $buttons->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
     $save->AddEvent(ON_CLICK, 'javascript:saveSettings();');
     $buttons->Add($save);
     $form->Add($buttons);
     $tpl->SetVariable('form', $form->Get());
     $tpl->SetVariable('menubar', $this->MenuBar('Properties'));
     $tpl->ParseBlock('Properties');
     return $tpl->Get();
 }
예제 #9
0
파일: Users.php 프로젝트: juniortux/jaws
 /**
  * Builds the user-groups UI
  *
  * @access  public
  * @return  string  XHTML form
  */
 function UserGroupsUI()
 {
     $tpl = $this->gadget->template->loadAdmin('UserGroups.html');
     $tpl->SetBlock('user_groups');
     $uModel = new Jaws_User();
     $user_groups =& Piwi::CreateWidget('CheckButtons', 'user_groups');
     $user_groups->setColumns(1);
     $groups = $uModel->GetGroups();
     foreach ($groups as $group) {
         $user_groups->AddOption($group['title'] . ' (' . $group['name'] . ')', $group['id'], 'group_' . $group['id']);
     }
     $tpl->SetVariable('lbl_user_groups', _t('USERS_USERS_MARK_GROUPS'));
     $tpl->SetVariable('user_groups', $user_groups->Get());
     $tpl->ParseBlock('user_groups');
     return $tpl->Get();
 }