Exemplo n.º 1
0
 /**
  * Returns class instance
  *
  * @return ATTACHMENTS_Plugin
  */
 public static function getInstance()
 {
     if (null === self::$classInstance) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Exemplo n.º 2
0
    public function __construct($feedAutoId, $feedType, $feedId, $actionVisibility = null)
    {
        parent::__construct();
        $form = new NEWSFEED_StatusForm($feedAutoId, $feedType, $feedId, $actionVisibility);
        $this->addForm($form);
        $uniqId = uniqid('statusUpdate');
        $attachmentId = $this->initAttachments();
        $attachmentInputId = $form->getElement('attachment')->getId();
        $inputId = $form->getElement('status')->getId();
        $this->assign('uniqId', $uniqId);
        $js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $uniqId), 'ATTP.AttachmentsControl', array($uniqId, array('attachmentId' => $attachmentId, 'attachmentInputId' => $attachmentInputId, 'inputId' => $inputId, 'formName' => $form->getName())));
        ATTACHMENTS_Plugin::getInstance()->addJs($js);
        $js = 'owForms[{$form}].bind("success", function(data){
                    if ( !data || data.error )
                    {
                        return;
                    }

                    if ( ATTP.CORE.ObjectRegistry[{$attachId}] )
                    {
                        ATTP.CORE.ObjectRegistry[{$attachId}].reset();
                    }
                });
                owForms[{$form}].reset = false;';
        $js = UTIL_JsGenerator::composeJsString($js, array('form' => $form->getName(), 'attachId' => $attachmentId));
        OW::getDocument()->addOnloadScript($js);
    }
Exemplo n.º 3
0
 public function initJs($delegate)
 {
     $data = array();
     $data = array('delegate' => $delegate, 'rsp' => OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'rsp'));
     $js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $this->uniqId), 'ATTP.LinkPanel', array($this->uniqId, $data));
     ATTACHMENTS_Plugin::getInstance()->addJs($js);
 }
Exemplo n.º 4
0
 public function initJs($delegate)
 {
     $js = UTIL_JsGenerator::newInstance();
     $js->newObject(array('ATTP.CORE.ObjectRegistry', $this->uniqId), 'ATTP.Attachment', array($this->uniqId, $delegate));
     ATTACHMENTS_Plugin::getInstance()->addJs($js);
     return $this->uniqId;
 }
Exemplo n.º 5
0
 public function initJs($delegate)
 {
     $data = array();
     $static = OW::getPluginManager()->getPlugin('attachments')->getStaticUrl();
     $webCam = array('swf' => $static . 'webcam/webcam.swf', 'sound' => $static . 'webcam/shutter.mp3', 'quality' => 100, 'uploader' => OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'webcamHandler'));
     $data = array('delegate' => $delegate, 'rsp' => OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'rsp'), 'uploader' => OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'uploader'), 'webcam' => $webCam);
     $js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $this->uniqId), 'ATTP.ImagePanel', array($this->uniqId, $data));
     ATTACHMENTS_Plugin::getInstance()->addJs($js);
 }
Exemplo n.º 6
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $rsp = OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'rsp');
     $tabs = array();
     $js = UTIL_JsGenerator::newInstance();
     foreach ($this->widgets as $uniqId => $widget) {
         $js->newObject(array('ATTP.ObjectRegistry', $uniqId), 'ATTP.Loader', array($uniqId, $rsp, $widget['loader']));
         $onClick = "ATTP.ObjectRegistry.{$this->uniqId}.load('{$uniqId}');";
         $tabs[$uniqId] = array('iconClass' => $widget['iconClass'], 'label' => $widget['label'], 'onClick' => $onClick, 'id' => $uniqId);
     }
     $js->newObject(array('ATTP.ObjectRegistry', $this->uniqId), 'ATTP.Panel', array($this->uniqId));
     ATTACHMENTS_Plugin::getInstance()->addJs($js);
     $this->assign('tabs', $tabs);
     $this->assign('uniqId', $this->uniqId);
 }
Exemplo n.º 7
0
 public function __construct($entityType, $entityId, $displayType, $pluginKey, $ownerId, $commentCountOnPage, $id, $cmpContextId, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     //comment form init
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $form->addElement($textArea);
     $entityTypeField = new HiddenField('entityType');
     $form->addElement($entityTypeField);
     $entityIdField = new HiddenField('entityId');
     $form->addElement($entityIdField);
     $displayTypeField = new HiddenField('displayType');
     $form->addElement($displayTypeField);
     $pluginKeyField = new HiddenField('pluginKey');
     $form->addElement($pluginKeyField);
     $ownerIdField = new HiddenField('ownerId');
     $form->addElement($ownerIdField);
     $attch = new HiddenField('attch');
     $form->addElement($attch);
     $cid = new HiddenField('cid');
     $form->addElement($cid);
     $commentsOnPageField = new HiddenField('commentCountOnPage');
     $form->addElement($commentsOnPageField);
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->getElement('entityType')->setValue($entityType);
     $form->getElement('entityId')->setValue($entityId);
     $form->getElement('displayType')->setValue($displayType);
     $form->getElement('pluginKey')->setValue($pluginKey);
     $form->getElement('ownerId')->setValue($ownerId);
     $form->getElement('commentCountOnPage')->setValue($commentCountOnPage);
     $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);
     $attachmentsId = null;
     if (BOL_TextFormatService::getInstance()->isCommentsRichMediaAllowed()) {
         $attachmentsId = $this->initAttachments();
         $attControlUniq = uniqid('attpControl');
         $js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $attControlUniq), 'ATTP.AttachmentsControl', array($cmpContextId, array('attachmentId' => $attachmentsId, 'attachmentInputId' => $attch->getId(), 'inputId' => $textArea->getId(), 'formName' => $form->getName())));
         ATTACHMENTS_Plugin::getInstance()->addJs($js);
     }
     OW::getDocument()->addOnloadScript("owCommentCmps['{$id}'].initForm('" . $form->getElement('commentText')->getId() . "', '" . $form->getElement('attch')->getId() . "');");
     OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('
         owForms[{$formName}].bind("success", function(data) {
             var attachId = {$attcachmentId};
             if ( attachId && ATTP.CORE.ObjectRegistry[attachId] )
             {
                 ATTP.CORE.ObjectRegistry[attachId].reset();
             }
         });
     ', array('formName' => $form->getName(), 'attcachmentId' => $attachmentsId)));
     $this->assign('form', true);
     $this->assign('id', $id);
     if (OW::getUser()->isAuthenticated()) {
         $currentUserInfo = BOL_AvatarService::getInstance()->getDataForUserAvatars(array(OW::getUser()->getId()));
         $this->assign('currentUserInfo', $currentUserInfo[OW::getUser()->getId()]);
     }
 }
Exemplo n.º 8
0
 public function init()
 {
     $js = UTIL_JsGenerator::newInstance();
     $js->newObject(array('ATTP.ObjectRegistry', $this->uniqId), $constructorName);
     ATTACHMENTS_Plugin::getInstance()->addJs($js);
 }
Exemplo n.º 9
0
 public function initJs()
 {
     $data = array('rsp' => OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'rsp'), 'delegate' => $this->panelUniqId, 'data' => array('start' => 1, 'offset' => self::ITEMS_COUNT, 'query' => $this->query));
     $js = UTIL_JsGenerator::newInstance()->newObject('ytList', 'ATTP.YouTubeList', array($this->uniqId, $data));
     ATTACHMENTS_Plugin::getInstance()->addJs($js);
 }
Exemplo n.º 10
0
 public function __construct($vars, $formatName = null)
 {
     parent::__construct($vars, $formatName);
     $this->assign("uniqId", uniqid("attp-v-"));
     ATTACHMENTS_Plugin::getInstance()->addStatic();
 }
Exemplo n.º 11
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     ATTACHMENTS_Plugin::getInstance()->addStatic($this->initJs);
     $this->assign('data', $this->oembed);
 }