Example #1
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->assign("uniqId", $this->uniqId);
     $this->assign("snippets", $this->snippets);
     $this->initStatic();
 }
Example #2
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $displayCount = 60;
     $list = $this->getList();
     $idList = empty($list['idList']) ? array() : $list['idList'];
     $allList = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false, true, false);
     $allList = empty($allList) ? array() : $allList;
     $cachelist = array();
     foreach ($allList as $uid => $info) {
         $info['userId'] = $uid;
         $info['kw'] = strtolower($info['title']);
         $cachelist[$uid] = $info;
     }
     $tplList = array_slice($cachelist, 0, $displayCount);
     $this->initJs($cachelist, $list['count']);
     $this->assign('list', $tplList);
     $this->assign('friendsMode', $this->friendsMode);
     $this->assign('uniqId', $this->uniqId);
     $language = OW::getLanguage();
     $this->assign('langs', array('ask' => $language->text('equestions', 'user_select_button_ask')));
     $this->assign('fakeAvatar', array('src' => '-', 'title' => '-'));
     $moderator = OW::getUser()->isAuthorized('equestions');
     $this->assign('moderator', $moderator);
 }
Example #3
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->assign('uniqId', $this->uniqId);
     $language = OW::getLanguage();
     $this->assign('langs', array('uploadSave' => $language->text('attachments', 'attachments_upload_save_label'), 'takeSave' => $language->text('attachments', 'attachments_take_save_label'), 'cancel' => $language->text('attachments', 'attachments_cancel_label'), 'close' => $language->text('attachments', 'attachments_close_label'), 'chooseImage' => $language->text('attachments', 'attachments_choose_image_label')));
 }
Example #4
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $uniqId = uniqid('questionAdd');
     $this->assign('uniqId', $uniqId);
     $config = OW::getConfig()->getValues(EQUESTIONS_Plugin::PLUGIN_KEY);
     $this->assign('configs', $config);
     $form = $this->initForm();
     $this->addForm($form);
     EQUESTIONS_Plugin::getInstance()->addStatic();
     $attachmentsId = null;
     if ($config['attachments']) {
         $types = array();
         if ($config['attachments_image']) {
             $types[] = 'image';
         }
         if ($config['attachments_video']) {
             $types[] = 'video';
         }
         if ($config['attachments_link']) {
             $types[] = 'link';
         }
         $attachments = new EQUESTIONS_CMP_Attachments($types);
         $attachments->initJs();
         $this->addComponent('attachments', $attachments);
         $attachmentsId = $attachments->getUniqId();
     }
     $js = UTIL_JsGenerator::newInstance()->newObject('questionsAdd', 'QUESTIONS_QuestionAdd', array($uniqId, $form->getName(), array('maxQuestionLength' => 500, 'minQuestionLength' => 3, 'maxAnswerLength' => 150), $attachmentsId));
     OW::getDocument()->addOnloadScript($js);
 }
Example #5
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $userList = array();
     $userDtoList = array();
     $userService = BOL_UserService::getInstance();
     $questionService = BOL_QuestionService::getInstance();
     $userIdList = array_keys($this->userList);
     $userDataList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $this->fieldList);
     foreach ($userService->findUserListByIdList($userIdList) as $userDto) {
         $userDtoList[$userDto->id] = $userDto;
     }
     foreach ($this->userList as $userId => $fieldList) {
         $fields = array_diff(array_keys($fieldList), $this->fieldList);
         $fieldsData = $questionService->getQuestionData(array($userId), $fields);
         $userList[$userId]['fields'] = array_merge(!empty($userDataList[$userId]) ? $userDataList[$userId] : array(), !empty($fieldsData[$userId]) ? $fieldsData[$userId] : array(), $fieldList);
         $userList[$userId]['dto'] = $userDtoList[$userId];
     }
     $this->assign('userList', $userList);
     $this->assign('avatars', BOL_AvatarService::getInstance()->getAvatarsUrlList($userIdList, 2));
     $this->assign('onlineList', !empty($userIdList) ? $userService->findOnlineStatusForUserList($userIdList) : array());
     $this->assign('usernameList', $userService->getUserNamesForList($userIdList));
     $this->assign('displaynameList', $userService->getDisplayNamesForList($userIdList));
     $this->assign('displayActivity', $this->displayActivity);
 }
Example #6
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $viewAllUrl = OW::getRouter()->urlForRoute('mailbox_messages_default');
     $this->assign('viewAllUrl', $viewAllUrl);
     $conversationService = MAILBOX_BOL_ConversationService::getInstance();
     $activeModeList = $conversationService->getActiveModeList();
     $mailModeEnabled = in_array('mail', $activeModeList) ? true : false;
     $this->assign('mailModeEnabled', $mailModeEnabled);
     $actionName = 'send_message';
     $event = new OW_Event('mailbox.show_send_message_button', array(), false);
     OW::getEventManager()->trigger($event);
     $showSendMessage = $event->getData();
     $isAuthorizedSendMessage = $showSendMessage && OW::getUser()->isAuthorized('mailbox', $actionName);
     if (!$isAuthorizedSendMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $script = '$("#mailboxConsoleListSendMessageBtn").click(function(){
                 OW.authorizationLimitedFloatbox(' . json_encode($status['msg']) . ');
             });';
             OW::getDocument()->addOnloadScript($script);
             $isAuthorizedSendMessage = true;
             //this service is promoted
         }
     }
     $this->assign('isAuthorizedSendMessage', $isAuthorizedSendMessage);
 }
Example #7
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->assign('uniqId', $this->uniqId);
     $language = OW::getLanguage();
     $this->assign('langs', array('cancel' => $language->text('attachments', 'attachments_cancel_label'), 'close' => $language->text('attachments', 'attachments_close_label'), 'addEmbed' => $language->text('attachments', 'attachments_add_embed_label'), 'search' => $language->text('attachments', 'attachments_add_search_label'), 'addVideo' => $language->text('attachments', 'attachments_add_video_label')));
 }
Example #8
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->initStatic();
     $this->assign("uniqId", $this->uniqId);
     $this->assign("name", $this->fieldName);
     $this->assign("snippets", $this->getSnippets());
 }
Example #9
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $this->assign('avatar', $this->avatar);
     $this->assign('content', $this->content);
     $this->assign('toolbar', $this->toolbar);
     $this->assign('contentImage', $this->contentImage);
     $this->assign('url', $this->url);
 }
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $showId = $this->assignUniqidVar('showId');
     $deleteId = $this->assignUniqidVar('deleteId');
     $backId = $this->assignUniqidVar('backId');
     $containerId = $this->assignUniqidVar('containerId');
     OW::getDocument()->addOnloadScript("\n            ;function exitBulkOptions(){\n                \$('#{$containerId}').fadeOut(function(){\n                    \$('#{$showId}').parent().parent().fadeIn();\n                    \$(this).parents('.ow_fw_menu').find('.ow_admin_date_filter').fadeIn();\n                    \$('.ow_photo_context_action').show();\n                    \$('.ow_photo_item .ow_photo_chekbox_area').hide();\n                });\n            }\n            \$('#{$deleteId}').click(function(){\n                var deleteIds = [];\n\n                \$('.ow_photo_item.ow_photo_item_checked').each(function(){\n                    deleteIds.push(\$(this).closest('.ow_photo_item_wrap').data('photoId'));\n                });\n                photoContextAction.deleteImages(deleteIds);\n                exitBulkOptions();\n            });\n            \$('#{$showId}').click(function(){\n                \$('.ow_photo_item.ow_photo_item_checked').toggleClass('ow_photo_item_checked');\n                \$(this).parents('.ow_fw_menu').find('.ow_admin_date_filter').fadeOut();\n                \$('#{$showId}').parent().parent().fadeOut(function(){\n                    \$('#{$containerId}').fadeIn();\n                    \$('.ow_photo_context_action').hide();\n                    \$('.ow_photo_item .ow_photo_chekbox_area').show();\n                });\n            });\n            \$('#{$backId}').click(function(){\n                exitBulkOptions();\n            });\n            \$('.ow_photo_list').on('click', '.ow_photo_checkbox, .ow_photo_chekbox_area', function(e){\n                e.stopPropagation();\n                \$(this).parents('.ow_photo_item').toggleClass('ow_photo_item_checked');\n            });");
 }
Example #11
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $count = 42;
     $photos = $this->bridge->findUserPhotos($this->userId, 0, $count);
     $this->addComponent('photoList', new UHEADER_CMP_MyPhotoList($photos));
     $js = UTIL_JsGenerator::composeJsString('UHEADER.GallerySwitcher.registerTab({$tabKey}, new UHEADER.PhotoSelector({$params}, _scope));', array('params' => array('responder' => OW::getRouter()->urlFor('UHEADER_CTRL_Header', 'rsp'), 'userId' => $this->userId, 'tabKey' => $this->tabKey, 'listFull' => count($photos) < $count), "tabKey" => $this->tabKey));
     OW::getDocument()->addOnloadScript($js);
 }
Example #12
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $bridge = EQUESTIONS_CLASS_VideoBridge::getInstance();
     $this->assign('videoActive', $bridge->isActive());
     $this->assign('uniqId', $this->uniqId);
     $language = OW::getLanguage();
     $this->assign('langs', array('cancel' => $language->text('equestions', 'attachments_cancel_label'), 'close' => $language->text('equestions', 'attachments_close_label'), 'addEmbed' => $language->text('equestions', 'attachments_add_embed_label'), 'search' => $language->text('equestions', 'attachments_add_search_label'), 'addVideo' => $language->text('equestions', 'attachments_add_video_label'), 'chooseMy' => $language->text('equestions', 'attachments_choose_my_video_label')));
 }
Example #13
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     $configs = OW::getConfig()->getValues('questions');
     $optionTotal = QUESTIONS_BOL_Service::getInstance()->findOptionCount($this->question->id);
     $answerCount = QUESTIONS_BOL_Service::getInstance()->findTotalAnswersCount($this->question->id);
     $postCount = BOL_CommentService::getInstance()->findCommentCount(QUESTIONS_BOL_Service::ENTITY_TYPE, $this->question->id);
     $questionUrl = OW::getRouter()->urlForRoute('questions-question', array('qid' => $this->question->id));
     $count = QUESTIONS_BOL_Service::DISPLAY_COUNT;
     if ($optionTotal - $count < 2) {
         $count = $optionTotal;
     }
     $answers = new QUESTIONS_CMP_Answers($this->question, $optionTotal, array(0, $count));
     $answers->setTotalAnswerCount($answerCount);
     $answers->setUsersContext($this->getContextUserIds());
     $bubbleActivity = $this->getBubbleActivity();
     $jsSelector = 'QUESTIONS_AnswerListCollection.' . $answers->getUniqId();
     $text = $this->getItemString($bubbleActivity, $jsSelector, $questionUrl);
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($bubbleActivity->userId));
     $allowPopups = !isset($configs['allow_popups']) || $configs['allow_popups'];
     $features = array();
     $onClickStr = "window.location.href='{$questionUrl}'";
     if ($configs['allow_comments']) {
         if ($allowPopups) {
             $onClickStr = "return {$jsSelector}.openQuestionDelegate(true);";
         }
         $features[] = array('class' => 'q-' . $answers->getUniqId() . '-status-comments', 'iconClass' => 'ow_miniic_comment', 'label' => $postCount, 'onclick' => $onClickStr, 'string' => null);
     }
     if ($allowPopups) {
         $onClickStr = "return {$jsSelector}.openQuestionDelegate();";
     }
     $features[] = array('class' => 'q-' . $answers->getUniqId() . '-status-votes', 'iconClass' => 'questions_miniicon_check', 'label' => $answerCount, 'onclick' => $onClickStr, 'string' => null);
     if ($configs['enable_follow']) {
         $onClickStr = "OW.error('" . $language->text('questions', 'follow_not_allowed') . "')";
         $isFollowing = false;
         if (QUESTIONS_BOL_Service::getInstance()->isCurrentUserCanInteract($this->question)) {
             $userId = OW::getUser()->getId();
             $isFollowing = QUESTIONS_BOL_Service::getInstance()->isFollow($userId, $this->question->id);
             $onClickStr = $isFollowing ? $jsSelector . '.unfollowQuestion();' : $jsSelector . '.followQuestion();';
         } else {
             if (OW::getUser()->isAuthenticated()) {
                 $isFollowing = QUESTIONS_BOL_Service::getInstance()->isFollow($userId, $this->question->id);
                 if ($isFollowing) {
                     $onClickStr = $jsSelector . '.unfollowQuestion();';
                 }
             }
         }
         $features[] = array('class' => 'q-' . $answers->getUniqId() . '-status-follows', 'iconClass' => 'questions_miniic_follow', 'label' => QUESTIONS_BOL_Service::getInstance()->findFollowsCount($this->question->id), 'onclick' => $onClickStr, 'active' => $isFollowing);
     }
     $settings = $this->question->getSettings();
     $context = empty($settings['context']['url']) || empty($settings['context']['label']) ? null : array('url' => $settings['context']['url'], 'label' => $settings['context']['label']);
     $tplQuestion = array('questionId' => $this->question->id, 'uniqId' => $this->getUniqId(), 'text' => $text, 'timeStamp' => UTIL_DateTime::formatDate($bubbleActivity->timeStamp), 'lastItem' => $this->lastItem, 'answers' => $answers->render(), 'avatar' => $avatars[$bubbleActivity->userId], 'settings' => $settings, 'context' => $context, 'features' => $features, 'permalink' => $questionUrl);
     $event = new OW_Event(QUESTIONS_BOL_Service::EVENT_ON_LIST_ITEM_RENDER, array("questionId" => $this->question->id, "questionDto" => $this->question, "text" => $text, "settings" => $settings, "uniqId" => $this->getUniqId()), $tplQuestion);
     OW::getEventManager()->trigger($event);
     $this->assign('item', $event->getData());
 }
Example #14
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $id = uniqid('filter');
     $this->assign('id', $id);
     $images = BOL_ThemeService::getInstance()->findAllCssImages();
     $this->assign('dates', $this->getDates($images));
     $jsString = ";\$('#{$id} ul li a').click(function(e){\n            e.preventDefault();\n            window.browsePhoto.filter({'date': \$(this).data('date')});\n            \$(this).parents('.ow_context_action').find('.ow_context_action_value span').html(\$(this).html());\n        });\n        ";
     OW::getDocument()->addOnloadScript($jsString);
 }
Example #15
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     if (!empty($this->url) && !empty($this->backUri)) {
         $this->url = OW::getRequest()->buildUrlQueryString($this->url, array('backUri' => $this->getBackUri()));
     }
     $this->addComponent('entityList', $this->getListCmp());
     $this->assign('url', $this->url);
     $this->assign('viewAllLabel', $this->label);
     $this->assign('displayViewAllButton', $this->display);
 }
Example #16
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $options = array();
     $js = UTIL_JsGenerator::newInstance();
     $js->callFunction(array("UHEADER.GallerySwitcher", "init"), array($this->uniqId, $options));
     OW::getDocument()->addOnloadScript($js);
     $this->assign("uniqId", $this->uniqId);
     $this->assign("tabs", $this->getTabs());
     $this->assign("dimensions", $this->getDimensions());
 }
Example #17
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     if (!empty($this->oembed['title'])) {
         $this->oembed['title'] = UTIL_String::truncate($this->oembed['title'], 23, '...');
     }
     if (!empty($this->oembed['description'])) {
         $this->oembed['description'] = UTIL_String::truncate($this->oembed['description'], 40, '...');
     }
     $this->assign('message', $this->message);
     $this->assign('data', $this->oembed);
 }
Example #18
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $id = uniqid('addNewFile');
     $this->assign('id', $id);
     OW::getDocument()->addScriptDeclaration(UTIL_JsGenerator::composeJsString(';window[{$addNewFile}] = function()
                 {
                     var ajaxUploadPhotoFB = OW.ajaxFloatBox("BASE_CMP_AjaxFileUpload", [], {
                         $title: {$title},
                         addClass: "ow_admin_ajax_file_upload_form"
                     });
                 };', array('addNewFile' => $id, 'title' => OW::getLanguage()->text('base', 'upload_files'), 'close_alert' => OW::getLanguage()->text('base', 'close_alert'))));
 }
Example #19
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $items = BOL_AttachmentService::getInstance()->getFilesByBundleName($this->pluginKey, $this->uid);
     $itemsArr = array();
     foreach ($items as $item) {
         $itemsArr[] = array('name' => $item['dto']->getOrigFileName(), 'size' => $item['dto']->getSize(), 'dbId' => $item['dto']->getId());
     }
     $params = array('uid' => $this->uid, 'submitUrl' => OW::getRouter()->urlFor('BASE_CTRL_Attachment', 'addFile'), 'deleteUrl' => OW::getRouter()->urlFor('BASE_CTRL_Attachment', 'deleteFile'), 'showPreview' => $this->showPreview, 'selector' => $this->inputSelector, 'pluginKey' => $this->pluginKey, 'multiple' => $this->multiple, 'lItems' => $itemsArr);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'attachments.js');
     OW::getDocument()->addOnloadScript("owFileAttachments['" . $this->uid . "'] = new OWFileAttachment(" . json_encode($params) . ");");
     $this->assign('data', array('uid' => $this->uid, 'showPreview' => $this->showPreview, 'selector' => $this->inputSelector));
 }
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $uniqId = uniqid('questionAdd');
     $this->assign('uniqId', $uniqId);
     $config = OW::getConfig()->getValues(QUESTIONS_Plugin::PLUGIN_KEY);
     $this->assign('configs', $config);
     $form = $this->initForm();
     $this->addForm($form);
     QUESTIONS_Plugin::getInstance()->addStatic();
     $js = UTIL_JsGenerator::newInstance()->newObject('questionsAdd', 'QUESTIONS_QuestionAdd', array($uniqId, $form->getName(), array('maxQuestionLength' => 500, 'minQuestionLength' => 3, 'maxAnswerLength' => 150)));
     OW::getDocument()->addOnloadScript($js);
 }
Example #21
0
    public function onBeforeRender()
    {
        parent::onBeforeRender();
        $hasSideBar = OW::getThemeManager()->getCurrentTheme()->getDto()->getSidebarPosition() != 'none';
        $photoParams = array('classicMode' => false);
        $photoParams[] = $photoParams['classicMode'] ? $hasSideBar ? 4 : 5 : 4;
        $photoDefault = array('getPhotoURL' => OW::getRouter()->urlFor('ADMIN_CTRL_Theme', 'ajaxResponder'), 'listType' => null, 'rateUserId' => OW::getUser()->getId(), 'urlHome' => OW_URL_HOME, 'level' => 4);
        $document = OW::getDocument();
        $plugin = OW::getPluginManager()->getPlugin('base');
        $document->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'clipboard.js');
        OW::getDocument()->addOnloadScript("\n        ;var floatboxClipboard = new Clipboard('.ow_photoview_url a');\n\n        floatboxClipboard.on('success', function(e) {\n            OW.info(OW.getLanguageText('admin', 'url_copied'));\n            e.clearSelection();\n        });\n\n        floatboxClipboard.on('error', function(e) {\n            OW.warning(OW.getLanguageText('admin', 'press_ctrl_c'));\n        });\n\n        OW.bind('photo.photoItemRendered', function(item){\n            var clipboard = new Clipboard(\$(item).find('.clipboard-button')[0]);\n\n            clipboard.on('success', function(e) {\n                OW.info(OW.getLanguageText('admin', 'url_copied'));\n                e.clearSelection();\n            });\n\n            clipboard.on('error', function(e) {\n                OW.warning(OW.getLanguageText('admin', 'press_ctrl_c'));\n                var parent = \$(e.trigger).parent();\n                var input = parent.find('input')\n                parent.addClass('ow_url_input_visible');\n                input.val(\$(e.trigger).attr('data-clipboard-text'));\n                input.get(0).setSelectionRange(0, input.get(0).value.length);\n            });\n        });\n        ");
        $document->addScriptDeclarationBeforeIncludes(';window.browsePhotoParams = ' . json_encode(array_merge($photoDefault, $photoParams)) . ';');
        $document->addOnloadScript(';window.browsePhoto.init();');
        $contDefault = array('downloadAccept' => (bool) OW::getConfig()->getValue('photo', 'download_accept'), 'downloadUrl' => OW_URL_HOME . 'photo/download-photo/:id', 'actionUrl' => $photoDefault['getPhotoURL'], 'contextOptions' => array(array('action' => 'deleteImage', 'name' => OW::getLanguage()->text('admin', 'delete_image'))));
        $document->addScriptDeclarationBeforeIncludes(';window.photoContextActionParams = ' . json_encode($contDefault));
        $document->addOnloadScript(';window.photoContextAction.init();');
        $document->addOnloadScript('$(document.getElementById("browse-photo")).on("click", ".ow_photo_item_wrap img", function( event )
            {
                var data = $(this).closest(".ow_photo_item_wrap").data(), _data = {};

                if ( data.dimension && data.dimension.length )
                {
                    try
                    {
                        var dimension = JSON.parse(data.dimension);

                        _data.main = dimension.main;
                    }
                    catch( e )
                    {
                        _data.main = [this.naturalWidth, this.naturalHeight];
                    }
                }
                else
                {
                    _data.main = [this.naturalWidth, this.naturalHeight];
                }

                _data.mainUrl = data.photoUrl;
                photoView.setId(data.photoId, data.listType, browsePhoto.getMoreData(), _data);
            });');
        $document->addStyleSheet($plugin->getStaticCssUrl() . 'browse_files.css');
        $document->addScript($plugin->getStaticJsUrl() . 'browse_file.js');
        OW::getLanguage()->addKeyForJs("admin", "copy_url");
        OW::getLanguage()->addKeyForJs("admin", "confirm_delete_images");
        OW::getLanguage()->addKeyForJs("admin", "no_photo_selected");
        OW::getLanguage()->addKeyForJs("admin", "no_items");
        OW::getLanguage()->addKeyForJs("admin", "dnd_support");
        OW::getLanguage()->addKeyForJs("admin", "url_copied");
        OW::getLanguage()->addKeyForJs("admin", "press_ctrl_c");
    }
Example #22
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $event = new BASE_CLASS_EventCollector(self::EVENT_NAME, array('userId' => $this->userId));
     OW::getEventManager()->trigger($event);
     $event = new OW_Event(self::EVENT_PROCESS_TOOLBAR, array('userId' => $this->userId), $event->getData());
     OW::getEventManager()->trigger($event);
     $addedData = $event->getData();
     if (empty($addedData)) {
         $this->setVisible(false);
         return;
     }
     $this->initToolbar($addedData);
 }
Example #23
0
    public function onBeforeRender()
    {
        parent::onBeforeRender();
        $hasSideBar = OW::getThemeManager()->getCurrentTheme()->getDto()->getSidebarPosition() != 'none';
        $photoParams = array('classicMode' => false);
        $photoParams[] = $photoParams['classicMode'] ? $hasSideBar ? 4 : 5 : 4;
        $photoDefault = array('getPhotoURL' => OW::getRouter()->urlFor('ADMIN_CTRL_Theme', 'ajaxResponder'), 'listType' => null, 'rateUserId' => OW::getUser()->getId(), 'urlHome' => OW_URL_HOME, 'level' => 4);
        $document = OW::getDocument();
        $plugin = OW::getPluginManager()->getPlugin('base');
        $document->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'ZeroClipboard.js');
        $swfPath = OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'ZeroClipboard.swf';
        OW::getDocument()->addOnloadScript("\n        ;ZeroClipboard.config( { swfPath: '{$swfPath}' } );\n        OW.bind('photo.photoItemRendered', function(item){\n            var elementId = 'zero_' + \$(item).attr('id');\n            \$(item).find('.zero-clipboard-button').attr('id', elementId);\n            var client = new ZeroClipboard(document.getElementById(elementId));\n            client.on('copy', function(){\n                OW.info('Url copied to clipboard');\n            });\n        });\n        ");
        $document->addScriptDeclarationBeforeIncludes(';window.browsePhotoParams = ' . json_encode(array_merge($photoDefault, $photoParams)) . ';');
        $document->addOnloadScript(';window.browsePhoto.init();');
        $contDefault = array('downloadAccept' => (bool) OW::getConfig()->getValue('photo', 'download_accept'), 'downloadUrl' => OW_URL_HOME . 'photo/download-photo/:id', 'actionUrl' => $photoDefault['getPhotoURL'], 'contextOptions' => array(array('action' => 'deleteImage', 'name' => OW::getLanguage()->text('admin', 'delete_image'))));
        $document->addScriptDeclarationBeforeIncludes(';window.photoContextActionParams = ' . json_encode($contDefault));
        $document->addOnloadScript(';window.photoContextAction.init();');
        $document->addOnloadScript('$(document.getElementById("browse-photo")).on("click", ".ow_photo_item_wrap img", function( event )
            {
                var data = $(this).closest(".ow_photo_item_wrap").data(), _data = {};

                if ( data.dimension && data.dimension.length )
                {
                    try
                    {
                        var dimension = JSON.parse(data.dimension);

                        _data.main = dimension.main;
                    }
                    catch( e )
                    {
                        _data.main = [this.naturalWidth, this.naturalHeight];
                    }
                }
                else
                {
                    _data.main = [this.naturalWidth, this.naturalHeight];
                }

                _data.mainUrl = data.photoUrl;
                photoView.setId(data.photoId, data.listType, browsePhoto.getMoreData(), _data);
            });');
        $document->addStyleSheet($plugin->getStaticCssUrl() . 'browse_files.css');
        $document->addScript($plugin->getStaticJsUrl() . 'browse_file.js');
        OW::getLanguage()->addKeyForJs("admin", "copy_url");
        OW::getLanguage()->addKeyForJs("admin", "confirm_delete_images");
        OW::getLanguage()->addKeyForJs("admin", "no_photo_selected");
        OW::getLanguage()->addKeyForJs("admin", "no_items");
        OW::getLanguage()->addKeyForJs("admin", "dnd_support");
    }
Example #24
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $templateList = $this->service->findTemplateListForUserId($this->userId);
     $tplTemplates = array();
     foreach ($templateList as $tpl) {
         /*@var $tpl UHEADER_BOL_Template */
         $settings = $tpl->getSettings();
         $template = array("id" => $tpl->id, "src" => $this->service->getTemplateUrl($tpl), "css" => $tpl->getCssString(), "canvas" => $tpl->getCanvas(self::ITEM_WIDTH));
         $tplTemplates[] = $template;
     }
     $this->assign("templates", $tplTemplates);
     $this->assign("dimensions", $this->dimensions);
     $js = UTIL_JsGenerator::composeJsString('UHEADER.GallerySwitcher.registerTab({$tabKey}, new UHEADER.TemplateGallery({$params}, _scope));', array('params' => array('userId' => $this->userId, 'tabKey' => $this->tabKey, "dimensions" => $this->dimensions), "tabKey" => $this->tabKey));
     OW::getDocument()->addOnloadScript($js);
 }
Example #25
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $rsp = OW::getRouter()->urlFor('EQUESTIONS_CTRL_Attachments', 'rsp');
     $tabs = array();
     $js = UTIL_JsGenerator::newInstance();
     foreach ($this->widgets as $uniqId => $widget) {
         $js->newObject(array('ATTACHMENTS.ObjectRegistry', $uniqId), 'ATTACHMENTS.Loader', array($uniqId, $rsp, $widget['loader']));
         $onClick = "ATTACHMENTS.ObjectRegistry.{$this->uniqId}.load('{$uniqId}');";
         $tabs[$uniqId] = array('iconClass' => $widget['iconClass'], 'label' => $widget['label'], 'onClick' => $onClick, 'id' => $uniqId);
     }
     $js->newObject(array('ATTACHMENTS.ObjectRegistry', $this->uniqId), 'ATTACHMENTS.Panel', array($this->uniqId));
     OW::getDocument()->addOnloadScript($js);
     $this->assign('tabs', $tabs);
     $this->assign('uniqId', $this->uniqId);
 }
Example #26
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $count = 28;
     $photos = $this->bridge->findUserPhotos($this->userId, 0, $count);
     $height = $this->windowHeight - 250;
     $height = $height > 650 ? 650 : $height;
     if (empty($photos)) {
         $height = null;
     } else {
         $this->addComponent('photoList', new GHEADER_CMP_MyPhotoList($photos));
     }
     $this->assign('height', $height);
     $js = UTIL_JsGenerator::composeJsString('var photoSelector = new GHEADER.PhotoSelector({$params}, _scope)', array('params' => array('responder' => OW::getRouter()->urlFor('GHEADER_CTRL_Header', 'rsp'), 'userId' => $this->userId, 'listFull' => count($photos) < $count)));
     OW::getDocument()->addOnloadScript($js);
 }
Example #27
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     //$items = $this->itemsPrepare();
     //        $this->assign('items', $items);
     //        $this->assign('userName', BOL_UserService::getInstance()->getDisplayName($this->userId));
     //        $this->assign('unsubscribeUrl', $this->getUnsubscribeUrl());
     //        $this->assign('unsubscribeAllUrl', $this->getUnsubscribeUrl(true));
     //
     //        $single = $this->unsubscribeAction != 'all';
     //        $this->assign('single', $single);
     //
     //        $this->assign('settingsUrl', OW::getRouter()->urlForRoute('notifications-settings'));
     OW::getConfig()->getValue('skapi', 'store_period');
     $this->assign('html', OW::getConfig()->getValue('skapi', 'store_period'));
 }
Example #28
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     if (empty($this->idList)) {
         if ($this->emptyListNoRender) {
             $this->setVisible(false);
         }
         return;
     }
     $avatars = $this->getAvatarInfo($this->idList);
     if ($this->viewMoreUrl !== null) {
         $this->assign('view_more_array', array('url' => $this->viewMoreUrl, 'title' => OW::getLanguage()->text('base', 'view_more_label')));
     }
     $this->assign('users', $avatars);
     $this->assign('css_class', $this->customCssClass);
 }
Example #29
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $tplOption = array();
     $tplOption['id'] = $this->option->id;
     $tplOption['text'] = $this->option->text;
     $tplOption['count'] = $this->voteCount;
     $tplOption['percents'] = $this->percents;
     $tplOption['voted'] = $this->voted;
     $tplOption['multiple'] = $this->multiple;
     $tplOption['disabled'] = $this->disabled;
     $tplOption['editMode'] = $this->editMode;
     $avatarList = new EQUESTIONS_CMP_Avatars($this->userIds, $this->voteCount);
     $tplOption['users'] = $avatarList->render();
     $this->assign('option', $tplOption);
 }
Example #30
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $event = new BASE_CLASS_ConsoleItemCollector(self::EVENT_NAME);
     OW::getEventManager()->trigger($event);
     $items = $event->getData();
     $resultItems = array();
     foreach ($items as $item) {
         $itemCmp = null;
         $order = self::ALIGN_LEFT;
         if (is_array($item)) {
             if (empty($item['item'])) {
                 continue;
             }
             $itemCmp = $item['item'];
             $order = isset($item['order']) ? $item['order'] : self::ALIGN_LEFT;
         } else {
             $itemCmp = $item;
         }
         if ($order == self::ALIGN_LEFT) {
             $order = count($resultItems);
         }
         $resultItem = array("item" => $itemCmp, "order" => $order);
         $renderEvent = new OW_Event(self::RENDER_EVENT_NAME, $resultItem, $resultItem);
         OW::getEventManager()->trigger($renderEvent);
         $resultItem = $renderEvent->getData();
         $itemCmp = $resultItem['item'];
         $order = $resultItem['order'];
         if (is_subclass_of($itemCmp, 'OW_Renderable') && $itemCmp->isVisible()) {
             $resultItems[] = array('item' => $itemCmp->render(), 'order' => $order);
         }
     }
     usort($resultItems, array($this, '_sortItems'));
     $tplItems = array();
     foreach ($resultItems as $item) {
         $tplItems[] = $item['item'];
     }
     $this->assign('items', $tplItems);
     $jsUrl = OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'console.js';
     OW::getDocument()->addScript($jsUrl);
     $event = new OW_Event(BASE_CTRL_Ping::PING_EVENT . '.consoleUpdate');
     OW::getEventManager()->trigger($event);
     $params = array('pingInterval' => 30000);
     $js = UTIL_JsGenerator::newInstance();
     $js->newObject(array('OW', 'Console'), 'OW_Console', array($params, $event->getData()));
     OW::getDocument()->addOnloadScript($js, 900);
 }