Example #1
0
 protected function getComponentMarkup(OW_Component $cmp)
 {
     /* @var $document OW_AjaxDocument */
     $document = OW::getDocument();
     $responce = array();
     $responce['content'] = trim($cmp->render());
     $beforeIncludes = $document->getScriptBeforeIncludes();
     if (!empty($beforeIncludes)) {
         $responce['beforeIncludes'] = $beforeIncludes;
     }
     foreach ($document->getScripts() as $script) {
         $responce['scriptFiles'][] = $script;
     }
     $onloadScript = $document->getOnloadScript();
     if (!empty($onloadScript)) {
         $responce['onloadScript'] = $onloadScript;
     }
     $styleDeclarations = $document->getStyleDeclarations();
     if (!empty($styleDeclarations)) {
         $responce['styleDeclarations'] = $styleDeclarations;
     }
     $styleSheets = $document->getStyleSheets();
     if (!empty($styleSheets)) {
         $responce['styleSheets'] = $styleSheets;
     }
     return $responce;
 }
 public function render()
 {
     $cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css';
     OW::getDocument()->addStyleSheet($cssUrl);
     FBCONNECT_BOL_Service::getInstance()->initializeJs();
     return parent::render();
 }
Example #3
0
 public function render()
 {
     $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     $this->assign('defaultAvatarUrl', $defaultAvatarUrl);
     $js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
     OW::getDocument()->addOnloadScript($js, 3006);
     //TODO check this config
     $enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
     $this->assign('enableAttachments', $enableAttachments);
     $replyToMessageActionPromotedText = '';
     $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
     $isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
     if (!$isAuthorizedReplyToMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
     $isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
     if (!$isAuthorizedReplyToChatMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
     $this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
     if ($isAuthorizedReplyToMessage) {
         $text = new WysiwygTextarea('mailbox_message');
         $text->setId('conversationTextarea');
         $this->assign('mailbox_message', $text->renderInput());
     }
     return parent::render();
 }
Example #4
0
 public function render()
 {
     $cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css';
     OW::getDocument()->addStyleSheet($cssUrl);
     FBCONNECT_BOL_Service::getInstance()->initializeJs(array('email', 'user_about_me', 'user_birthday'), $_GET);
     return parent::render();
 }
Example #5
0
 public function render()
 {
     if (empty($this->sortItems)) {
         $this->setVisible(false);
     }
     $this->assign('itemList', $this->sortItems);
     return parent::render();
 }
Example #6
0
 public function render()
 {
     if ($this->oembed["type"] == "video" && !empty($this->oembed["html"])) {
         $this->initJs();
     }
     $this->assign('data', $this->oembed);
     return parent::render();
 }
Example #7
0
 public function render()
 {
     //	init
     $iLimit = OW::getConfig()->getValue('ynsocialconnect', 'limit_providers_view_on_login_header');
     $iLimitSelected = OW::getConfig()->getValue('ynsocialconnect', 'limit_providers_view_on_login_header');
     //	process
     //$aOpenProviders = YNSOCIALCONNECT_BOL_ServicesService::getInstance() -> getEnabledProviders($iLimit, (int)$iLimitSelected);
     $aOpenProviders = YNSOCIALCONNECT_BOL_ServicesService::getInstance()->getProvidersByStatus($bDisplay = true);
     $listProvider = array();
     $step = 0;
     foreach ($aOpenProviders as $item) {
         if (in_array($item->name, array('facebook', 'twitter', 'linkedin'))) {
             if (!YNSOCIALCONNECT_CLASS_SocialConnect::getInstance()->checkSocialBridgePlugin($item->name)) {
                 continue;
             }
         }
         $listProvider[] = $item;
         $step++;
         if ($step >= $iLimit) {
             break;
         }
     }
     $iIconSize = intval(OW::getConfig()->getValue('ynsocialconnect', 'size_of_provider_icon_px')) >= 0 ? intval(OW::getConfig()->getValue('ynsocialconnect', 'size_of_provider_icon_px')) : 24;
     $iWidth = (count($listProvider) + 1) * ($iIconSize + 6);
     $this->assign('iLimitView', $iLimit);
     $this->assign('iLimitSelected', $iLimitSelected);
     $this->assign('aOpenProviders', $listProvider);
     $this->assign('iIconSize', $iIconSize);
     $this->assign('iWidth', $iWidth);
     $this->assign('sCoreUrl', OW_DIR_ROOT);
     $this->assign('sImgSrc', OW::getPluginManager()->getPlugin('ynsocialconnect')->getStaticUrl() . 'img/');
     //	set url redirect to session
     $uri = OW::getRequest()->getRequestUri();
     // @formatter:off
     if (isset($uri) && strpos($uri, 'socialbridge') === false && strpos($uri, 'ynsocialbridge') === false && strpos($uri, 'ynsocialconnect') === false && strpos($uri, 'socialconnect') === false) {
         $uri = OW_URL_HOME . $uri;
         $_SESSION['ynsc_session']['urlRedirect'] = $uri;
     }
     // @formatter:on
     if (OW::getSession()->isKeySet(YNSOCIALCONNECT_CTRL_Sync::SESSION_SIGNUP_DATA)) {
         $signupData = OW::getSession()->get(YNSOCIALCONNECT_CTRL_Sync::SESSION_SIGNUP_DATA);
         $profilePicture = YNSOCIALCONNECT_CLASS_SocialConnect::getInstance()->getPhotoUrlFromTokenData($signupData['user'], $signupData['service']);
         if ($profilePicture == null) {
             //OW::getSession() -> set(self::SESSION_USE_PROFILE_PHOTO, 'not_use');
             $profilePicture = "";
         } else {
             //OW::getSession() -> set(self::SESSION_USE_PROFILE_PHOTO, 'use');
             $url = OW::getRouter()->urlFor('YNSOCIALCONNECT_CTRL_Sync', 'removeAvatar');
             $removeEl = "<div class=\"ow_avatar_change\"><a href=\"javascript:void(0);\" onclick=\"YNSocialConnect.removeAvatar(\\'{$url}\\');\" class=\"ow_lbutton\">X</a></div>";
             //$removeEl = "<div class=\"ow_avatar_change\"><a href=\"javascript:void(0);\" onclick=\"YNSocialConnect.removeAvatar();\" class=\"ow_lbutton\">X</a></div>";
             $profilePicture = "<div id=\"ynsc_profile_picture\" class=\"ynsc_profile_photo_center\"><img class=\"ynsc_profile_phpto\" src=\"" . $profilePicture . "\">" . $removeEl . "</div><br />";
         }
         $this->assign('profilePicture', $profilePicture);
     }
     //	end
     return parent::render();
 }
Example #8
0
 public function render()
 {
     $tplTabs = array();
     foreach ($this->tabs as $item) {
         $tplTabs[] = array('label' => $item['label'], 'content' => $item['cmp']->render(), 'icon' => $item['icon'], 'active' => false);
     }
     $tplTabs[0]['active'] = true;
     $this->assign('tabs', $tplTabs);
     return parent::render();
 }
Example #9
0
 public function render()
 {
     $tplComponentList = array();
     foreach ($this->componentList as $item) {
         $position = $this->positionList[$item['uniqName']];
         $tplComponentList[$position['order']] = $item;
     }
     ksort($tplComponentList);
     $this->assign('componentList', $tplComponentList);
     return parent::render();
 }
Example #10
0
 public function render()
 {
     $userId = OW::getUser()->getId();
     $userSettingsForm = MAILBOX_BOL_ConversationService::getInstance()->getUserSettingsForm();
     $this->addForm($userSettingsForm);
     $userSettingsForm->getElement('user_id')->setValue($userId);
     $friendsEnabled = (bool) OW::getEventManager()->call('plugin.friends');
     $this->assign('friendsEnabled', $friendsEnabled);
     $showAllMembersModeEnabled = (bool) OW::getConfig()->getValue('mailbox', 'show_all_members');
     $this->assign('showAllMembersModeEnabled', $showAllMembersModeEnabled);
     return parent::render();
 }
Example #11
0
 private function getTxt()
 {
     $template = OW::getPluginManager()->getPlugin('matchmaking')->getCmpViewDir() . 'notification_txt.html';
     $this->setTemplate($template);
     $this->assign('nl', self::NL_PLACEHOLDER);
     $this->assign('tab', self::TAB_PLACEHOLDER);
     $this->assign('space', self::SPACE_PLACEHOLDER);
     $content = parent::render();
     $search = array(self::NL_PLACEHOLDER, self::TAB_PLACEHOLDER, self::SPACE_PLACEHOLDER);
     $replace = array("\n", '    ', ' ');
     return str_replace($search, $replace, $content);
 }
Example #12
0
 public function render()
 {
     //	init
     $iLimit = OW::getConfig()->getValue('ynsocialconnect', 'limit_providers_view_on_login_header');
     $iLimitSelected = OW::getConfig()->getValue('ynsocialconnect', 'limit_providers_view_on_login_header');
     //	process
     //$aOpenProviders = YNSOCIALCONNECT_BOL_ServicesService::getInstance() -> getEnabledProviders($iLimit, (int)$iLimitSelected);
     $aOpenProviders = YNSOCIALCONNECT_BOL_ServicesService::getInstance()->getProvidersByStatus($bDisplay = true);
     $listProvider = array();
     $step = 0;
     foreach ($aOpenProviders as $item) {
         if (in_array($item->name, array('facebook', 'twitter', 'linkedin'))) {
             if (!YNSOCIALCONNECT_CLASS_SocialConnect::getInstance()->checkSocialBridgePlugin($item->name)) {
                 continue;
             }
         }
         $listProvider[] = $item;
         $step++;
         if ($step >= $iLimit) {
             break;
         }
     }
     $iIconSize = intval(OW::getConfig()->getValue('ynsocialconnect', 'size_of_provider_icon_px')) >= 0 ? intval(OW::getConfig()->getValue('ynsocialconnect', 'size_of_provider_icon_px')) : 24;
     $iWidth = (count($listProvider) + 1) * ($iIconSize + 6);
     $this->assign('iLimitView', $iLimit);
     $this->assign('iLimitSelected', $iLimitSelected);
     $this->assign('aOpenProviders', $listProvider);
     $this->assign('iIconSize', $iIconSize);
     $this->assign('iWidth', $iWidth);
     $this->assign('sCoreUrl', OW_DIR_ROOT);
     $this->assign('sImgSrc', OW::getPluginManager()->getPlugin('ynsocialconnect')->getStaticUrl() . 'img/');
     if (YNSOCIALCONNECT_CLASS_Helper::getInstance()->getIsViewMore() == '0') {
         $staticUrl = OW::getPluginManager()->getPlugin('ynsocialconnect')->getStaticUrl();
         $document = OW::getDocument();
         $document->addScript($staticUrl . 'js/ynsocialconnect.js');
         $this->assign('isShowViewMore', '1');
         $this->addComponent('eicmp', new YNSOCIALCONNECT_CMP_ViewMore());
     }
     //	set url redirect to session
     $uri = OW::getRequest()->getRequestUri();
     // @formatter:off
     if (isset($uri) && strpos($uri, 'socialbridge') === false && strpos($uri, 'ynsocialbridge') === false && strpos($uri, 'ynsocialconnect') === false && strpos($uri, 'socialconnect') === false) {
         $uri = OW_URL_HOME . $uri;
         $_SESSION['ynsc_session']['urlRedirect'] = $uri;
     }
     // @formatter:ofn
     //	end
     return parent::render();
 }
Example #13
0
 public function render()
 {
     if ($this->getTemplate() === null) {
         try {
             $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey(get_class($this)));
         } catch (InvalidArgumentException $e) {
             $plugin = null;
         }
         if ($plugin !== null) {
             $template = OW::getAutoloader()->classToFilename(get_class($this), false);
             $this->setTemplate($plugin->getMobileCmpViewDir() . $template . '.html');
         }
     }
     return parent::render();
 }
Example #14
0
 public function render()
 {
     if (!count($this->actions)) {
         $this->setVisible(false);
     } else {
         $visible = true;
         foreach ($this->actions as &$action) {
             if (empty($action['subactions']) && !$action['action']->getLabel()) {
                 $visible = false;
                 break;
             }
             if (!empty($action['subactions'])) {
                 usort($action['subactions'], array($this, 'sortActionsCallback'));
             }
         }
         $this->setVisible($visible);
     }
     usort($this->actions, array($this, 'sortParentActionsCallback'));
     $this->assign('actions', $this->actions);
     $this->assign('position', $this->position);
     $this->setVisible(true);
     return parent::render();
 }
Example #15
0
 public function render()
 {
     $this->assign("images", $this->images);
     $this->assign("url", $this->url);
     $this->assign("label", $this->label);
     $this->assign("iconClass", $this->iconClass);
     $autoDisplayType = count($this->images);
     $autoDisplayType = $autoDisplayType > 4 ? 4 : $autoDisplayType;
     $this->assign("displayType", $this->displayType !== null ? $this->displayType : $autoDisplayType);
     return parent::render();
 }
Example #16
0
 public function render()
 {
     $boxSettings = $this->getBoxSettingList($this->settingList, $this->runTimeSettingList);
     $boxSettings['access'] = $this->getComponentAccess();
     $this->assign('box', $boxSettings);
     return parent::render();
 }
 protected function getSettingFormMarkup(OW_Component $viewInstance)
 {
     /* @var $document OW_AjaxDocument */
     $document = OW::getDocument();
     $responce = array();
     $responce['content'] = $viewInstance->render();
     foreach ($document->getScripts() as $script) {
         $responce['scriptFiles'][] = $script;
     }
     $onloadScript = $document->getOnloadScript();
     if (!empty($onloadScript)) {
         $responce['onloadScript'] = $onloadScript;
     }
     $styleDeclarations = $document->getStyleDeclarations();
     if (!empty($styleDeclarations)) {
         $responce['styleDeclarations'] = $styleDeclarations;
     }
     $styleSheets = $document->getStyleSheets();
     if (!empty($styleSheets)) {
         $responce['styleSheets'] = $styleSheets;
     }
     return $responce;
 }
Example #18
0
 public function render()
 {
     $this->data['displayType'] = $this->displayType;
     $this->actionList = $this->getActionsList();
     $this->initializeJs();
     $list = $this->createFeedList($this->actionList, $this->data);
     $list->setDisplayType($this->displayType);
     $this->assign('list', $list->render());
     $this->assign('autoId', $this->autoId);
     $this->assign('data', $this->data);
     if ($this->displayType == self::DISPLAY_TYPE_PAGE || !$this->data['viewMore']) {
         $viewMore = 0;
     } else {
         $viewMore = $this->getActionsCount() - $this->data['displayCount'];
         $viewMore = $viewMore < 0 ? 0 : $viewMore;
     }
     $this->assign('viewMore', $viewMore);
     return parent::render();
 }
Example #19
0
 public function render()
 {
     $this->consoleItem->setControl(parent::render());
     return $this->consoleItem->render();
 }
Example #20
0
 public function getTxt()
 {
     $template = OW::getPluginManager()->getPlugin('notifications')->getCmpViewDir() . 'notification_txt.html';
     $this->setTemplate($template);
     $this->assign('nl', '%%%nl%%%');
     $this->assign('tab', '%%%tab%%%');
     $this->assign('space', '%%%space%%%');
     $content = parent::render();
     $search = array('%%%nl%%%', '%%%tab%%%', '%%%space%%%');
     $replace = array("\n", '    ', ' ');
     return str_replace($search, $replace, $content);
 }
Example #21
0
 public function render()
 {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("base")->getStaticJsUrl() . "jquery-ui.min.js");
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('ajaxim')->getStaticJsUrl() . 'audio-player.js');
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('ajaxim')->getStaticJsUrl() . 'ajaxim.js');
     $node = OW::getUser()->getId();
     $password = '';
     $domain = 'localhost';
     $port = 0;
     $username = BOL_UserService::getInstance()->getDisplayName($node);
     $avatar = BOL_AvatarService::getInstance()->getAvatarUrl(OW::getUser()->getId());
     if (empty($avatar)) {
         $avatar = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $jsGenerator = UTIL_JsGenerator::newInstance();
     $jsGenerator->setVariable('im_oldTitle', OW::getDocument()->getTitle());
     $jsGenerator->setVariable('im_soundEnabled', (bool) BOL_PreferenceService::getInstance()->getPreferenceValue('ajaxim_user_settings_enable_sound', OW::getUser()->getId()));
     $jsGenerator->setVariable('im_awayTimeout', 5000);
     //TODO change to 30000
     $jsGenerator->setVariable('im_soundSwf', OW::getPluginManager()->getPlugin('ajaxim')->getStaticUrl() . 'js/player.swf');
     $jsGenerator->setVariable('im_soundUrl', OW::getPluginManager()->getPlugin('ajaxim')->getStaticUrl() . 'sound/receive.mp3');
     $jsGenerator->setVariable('window.ajaximLogMsgUrl', OW::getRouter()->urlFor('AJAXIM_CTRL_Action', 'logMsg'));
     $jsGenerator->setVariable('window.ajaximGetLogUrl', OW::getRouter()->urlFor('AJAXIM_CTRL_Action', 'getLog'));
     $jsGenerator->setVariable('window.im_updateUserInfoUrl', OW::getRouter()->urlFor('AJAXIM_CTRL_Action', 'updateUserInfo'));
     $jsGenerator->setVariable('window.im_userBlockedMessage', OW::getLanguage()->text('base', 'user_block_message'));
     $site_timezone = OW::getConfig()->getValue('base', 'site_timezone');
     $site_datetimezone = new DateTimeZone($site_timezone);
     $site_datetime = new DateTime("now", $site_datetimezone);
     $jsGenerator->setVariable('ajaximSiteTimezoneOffset', $site_datetimezone->getOffset($site_datetime) * 1000);
     $isFriendsOnlyMode = (bool) OW::getEventManager()->call('plugin.friends');
     $jsGenerator->setVariable('im_isFriendsOnlyMode', (bool) $isFriendsOnlyMode);
     $privacyPluginActive = OW::getEventManager()->call('plugin.privacy');
     $this->assign('privacyPluginActive', $privacyPluginActive);
     $privacyActionValue = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => OW::getUser()->getId(), 'action' => 'ajaxim_invite_to_chat'));
     $jsGenerator->setVariable('im_privacyActionValue', $privacyActionValue);
     if ($privacyPluginActive) {
         $this->assign('privacy_settings_url', OW::getRouter()->urlForRoute('privacy_index'));
         $visibleForFriends = $privacyActionValue == 'friends_only';
         $visibleForEverybody = $privacyActionValue == 'everybody';
     } else {
         $visibleForFriends = false;
         $visibleForEverybody = true;
     }
     $jsGenerator->setVariable('im_visibleForFriends', $visibleForFriends);
     $jsGenerator->setVariable('im_visibleForEverybody', $visibleForEverybody);
     $this->assign('im_sound_url', OW::getPluginManager()->getPlugin('ajaxim')->getStaticUrl() . 'sound/receive.mp3');
     /* Instant Chat DEBUG MODE */
     $debugMode = false;
     $jsGenerator->setVariable('im_debug_mode', $debugMode);
     $this->assign('debug_mode', $debugMode);
     $variables = $jsGenerator->generateJs();
     $details = array('userId' => OW::getUser()->getId(), 'node' => $node, 'password' => $password, 'username' => $username, 'domain' => $domain, 'avatar' => $avatar);
     OW::getDocument()->addScriptDeclaration("window.OW_InstantChat.Details = " . json_encode($details) . ";\n " . $variables);
     $userSettingsForm = AJAXIM_BOL_Service::getInstance()->getUserSettingsForm();
     $this->addForm($userSettingsForm);
     $userSettingsForm->getElement('user_id')->setValue(OW::getUser()->getId());
     $avatar_proto_data = array('url' => 1, 'src' => BOL_AvatarService::getInstance()->getDefaultAvatarUrl(), 'class' => 'talk_box_avatar');
     $this->assign('avatar_proto_data', $avatar_proto_data);
     $this->assign('no_avatar_url', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
     $this->assign('online_list_url', OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'online')));
     return parent::render();
 }
Example #22
0
 public function getHtml()
 {
     $template = OW::getPluginManager()->getPlugin('ocs_guests2')->getCmpViewDir() . 'landing_html.html';
     $this->setTemplate($template);
     return parent::render();
 }
Example #23
0
 private function getHtml()
 {
     $this->setTemplate(OW::getPluginManager()->getPlugin('bookmarks')->getCmpViewDir() . 'notify_html.html');
     return parent::render();
 }
Example #24
0
 public function render()
 {
     $this->assign('data', $this->oembed);
     return parent::render();
 }
Example #25
0
 public function render()
 {
     FBCONNECT_BOL_Service::getInstance()->initializeJs();
     return parent::render();
 }
Example #26
0
 public function render()
 {
     FBCONNECT_BOL_Service::getInstance()->initializeJs(array('email', 'user_about_me', 'user_birthday'), $_GET);
     return parent::render();
 }
Example #27
0
 public function render()
 {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("base")->getStaticJsUrl() . "jquery-ui.min.js");
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'underscore-min.js', 'text/javascript', 3000);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'backbone-min.js', 'text/javascript', 3000);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'audio-player.js');
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'mailbox.js', 'text/javascript', 3000);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'contactmanager.js', 'text/javascript', 3001);
     OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('mailbox')->getStaticCssUrl() . 'mailbox.css');
     $conversationService = MAILBOX_BOL_ConversationService::getInstance();
     $userId = OW::getUser()->getId();
     $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
     $avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatarUrl)) {
         $avatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $profileUrl = BOL_UserService::getInstance()->getUserUrl($userId);
     $jsGenerator = UTIL_JsGenerator::newInstance();
     $jsGenerator->setVariable('OWMailbox.documentTitle', OW::getDocument()->getTitle());
     $jsGenerator->setVariable('OWMailbox.soundEnabled', (bool) BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_user_settings_enable_sound', $userId));
     $jsGenerator->setVariable('OWMailbox.showOnlineOnly', (bool) BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_user_settings_show_online_only', $userId));
     $jsGenerator->setVariable('OWMailbox.showAllMembersMode', (bool) OW::getConfig()->getValue('mailbox', 'show_all_members'));
     $jsGenerator->setVariable('OWMailbox.soundSwfUrl', OW::getPluginManager()->getPlugin('mailbox')->getStaticUrl() . 'js/player.swf');
     $jsGenerator->setVariable('OWMailbox.soundUrl', OW::getPluginManager()->getPlugin('mailbox')->getStaticUrl() . 'sound/receive.mp3');
     $jsGenerator->setVariable('OWMailbox.defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
     $jsGenerator->setVariable('OWMailbox.serverTimezoneOffset', date('Z') / 3600);
     $jsGenerator->setVariable('OWMailbox.useMilitaryTime', (bool) OW::getConfig()->getValue('base', 'military_time'));
     $jsGenerator->setVariable('OWMailbox.getHistoryResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'getHistory'));
     $jsGenerator->setVariable('OWMailbox.openDialogResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'updateUserInfo'));
     $jsGenerator->setVariable('OWMailbox.attachmentsSubmitUrl', OW::getRouter()->urlFor('BASE_CTRL_Attachment', 'addFile'));
     $jsGenerator->setVariable('OWMailbox.attachmentsDeleteUrl', OW::getRouter()->urlFor('BASE_CTRL_Attachment', 'deleteFile'));
     $jsGenerator->setVariable('OWMailbox.authorizationResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'authorization'));
     $jsGenerator->setVariable('OWMailbox.responderUrl', OW::getRouter()->urlFor("MAILBOX_CTRL_Mailbox", "responder"));
     $jsGenerator->setVariable('OWMailbox.userListUrl', OW::getRouter()->urlForRoute('mailbox_user_list'));
     $jsGenerator->setVariable('OWMailbox.convListUrl', OW::getRouter()->urlForRoute('mailbox_conv_list'));
     $jsGenerator->setVariable('OWMailbox.pingResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'ping'));
     $jsGenerator->setVariable('OWMailbox.settingsResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'settings'));
     $jsGenerator->setVariable('OWMailbox.userSearchResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'rsp'));
     $jsGenerator->setVariable('OWMailbox.bulkOptionsResponderUrl', OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'bulkOptions'));
     $plugin_update_timestamp = 0;
     if (OW::getConfig()->configExists('mailbox', 'plugin_update_timestamp')) {
         $plugin_update_timestamp = OW::getConfig()->getValue('mailbox', 'plugin_update_timestamp');
     }
     $jsGenerator->setVariable('OWMailbox.pluginUpdateTimestamp', $plugin_update_timestamp);
     $todayDate = date('Y-m-d', time());
     $jsGenerator->setVariable('OWMailbox.todayDate', $todayDate);
     $todayDateLabel = UTIL_DateTime::formatDate(time(), true);
     $jsGenerator->setVariable('OWMailbox.todayDateLabel', $todayDateLabel);
     $activeModeList = $conversationService->getActiveModeList();
     $chatModeEnabled = in_array('chat', $activeModeList) ? true : false;
     $this->assign('chatModeEnabled', $chatModeEnabled);
     $jsGenerator->setVariable('OWMailbox.chatModeEnabled', $chatModeEnabled);
     $jsGenerator->setVariable('OWMailbox.useChat', $this->useChat);
     $mailModeEnabled = in_array('mail', $activeModeList) ? true : false;
     $this->assign('mailModeEnabled', $mailModeEnabled);
     $jsGenerator->setVariable('OWMailbox.mailModeEnabled', $mailModeEnabled);
     $isAuthorizedSendMessage = OW::getUser()->isAuthorized('mailbox', 'send_message');
     $this->assign('isAuthorizedSendMessage', $isAuthorizedSendMessage);
     $configs = OW::getConfig()->getValues('mailbox');
     //        if ( !empty($configs['enable_attachments']))
     //        {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'attachments.js');
     //        }
     $this->assign('im_sound_url', OW::getPluginManager()->getPlugin('mailbox')->getStaticUrl() . 'sound/receive.mp3');
     /* DEBUG MODE */
     $debugMode = false;
     $jsGenerator->setVariable('im_debug_mode', $debugMode);
     $this->assign('debug_mode', $debugMode);
     $variables = $jsGenerator->generateJs();
     $details = array('userId' => $userId, 'displayName' => $displayName, 'profileUrl' => $profileUrl, 'avatarUrl' => $avatarUrl);
     OW::getDocument()->addScriptDeclaration("OWMailbox.userDetails = " . json_encode($details) . ";\n " . $variables);
     OW::getLanguage()->addKeyForJs('mailbox', 'find_contact');
     OW::getLanguage()->addKeyForJs('base', 'user_block_message');
     OW::getLanguage()->addKeyForJs('mailbox', 'send_message_failed');
     OW::getLanguage()->addKeyForJs('mailbox', 'confirm_conversation_delete');
     OW::getLanguage()->addKeyForJs('mailbox', 'silent_mode_off');
     OW::getLanguage()->addKeyForJs('mailbox', 'silent_mode_on');
     OW::getLanguage()->addKeyForJs('mailbox', 'show_all_users');
     OW::getLanguage()->addKeyForJs('mailbox', 'show_all_users');
     OW::getLanguage()->addKeyForJs('mailbox', 'show_online_only');
     OW::getLanguage()->addKeyForJs('mailbox', 'new_message');
     OW::getLanguage()->addKeyForJs('mailbox', 'mail_subject_prefix');
     OW::getLanguage()->addKeyForJs('mailbox', 'chat_subject_prefix');
     OW::getLanguage()->addKeyForJs('mailbox', 'new_message_count');
     OW::getLanguage()->addKeyForJs('mailbox', 'chat_message_empty');
     OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation');
     $avatar_proto_data = array('url' => 1, 'src' => BOL_AvatarService::getInstance()->getDefaultAvatarUrl(), 'class' => 'talk_box_avatar');
     $this->assign('avatar_proto_data', $avatar_proto_data);
     $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
     $this->assign('online_list_url', OW::getRouter()->urlForRoute('base_user_lists', array('list' => 'online')));
     /**/
     $actionPromotedText = '';
     $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
     $isAuthorizedSendMessage = OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
     $isAuthorized = $isAuthorizedReplyToMessage || $isAuthorizedSendMessage;
     if (!$isAuthorized) {
         $actionName = 'send_chat_message';
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $actionPromotedText = $status['msg'];
         }
     }
     $this->assign('replyToMessageActionPromotedText', $actionPromotedText);
     $this->assign('isAuthorizedReplyToMessage', $isAuthorized);
     /**/
     $lastSentMessage = $conversationService->getLastSentMessage($userId);
     $lastMessageTimestamp = (int) ($lastSentMessage ? $lastSentMessage->timeStamp : 0);
     if ($chatModeEnabled) {
         $countOnline = BOL_UserService::getInstance()->countOnline();
         if ($countOnline < 5) {
             $pingInterval = 5000;
         } else {
             if ($countOnline > 15) {
                 $pingInterval = 15000;
             } else {
                 $pingInterval = 5000;
                 //TODO think about ping interval here
             }
         }
     } else {
         $pingInterval = 30000;
     }
     $applicationParams = array('pingInterval' => $pingInterval, 'lastMessageTimestamp' => $lastMessageTimestamp);
     $js = UTIL_JsGenerator::composeJsString('OW.Mailbox = new OWMailbox.Application({$params});', array('params' => $applicationParams));
     OW::getDocument()->addOnloadScript($js, 3003);
     $js = "\n        OW.Mailbox.contactManager = new MAILBOX_ContactManager;\n        OW.Mailbox.contactManagerView = new MAILBOX_ContactManagerView({model: OW.Mailbox.contactManager});";
     OW::getDocument()->addOnloadScript($js, 3009);
     return parent::render();
 }
Example #28
-1
 public function render()
 {
     if ($this->getTemplate() === null) {
         $template = OW::getAutoloader()->classToFilename(get_class($this), false);
         $this->setTemplate($this->getViewDir() . "formats" . DS . $template . '.html');
     }
     return parent::render();
 }