public function __construct($userId) { parent::__construct(); $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId)); $albums = empty($data["albums"]) ? array() : $data["albums"]; $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId); $this->assign("source", $source == "album" ? "album" : "all"); $selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId); $form = new Form("pcGallerySettings"); $form->setEmptyElementsErrorMessage(null); $form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings")); $element = new HiddenField("userId"); $element->setValue($userId); $form->addElement($element); $element = new Selectbox("album"); $element->setHasInvitation(true); $element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation")); $validator = new PCGALLERY_AlbumValidator(); $element->addValidator($validator); $albumsPhotoCount = array(); foreach ($albums as $album) { $element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})"); $albumsPhotoCount[$album["id"]] = $album["photoCount"]; if ($album["id"] == $selectedAlbum) { $element->setValue($album["id"]); } } OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount))); $element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label")); $form->addElement($element); $submit = new Submit("save"); $submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label")); $form->addElement($submit); $this->addForm($form); }
public function __construct() { parent::__construct('delete-membership-form'); $this->setAjaxResetOnSuccess(false); $this->setAjax(true); $this->setAction(OW::getRouter()->urlForRoute('membership_delete_type')); $lang = OW::getLanguage(); $typeId = new HiddenField('typeId'); $typeId->setRequired(true); $this->addElement($typeId); $newTypeId = new Selectbox('newTypeId'); $newTypeId->setHasInvitation(false); $this->addElement($newTypeId); $types = new RadioGroupItemField('type'); $types->setRequired(true); $types->setLabel($lang->text('membership', 'set_membership')); $this->addElement($types); $this->bindJsFunction(Form::BIND_SUCCESS, "function( data ) {\n if ( data.result ) {\n document.location.reload();\n }\n }"); $script = '$("#btn-confirm-type-delete").click(function(){ if ( confirm(' . json_encode($lang->text('membership', 'type_delete_confirm')) . ') ) { $(this).parents("form:eq(0)").submit(); } }); '; OW::getDocument()->addOnloadScript($script); }
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(); }
protected function initJs() { $js = UTIL_JsGenerator::newInstance(); $js->addScript('OW.Console.addItem(new OW_ConsoleDropdownClick({$uniqId}, {$contentIniqId}), {$key});', array('uniqId' => $this->consoleItem->getUniqId(), 'key' => $this->getKey(), 'contentIniqId' => $this->consoleItem->getContentUniqId())); OW::getDocument()->addOnloadScript($js); return $this->consoleItem->getUniqId(); }
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(); }
/** * @return Constructor. */ public function __construct($groupId) { parent::__construct(); $service = GROUPS_BOL_Service::getInstance(); $groupDto = $service->findGroupById($groupId); $group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id); $imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto); OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop'); OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property'); $createDate = UTIL_DateTime::formatDate($groupDto->timeStamp); $adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId); $adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId); $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId))); OW::getDocument()->addOnloadScript($js, 1001); $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl)))); if ($service->isCurrentUserCanEdit($groupDto)) { $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId))); } if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) { $toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag'); } $event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId)); OW::getEventManager()->trigger($event); foreach ($event->getData() as $item) { $toolbar[] = $item; } $this->assign('toolbar', $toolbar); $this->assign('group', $group); }
public function __construct() { parent::__construct(); $this->setPageHeading(OW::getLanguage()->text('admin', 'pages_page_heading')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); OW::getDocument()->getMasterPage()->getMenu(OW_Navigation::ADMIN_PAGES)->getElement('sidebar_menu_item_pages_manage')->setActive(true); }
public function chooseTheme() { $this->themeService->updateThemeList(); $this->themeService->updateThemesInfo(); $themes = $this->themeService->findAllThemes(); $themesInfo = array(); $activeTheme = OW::getThemeManager()->getSelectedTheme()->getDto()->getName(); /* @var $theme BOL_Theme */ foreach ($themes as $theme) { $themesInfo[$theme->getName()] = (array) json_decode($theme->getDescription()); $themesInfo[$theme->getName()]['key'] = $theme->getName(); $themesInfo[$theme->getName()]['title'] = $theme->getTitle(); $themesInfo[$theme->getName()]['iconUrl'] = $this->themeService->getStaticUrl($theme->getName()) . BOL_ThemeService::ICON_FILE; $themesInfo[$theme->getName()]['previewUrl'] = $this->themeService->getStaticUrl($theme->getName()) . BOL_ThemeService::PREVIEW_FILE; $themesInfo[$theme->getName()]['active'] = $theme->getName() === $activeTheme; $themesInfo[$theme->getName()]['changeUrl'] = OW::getRouter()->urlFor(__CLASS__, 'changeTheme', array('theme' => $theme->getName())); $themesInfo[$theme->getName()]['update_url'] = (int) $theme->getUpdate() === 1 && !defined('OW_PLUGIN_XP') ? OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'updateRequest', array('name' => $theme->getName())) : false; } OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('admin')->getStaticJsUrl() . 'theme_select.js'); OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.sticky.js'); OW::getDocument()->addOnloadScript("window.owThemes = new ThemesSelect(" . json_encode($themesInfo) . ");\n \t\$('.selected_theme_info input.theme_select_submit').click(function(){\n \t\t\twindow.location.href = '" . $themesInfo[$activeTheme]['changeUrl'] . "';\n \t\t});\n \$('.selected_theme_info_stick').sticky({topSpacing:60});\n "); $adminTheme = OW::getThemeManager()->getThemeService()->getThemeObjectByName('origin'); $defaultThemeImgUrl = $adminTheme === null ? '' : $adminTheme->getStaticImagesUrl(); $this->assign('themeInfo', $themesInfo[$activeTheme]); $this->assign('themes', $themesInfo); $this->assign('defaultThemeImgDir', $defaultThemeImgUrl); }
public function __construct(BASE_CLASS_WidgetParameter $paramObject) { parent::__construct(); $text = OW::getLanguage()->text('base', 'welcome_widget_content'); $text = str_replace('</li>', "</li>\n", $text); //if the tags are written in a line it is necessary to make a compulsory hyphenation? $photoKey = str_replace('{$key}', self::KEY_PHOTO_UPLOAD, self::PATTERN); $avatarKey = str_replace('{$key}', self::KEY_CHANGE_AVATAR, self::PATTERN); if (OW::getPluginManager()->isPluginActive('photo') && mb_stripos($text, self::KEY_PHOTO_UPLOAD) !== false) { $label = OW::getLanguage()->text('photo', 'upload_photos'); $js = OW::getEventManager()->call('photo.getAddPhotoURL'); $langLabel = $this->getLangLabel($photoKey, $text, self::KEY_PHOTO_UPLOAD); if ($langLabel != NULL) { $label = $langLabel; } $text = preg_replace($photoKey, '<li><a href="javascript://" onclick="' . $js . '();">' . $label . '</a></li>', $text); } else { $text = preg_replace($photoKey, '', $text); } if (mb_stripos($text, self::KEY_CHANGE_AVATAR) !== false) { $label = OW::getLanguage()->text('base', 'avatar_change'); $js = ' $("#welcomeWinget_loadAvatarChangeCmp").click(function(){' . 'document.avatarFloatBox = OW.ajaxFloatBox("BASE_CMP_AvatarChange", [], {width: 749, title: ' . json_encode($label) . '});' . '});'; OW::getDocument()->addOnloadScript($js); $langLabel = $this->getLangLabel($avatarKey, $text, self::KEY_CHANGE_AVATAR); if ($langLabel != NULL) { $label = $langLabel; } $text = preg_replace($avatarKey, '<li><a id="welcomeWinget_loadAvatarChangeCmp" href="javascript://">' . $label . '</a></li>', $text); } else { $text = preg_replace($avatarKey, '', $text); } $this->assign('text', $text); }
/** * Finance list page controller * * @param array $params */ public function index(array $params) { $service = BOL_BillingService::getInstance(); $lang = OW::getLanguage(); $page = isset($_GET['page']) ? $_GET['page'] : 1; $onPage = 20; $list = $service->getFinanceList($page, $onPage); $userIdList = array(); foreach ($list as $sale) { if (isset($sale['userId']) && !in_array($sale['userId'], $userIdList)) { array_push($userIdList, $sale['userId']); } } $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($userIdList); $userNames = BOL_UserService::getInstance()->getUserNamesForList($userIdList); $this->assign('list', $list); $this->assign('displayNames', $displayNames); $this->assign('userNames', $userNames); $total = $service->countSales(); // Paging $pages = (int) ceil($total / $onPage); $paging = new BASE_CMP_Paging($page, $pages, 10); $this->assign('paging', $paging->render()); $this->assign('total', $total); $stats = $service->getTotalIncome(); $this->assign('stats', $stats); OW::getDocument()->setHeading($lang->text('admin', 'page_title_finance')); OW::getDocument()->setHeadingIconClass('ow_ic_app'); }
/** * Smarty style block function. * * @author Sardar Madumarov <*****@*****.**> * @package ow.ow_smarty.plugin * @since 1.0 */ function smarty_block_style($params, $styles, $smarty) { if ($styles === null) { return; } OW::getDocument()->addStyleDeclaration($styles); }
public function onConsolePagesCollect(BASE_CLASS_EventCollector $event) { 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('base')->getStaticJsUrl().'backbone.js', 'text/javascript', 3000 ); OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'mobile_mailbox.js', 'text/javascript', 3000); $userListUrl = OW::getRouter()->urlForRoute('mailbox_user_list'); $convListUrl = OW::getRouter()->urlForRoute('mailbox_conv_list'); $authorizationResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'authorization'); $pingResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'ping'); $getHistoryResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'getHistory'); $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); $lastSentMessage = MAILBOX_BOL_ConversationService::getInstance()->getLastSentMessage($userId); $lastMessageTimestamp = (int) ($lastSentMessage ? $lastSentMessage->timeStamp : 0); $params = array('getHistoryResponderUrl' => $getHistoryResponderUrl, 'pingResponderUrl' => $pingResponderUrl, 'authorizationResponderUrl' => $authorizationResponderUrl, 'userListUrl' => $userListUrl, 'convListUrl' => $convListUrl, 'pingInterval' => 5000, 'lastMessageTimestamp' => $lastMessageTimestamp, 'user' => array('userId' => $userId, 'displayName' => $displayName, 'profileUrl' => $profileUrl, 'avatarUrl' => $avatarUrl)); $js = UTIL_JsGenerator::composeJsString('OWM.Mailbox = new MAILBOX_Mobile({$params});', array('params' => $params)); OW::getDocument()->addOnloadScript($js, 'text/javascript', 3000); $event->add(array('key' => 'convers', 'cmpClass' => 'MAILBOX_MCMP_ConsoleConversationsPage', 'order' => 2)); }
/** * @param BASE_CLASS_EventCollector $event */ public function onCollectButtons(BASE_CLASS_EventCollector $event) { $params = $event->getParams(); if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) { return; } $userId = $params["entityId"]; if (!OW::getUser()->isAuthenticated() || $userId == OW::getUser()->getId() || !OW::getUser()->isAuthorized('ocsfavorites', 'add_to_favorites')) { return; } $service = OCSFAVORITES_BOL_Service::getInstance(); $lang = OW::getLanguage(); $isFavorite = $service->isFavorite(OW::getUser()->getId(), $userId); $uniqId = uniqid("hint-favorites-"); if ($isFavorite) { $command = "favorites.remove"; $label = $lang->text('ocsfavorites', 'remove_favorite_button'); } else { $command = "favorites.add"; $label = $lang->text('ocsfavorites', 'add_favorite_button'); } $js = UTIL_JsGenerator::newInstance(); $js->jQueryEvent('#' . $uniqId, 'click', ' var self = $(this), command = self.data("command"); HINT.UTILS.toggleText(this, e.data.l1, e.data.l2); self.data("command", command == "favorites.remove" ? "favorites.add" : "favorites.remove"); HINT.UTILS.query(command, e.data.params); return false;', array('e'), array("l1" => $lang->text('ocsfavorites', 'add_favorite_button'), "l2" => $lang->text('ocsfavorites', 'remove_favorite_button'), "params" => array("userId" => $userId))); OW::getDocument()->addOnloadScript($js); $button = array("key" => "ocsfavorites", "label" => $label, "attrs" => array("id" => $uniqId, "data-command" => $command)); $event->add($button); }
public function rated() { if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $lang = OW::getLanguage(); $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1; $perPage = (int) OW::getConfig()->getValue('base', 'users_count_on_page'); $service = OCSTOPUSERS_BOL_Service::getInstance(); $userId = OW::getUser()->getId(); $users = $service->findRateUserList($userId, $page, $perPage); if ($users) { $count = $service->countRateUsers($userId); $list = array(); $fields = array(); foreach ($users as $user) { $list[] = $user['dto']; $fields[$user['dto']->id] = array('score' => $user['score'], 'timeStamp' => $user['timeStamp']); } $cmp = new OCSTOPUSERS_CMP_RatedList($list, $count, $perPage, false, $fields); $this->addComponent('users', $cmp); } else { $this->assign($users, null); } OW::getDocument()->setHeading($lang->text('ocstopusers', 'rated_me')); OW::getDocument()->setHeadingIconClass('ow_ic_star'); OW::getNavigation()->activateMenuItem(BOL_NavigationService::MENU_TYPE_MAIN, 'base', 'users_main_menu_item'); $this->setTemplate(OW::getPluginManager()->getPlugin('ocstopusers')->getCtrlViewDir() . 'list_index.html'); }
public function __construct($data) { $script = UTIL_JsGenerator::composeJsString(' OWM.bind("mailbox.ready", function(readyStatus){ if (readyStatus == 2){ OWM.conversation = new MAILBOX_Conversation({$params}); OWM.conversationView = new MAILBOX_MailConversationView({model: OWM.conversation}); } }); ', array('params' => $data)); OW::getDocument()->addOnloadScript($script); OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation'); $form = new MAILBOX_MCLASS_NewMailMessageForm($data['conversationId'], $data['opponentId']); $this->addForm($form); $this->assign('data', $data); $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl()); $firstMessage = MAILBOX_BOL_ConversationService::getInstance()->getFirstMessage($data['conversationId']); if (empty($firstMessage)) { $actionName = 'send_message'; } else { $actionName = 'reply_to_message'; } $isAuthorized = OW::getUser()->isAuthorized('mailbox', $actionName); if (!$isAuthorized) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName); if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) { $this->assign('sendAuthMessage', $status['msg']); } elseif ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) { $this->assign('sendAuthMessage', OW::getLanguage()->text('mailbox', $actionName . '_permission_denied')); } } }
public function __construct() { parent::__construct('set-credits-form'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('USERCREDITS_CTRL_Ajax', 'setCredits')); $lang = OW::getLanguage(); $userIdField = new HiddenField('userId'); $userIdField->setRequired(true); $this->addElement($userIdField); $balance = new TextField('balance'); $this->addElement($balance); $submit = new Submit('save'); $submit->setValue($lang->text('base', 'edit_button')); $this->addElement($submit); $js = 'owForms["' . $this->getName() . '"].bind("success", function(data){ if ( data.error ){ OW.error(data.error); } if ( data.message ) { OW.info(data.message); } _scope.floatBox && _scope.floatBox.close(); _scope.callBack && _scope.callBack(data); });'; OW::getDocument()->addOnloadScript($js); }
function smarty_function_text_edit($params, $smarty) { $key = $params['key']; unset($params['key']); $key = explode('+', $key); if (empty($key[0]) || empty($key[1])) { return '_INVALID_KEY_'; } $prefix = $key[0]; $key = $key[1]; $text = OW::getLanguage()->text($prefix, $key, $params); $keyDto = BOL_LanguageService::getInstance()->findKey($prefix, $key); if (!$keyDto) { return '<span class="ow_red">' . $text . '</span>'; } $script = '$("a.ow_text_edit").click(function(){ var self=$(this), lang = this.rel.split("+"); OW.editLanguageKey(lang[0],lang[1], function(e){ self.text(e.value); }); });'; OW::getDocument()->addOnloadScript($script); $rel = json_encode($prefix . '+' . $key); return '<a href="javascript://" rel=' . $rel . ' class="ow_text_edit">' . $text . '</a>'; }
/** * Constructor. */ public function __construct($params = array()) { parent::__construct(); $userId = (int) $params['userId']; $showMessage = (bool) $params['showMessage']; $rspUrl = OW::getRouter()->urlFor('BASE_CTRL_User', 'deleteUser', array('user-id' => $userId)); $rspUrl = OW::getRequest()->buildUrlQueryString($rspUrl, array('showMessage' => (int) $showMessage)); $js = UTIL_JsGenerator::composeJsString('$("#baseDCButton").click(function() { var button = this; OW.inProgressNode(button); $.getJSON({$rsp}, function(r) { OW.activateNode(button); if ( _scope.floatBox ) { _scope.floatBox.close(); } if ( _scope.deleteCallback ) { _scope.deleteCallback(r); } }); });', array('rsp' => $rspUrl)); OW::getDocument()->addOnloadScript($js); }
public function __construct(BASE_CommentsParams $params, $id, $formName) { parent::__construct(); $language = OW::getLanguage(); $form = new Form($formName); $textArea = new Textarea('commentText'); $textArea->setHasInvitation(true); $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text')); $form->addElement($textArea); $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1); foreach ($hiddenEls as $name => $value) { $el = new HiddenField($name); $el->setValue($value); $form->addElement($el); } $submit = new Submit('comment-submit'); $submit->setValue($language->text('base', 'comment_add_submit_label')); $form->addElement($submit); $form->setAjax(true); $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment')); // $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}"); // $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}"); $this->addForm($form); OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');"); $this->assign('form', true); $this->assign('id', $id); }
public function addStatic($onloadJs = '') { static $fistCall = true; $staticUrl = OW::getPluginManager()->getPlugin('attachments')->getStaticUrl(); OW::getDocument()->addStyleSheet($staticUrl . 'styles.css' . '?' . self::PLUGIN_VERSION); if ($fistCall) { if (OW::getRequest()->isAjax()) { OW::getDocument()->addOnloadScript('window.ATTPAjaxLoadCallbackQueue = [];'); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(' if ( !window.ATTP ) OW.addScriptFiles([{$url}]); ', array('url' => $staticUrl . 'scripts.js' . '?' . self::PLUGIN_VERSION))); } else { OW::getDocument()->addScript($staticUrl . 'scripts.js' . '?' . self::PLUGIN_VERSION); if (!empty($onloadJs)) { OW::getDocument()->addOnloadScript($onloadJs); } return; } } $fistCall = false; OW::getDocument()->addOnloadScript('(function() { var loaded = function() { ' . $onloadJs . ' }; if ( window.ATTP ) loaded.call(); else window.ATTPAjaxLoadCallbackQueue.push(loaded); })();'); }
public function index() { $language = OW::getLanguage(); OW::getDocument()->setHeading($language->text('mcompose', 'heading_configuration')); OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel'); $this->assign('pluginUrl', 'http://www.oxwall.org/store/item/10'); if (!$this->plugin->isAvaliable()) { $this->assign('avaliable', false); return; } $this->assign('avaliable', true); $settingUrl = OW::getRouter()->urlForRoute('mailbox_admin_config'); $this->assign('settingsUrl', $settingUrl); $configs = OW::getConfig()->getValues('mcompose'); $features = array(); $features["friends"] = MCOMPOSE_CLASS_FriendsBridge::getInstance()->isActive(); $features["groups"] = MCOMPOSE_CLASS_GroupsBridge::getInstance()->isActive(); $features["events"] = MCOMPOSE_CLASS_EventsBridge::getInstance()->isActive(); $form = new MCOMPOSE_ConfigForm($configs, $features); $this->addForm($form); $this->assign("configs", $configs); $this->assign("features", $features); $this->assign("activeFeatures", array_filter($features)); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { if ($form->process($_POST)) { OW::getFeedback()->info($language->text('mcompose', 'admin_settings_updated')); $this->redirect(OW::getRouter()->urlForRoute('mcompose-admin')); } } }
public function __construct($conversationId, $opponentId) { parent::__construct('newMailMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new TextField('newMessageText'); $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setId('newMessageText'); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $field = new HiddenField('conversationId'); $field->setValue($conversationId); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId)); $this->addElement($field); $submit = new Submit('newMessageSendBtn'); $submit->setId('newMessageSendBtn'); $submit->setName('newMessageSendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["newMailMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage')); }
public function onCollectButtonList(BASE_CLASS_EventCollector $event) { $cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css'; OW::getDocument()->addStyleSheet($cssUrl); $button = new FBCONNECT_CMP_ConnectButton(); $event->add(array('iconClass' => 'ow_ico_signin_f', 'markup' => $button->render())); }
public function index() { $language = OW::getLanguage(); $config = OW::getConfig(); OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings')); OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel'); $settingsForm = new Form('mobile_settings'); $disableMobile = new CheckboxField('disable_mobile'); $disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label')); $disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc')); $settingsForm->addElement($disableMobile); $submit = new Submit('save'); $submit->setValue($language->text('admin', 'save_btn_label')); $settingsForm->addElement($submit); $this->addForm($settingsForm); if (OW::getRequest()->isPost()) { if ($settingsForm->isValid($_POST)) { $data = $settingsForm->getValues(); $config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']); OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message')); } else { OW::getFeedback()->error('Error'); } $this->redirect(); } $disableMobile->setValue($config->getValue('base', 'disable_mobile_context')); }
public function setCustomMetaInfo() { OW::getDocument()->setDescription(null); if (OW::getLanguage()->valueExist('base', "local_page_meta_tags_{$this->getDocumentKey()}")) { OW::getDocument()->addCustomHeadInfo(OW::getLanguage()->text('base', "local_page_meta_tags_{$this->getDocumentKey()}")); } }
/** * Default action */ public function index() { $language = OW::getLanguage(); $clipService = VIDEO_BOL_ClipService::getInstance(); $userId = OW::getUser()->getId(); if (!OW::getUser()->isAuthorized('video', 'add')) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'add'); throw new AuthorizationException($status['msg']); } if (!($clipService->findUserClipsCount($userId) <= $clipService->getUserQuotaConfig())) { $this->assign('auth_msg', $language->text('video', 'quota_exceeded', array('limit' => $clipService->getUserQuotaConfig()))); } else { $this->assign('auth_msg', null); $videoAddForm = new videoAddForm(); $this->addForm($videoAddForm); if (OW::getRequest()->isPost() && $videoAddForm->isValid($_POST)) { $values = $videoAddForm->getValues(); $code = $clipService->validateClipCode($values['code']); if (!mb_strlen($code)) { OW::getFeedback()->warning($language->text('video', 'resource_not_allowed')); $this->redirect(); } $res = $videoAddForm->process(); OW::getFeedback()->info($language->text('video', 'clip_added')); $this->redirect(OW::getRouter()->urlForRoute('view_clip', array('id' => $res['id']))); } } if (!OW::getRequest()->isAjax()) { OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'video', 'video'); } OW::getDocument()->setHeading($language->text('video', 'page_title_add_video')); OW::getDocument()->setHeadingIconClass('ow_ic_video'); OW::getDocument()->setTitle($language->text('video', 'meta_title_video_add')); OW::getDocument()->setDescription($language->text('video', 'meta_description_video_add')); }
public function initJs($delegate) { $js = UTIL_JsGenerator::newInstance(); $js->newObject(array('CORE.ObjectRegistry', $this->uniqId), 'ATTACHMENTS.Attachment', array($this->uniqId, $delegate)); OW::getDocument()->addOnloadScript($js); return $this->uniqId; }
public function sendPrivateMessageActionTool(BASE_CLASS_EventCollector $event) { $params = $event->getParams(); if (empty($params['userId'])) { return; } $userId = (int) $params['userId']; if (OW::getUser()->getId() == $userId) { return; } if (!OW::getUser()->isAuthorized('mailbox', 'send_message')) { return; } if (BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $userId)) { $linkId = 'mb' . rand(10, 1000000); $script = "\$('#" . $linkId . "').click(function(){\n\n window.OW.error('" . OW::getLanguage()->text('base', 'user_block_message') . "');\n\n });"; OW::getDocument()->addOnloadScript($script); } else { $linkId = 'mb' . rand(10, 1000000); $script = "\$('#" . $linkId . "').click(function(){\n \$form = \$('#create-conversation-div').children();\n\n window.mailbox_send_message_floatbox = new OW_FloatBox({\n \$title: '" . OW::getLanguage()->text('mailbox', 'compose_message') . "',\n \$contents: \$form,\n 'width': '480px',\n 'class': 'ow_ic_add'\n });\n\n window.mailbox_send_message_floatbox.bind('show', function()\n {\n var textarea = \$form.find('textarea[name=message]').get(0);\n textarea.htmlarea();\n textarea.htmlareaRefresh();\n });\n });"; OW::getDocument()->addOnloadScript($script); } $resultArray = array(BASE_CMP_ProfileActionToolbar::DATA_KEY_LABEL => OW::getLanguage()->text('mailbox', 'create_conversation_button'), BASE_CMP_ProfileActionToolbar::DATA_KEY_CMP_CLASS => 'MAILBOX_CMP_CreateConversation', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_HREF => 'javascript://', BASE_CMP_ProfileActionToolbar::DATA_KEY_LINK_ID => $linkId, BASE_CMP_ProfileActionToolbar::DATA_KEY_ITEM_KEY => "mailbox.send_message"); $event->add($resultArray); }
public function __construct(BASE_CLASS_WidgetParameter $objParams) { parent::__construct(); $uniqName = $objParams->widgetDetails->uniqName; $this->assign('uniqName', $uniqName); $service = SLIDESHOW_BOL_Service::getInstance(); $slides = $service->getSlideList($uniqName); $this->assign('slides', $slides); if ($slides) { $url = OW::getPluginManager()->getPlugin('slideshow')->getStaticJsUrl() . 'slides.min.jquery.js'; OW::getDocument()->addScript($url); $settings = $objParams->customParamList; $params = array('sizes' => $service->getSizes($slides), 'pagination' => $settings['navigation'] ? "true" : "false", 'interval' => $settings['interval'], 'uniqname' => $uniqName, 'effect' => $settings['effect'], 'preloadImage' => OW::getThemeManager()->getThemeImagesUrl() . '/ajax_preloader_content.gif'); $url = OW::getPluginManager()->getPlugin('slideshow')->getStaticJsUrl() . 'slideshow.js'; OW::getDocument()->addScript($url); $id = uniqid(); $script = 'var slideshow' . $id . ' = new slideshow(' . json_encode($params) . '); slideshow' . $id . '.init();'; if ($objParams->customizeMode) { $script .= 'OW.WidgetPanel.bind("move", function(e) { if ( e.widgetName == "' . $uniqName . '" ) { OW.WidgetPanel.reloadWidget("' . $uniqName . '", function(markup, data){}); } });'; } OW::getDocument()->addOnloadScript($script); } }
public function __construct($layout) { parent::__construct(); $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view'); if ($status['status'] == BOL_AuthorizationService::STATUS_DISABLED) { $this->assign('authError', $status['msg']); return; } $class = ""; switch ($layout) { case 'page': $class = ' ow_photoview_info_onpage'; break; default: if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) { $class = ' ow_photoview_pint_mode'; } else { $class = ''; } break; } $this->assign('class ', $class); $this->assign('layout ', $layout); $document = OW::getDocument(); $js = "\$('#btn-save-as-avatar').off().on('click', function() {\n console.log('photo floatbox call js');\n var photoId = \$('#btn-photo-edit') . attr('rel');\n\n document.avatarFloatBox = OW.ajaxFloatBox(\n 'BASE_CMP_AvatarChange', {\n params: {\n step: 2, entityType: 'photo_album', entityId: '', id: photoId\n }}, {\n width: 749, title: OW.getLanguageText('base', 'avatar_change')}\n );\n })"; $document->addOnloadScript($js); }