/** * @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(); '); }