/** * @param PageBuilder $pageBuilder * @return MessageListTable */ function MessageListTable(&$pagebuilder) { $this->_pagebuilder =& $pagebuilder; $this->_proc =& $pagebuilder->_proc; $this->sortField = Get::val('s_fld', 0); $this->sortOrder = Get::val('s_ord', 0); $this->page = $this->_proc->sArray[PAGE]; $this->_proc->account->DefaultOrder = $this->sortField + $this->sortOrder; $this->folders =& $this->_proc->GetFolders(); if (isset($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) && strlen($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) > 0) { if ($this->_proc->sArray[SEARCH_ARRAY][S_FOLDER] > -2) { $this->folder =& $this->folders->GetFolderById((int) $this->_proc->sArray[FOLDER_ID]); $this->_proc->processor->GetFolderInfo($this->folder); $this->folders =& new FolderCollection(); $this->folders->Add($this->folder); } else { $this->folder = null; } $field = $this->_proc->sArray[SEARCH_ARRAY][S_MODE] == 'onlyheaders'; $condition = ConvertUtils::ConvertEncoding($this->_proc->sArray[SEARCH_ARRAY][S_TEXT], $this->_proc->account->GetUserCharset(), $this->_proc->account->DbCharset); $this->messCount = (int) $this->_proc->processor->SearchMessagesCount($condition, $this->folders, $field); $this->messageCollection =& $this->_proc->processor->SearchMessages($this->page, $condition, $this->folders, $field, $this->messCount); } else { $cfolder =& $this->_proc->GetCurrentFolder(); if ($cfolder) { $this->folder =& $cfolder; $this->messCount = (int) $this->folder->MessageCount; if ($this->_proc->account->MailsPerPage * ($this->page - 1) >= $this->messCount) { $this->page = (int) ceil($this->messCount / $this->_proc->account->MailsPerPage); } $this->page = $this->page < 1 ? $this->page = 1 : $this->page; $this->messageCollection =& $this->_proc->processor->GetMessageHeaders($this->page, $this->folder); } else { $this->folder = null; $this->messCount = 0; $this->page = 1; $this->messageCollection =& new WebMailMessageCollection(); } } if ($this->folder && $this->folders) { $this->folders->InitToFolder($this->folder); } if ($this->messageCollection === null) { $this->folder = null; $this->messCount = 0; $this->page = 1; $this->messageCollection =& new WebMailMessageCollection(); SetOnlineError(PROC_CANT_GET_MSG_LIST); } $jsTempString = $this->_proc->currentFolder && $this->_proc->currentFolder->Type == FOLDERTYPE_Drafts ? 'BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '";' : 'BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_FULLSCREEN . '";'; $flagjs = ' var line = InboxLines.GetLinesById(id); if (line.Flagged) { InboxLines.SetParams([id], "Flagged", false, false); } else { InboxLines.SetParams([id], "Flagged", true, false); } DoFlagOneMessage(line); '; if ($this->_proc->account->MailProtocol != MAILPROTOCOL_IMAP4 && $this->_proc->currentFolder && $this->_proc->currentFolder->SyncType == FOLDERSYNC_DirectMode) { $flagjs = ''; } $this->_pagebuilder->AddJSText(' function CheckThisLine(e, trobj) { var id = trobj.id; e = e ? e : window.event; if (e.ctrlKey) { InboxLines.CheckCtrlLine(id); } else if (e.shiftKey) { InboxLines.CheckShiftLine(id); } else { if (Browser.Mozilla) {var elem = e.target;} else {var elem = e.srcElement;} if (!elem || id == "" || elem.id == "none") { return false; } var loverTag = elem.tagName.toLowerCase(); if (loverTag == "a") { LoadMessageFull(id); } else if (loverTag == "input") { InboxLines.CheckCBox(id); } else if (loverTag == "img") { ' . $flagjs . ' } else if (isPreviewPane) { InboxLines.CheckLine(id); LoadMessage(id); } } } function CheckThisLineDb(e, trobj) { var id = trobj.id; e = e ? e : window.event; if (Browser.Mozilla) { var elem = e.target; } else { var elem = e.srcElement; } if (!elem || id == "" || elem.id == "none" || elem.tagName.toLowerCase() == "input") { return false; } LoadMessageFull(id); } function LoadMessageFull(lineid) { var parseObj = ParseLineId(lineid); var obj = InboxLines.GetLinesById(lineid); ' . $jsTempString . ' BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Form.submit(); } function LoadMessage(lineid) { if (tempReq != lineid){ InfoPanel._isError = false; InfoPanel.SetInfo(Lang.Loading); InfoPanel.Show(); tempReq = lineid; var parseObj = ParseLineId(lineid); var obj = InboxLines.GetLinesById(lineid); BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Form.submit(); } } function DoForwardButton() { var lineobjs = InboxLines.GetCheckedLinesObj(); if (lineobjs && lineobjs.length == 1) { var obj = lineobjs[0]; var parseObj = ParseLineId(obj.Id); BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"; BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Type.value = "forward"; BaseForm.Form.submit(); } } function DoReplyButton() { var lineobjs = InboxLines.GetCheckedLinesObj(); if (lineobjs && lineobjs.length == 1) { var obj = lineobjs[0]; var parseObj = ParseLineId(obj.Id); BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"; BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Type.value = "reply"; BaseForm.Form.submit(); } } function DoReplyAllButton() { var lineobjs = InboxLines.GetCheckedLinesObj(); if (lineobjs && lineobjs.length == 1) { var obj = lineobjs[0]; var parseObj = ParseLineId(obj.Id); BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"; BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Type.value = "replytoall"; BaseForm.Form.submit(); } } function ChangeCharset(newCharset) { var idline = BaseForm.MessId.value + sep + BaseForm.MessUid.value + sep + BaseForm.FolderId.value + sep + BaseForm.Charset.value + sep; var newidline = BaseForm.MessId.value + sep + BaseForm.MessUid.value + sep + BaseForm.FolderId.value + sep + newCharset + sep; BaseForm.Charset.value = newCharset; for (var i=0; i<InboxLines.length; i++) { if (InboxLines.lines[i].Id == idline) { InboxLines.lines[i].Id = newidline; InboxLines.lines[i]._tr.id = newidline; } } } function ParseLineId(lineid) { var IdArray = lineid.split(sep); if (IdArray.length > 3) { var objcharset = (IdArray[3]) ? IdArray[3] : -1; return {id: IdArray[0], uid: IdArray[1], folder_id: IdArray[2], charset: objcharset} } return null; } '); $this->_pagebuilder->AddInitText(' PageSwitcher.Show(' . $this->page . ', ' . $this->_proc->account->MailsPerPage . ', ' . $this->messCount . ', "document.location.replace(\'?s_ord=' . $this->sortOrder . '&s_fld=' . $this->sortField . '&page=", "\');"); tempReq = ""; function CBaseForm() { this.Form = document.getElementById("messform"); this.MessId = document.getElementById("m_id"); this.MessUid = document.getElementById("m_uid"); this.FolderId = document.getElementById("f_id"); this.FolderName = document.getElementById("f_name"); this.Charset = document.getElementById("charset"); this.Plain = document.getElementById("plain"); this.Type = document.getElementById("mtype"); } BaseForm = new CBaseForm(); '); }
/** * @param PageBuilder $pagebuilder * @return SettingsAccount */ function SettingsAccount(&$pagebuilder) { $this->_pagebuilder =& $pagebuilder; $this->_proc =& $pagebuilder->_proc; $screen = $this->_proc->sArray[SCREEN]; if ($this->_proc->sArray[EDIT_ACCOUNT_ID] != $this->_proc->account->Id) { if (array_key_exists($this->_proc->sArray[EDIT_ACCOUNT_ID], $this->_proc->accounts)) { $this->_editAccount =& Account::LoadFromDb($this->_proc->sArray[EDIT_ACCOUNT_ID]); $this->_editProccessor =& new MailProcessor($this->_editAccount); $this->_editFolders =& $this->_editProccessor->GetFolders(); } else { $this->_editAccount =& $this->_proc->account; $this->_editProccessor =& $this->_proc->processor; $this->_editFolders =& $this->_proc->GetFolders(); } } else { $this->_editAccount =& $this->_proc->account; $this->_editProccessor =& $this->_proc->processor; $this->_editFolders =& $this->_proc->GetFolders(); } $this->data['allowNewAccount'] = !$this->_proc->settings->AllowUsersAddNewAccounts || !$this->_editAccount->AllowChangeSettings ? '' : ' <input type="button" value="' . JS_LANG_AddNewAccount . '" onclick="document.location=\'' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_ADDACC . '\';" class="wm_button" ID="Button4" NAME="Button2"/>'; $this->data['accountsTable'] = ''; $accounts =& $this->_proc->GetAccounts(); foreach ($accounts as $keyid => $value) { $isCurrent = $keyid == $this->_editAccount->Id; $class = $isCurrent ? ' class="wm_settings_list_select"' : ' class="wm_control"'; $name = $isCurrent ? '<b>' . $value[4] . '</b>' : $value[4]; //$name .= ($value[6]) ? ' (default)' : ''; $onclick = $isCurrent ? '' : ' onclick="document.location=\'' . BASEFILE . '?' . EDIT_ACCOUNT_ID . '=' . $keyid . '\';"'; $deleteHref = $this->_proc->account->IsDemo ? '<a href="#" onclick="return DoAlert();">' . JS_LANG_Delete . '</a>' : '<a href="' . ACTIONFILE . '?action=delete&req=account&acctid=' . $keyid . '" onclick="return confirm(\'' . ConfirmDeleteAccount . '\');">' . JS_LANG_Delete . '</a>'; $deleteHref = $this->_editAccount->AllowChangeSettings ? $deleteHref : ''; $this->data['accountsTable'] .= ' <tr' . $class . '> <td' . $onclick . '>' . $name . '</td> <td style="width: 10px;">' . $deleteHref . '</td> </tr>'; } if ($screen == SET_ACCOUNT_ADDACC && !$this->_proc->settings->AllowUsersAddNewAccounts) { $screen = SET_ACCOUNT_PROF; } $this->_main =& new SettingsAccountForms($screen, $this); $this->data['tabSwitcher'] = ''; if ($screen != SET_ACCOUNT_ADDACC) { $this->data['tabSwitcher'] .= ' <div class="wm_settings_accounts_info"> <div class="wm_settings_switcher_indent"></div>'; $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_MFOLDERS ? '<div class="wm_settings_switcher_select_item">' . JS_LANG_ManageFolders . '</div>' : '<div class="wm_settings_switcher_item"><a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_MFOLDERS . '">' . JS_LANG_ManageFolders . '</a></div>'; $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_SIGNATURE ? '<div class="wm_settings_switcher_select_item">' . JS_LANG_Signature . '</div>' : '<div class="wm_settings_switcher_item"><a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_SIGNATURE . '">' . JS_LANG_Signature . '</a></div>'; $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_FILTERS ? '<div class="wm_settings_switcher_select_item"> ' . JS_LANG_Filters . ' </div>' : '<div class="wm_settings_switcher_item"> <a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_FILTERS . '">' . JS_LANG_Filters . '</a> </div>'; if ($this->_editAccount->AllowChangeSettings) { $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_PROF ? '<div class="wm_settings_switcher_select_item">' . JS_LANG_Properties . '</div>' : '<div class="wm_settings_switcher_item"><a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_PROF . '">' . JS_LANG_Properties . '</a></div>'; } $this->data['tabSwitcher'] .= '</div>'; } }