本文整理汇总了PHP中UTIL_JsGenerator::composeJsString方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_JsGenerator::composeJsString方法的具体用法?PHP UTIL_JsGenerator::composeJsString怎么用?PHP UTIL_JsGenerator::composeJsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_JsGenerator
的用法示例。
在下文中一共展示了UTIL_JsGenerator::composeJsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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);
}
示例2: onConsolePagesCollect
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));
}
示例3: addStatic
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);
})();');
}
示例4: __construct
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);
}
}
示例5: __construct
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'));
}
示例6: __construct
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'));
}
}
}
示例7: __construct
/**
* @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);
}
示例8: __construct
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);
}
示例9: generateJs
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);
}
示例10: onBeforeRender
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);
}
示例11: __construct
/**
* 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);
}
示例12: __construct
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());
}
示例13: onBeforeRender
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'))));
}
示例14: __construct
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');
}
示例15: __construct
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);
}