/** * 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 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)); }
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 __construct($opponentId) { parent::__construct('composeMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_new_message_' . $opponentId)); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new TextField('subject'); $field->setInvitation(OW::getLanguage()->text('mailbox', 'subject')); $field->setHasInvitation(true); $field->setRequired(); $this->addElement($field); $field = new Textarea('message'); $field->setInvitation(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setHasInvitation(true); $field->setRequired(); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $submit = new Submit('sendBtn'); $submit->setId('sendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["composeMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } }
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 __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')); } } }
/** * @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($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 generateJs($data) { $js = UTIL_JsGenerator::composeJsString(' window.ow_newsfeed_feed_list[{$feedAutoId}].actions[{$uniq}] = new NEWSFEED_MobileFeedItem({$autoId}, window.ow_newsfeed_feed_list[{$feedAutoId}]); window.ow_newsfeed_feed_list[{$feedAutoId}].actions[{$uniq}].construct({$data}); ', array('uniq' => $data['entityType'] . '.' . $data['entityId'], 'feedAutoId' => $this->sharedData['feedAutoId'], 'autoId' => $this->autoId, 'id' => $this->action->getId(), 'data' => array('entityType' => $data['entityType'], 'entityId' => $data['entityId'], 'id' => $data['id'], 'updateStamp' => $this->action->getUpdateTime(), 'displayType' => $this->displayType))); OW::getDocument()->addOnloadScript($js, 50); }
public function addStatic($ajax = false) { if ($this->staticAdded) { return; } $staticUrl = OW::getPluginManager()->getPlugin(self::PLUGIN_KEY)->getStaticUrl(); $scriptUrl = $staticUrl . 'equestions.js' . '?' . self::PLUGIN_VERSION; $styleUrl = $staticUrl . 'equestions.css' . '?' . self::PLUGIN_VERSION; $imagesUrl = OW::getThemeManager()->getThemeImagesUrl(); $css = 'html body div .q_ic_preloader { background-image: url(' . $imagesUrl . 'ajax_preloader_button.gif) };'; OW::getDocument()->addStyleDeclaration($css); if (!$ajax) { OW::getDocument()->addScript($scriptUrl); OW::getDocument()->addStyleSheet($styleUrl); } else { OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(' if ( !window.QUESTIONS_Loaded ) { OW.addScriptFiles([{$scriptUrl}], function(){ if ( window.EQAjaxLoadCallbacksRun ) { window.EQAjaxLoadCallbacksRun(); } }); OW.addCssFile({$styleUrl}); } ', array('styleUrl' => $styleUrl, 'scriptUrl' => $scriptUrl))); } $messages = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissionMessages(); $actions = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissions(); $js = UTIL_JsGenerator::newInstance(); $js->addScript(UTIL_JsGenerator::composeJsString('UTILS.Credits = new UTILS.CreditsConstructor({$actions}, {$messages}); ', array('messages' => $messages, 'actions' => $actions))); $friendMode = (bool) OW::getEventManager()->call('plugin.friends'); $js->setVariable(array('QUESTIONS', 'friendMode'), $friendMode); if (!$ajax) { OW::getDocument()->addOnloadScript($js); } else { OW::getDocument()->addOnloadScript('window.EQAjaxLoadCallbackQueue = [];'); OW::getDocument()->addOnloadScript('(function() { var loaded = function() { ' . $js->generateJs() . ' }; if ( window.QUESTIONS_Loaded ) loaded.call(); else window.EQAjaxLoadCallbackQueue.push(loaded); })();'); } OW::getLanguage()->addKeyForJs('equestions', 'selector_title_friends'); OW::getLanguage()->addKeyForJs('equestions', 'selector_title_users'); OW::getLanguage()->addKeyForJs('equestions', 'followers_fb_title'); OW::getLanguage()->addKeyForJs('equestions', 'toolbar_unfollow_btn'); OW::getLanguage()->addKeyForJs('equestions', 'toolbar_follow_btn'); $this->staticAdded = true; }
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); }
/** * Constructor. */ public function __construct($params = array()) { parent::__construct(); $userId = (int) $params['userId']; $js = UTIL_JsGenerator::composeJsString('$("#baseBlockButton").click(function(){ _scope.confirmCallback(); });'); OW::getDocument()->addOnloadScript($js); }
public function __construct($data) { $script = UTIL_JsGenerator::composeJsString(' OWM.conversation = new MAILBOX_Conversation({$params}); OWM.conversationView = new MAILBOX_ConversationView({model: OWM.conversation}); ', array('params' => $data)); OW::getDocument()->addOnloadScript($script); OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation'); $form = new MAILBOX_MCLASS_NewMessageForm($data['conversationId'], $data['opponentId']); $this->addForm($form); $this->assign('data', $data); $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl()); }
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')))); }
public function __construct($albumId = NULL, $albumName = NULL, $albumDescription = null, $url = NULL) { if (!OW::getUser()->isAuthorized('photo', 'upload')) { $this->setVisible(FALSE); return; } $userId = OW::getUser()->getId(); $document = OW::getDocument(); PHOTO_BOL_PhotoTemporaryService::getInstance()->deleteUserTemporaryPhotos($userId); $plugin = OW::getPluginManager()->getPlugin('photo'); $document->addStyleSheet($plugin->getStaticCssUrl() . 'photo_upload.css'); $document->addScript($plugin->getStaticJsUrl() . 'jQueryRotate.min.js'); $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js'); $document->addScript($plugin->getStaticJsUrl() . 'upload.js'); $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxPhotoUploadParams = {}; Object.defineProperties(ajaxPhotoUploadParams, { actionUrl: { value: {$url}, writable: false, enumerable: true }, maxFileSize: { value: {$size}, writable: false, enumerable: true }, deleteAction: { value: {$deleteAction}, writable: false, enumerable: true } });', array('url' => OW::getRouter()->urlForRoute('photo.ajax_upload'), 'size' => PHOTO_BOL_PhotoService::getInstance()->getMaxUploadFileSize(), 'deleteAction' => OW::getRouter()->urlForRoute('photo.ajax_upload_delete')))); $document->addOnloadScript(';window.ajaxPhotoUploader.init();'); $this->addForm(new PHOTO_CLASS_AjaxUploadForm('user', $userId, $albumId, $albumName, $albumDescription, $url)); $newsfeedAlbum = PHOTO_BOL_PhotoAlbumService::getInstance()->getNewsfeedAlbum($userId); $this->assign('albumNameList', PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumNameListByUserId($userId, !empty($newsfeedAlbum) ? array($newsfeedAlbum->id) : array())); $language = OW::getLanguage(); $language->addKeyForJs('photo', 'not_all_photos_uploaded'); $language->addKeyForJs('photo', 'size_limit'); $language->addKeyForJs('photo', 'type_error'); $language->addKeyForJs('photo', 'dnd_support'); $language->addKeyForJs('photo', 'dnd_not_support'); $language->addKeyForJs('photo', 'drop_here'); $language->addKeyForJs('photo', 'please_wait'); $language->addKeyForJs('photo', 'create_album'); $language->addKeyForJs('photo', 'album_name'); $language->addKeyForJs('photo', 'album_desc'); $language->addKeyForJs('photo', 'describe_photo'); $language->addKeyForJs('photo', 'photo_upload_error'); }
public function __construct($itemKey) { parent::__construct(); list($prefix, $key) = explode(':', $itemKey); $menuItem = BOL_NavigationService::getInstance()->findMenuItem($prefix, $key); $custom = $menuItem->getPrefix() == BOL_MobileNavigationService::MENU_PREFIX; $form = new ADMIN_CLASS_MobileNavigationItemSettingsForm($menuItem, $custom); $this->addForm($form); $this->assign("custom", $custom); $js = UTIL_JsGenerator::composeJsString('owForms[{$formName}].bind("success", function(r) { _scope.callBack(r); _scope.floatBox.close(); })', array("formName" => $form->getName())); OW::getDocument()->addOnloadScript($js); }
public function onAddNewContent(BASE_CLASS_EventCollector $event) { $uniqId = uniqid("groups-create-"); if (!GROUPS_BOL_Service::getInstance()->isCurrentUserCanCreate()) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('groups', 'create'); if ($status['status'] != BOL_AuthorizationService::STATUS_PROMOTED) { return; } $script = UTIL_JsGenerator::composeJsString('$("#" + {$id}).click(function(){ OW.authorizationLimitedFloatbox({$msg}); });', array("id" => $uniqId, "msg" => $status["msg"])); OW::getDocument()->addOnloadScript($script); } $event->add(array(BASE_CMP_AddNewContent::DATA_KEY_ICON_CLASS => 'ow_ic_comment', BASE_CMP_AddNewContent::DATA_KEY_ID => $uniqId, BASE_CMP_AddNewContent::DATA_KEY_URL => OW::getRouter()->urlForRoute('groups-create'), BASE_CMP_AddNewContent::DATA_KEY_LABEL => OW::getLanguage()->text('groups', 'add_new_label'))); }
public function __construct($entityType, $entityId, $url = NULL) { parent::__construct('ajax-upload'); $this->clipService = VIDEO_BOL_ClipService::getInstance(); $this->setAjax(TRUE); $this->setAjaxResetOnSuccess(FALSE); //$this->setAjaxDataType(Form::AJAX_DATA_TYPE_JSON); $this->setAction(OW::getRouter()->urlForRoute('spvideolite.ajax_video_add_submit')); $this->bindJsFunction('success', UTIL_JsGenerator::composeJsString('function( data ) { if ( data ) { if ( !data.result ) { if ( data.msg ) { OW.error(data.msg); } else { OW.getLanguageText("spvideolite", "video_add_error"); } } else { var url = {$url}; if ( url ) { window.location.href = url; } else if ( data.url ) { window.location.href = data.url; } } } else { OW.error("Server error"); } }', array('url' => $url))); $language = OW::getLanguage(); $userId = OW::getUser()->getId(); $submit = new Submit('submit'); $submit->addAttribute('class', 'ow_ic_submit ow_positive'); $this->addElement($submit); }
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); }
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); }
public function getJsValidator() { return UTIL_JsGenerator::composeJsString('{ validate : function( value ) { if ( {$albumName} && {$albumName}.trim().toLowerCase() == {$newsfeedAlbum}.toString().trim().toLowerCase() ) { return true; } if ( value.toString().trim().toLowerCase() == {$newsfeedAlbum}.toString().trim().toLowerCase() ) { throw {$errorMsg}; } } }', array('albumName' => $this->albumName, 'newsfeedAlbum' => OW::getLanguage()->text('photo', 'newsfeed_album'), 'errorMsg' => $this->errorMessage)); }
public function __construct($entityType, $entityId, $albumId = null, $albumName = null, $albumDescription = null, $url = null) { parent::__construct('ajax-upload'); $this->setAjax(true); $this->setAjaxResetOnSuccess(false); $this->setAction(OW::getRouter()->urlForRoute('admin.ajax_upload_submit')); $this->bindJsFunction('success', UTIL_JsGenerator::composeJsString('function( data ) { if ( data ) { if ( !data.result ) { if ( data.msg ) { OW.error(data.msg); } else { OW.getLanguageText("admin", "photo_upload_error"); } } else { var url = {$url}; if ( url ) { window.location.href = url; } else if ( data.url ) { window.location.href = data.url; } } } else { OW.error("Server error"); } }', array('url' => $url))); $submit = new Submit('submit'); $submit->addAttribute('class', 'ow_ic_submit ow_positive'); $this->addElement($submit); }
public function __construct($userId) { if (empty($userId)) { $this->setVisible(FALSE); return; } $data = PROFILEPROGRESSBAR_BOL_Service::getInstance()->getProgressbarData($userId); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';var progressbar = $("#profile-progressbar-{$userId}"); var complete = {$complete}; progressbar.find(".profile-progressbar-caption").text(complete + "%"); progressbar.find(".profile-progressbar-complete").animate({width: complete + "%"}, { duration: "slow", specialEasing: {width: "easeOutBounce"}, queue: false });', array('userId' => (int) $userId, 'complete' => round($data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR][PROFILEPROGRESSBAR_BOL_Service::COUNT_COMPLETED_QUESTION] * 100 / $data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR][PROFILEPROGRESSBAR_BOL_Service::COUNT_QUESTION])))); $this->assign('userId', $userId); }
public function __construct($url = NULL) { if (!OW::getUser()->isAuthorized('video', 'add')) { $this->setVisible(FALSE); return; } $userId = OW::getUser()->getId(); $document = OW::getDocument(); $plugin = OW::getPluginManager()->getPlugin('photo'); $pluginSP = OW::getPluginManager()->getPlugin('spvideolite'); $document->addStyleSheet($pluginSP->getStaticCssUrl() . 'addvideo.css'); $document->addScript($plugin->getStaticJsUrl() . 'jQueryRotate.min.js'); $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js'); $document->addScript($pluginSP->getStaticJsUrl() . 'addvideo.js'); $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxAddVideoParams = {}; Object.defineProperties(ajaxAddVideoParams, { actionUrl: { value: {$url}, writable: false, enumerable: true }, deleteAction: { value: {$deleteAction}, writable: false, enumerable: true }, submitUrl: { value: {$submitUrl}, writable: false, enumerable: true }, });', array('url' => OW::getRouter()->urlForRoute('spvideolite.ajax_video_add'), 'deleteAction' => OW::getRouter()->urlForRoute('spvideolite.ajax_video_delete'), 'submitUrl' => OW::getRouter()->urlForRoute('spvideolite.ajax_video_add_submit')))); $document->addOnloadScript(';window.ajaxVideoAdder.init();'); $this->addForm(new SPVIDEOLITE_CLASS_AjaxUploadForm('user', $userId, $url)); $language = OW::getLanguage(); $language->addKeyForJs('spvideolite', 'not_all_videos_added'); $language->addKeyForJs('spvideolite', 'dnd_support'); $language->addKeyForJs('spvideolite', 'dnd_not_support'); $language->addKeyForJs('spvideolite', 'drop_here'); $language->addKeyForJs('spvideolite', 'please_wait'); $language->addKeyForJs('spvideolite', 'describe_video'); $language->addKeyForJs('spvideolite', 'video_add_error'); }
/** * @return Constructor. */ public function __construct(BASE_CLASS_WidgetParameter $paramObj) { parent::__construct(); $this->service = GROUPS_BOL_Service::getInstance(); if (!$this->service->isCurrentUserCanCreate()) { $authStatus = BOL_AuthorizationService::getInstance()->getActionStatus('groups', 'create'); $this->showCreate = $authStatus['status'] == BOL_AuthorizationService::STATUS_PROMOTED; if ($this->showCreate) { $script = UTIL_JsGenerator::composeJsString('$("#groups-create-btn-c a").click(function(){ OW.authorizationLimitedFloatbox({$msg}); return false; });', array("msg" => $authStatus["msg"])); OW::getDocument()->addOnloadScript($script); } } $num = isset($paramObj->customParamList['count']) ? (int) $paramObj->customParamList['count'] : 8; $this->assign('showTitles', !empty($paramObj->customParamList['showTitles'])); $latest = $this->service->findGroupList(GROUPS_BOL_Service::LIST_LATEST, 0, $num); $popular = $this->service->findGroupList(GROUPS_BOL_Service::LIST_MOST_POPULAR, 0, $num); $toolbars = self::getToolbar(); $lang = OW::getLanguage(); $menuItems = array(); if ($this->assignList('latest', $latest)) { $this->setSettingValue(self::SETTING_TOOLBAR, $toolbars['latest']); $menuItems[] = array('label' => $lang->text('groups', 'group_list_menu_item_latest'), 'id' => 'groups-widget-menu-latest', 'contId' => 'groups-widget-latest', 'active' => true); } if ($this->assignList('popular', $popular)) { $menuItems[] = array('label' => $lang->text('groups', 'group_list_menu_item_popular'), 'id' => 'groups-widget-menu-popular', 'contId' => 'groups-widget-popular', 'active' => empty($menuItems)); } if (empty($menuItems) && !$this->showCreate) { $this->setVisible(false); return; } $this->assign('menuItems', $menuItems); if ($paramObj->customizeMode) { $this->assign('menu', ''); } else { $this->addComponent('menu', new BASE_CMP_WidgetMenu($menuItems)); } $this->assign('toolbars', $toolbars); $this->assign('createUrl', OW::getRouter()->urlForRoute('groups-create')); }
public static function getSettingList() { $language = OW::getLanguage(); $pluginManager = OW::getPluginManager(); return array('banners' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'banners_label'), 'render' => function ($uniqName, $name, $value) { OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('skadate')->getStaticJsUrl() . 'mobile_experience.js'); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';window.SKADATE_ME_SETTINGS({$params});', array('params' => array('iosActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::IOS), 'androidActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::ANDROID))))); $input = new CheckboxGroup('banners'); $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label'))); $input->setColumnCount(2); $input->setValue(!empty($value) ? array_keys($value) : null); return $input->renderInput(); }, 'value' => array(self::IOS => $pluginManager->isPluginActive(self::IOS), self::ANDROID => $pluginManager->isPluginActive(self::ANDROID))), 'show_first' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'show_first_label'), 'render' => function ($uniqName, $name, $value) { $input = new RadioField('show_first[]'); $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label'))); $input->setValue($value); $input->setColumnCount(2); return $input->renderInput(); }, 'value' => $pluginManager->isPluginActive(self::IOS) ? self::IOS : self::ANDROID)); }
public function __construct($recipients = null, $context = MCOMPOSE_BOL_Service::CONTEXT_USER, $inPopup = true) { parent::__construct(); $recipients = empty($recipients) ? array() : $recipients; $userId = OW::getUser()->getId(); $isAuthorized = OW::getUser()->isAuthorized('mailbox', 'send_message'); $this->assign('isAuthorized', $isAuthorized); $this->assign('permissionMessage', OW::getLanguage()->text('mailbox', 'write_permission_denied')); if (!$isAuthorized) { return; } $mailboxConfigs = OW::getConfig()->getValues('mailbox'); $form = new MCOMPOSE_CLASS_Form(uniqid("mcmpose_send_message_form"), $userId, $context, true, $inPopup); $event = new OW_Event(MCOMPOSE_BOL_Service::EVENT_ON_INPUT_INIT, array("input" => $form->getElement("recipients"), "userId" => $userId, "context" => $context)); OW::getEventManager()->trigger($event); $preloadedData = MCOMPOSE_BOL_Service::getInstance()->getSuggestEntries($userId, null, $recipients, $context); $values = array(); foreach ($recipients as $r) { if (!empty($preloadedData[$r])) { $values[] = $preloadedData[$r]; } } $form->getElement("recipients")->setData($preloadedData); $form->getElement("recipients")->setValue($values); $this->addForm($form); $attachmentsInput = $form->getElement("attachments"); if (!empty($attachmentsInput)) { $this->assign("attachmentsId", $attachmentsInput->getId()); } $this->assign("formName", $form->getName()); $displayCaptcha = true; $this->assign('enableAttachments', !empty($mailboxConfigs['enable_attachments'])); $this->assign('displayCaptcha', $displayCaptcha); $imagesUrl = OW::getPluginManager()->getPlugin('base')->getStaticCssUrl(); $css = array('.mc-attachments .ow_mailbox_attachment { background-image: url(' . $imagesUrl . 'images/tag_bg.png); }'); OW::getDocument()->addStyleDeclaration(implode("\n", $css)); $jsParams = array("senderId" => $userId, "recipients" => $recipients, "context" => $context, "formId" => $form->getId(), "formName" => $form->getName()); $js = UTIL_JsGenerator::composeJsString('var sendMessage = new MCOMPOSE.sendMessage({$params}, _scope);', array("params" => $jsParams)); OW::getDocument()->addOnloadScript($js); OW::getLanguage()->addKeyForJs("mcompose", "close_fb_confirmation"); }
public function __construct($url = null) { $userId = OW::getUser()->getId(); $document = OW::getDocument(); $plugin = OW::getPluginManager()->getPlugin('base'); $document->addScript($plugin->getStaticJsUrl() . 'jQueryRotate.min.js'); $document->addScript($plugin->getStaticJsUrl() . 'codemirror.min.js'); $document->addScript($plugin->getStaticJsUrl() . 'upload.js'); $document->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.ajaxFileUploadParams = {}; Object.defineProperties(ajaxFileUploadParams, { actionUrl: { value: {$url}, writable: false, enumerable: true }, maxFileSize: { value: {$size}, writable: false, enumerable: true }, deleteAction: { value: {$deleteAction}, writable: false, enumerable: true } });', array('url' => OW::getRouter()->urlForRoute('admin.ajax_upload'), 'size' => BOL_FileService::getInstance()->getUploadMaxFilesizeBytes(), 'deleteAction' => OW::getRouter()->urlForRoute('admin.ajax_upload_delete')))); $document->addOnloadScript(';window.ajaxFileUploader.init();'); BOL_FileTemporaryService::getInstance()->deleteUserTemporaryFiles($userId); $form = new BASE_CLASS_AjaxUploadForm('user', $userId, $url); $this->addForm($form); $language = OW::getLanguage(); $language->addKeyForJs('admin', 'not_all_photos_uploaded'); $language->addKeyForJs('admin', 'size_limit'); $language->addKeyForJs('admin', 'type_error'); $language->addKeyForJs('admin', 'dnd_support'); $language->addKeyForJs('admin', 'dnd_not_support'); $language->addKeyForJs('admin', 'drop_here'); $language->addKeyForJs('admin', 'please_wait'); $language->addKeyForJs('admin', 'describe_photo'); $language->addKeyForJs('admin', 'photo_upload_error'); }
public function __construct($value, $languageData) { parent::__construct(); $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'language_value_edit.html'); $list = BOL_LanguageService::getInstance()->findActiveList(); $this->assign('langs', $list); $this->assign('prefix', 'value'); $this->assign('key', $value); $form = new QuestionValueEditForm($value, $languageData); $this->addForm($form); $formName = $form->getName(); $jsString = ' owForms[{$formName}].submitForm = function(){ var self = this; this.removeErrors(); try{ this.validate(); }catch(e){ if( this.showErrors ){ OW.error(e); } return false; } var dataToSend = this.getValues(); self.trigger("submit", dataToSend); return false; } owForms[{$formName}].bind("submit", function($data){ OW.trigger("admin.questions_edit_question_value", [$data], this); return false; })'; $script = UTIL_JsGenerator::composeJsString($jsString, array('formName' => $form->getName())); OW::getDocument()->addOnloadScript($script); }
public function __construct() { $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(); $this->assign('defaultAvatarUrl', $defaultAvatarUrl); OW::getLanguage()->addKeyForJs('mailbox', 'label_invitation_conversation_search'); // OW::getDocument()->addScript( OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl().'mobile_mailbox_sidebar.js' ); $list = array('list' => array(array('mode' => 'conversations', 'title' => OW::getLanguage()->text('mailbox', 'conversations'), 'selected' => true), array('mode' => 'userlist', 'title' => OW::getLanguage()->text('mailbox', 'userlist'), 'selected' => false))); $js = UTIL_JsGenerator::composeJsString(' OWM.mailboxSidebarMenu = new MAILBOX_SidebarMenu({$list}); OWM.mailboxSidebarMenuView = new MAILBOX_SidebarMenuView({model: OWM.mailboxSidebarMenu}); OWM.mailboxConversations = new MAILBOX_Conversations(); OWM.mailboxConversationsView = new MAILBOX_ConversationsView({model: OWM.mailboxConversations}); OWM.mailboxUsers = new MAILBOX_Users(); OWM.mailboxUsersView = new MAILBOX_UsersView({model: OWM.mailboxUsers}); OWM.mailboxSearch = new MAILBOX_Search(); OWM.trigger("mailbox.right_sidebar_loaded"); ', array('list' => $list)); OW::getDocument()->addOnloadScript($js); }