Esempio n. 1
0
 public function __construct($albumId)
 {
     parent::__construct(self::FORM_NAME);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $albumIdField = new HiddenField(self::ELEMENT_ALBUM_ID);
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(true, null, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea(self::ELEMENT_DESC);
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
     $this->triggerReady(array('albumId' => $albumId));
 }
 public function testVerificaSeGetFieldPassaAlert()
 {
     $textarea = new Textarea();
     $textarea->setName("descricao");
     $textarea->setValue("descricao");
     $this->assertEquals('<textarea id="" name="descricao" class="" rows="" >descricao</textarea><p class="text-danger"></p>', $textarea->getField('alert'));
 }
Esempio n. 3
0
 public function __construct($albumId)
 {
     parent::__construct('albumEditForm');
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
     $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
     $this->setAjax(TRUE);
     $this->setAjaxResetOnSuccess(FALSE);
     $albumIdField = new HiddenField('album-id');
     $albumIdField->setValue($album->id);
     $albumIdField->setRequired();
     $albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
     $this->addElement($albumIdField);
     $albumNameField = new TextField('albumName');
     $albumNameField->setValue($album->name);
     $albumNameField->setRequired();
     if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(TRUE, NULL, $album->name));
     }
     $albumNameField->addAttribute('class', 'ow_photo_album_name_input');
     $this->addElement($albumNameField);
     $desc = new Textarea('desc');
     $desc->setValue(!empty($album->description) ? $album->description : NULL);
     $desc->setHasInvitation(TRUE);
     $desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
     $desc->addAttribute('class', 'ow_photo_album_description_textarea');
     $this->addElement($desc);
 }
Esempio n. 4
0
 public function index(array $params = array())
 {
     $config = OW::getConfig();
     $configs = $config->getValues('antibruteforce');
     $form = new Form('settings');
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->setAction(OW::getRouter()->urlForRoute('antibruteforce.admin'));
     $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if(data.result){OW.info("Settings successfuly saved");}else{OW.error("Parser error");}}');
     $auth = new CheckboxField('auth');
     $auth->setValue($configs['authentication']);
     $form->addElement($auth);
     $reg = new CheckboxField('reg');
     $reg->setValue($configs['registration']);
     $form->addElement($reg);
     $tryCount = new TextField('tryCount');
     $tryCount->setRequired();
     $tryCount->addValidator(new IntValidator(1));
     $tryCount->setValue($configs['try_count']);
     $form->addElement($tryCount);
     $expTime = new TextField('expTime');
     $expTime->setRequired();
     $expTime->setValue($configs['expire_time']);
     $expTime->addValidator(new IntValidator(1));
     $form->addElement($expTime);
     $title = new TextField('title');
     $title->setRequired();
     $title->setValue($configs['lock_title']);
     $form->addElement($title);
     $desc = new Textarea('desc');
     $desc->setValue($configs['lock_desc']);
     $form->addElement($desc);
     $submit = new Submit('save');
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isAjax()) {
         if ($form->isValid($_POST)) {
             $config->saveConfig('antibruteforce', 'authentication', $form->getElement('auth')->getValue());
             $config->saveConfig('antibruteforce', 'registration', $form->getElement('reg')->getValue());
             $config->saveConfig('antibruteforce', 'try_count', $form->getElement('tryCount')->getValue());
             $config->saveConfig('antibruteforce', 'expire_time', $form->getElement('expTime')->getValue());
             $config->saveConfig('antibruteforce', 'lock_title', strip_tags($form->getElement('title')->getValue()));
             $config->saveConfig('antibruteforce', 'lock_desc', strip_tags($form->getElement('desc')->getValue()));
             exit(json_encode(array('result' => true)));
         }
     }
 }
 public function __construct(BOL_MenuItem $menuItem, $custom = false)
 {
     parent::__construct("settingForm");
     $this->menuItem = $menuItem;
     $language = OW::getLanguage();
     $this->setAjax();
     $this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_MobileNavigation", "saveItemSettings"));
     $item = new HiddenField("key");
     $item->setValue($menuItem->prefix . ':' . $menuItem->key);
     $this->addElement($item);
     $settings = BOL_MobileNavigationService::getInstance()->getItemSettings($this->menuItem);
     // Mail Settings
     $item = new TextField(BOL_MobileNavigationService::SETTING_LABEL);
     $item->setLabel($language->text("mobile", "admin_nav_item_label_field"));
     $item->setValue($settings[BOL_MobileNavigationService::SETTING_LABEL]);
     $this->addElement($item);
     if ($custom) {
         $item = new TextField(BOL_MobileNavigationService::SETTING_TITLE);
         $item->setLabel($language->text("mobile", "admin_nav_item_title_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_TITLE]);
         $this->addElement($item);
         $item = new Textarea(BOL_MobileNavigationService::SETTING_CONTENT);
         $item->setLabel($language->text("mobile", "admin_nav_item_content_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_CONTENT]);
         $this->addElement($item);
         $item = new CheckboxGroup(BOL_MobileNavigationService::SETTING_VISIBLE_FOR);
         $visibleFor = empty($settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]) ? 0 : $settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR];
         $options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members'));
         $values = array();
         foreach ($options as $value => $option) {
             if (!($value & $visibleFor)) {
                 continue;
             }
             $values[] = $value;
         }
         $this->addElement($item->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for')));
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
 public function __construct($value, $languageData)
 {
     parent::__construct('lang-values-edit');
     $this->setAjax(true);
     //$this->setAction('javascript://');
     $hidden = new HiddenField('value');
     $hidden->setValue($value);
     $this->addElement($hidden);
     $languageService = BOL_LanguageService::getInstance();
     $list = $languageService->findActiveList();
     foreach ($list as $item) {
         $textArea = new Textarea("lang[{$item->getId()}][value][{$value}]");
         if (isset($languageData[$item->getId()])) {
             $textArea->setValue($languageData[$item->getId()]);
         }
         $this->addElement($textArea);
     }
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Esempio n. 7
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     $form = new Form('inite-friends');
     $emailList = new TagsInputField('emailList');
     $emailList->setRequired();
     $emailList->setDelimiterChars(array(',', ' '));
     $emailList->setInvitation($language->text('contactimporter', 'email_field_inv_message'));
     $emailList->setJsRegexp('/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/');
     $form->addElement($emailList);
     $text = new Textarea('text');
     $text->setValue($language->text('contactimporter', 'email_invite_field_default_text'));
     $text->setHasInvitation(true);
     $form->addElement($text);
     $submit = new Submit('submit');
     $form->addElement($submit);
     $form->setAction(OW::getRouter()->urlFor('CONTACTIMPORTER_CTRL_Email', 'send'));
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->bindJsFunction(Form::BIND_SUCCESS, "\n            function(data){                \n                if( data.success ){\n                    OW.info(data.message);\n                    owForms['inite-friends'].resetForm();\n                    window.ciMailFloatBox.close();\n                }\n                else{\n                    OW.error(data.message);\n                }\n              }");
     $this->addForm($form);
 }
Esempio n. 8
0
 /**
  * Class constructor
  *
  */
 public function __construct($clipId)
 {
     parent::__construct('vwvcEditForm');
     $language = OW::getLanguage();
     // clip id field
     $clipIdField = new HiddenField('id');
     $clipIdField->setRequired(true);
     $this->addElement($clipIdField);
     // select box for permission
     $permArr0 = array('1' => 'moderators', '3' => 'none', '2' => 'owner', '0' => 'all');
     $permArr1 = array('0' => 'all', '3' => 'none', '2' => 'owner', '1' => 'moderators');
     // room_name Field
     $room_nameField = new TextField('room_name');
     $sValidator = new StringValidator(1, 22);
     $room_nameField->addValidator($sValidator);
     $room_nameField->setRequired(true);
     $this->addElement($room_nameField->setLabel($language->text('vwvc', 'room_name')));
     // Description Field
     $descriptionField = new Textarea('description');
     $this->addElement($descriptionField->setLabel($language->text('vwvc', 'description')));
     // welcome Field
     $welcomeField = new Textarea('welcome');
     $welcomeField->setValue($language->text('vwvc', 'welcome_default'));
     $this->addElement($welcomeField->setLabel($language->text('vwvc', 'welcome')));
     // resolution Field
     $resolutionArr = array('320x240' => '320x240', '160x120' => '160x120', '176x144' => '176x144', '352x288' => '352x288', '640x480' => '640x480');
     $resolutionField = new Selectbox('resolution');
     $resolutionField->addOptions($resolutionArr);
     $resolutionField->setRequired();
     $resolutionField->setHasInvitation(false);
     $this->addElement($resolutionField->setLabel($language->text('vwvc', 'resolution')));
     // camera_fps Field
     $camera_fpsArr = array('10' => '10', '12' => '12', '20' => '20', '25' => '25', '30' => '30');
     $camera_fpsField = new Selectbox('camera_fps');
     $camera_fpsField->addOptions($camera_fpsArr);
     $camera_fpsField->setRequired();
     $camera_fpsField->setHasInvitation(false);
     $this->addElement($camera_fpsField->setLabel($language->text('vwvc', 'camera_fps')));
     // Microphone Rate Field
     $microphone_rateArr = array('11' => '11', '22' => '22', '44' => '44', '48' => '48');
     $microphone_rateField = new Selectbox('microphone_rate');
     $microphone_rateField->addOptions($microphone_rateArr);
     $microphone_rateField->setRequired();
     $microphone_rateField->setHasInvitation(false);
     $this->addElement($microphone_rateField->setLabel($language->text('vwvc', 'microphone_rate')));
     // soundQuality Field
     $soundQualityField = new TextField('soundQuality');
     $soundQualityField->setRequired(true);
     $this->addElement($soundQualityField->setLabel($language->text('vwvc', 'soundQuality')));
     // Bandwidth Field
     $bandwidthField = new TextField('bandwidth');
     $bandwidthField->setRequired(true);
     $bandwidthField->setValue(40960);
     $this->addElement($bandwidthField->setLabel($language->text('vwvc', 'bandwidth')));
     // verbose_level Field
     $verbose_levelArr = array('2' => 'warning/recoverable failure', '0' => 'nothing', '1' => 'failure', '3' => 'success', '4' => 'action');
     $verbose_levelField = new Selectbox('verbose_level');
     $verbose_levelField->addOptions($verbose_levelArr);
     $verbose_levelField->setRequired();
     $verbose_levelField->setHasInvitation(false);
     $this->addElement($verbose_levelField->setLabel($language->text('vwvc', 'verbose_level')));
     // Background url Field
     $background_urlField = new TextField('background_url');
     $this->addElement($background_urlField->setLabel($language->text('vwvc', 'background_url')));
     // Layout Code Field
     $layout_codeField = new Textarea('layout_code');
     $this->addElement($layout_codeField->setLabel($language->text('vwvc', 'layout_code')));
     // Fill window Field
     $fill_windowField = new Selectbox('fill_window');
     $fill_windowField->addOptions($permArr0);
     $fill_windowField->setRequired();
     $fill_windowField->setHasInvitation(false);
     $this->addElement($fill_windowField->setLabel($language->text('vwvc', 'fill_window')));
     // FloodProtection Field
     $flood_protectionField = new TextField('flood_protection');
     $flood_protectionField->setValue(3);
     $this->addElement($flood_protectionField->setLabel($language->text('vwvc', 'flood_protection')));
     // Filter regex Field
     $filter_regexField = new TextField('filter_regex');
     $filter_regexField->setValue('(?i)(f**k|c**t)(?-i)');
     $this->addElement($filter_regexField->setLabel($language->text('vwvc', 'filter_regex')));
     // Filter replace Field
     $filter_replaceField = new TextField('filter_replace');
     $filter_replaceField->setValue('**');
     $this->addElement($filter_replaceField->setLabel($language->text('vwvc', 'filter_replace')));
     // Show Camera Settings Field
     $show_camera_settingsField = new Selectbox('show_camera_settings');
     $show_camera_settingsField->addOptions($permArr1);
     $show_camera_settingsField->setRequired();
     $show_camera_settingsField->setHasInvitation(false);
     $this->addElement($show_camera_settingsField->setLabel($language->text('vwvc', 'show_camera_settings')));
     // Advanced Camera Settings Field
     $advanced_camera_settingsField = new Selectbox('advanced_camera_settings');
     $advanced_camera_settingsField->addOptions($permArr1);
     $advanced_camera_settingsField->setRequired();
     $advanced_camera_settingsField->setHasInvitation(false);
     $this->addElement($advanced_camera_settingsField->setLabel($language->text('vwvc', 'advanced_camera_settings')));
     // Configure Source Field
     $configure_sourceField = new Selectbox('configure_source');
     $configure_sourceField->addOptions($permArr1);
     $configure_sourceField->setRequired();
     $configure_sourceField->setHasInvitation(false);
     $this->addElement($configure_sourceField->setLabel($language->text('vwvc', 'configure_source')));
     // Disable Video Field
     $disable_videoField = new Selectbox('disable_video');
     $disable_videoField->addOptions($permArr1);
     $disable_videoField->setRequired();
     $disable_videoField->setHasInvitation(false);
     $this->addElement($disable_videoField->setLabel($language->text('vwvc', 'disable_video')));
     // disable_sound Field
     $disable_soundField = new Selectbox('disable_sound');
     $disable_soundField->addOptions($permArr1);
     $disable_soundField->setRequired();
     $disable_soundField->setHasInvitation(false);
     $this->addElement($disable_soundField->setLabel($language->text('vwvc', 'disable_sound')));
     // panel Files Field
     $panel_filesField = new Selectbox('panel_files');
     $panel_filesField->addOptions($permArr1);
     $panel_filesField->setRequired();
     $panel_filesField->setHasInvitation(false);
     $this->addElement($panel_filesField->setLabel($language->text('vwvc', 'panel_files')));
     // panel rooms Field
     $panel_roomsField = new Selectbox('panel_rooms');
     $panel_roomsField->addOptions($permArr1);
     $panel_roomsField->setRequired();
     $panel_roomsField->setHasInvitation(false);
     $this->addElement($panel_roomsField->setLabel($language->text('vwvc', 'panel_rooms')));
     // panel users Field
     $panel_usersField = new Selectbox('panel_users');
     $panel_usersField->addOptions($permArr1);
     $panel_usersField->setRequired();
     $panel_usersField->setHasInvitation(false);
     $this->addElement($panel_usersField->setLabel($language->text('vwvc', 'panel_users')));
     // File Upload Field
     $file_uploadField = new Selectbox('file_upload');
     $file_uploadField->addOptions($permArr1);
     $file_uploadField->setRequired();
     $file_uploadField->setHasInvitation(false);
     $this->addElement($file_uploadField->setLabel($language->text('vwvc', 'file_upload')));
     // file_delete Field
     $file_deleteField = new Selectbox('file_delete');
     $file_deleteField->addOptions($permArr0);
     $file_deleteField->setRequired();
     $file_deleteField->setHasInvitation(false);
     $this->addElement($file_deleteField->setLabel($language->text('vwvc', 'file_delete')));
     // Tutorial Field
     $tutorialField = new Selectbox('tutorial');
     $tutorialField->addOptions($permArr1);
     $tutorialField->setRequired();
     $tutorialField->setHasInvitation(false);
     $this->addElement($tutorialField->setLabel($language->text('vwvc', 'tutorial')));
     // Auto View Cameras Field
     $auto_view_camerasField = new Selectbox('auto_view_cameras');
     $auto_view_camerasField->addOptions($permArr1);
     $auto_view_camerasField->setRequired();
     $auto_view_camerasField->setHasInvitation(false);
     $this->addElement($auto_view_camerasField->setLabel($language->text('vwvc', 'auto_view_cameras')));
     // Show Timer Field
     $show_timerField = new Selectbox('show_timer');
     $show_timerField->addOptions($permArr1);
     $show_timerField->setRequired();
     $show_timerField->setHasInvitation(false);
     $this->addElement($show_timerField->setLabel($language->text('vwvc', 'show_timer')));
     // writeText Field
     $write_textField = new Selectbox('write_text');
     $write_textField->addOptions($permArr1);
     $write_textField->setRequired();
     $write_textField->setHasInvitation(false);
     $this->addElement($write_textField->setLabel($language->text('vwvc', 'write_text')));
     // regularWatch Field
     $regular_watchField = new Selectbox('regular_watch');
     $regular_watchField->addOptions($permArr1);
     $regular_watchField->setRequired();
     $regular_watchField->setHasInvitation(false);
     $this->addElement($regular_watchField->setLabel($language->text('vwvc', 'regular_watch')));
     // newWatch Field
     $new_watchField = new Selectbox('new_watch');
     $new_watchField->addOptions($permArr1);
     $new_watchField->setRequired();
     $new_watchField->setHasInvitation(false);
     $this->addElement($new_watchField->setLabel($language->text('vwvc', 'new_watch')));
     // privateTextchat Field
     $private_textchatField = new Selectbox('private_textchat');
     $private_textchatField->addOptions($permArr1);
     $private_textchatField->setRequired();
     $private_textchatField->setHasInvitation(false);
     $this->addElement($private_textchatField->setLabel($language->text('vwvc', 'private_textchat')));
     // user_list Field
     $user_listField = new Textarea('user_list');
     $this->addElement($user_listField->setLabel($language->text('vwvc', 'user_list')));
     // moderator_list Field
     $moderator_listField = new Textarea('moderator_list');
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById(OW::getUser()->getId());
     $username = $user->getUsername();
     $moderator_listField->setValue($username);
     $this->addElement($moderator_listField->setLabel($language->text('vwvc', 'moderator_list')));
     // administrator Field
     $administratorField = new Selectbox('administrator');
     $administratorField->addOptions($permArr0);
     $administratorField->setRequired();
     $administratorField->setHasInvitation(false);
     $this->addElement($administratorField->setLabel($language->text('vwvc', 'administrator')));
     // clean_up Field
     $clean_upField = new TextField('clean_up');
     $clean_upField->setValue(0);
     $this->addElement($clean_upField->setLabel($language->text('vwvc', 'clean_up')));
     $entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'vwvc');
     if ($entityTags) {
         $tags = array();
         foreach ($entityTags as $entityTag) {
             $tags[] = $entityTag->label;
         }
         $tagsField = new TagsField('tags', $tags);
     } else {
         $tagsField = new TagsField('tags');
     }
     $this->addElement($tagsField->setLabel($language->text('vwvc', 'tags')));
     $submit = new Submit('edit');
     $submit->setValue($language->text('vwvc', 'btn_edit'));
     $this->addElement($submit);
 }
Esempio n. 9
0
 public function __construct()
 {
     parent::__construct('add-css');
     $text = new Textarea('css');
     $dto = BOL_ThemeService::getInstance()->findThemeByKey(OW::getConfig()->getValue('base', 'selectedTheme'));
     $text->setValue($dto->getCustomCss());
     $this->addElement($text);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'theme_css_edit_submit_label'));
     $this->addElement($submit);
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $this->bindJsFunction(Form::BIND_SUCCESS, 'function(data){OW.info(data.message)}');
 }
Esempio n. 10
0
 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('photo.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("photo", "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)));
     $language = OW::getLanguage();
     $albumField = new TextField('album');
     $albumField->setRequired();
     $albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
     $albumField->addAttribute('autocomplete', 'off');
     $albumField->addAttribute('readonly');
     $albumNameField = new TextField('album-name');
     $albumNameField->setRequired();
     $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
     $albumNameField->addAttribute('class', 'ow_smallmargin invitation');
     $this->addElement($albumNameField);
     $desc = new Textarea('description');
     $desc->addAttribute('class', 'invitation');
     if (!empty($albumDescription)) {
         $desc->setValue($albumDescription);
     } else {
         $desc->setValue($language->text('photo', 'album_desc'));
     }
     $this->addElement($desc);
     $userId = OW::getUser()->getId();
     if (!empty($albumId) && ($album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId, $userId)) !== NULL && $album->userId == $userId && $album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
         $albumField->setValue($album->name);
         $albumNameField->setValue($album->name);
     } elseif (!empty($albumName)) {
         $albumField->setValue($albumName);
         $albumNameField->setValue($albumName);
     } else {
         $event = new BASE_CLASS_EventCollector(PHOTO_CLASS_EventHandler::EVENT_SUGGEST_DEFAULT_ALBUM, array('userId' => $userId, 'entityType' => $entityType, 'entityId' => $entityId));
         OW::getEventManager()->trigger($event);
         $data = $event->getData();
         if (!empty($data)) {
             $albumField->setValue($data[0]);
             $albumNameField->setValue($data[0]);
         } else {
             $albumField->setValue($language->text('photo', 'choose_existing_or_create'));
             $albumNameField->setValue($language->text('photo', 'album_name'));
         }
     }
     $this->addElement($albumField);
     $submit = new Submit('submit');
     $submit->addAttribute('class', 'ow_ic_submit ow_positive');
     $this->addElement($submit);
 }
Esempio n. 11
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     // baseSwf_url Field
     $baseSwf_urlField = new TextField('baseSwf_url');
     $baseSwf_urlField->addAttribute('readonly', 'readonly');
     $this->addElement($baseSwf_urlField->setLabel($language->text('vwvc', 'baseSwf_url')));
     // server Field
     $serverField = new TextField('server');
     $serverField->setRequired(true);
     $this->addElement($serverField->setLabel($language->text('vwvc', 'server')));
     // serverAMF Field
     $serverAMFField = new TextField('serverAMF');
     $serverAMFField->setRequired(true);
     $this->addElement($serverAMFField->setLabel($language->text('vwvc', 'serverAMF')));
     // serverRTMFP Field
     $serverRTMFPField = new TextField('serverRTMFP');
     $serverRTMFPField->setRequired(true);
     $this->addElement($serverRTMFPField->setLabel($language->text('vwvc', 'serverRTMFP')));
     // select box for certain parameters
     $par = array('0' => 'no', '1' => 'yes');
     $par1 = array('1' => 'yes', '0' => 'no');
     // enableRTMP Field
     $enableRTMPField = new Selectbox('enableRTMP');
     $enableRTMPField->addOptions($par1);
     $enableRTMPField->setRequired();
     $enableRTMPField->setHasInvitation(false);
     $this->addElement($enableRTMPField->setLabel($language->text('vwvc', 'enableRTMP')));
     // enableP2P Field
     $enableP2PField = new Selectbox('enableP2P');
     $enableP2PField->addOptions($par);
     $enableP2PField->setRequired();
     $enableP2PField->setHasInvitation(false);
     $this->addElement($enableP2PField->setLabel($language->text('vwvc', 'enableP2P')));
     // supportRTMP Field
     $supportRTMPField = new Selectbox('supportRTMP');
     $supportRTMPField->addOptions($par1);
     $supportRTMPField->setRequired();
     $supportRTMPField->setHasInvitation(false);
     $this->addElement($supportRTMPField->setLabel($language->text('vwvc', 'supportRTMP')));
     // supportP2P Field
     $supportP2PField = new Selectbox('supportP2P');
     $supportP2PField->addOptions($par1);
     $supportP2PField->setRequired();
     $supportP2PField->setHasInvitation(false);
     $this->addElement($supportP2PField->setLabel($language->text('vwvc', 'supportP2P')));
     // alwaysRTMP Field
     $alwaysRTMPField = new Selectbox('alwaysRTMP');
     $alwaysRTMPField->addOptions($par);
     $alwaysRTMPField->setRequired();
     $alwaysRTMPField->setHasInvitation(false);
     $this->addElement($alwaysRTMPField->setLabel($language->text('vwvc', 'alwaysRTMP')));
     // alwaysP2P Field
     $alwaysP2PField = new Selectbox('alwaysP2P');
     $alwaysP2PField->addOptions($par);
     $alwaysP2PField->setRequired();
     $alwaysP2PField->setHasInvitation(false);
     $this->addElement($alwaysP2PField->setLabel($language->text('vwvc', 'alwaysP2P')));
     // videoCodec Field
     $videoCodecField = new TextField('videoCodec');
     $videoCodecField->setRequired(true);
     $this->addElement($videoCodecField->setLabel($language->text('vwvc', 'videoCodec')));
     // codecLevel Field
     $codecLevelField = new TextField('codecLevel');
     $codecLevelField->setRequired(true);
     $this->addElement($codecLevelField->setLabel($language->text('vwvc', 'codecLevel')));
     // codecProfile Field
     $codecProfileArr = array('main' => 'main', 'baseline' => 'baseline');
     $codecProfileField = new Selectbox('codecProfile');
     $codecProfileField->addOptions($codecProfileArr);
     $codecProfileField->setRequired();
     $codecProfileField->setHasInvitation(false);
     $this->addElement($codecProfileField->setLabel($language->text('vwvc', 'codecProfile')));
     // soundCodec Field
     $soundCodecArr = array('Speex' => 'Speex', 'Nellymoser' => 'Nellymoser');
     $soundCodecField = new Selectbox('soundCodec');
     $soundCodecField->addOptions($soundCodecArr);
     $soundCodecField->setRequired();
     $soundCodecField->setHasInvitation(false);
     $this->addElement($soundCodecField->setLabel($language->text('vwvc', 'soundCodec')));
     // p2pGroup Field
     $p2pGroupField = new TextField('p2pGroup');
     $p2pGroupField->setRequired(true);
     $this->addElement($p2pGroupField->setLabel($language->text('vwvc', 'p2pGroup')));
     // camMaxBandwidth Field
     $camMaxBandwidthField = new TextField('camMaxBandwidth');
     $camMaxBandwidthField->setRequired(true);
     $this->addElement($camMaxBandwidthField->setLabel($language->text('vwvc', 'camMaxBandwidth')));
     // bufferLive Field
     $bufferLiveField = new TextField('bufferLive');
     $bufferLiveField->setRequired(true);
     $this->addElement($bufferLiveField->setLabel($language->text('vwvc', 'bufferLive')));
     // bufferFull Field
     $bufferFullField = new TextField('bufferFull');
     $bufferFullField->setRequired(true);
     $this->addElement($bufferFullField->setLabel($language->text('vwvc', 'bufferFull')));
     // bufferLivePlayback Field
     $bufferLivePlaybackField = new TextField('bufferLivePlayback');
     $bufferLivePlaybackField->setRequired(true);
     $this->addElement($bufferLivePlaybackField->setLabel($language->text('vwvc', 'bufferLivePlayback')));
     // bufferFullPlayback Field
     $bufferFullPlaybackField = new TextField('bufferFullPlayback');
     $bufferFullPlaybackField->setRequired(true);
     $this->addElement($bufferFullPlaybackField->setLabel($language->text('vwvc', 'bufferFullPlayback')));
     // disableBandwidthDetection Field
     $disableBandwidthDetectionField = new Selectbox('disableBandwidthDetection');
     $disableBandwidthDetectionField->addOptions($par);
     $disableBandwidthDetectionField->setRequired();
     $disableBandwidthDetectionField->setHasInvitation(false);
     $this->addElement($disableBandwidthDetectionField->setLabel($language->text('vwvc', 'disableBandwidthDetection')));
     // disableUploadDetection Field
     $disableUploadDetectionField = new Selectbox('disableUploadDetection');
     $disableUploadDetectionField->addOptions($par);
     $disableUploadDetectionField->setRequired();
     $disableUploadDetectionField->setHasInvitation(false);
     $this->addElement($disableUploadDetectionField->setLabel($language->text('vwvc', 'disableUploadDetection')));
     // limitByBandwidth Field
     $limitByBandwidthField = new Selectbox('limitByBandwidth');
     $limitByBandwidthField->addOptions($par);
     $limitByBandwidthField->setRequired();
     $limitByBandwidthField->setHasInvitation(false);
     $this->addElement($limitByBandwidthField->setLabel($language->text('vwvc', 'limitByBandwidth')));
     // ws_ads Field
     $ws_adsField = new TextField('ws_ads');
     $ws_adsField->setRequired(true);
     $this->addElement($ws_adsField->setLabel($language->text('vwvc', 'ws_ads')));
     // adsTimeout Field
     $adsTimeoutField = new TextField('adsTimeout');
     $adsTimeoutField->setRequired(true);
     $this->addElement($adsTimeoutField->setLabel($language->text('vwvc', 'adsTimeout')));
     // adsInterval Field
     $adsIntervalField = new TextField('adsInterval');
     $adsIntervalField->setRequired(true);
     $this->addElement($adsIntervalField->setLabel($language->text('vwvc', 'adsInterval')));
     // statusInterval Field
     $statusIntervalField = new TextField('statusInterval');
     $statusIntervalField->setRequired(true);
     $this->addElement($statusIntervalField->setLabel($language->text('vwvc', 'statusInterval')));
     // availability Field
     $availabilityField = new TextField('availability');
     $availabilityField->setRequired(true);
     $this->addElement($availabilityField->setLabel($language->text('vwvc', 'availability')));
     // status Field
     $statusBox = array('approved' => 'approved', 'pending' => 'pending');
     $statusField = new Selectbox('status');
     $statusField->addOptions($statusBox);
     $statusField->setRequired();
     $statusField->setHasInvitation(false);
     $this->addElement($statusField->setLabel($language->text('vwvc', 'status')));
     // who can create room Field
     $memberBox = array('all' => 'all', 'member' => 'member list');
     $memberField = new Selectbox('member');
     $memberField->addOptions($memberBox);
     $memberField->setRequired();
     $memberField->setHasInvitation(false);
     $this->addElement($memberField->setLabel($language->text('vwvc', 'member')));
     // member_list Field
     $member_listField = new Textarea('member_list');
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById(OW::getUser()->getId());
     $username = $user->getUsername();
     $member_listField->setValue($username);
     $this->addElement($member_listField->setLabel($language->text('vwvc', 'member_list')));
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('vwvc', 'btn_edit'));
     $this->addElement($submit);
 }
Esempio n. 12
0
            $insert .= $col[$i] . ', ';
            $vals[] = $item->{$col}[$i];
        }
        $insert = substr($insert, 0, -2) . ") VALUES ('";
        // var_dump($vals);
        for ($i = 0; $i < sizeof($vals); ++$i) {
            // var_dump($col);
            // echo "$col[$i] - waarde = ".$item->$col[$i].'<br />';
            $insert .= $vals[$i] . "','";
            // $vals[] = $item->$col[$i];
        }
        $insert = substr($insert, 0, -2) . ");\r\n";
        // echo '<hr />';
        // $body->line($insert.'<br />');
        $resultset .= $insert;
        $insert = '';
        unset($vals);
        // echo '<hr />';
    }
    $restext = new Textarea();
    $restext->setName('queries');
    $restext->setRows(20);
    $restext->setCols(85);
    $restext->setValue($resultset);
    // $restext->setSelected('true');
    $restext->build();
}
$body->line('</div>');
include_once './inc/footer.php';
unset($body);
unset($html);
 public function __construct(BOL_MenuItem $menuItem, $custom = false, $addUrlValidator = true)
 {
     parent::__construct("settingForm");
     $this->menuItem = $menuItem;
     $language = OW::getLanguage();
     $this->setAjax();
     $this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_MobileNavigation", "saveItemSettings"));
     $item = new HiddenField("key");
     $item->setValue($menuItem->prefix . ':' . $menuItem->key);
     $this->addElement($item);
     $settings = BOL_MobileNavigationService::getInstance()->getItemSettings($this->menuItem);
     // Mail Settings
     $item = new TextField(BOL_MobileNavigationService::SETTING_LABEL);
     $item->setLabel($language->text("mobile", "admin_nav_item_label_field"));
     $item->setValue($settings[BOL_MobileNavigationService::SETTING_LABEL]);
     $item->setRequired();
     $this->addElement($item);
     if ($custom) {
         $typeField = new RadioField(BOL_MobileNavigationService::SETTING_TYPE);
         $typeField->setLabel($language->text("mobile", "admin_nav_item_type_field"));
         $typeField->setValue($settings[BOL_MobileNavigationService::SETTING_TYPE]);
         $typeField->addOption("local", $language->text("mobile", "admin_nav_item_type_local"));
         $typeField->addOption("external", $language->text("mobile", "admin_nav_item_type_external"));
         $this->addElement($typeField);
         $item = new TextField(BOL_MobileNavigationService::SETTING_TITLE);
         $item->setLabel($language->text("mobile", "admin_nav_item_title_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_TITLE]);
         $item->setRequired();
         $this->addElement($item);
         $item = new Textarea(BOL_MobileNavigationService::SETTING_CONTENT);
         $item->setLabel($language->text("mobile", "admin_nav_item_content_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_CONTENT]);
         $this->addElement($item);
         $item = new TextField(BOL_MobileNavigationService::SETTING_URL);
         if ($addUrlValidator) {
             $item->addValidator(new UrlValidator());
             $item->setRequired();
         }
         $item->setLabel($language->text("mobile", "admin_nav_item_url_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_URL]);
         $this->addElement($item);
         $item = new CheckboxGroup(BOL_MobileNavigationService::SETTING_VISIBLE_FOR);
         $visibleFor = empty($settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]) ? 0 : $settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR];
         $options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members'));
         $values = array();
         foreach ($options as $value => $option) {
             if (!($value & $visibleFor)) {
                 continue;
             }
             $values[] = $value;
         }
         $this->addElement($item->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for')));
         $js = UTIL_JsGenerator::newInstance();
         $js->addScript('var url = owForms[{$name}].elements["url"]; var validators = url.validators; url.validators = []; $("input[name=type]", "#" + {$id}).change(function() { ' . 'if ($(this).val() == "local") { ' . '$("#mp-content").show(); $("#mp-url").hide(); url.validators = []; ' . '} else { ' . '$("#mp-content").hide(); $("#mp-url").show(); url.validators = validators; } ' . '});', array("id" => $this->getId(), "name" => $this->getName()));
         OW::getDocument()->addOnloadScript($js);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Esempio n. 14
0
 public function robots()
 {
     if (OW::getRequest()->isPost()) {
         $contents = trim($_POST['robots']);
         OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_ROBOTS_CONTENTS, $contents);
         OW::getFeedback()->info(OW::getLanguage()->text('oaseo', 'admin_saved_msg'));
         $this->redirect();
     }
     $form = new Form('robots');
     $textarea = new Textarea('robots');
     $textarea->setValue(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_ROBOTS_CONTENTS));
     $form->addElement($textarea);
     $submit = new Submit('submit');
     $form->addElement($submit);
     $this->addForm($form);
 }
Esempio n. 15
0
 public function setValue($value)
 {
     if ($this->textarea !== null) {
         return $this->textarea->setValue($value);
     }
     $this->value = $value;
 }
Esempio n. 16
0
 public function getfile($params)
 {
     $checkpermissions = new SPDOWNLOAD_CLASS_Permissions();
     $checkpermissions->getInstance()->checkpageurl('download');
     $arrayCheck = $checkpermissions->getInstance()->checkpageclick('download');
     $this->assign('addNew_promoted', $arrayCheck['promoted']);
     $this->assign('addNew_isAuthorized', $arrayCheck['isAuthorized']);
     $versionId = $params['versionId'];
     $vFileName = $params['vFileName'];
     $arraylabellicense = array('label_license' => OW::getLanguage()->text('spdownload', 'label_license'), 'title_license' => OW::getLanguage()->text('spdownload', 'title_license'));
     $form = new Form('download_form');
     $this->addForm($form);
     $cmpCategories = new SPDOWNLOAD_CMP_Category();
     $this->addComponent('cmpCategories', $cmpCategories);
     $file = SPDOWNLOAD_BOL_VersionService::getInstance()->getFileId($versionId);
     $fieldLicense = new Textarea('message');
     $fieldLicense->setValue(OW::getLanguage()->text('spdownload', 'content_license'));
     $fieldLicense->setRequired();
     $form->addElement($fieldLicense);
     $fieldAgree = new CheckboxField('agreeCheck');
     $fieldAgree->setLabel(OW::getLanguage()->text('spdownload', 'label_content_license'));
     $fieldAgree->setValue(1);
     $form->addElement($fieldAgree);
     $submit = new Submit('downloadfile');
     $submit->setValue($this->text('spdownload', 'form_label_download'));
     $form->addElement($submit);
     $this->addForm($form);
     $this->assign('arraylabellicense', $arraylabellicense);
     if ($file === NULL) {
         throw new Redirect404Exception();
     }
     if (OW::getRequest()->isPost()) {
         $data = $form->getValues();
         if ($data['agreeCheck']) {
             $event = new OW_Event('spdownload.onDownloadFile', array('id' => $file->id));
             OW::getEventManager()->trigger($event);
             $data = $event->getData();
             if ($data !== null) {
                 $path = $data;
             } else {
                 $path = SPDOWNLOAD_BOL_FileService::getInstance()->getFilePath($file->id);
             }
             if (ini_get('zlib.output_compression')) {
                 ini_set('zlib.output_compression', 'Off');
             }
             header('Pragma: public');
             header('Expires: 0');
             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
             header('Cache-Control: private', false);
             header('Content-Type:' . $file->mimeType);
             header('Content-Description: File Transfer');
             header('Content-Disposition: attachment; filename="' . basename($file->filename) . '";');
             header('Content-Transfer-Encoding: binary');
             header('Content-Length: ' . filesize($path));
             ob_end_clean();
             readfile($path);
             die;
         }
     }
     $urlback = OW::getRouter()->urlForRoute('spdownload.index');
     $script = "\n            \$('#submit_downloadfile').click(function(){\n                setTimeout(function(){ window.location.href = '{$urlback}'; }, 1000);\n                \n            });\n        ";
     OW::getDocument()->addOnloadScript($script);
 }
Esempio n. 17
0
 public function index($params)
 {
     $filevernew = array();
     $file = array();
     $flag = false;
     $this->setPageTitle(OW::getLanguage()->text('spdownload', 'index_upload_title'));
     $this->setPageHeading(OW::getLanguage()->text('spdownload', 'index_upload_heading'));
     $arrayCheckCategory = array();
     if (!empty($params) && isset($params['fileId'])) {
         if (!stripos($params['fileId'], "-")) {
             throw new Redirect404Exception();
         }
         $check = $params['fileId'];
         $params['fileId'] = substr($params['fileId'], 0, stripos($params['fileId'], "-"));
         $file = SPDOWNLOAD_BOL_FileService::getInstance()->getFileId($params['fileId']);
         if ($file->id . '-' . $file->slug != $check) {
             throw new Redirect404Exception();
         }
         $CategoryIdList = SPDOWNLOAD_BOL_FileCategoryService::getInstance()->getCategoryId($params['fileId']);
         foreach ($CategoryIdList as $key => $value) {
             array_push($arrayCheckCategory, $value->categoryId);
         }
         $flag = true;
         $file = SPDOWNLOAD_BOL_FileService::getInstance()->getFileId($params['fileId']);
         if ($file === NULL) {
             throw new Redirect404Exception();
         }
         $filevernew = SPDOWNLOAD_BOL_VersionService::getInstance()->getFileVerNew($params['fileId']);
         $url = OW::getPluginManager()->getPlugin('spdownload')->getUserFilesUrl();
         $file->icon = $url . 'icon_small_' . $params['fileId'] . '.png';
         $thumbnails = SPDOWNLOAD_BOL_FileService::getInstance()->getThumbnailList($params['fileId']);
         foreach ($thumbnails as $key => $value) {
             $value->image = $url . $value->fileId . '_thumb_small_' . $value->uri . '.jpg';
         }
         $this->assign('file', $file);
         $this->assign('thumbnails', $thumbnails);
     }
     $form = new Form('upload_form');
     $form->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $cmpCategories = new SPDOWNLOAD_CMP_Category(false, $arrayCheckCategory);
     $this->addComponent('cmpCategories', $cmpCategories);
     $fieldName = new TextField('upname');
     $fieldName->setLabel($this->text('spdownload', 'form_label_name_up'));
     $fieldName->setRequired();
     if (!empty($params) && isset($params['fileId'])) {
         $fieldName->setValue($file->name);
     }
     $form->addElement($fieldName);
     $fieldSlug = new TextField('upslug');
     $fieldSlug->setLabel($this->text('spdownload', 'form_label_slug_up'));
     $fieldSlug->setRequired();
     if (!empty($params) && isset($params['fileId'])) {
         $fieldSlug->setValue($file->slug);
     }
     $form->addElement($fieldSlug);
     $fieldFile = new FileField('upfile');
     $fieldFile->setLabel($this->text('spdownload', 'form_label_file_up'));
     $form->addElement($fieldFile);
     $fieldIcon = new FileField('upicon');
     $fieldIcon->setLabel($this->text('spdownload', 'form_label_icon_up'));
     $form->addElement($fieldIcon);
     $fieldThumb = new MultiFileField('upthumb', 5);
     $fieldThumb->setLabel($this->text('spdownload', 'form_label_thumb_up'));
     $form->addElement($fieldThumb);
     $fieldDescription = new Textarea('updescription');
     $fieldDescription->setLabel($this->text('spdownload', 'form_label_description_up'));
     if (!empty($params) && isset($params['fileId'])) {
         $fieldDescription->setValue($file->description);
     }
     $form->addElement($fieldDescription);
     $fieldCategory = new CheckboxGroup('ct');
     $form->addElement($fieldCategory);
     $submit = new Submit('upload');
     $submit->setValue($this->text('spdownload', 'form_label_submit_up'));
     $form->addElement($submit);
     $this->addForm($form);
     $this->assign('flag', $flag);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             if (!empty($params) && isset($params['fileId'])) {
                 if (!empty($_POST['ct'])) {
                     $arrayAdd = array_diff($_POST['ct'], $arrayCheckCategory);
                     $arrayDelete = array_diff($arrayCheckCategory, $_POST['ct']);
                     foreach ($arrayDelete as $key => $value) {
                         SPDOWNLOAD_BOL_FileCategoryService::getInstance()->deleteId($params['fileId'], $value);
                     }
                     foreach ($arrayAdd as $key => $value) {
                         SPDOWNLOAD_BOL_FileCategoryService::getInstance()->addFileCategory($params['fileId'], $value);
                     }
                 } else {
                     SPDOWNLOAD_BOL_FileCategoryService::getInstance()->deleteId($params['fileId'], null);
                 }
             }
             $arrayFile = array();
             $arrayFile['id'] = null;
             if (!empty($params) && isset($params['fileId'])) {
                 $arrayFile['id'] = $params['fileId'];
             }
             $arrayFile['name'] = $_POST['upname'];
             $arrayFile['description'] = $_POST['updescription'];
             $arrayFile['slug'] = $_POST['upslug'];
             $arrayFile['authorId'] = OW::getUser()->getId();
             $arrayFile['addedTime'] = time();
             SPDOWNLOAD_BOL_FileService::getInstance()->addFile($arrayFile);
             if (isset($arrayFile['id']) && !empty($arrayFile['id'])) {
             } else {
                 $fileNew = SPDOWNLOAD_BOL_FileService::getInstance()->getIdNew($arrayFile);
                 $arrayFile['id'] = $fileNew[0]->id;
             }
             if (empty($params) && !isset($params['fileId'])) {
                 if (isset($_POST['ct']) && !empty($_POST['ct'])) {
                     foreach ($_POST['ct'] as $key => $value) {
                         SPDOWNLOAD_BOL_FileCategoryService::getInstance()->addFileCategory($arrayFile['id'], $value);
                     }
                 }
             }
             $arrayInputFile = array();
             $arrayInputFile['size'] = $_FILES['upfile']['size'];
             $arrayInputFile['name'] = $_FILES['upfile']['name'];
             $arrayInputFile['type'] = $_FILES['upfile']['type'];
             $arrayInputFile['tmp_name'] = $_FILES['upfile']['tmp_name'];
             $arrayInputFile['error'] = $_FILES['upfile']['error'];
             $arrayInputFile['addedTime'] = $arrayFile['addedTime'];
             $arrayInputFile['fileId'] = $arrayFile['id'];
             $path = SPDOWNLOAD_BOL_FileService::getInstance()->getFilePath();
             if ($arrayInputFile['error'] == 0) {
                 SPDOWNLOAD_BOL_VersionService::getInstance()->addVersion($arrayInputFile);
                 $verNew = SPDOWNLOAD_BOL_VersionService::getInstance()->getIdVer($arrayInputFile);
                 $arrayInputFile['id'] = $verNew[0]->id;
                 SPDOWNLOAD_BOL_FileService::getInstance()->move_file($arrayInputFile['tmp_name'], $path, $arrayInputFile['id']);
             }
             if ($_FILES['upicon']['error'] == 0 && !empty($_FILES['upicon']['name'])) {
                 SPDOWNLOAD_BOL_FileService::getInstance()->copy_resize_image($_FILES['upicon']['tmp_name'], 'icon_small', $arrayFile['id'], 'png', 48, 48);
                 SPDOWNLOAD_BOL_FileService::getInstance()->copy_resize_image($_FILES['upicon']['tmp_name'], 'icon_large', $arrayFile['id'], 'png', 128, 128);
             }
             foreach ($_FILES['upthumb']['tmp_name'] as $key => $value) {
                 if ($_FILES['upthumb']['error'][$key] == 0 && !empty($_FILES['upthumb']['name'][$key])) {
                     SPDOWNLOAD_BOL_FileThumbService::getInstance()->addThumb($arrayFile['id'], $key);
                     SPDOWNLOAD_BOL_FileService::getInstance()->copy_resize_image($_FILES['upthumb']['tmp_name'][$key], $arrayFile['id'] . '_thumb_small', $key, 'jpg', 360, 180);
                     SPDOWNLOAD_BOL_FileService::getInstance()->copy_resize_image($_FILES['upthumb']['tmp_name'][$key], $arrayFile['id'] . '_thumb_large', $key, 'jpg', 720, 360);
                 }
             }
         }
         $this->redirect(OW::getRouter()->urlForRoute('spdownload.up_myfile', array('userId' => OW::getUser()->getId())));
     }
 }
Esempio n. 18
0
    public function __construct($entityType, $entityId, $albumId = null, $albumName = null, $albumDescription = null, $url = null, $data = null)
    {
        parent::__construct(self::FORM_NAME);
        $this->setAjax(true);
        $this->setAjaxResetOnSuccess(false);
        $this->setAction(OW::getRouter()->urlForRoute('photo.ajax_upload_submit'));
        $this->bindJsFunction(self::BIND_SUCCESS, UTIL_JsGenerator::composeJsString('function( data )
        {
            if ( data )
            {
                if ( !data.result )
                {
                    if ( data.msg )
                    {
                        OW.error(data.msg);
                    }
                    else
                    {
                        OW.getLanguageText("photo", "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)));
        $language = OW::getLanguage();
        $albumField = new TextField(self::ELEMENT_ALBUM);
        $albumField->setRequired();
        $albumField->addAttribute(FormElement::ATTR_CLASS, 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
        $albumField->addAttribute('autocomplete', 'off');
        $albumField->addAttribute(FormElement::ATTR_READONLY);
        $albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
        $albumNameField->setRequired();
        $albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(false));
        $albumNameField->addAttribute('placeholder', $language->text('photo', 'album_name'));
        $this->addElement($albumNameField);
        $desc = new Textarea(self::ELEMENT_DESCRIPTION);
        $desc->addAttribute('placeholder', $language->text('photo', 'album_desc'));
        $desc->setValue(!empty($albumDescription) ? $albumDescription : null);
        $this->addElement($desc);
        $userId = OW::getUser()->getId();
        $albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
        if (!empty($albumId) && ($album = $albumService->findAlbumById($albumId)) !== null && $album->userId == $userId && !$albumService->isNewsfeedAlbum($album)) {
            $albumField->setValue($album->name);
            $albumNameField->setValue($album->name);
        } elseif (!empty($albumName)) {
            $albumField->setValue($albumName);
            $albumNameField->setValue($albumName);
        } else {
            $event = OW::getEventManager()->trigger(new BASE_CLASS_EventCollector(PHOTO_CLASS_EventHandler::EVENT_SUGGEST_DEFAULT_ALBUM, array('userId' => $userId, 'entityType' => $entityType, 'entityId' => $entityId)));
            $eventData = $event->getData();
            if (!empty($eventData)) {
                $value = array_shift($eventData);
                $albumField->setValue($value);
                $albumNameField->setValue($value);
            } else {
                $albumField->setValue($language->text('photo', 'choose_existing_or_create'));
            }
        }
        $this->addElement($albumField);
        $submit = new Submit('submit');
        $submit->addAttribute('class', 'ow_ic_submit ow_positive');
        $this->addElement($submit);
        $this->triggerReady(array('entityType' => $entityType, 'entityId' => $entityId, 'albumId' => $albumId, 'albumName' => $albumName, 'albumDescription' => $albumDescription, 'url' => $url, 'data' => $data));
    }
Esempio n. 19
0
 public function __construct($pluginKey, $entityType, $entityId)
 {
     // remove newfeeds cookie if has
     setcookie('ynsocialpublisher_feed_data_' . $entityId, '', -1, '/');
     parent::__construct();
     $userId = OW::getUser()->getId();
     $language = OW::getLanguage();
     $service = YNSOCIALPUBLISHER_BOL_Service::getInstance();
     $core = YNSOCIALPUBLISHER_CLASS_Core::getInstance();
     // user setting
     $userSetting = $service->getUsersetting($userId, $pluginKey);
     $this->assign('userSetting', $userSetting);
     // avatar
     $avatar = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatar)) {
         $avatar = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $this->assign('avatar', $avatar);
     // default status
     $defaultStatus = $core->getDefaultStatus($pluginKey, $entityType, $entityId);
     $this->assign('defaultStatus', $defaultStatus);
     // entity url
     $url = $core->getUrl($pluginKey, $entityType, $entityId);
     $this->assign('url', $url);
     // title
     $title = $core->getTitle($pluginKey, $entityType, $entityId);
     $this->assign('title', $title);
     // -- connect each provider to get data
     // callbackUrl
     $callbackUrl = OW::getRouter()->urlForRoute('ynsocialbridge-connects');
     $coreBridge = new YNSOCIALBRIDGE_CLASS_Core();
     $arrObjServices = array();
     foreach (array('facebook', 'twitter', 'linkedin') as $serviceName) {
         $profile = null;
         $connect_url = "";
         $access_token = "";
         $scope = '';
         $objService = array();
         //check enable API
         $clientConfig = YNSOCIALBRIDGE_BOL_ApisettingService::getInstance()->getConfig($serviceName);
         if ($clientConfig) {
             $obj = $coreBridge->getInstance($serviceName);
             $values = array('service' => $serviceName, 'userId' => OW::getUser()->getId());
             //$tokenDto = $obj -> getToken($values);
             //print_r($_SESSION['socialbridge_session'][$serviceName]);die;
             $disconnect_url = OW::getRouter()->urlForRoute('ynsocialbridge-disconnect') . "?service=" . $serviceName;
             if (!empty($_SESSION['socialbridge_session'][$serviceName]['access_token'])) {
                 if ($serviceName == 'facebook') {
                     $access_token = $_SESSION['socialbridge_session'][$serviceName]['access_token'];
                     //check permission
                     $me = $obj->getOwnerInfo(array('access_token' => $access_token));
                     $uid = $me['id'];
                     $permissions = $obj->hasPermission(array('uid' => $uid, 'access_token' => $access_token));
                     if ($permissions) {
                         if (empty($permissions[0]['publish_stream']) || empty($permissions[0]['status_update'])) {
                             $scope = 'publish_stream,status_update';
                             //$scope = "email,user_about_me,user_birthday,user_hometown,user_interests,user_location,user_photos,user_website,publish_stream,status_update";
                         } else {
                             try {
                                 $profile = $obj->getOwnerInfo($_SESSION['socialbridge_session'][$serviceName]);
                             } catch (Exception $e) {
                                 $profile = null;
                             }
                         }
                     }
                 } else {
                     $profile = $obj->getOwnerInfo($_SESSION['socialbridge_session'][$serviceName]);
                 }
             } else {
                 $scope = "";
                 switch ($serviceName) {
                     case 'facebook':
                         //$scope = "email,user_about_me,user_birthday,user_hometown,user_interests,user_location,user_photos,user_website";
                         $scope = 'publish_stream,status_update';
                         break;
                     case 'twitter':
                         $scope = "";
                         break;
                     case 'linkedin':
                         $scope = "r_basicprofile,rw_nus,r_network,w_messages";
                         break;
                 }
             }
             $connect_url = $obj->getConnectUrl() . "?scope=" . $scope . "&" . http_build_query(array('callbackUrl' => $callbackUrl, 'isFromSocialPublisher' => 1, 'pluginKey' => $pluginKey, 'entityType' => $entityType, 'entityId' => $entityId));
             $objService['has_config'] = 1;
         } else {
             $objService['has_config'] = 0;
         }
         $objService['serviceName'] = $serviceName;
         $objService['connectUrl'] = $connect_url;
         $objService['disconnectUrl'] = $disconnect_url;
         $objService['profile'] = $profile;
         $objService['logo'] = OW::getPluginManager()->getPlugin('ynsocialpublisher')->getStaticUrl() . "img/" . $serviceName . ".png";
         $arrObjServices[$serviceName] = $objService;
     }
     //print_r($userSetting);
     //print_r($arrObjServices);
     $this->assign('arrObjServices', $arrObjServices);
     // create form
     $formUrl = OW::getRouter()->urlFor('YNSOCIALPUBLISHER_CTRL_Ynsocialpublisher', 'ajaxPublish');
     $form = new Form('ynsocialpubisher_share');
     $form->setAction($formUrl);
     $form->setAjax();
     // -- hidden fields
     // for plugin key
     $pluginKeyHiddenField = new HiddenField('ynsocialpublisher_pluginKey');
     $pluginKeyHiddenField->setValue($pluginKey);
     $form->addElement($pluginKeyHiddenField);
     // for entity id
     $entityIdHiddenField = new HiddenField('ynsocialpublisher_entityId');
     $entityIdHiddenField->setValue($entityId);
     $form->addElement($entityIdHiddenField);
     // for entity type
     $entityTypeHiddenField = new HiddenField('ynsocialpublisher_entityType');
     $entityTypeHiddenField->setValue($entityType);
     $form->addElement($entityTypeHiddenField);
     // Status - textarea
     $status = new Textarea('ynsocialpublisher_status');
     $status->setValue($defaultStatus);
     $form->addElement($status);
     // Options - radio buttons
     $options = new RadioField('ynsocialpublisher_options');
     $options->setRequired();
     $options->addOptions(array('0' => $language->text('ynsocialpublisher', 'ask'), '1' => $language->text('ynsocialpublisher', 'auto'), '2' => $language->text('ynsocialpublisher', 'not_ask')));
     $options->setValue($userSetting['option']);
     $form->addElement($options);
     // Providers - checkboxes
     foreach (array('facebook', 'twitter', 'linkedin') as $provider) {
         if (in_array($provider, $userSetting['adminProviders']) && $arrObjServices[$provider]['has_config']) {
             $providerField = new CheckboxField('ynsocialpublisher_' . $provider);
             $form->addElement($providerField);
         }
     }
     // add js action to form
     $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);OWActiveFloatBox.close();}else{OW.error(data.message);}}');
     // submit button
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('ynsocialpublisher', 'submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     // assign to view
     $this->assign('formUrl', $formUrl);
 }
Esempio n. 20
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     // select box for permission
     $arr1 = array('1' => 'yes', '0' => 'no');
     // Record path Field
     $record_limitPath = new TextField('record_path');
     $record_limitPath->setRequired(false);
     $this->addElement($record_limitPath->setLabel($language->text('vwvr', 'record_path')));
     // Record limit Field
     $record_limitField = new TextField('record_limit');
     $record_limitField->setRequired(false);
     $this->addElement($record_limitField->setLabel($language->text('vwvr', 'record_limit')));
     // Show Camera Settings Field
     $show_camera_settingsField = new Selectbox('show_camera_settings');
     $show_camera_settingsField->addOptions($arr1);
     $show_camera_settingsField->setRequired();
     $show_camera_settingsField->setHasInvitation(false);
     $this->addElement($show_camera_settingsField->setLabel($language->text('vwvr', 'show_camera_settings')));
     // Advanced Camera Settings Field
     $advanced_camera_settingsField = new Selectbox('advanced_camera_settings');
     $advanced_camera_settingsField->addOptions($arr1);
     $advanced_camera_settingsField->setRequired();
     $advanced_camera_settingsField->setHasInvitation(false);
     $this->addElement($advanced_camera_settingsField->setLabel($language->text('vwvr', 'advanced_camera_settings')));
     // resolution Field
     $resolutionArr = array('320x240' => '320x240', '160x120' => '160x120', '176x144' => '176x144', '352x288' => '352x288', '640x480' => '640x480');
     $resolutionField = new Selectbox('resolution');
     $resolutionField->addOptions($resolutionArr);
     $resolutionField->setRequired();
     $resolutionField->setHasInvitation(false);
     $this->addElement($resolutionField->setLabel($language->text('vwvr', 'resolution')));
     // camera_fps Field
     $camera_fpsArr = array('10' => '10', '12' => '12', '20' => '20', '25' => '25', '30' => '30');
     $camera_fpsField = new Selectbox('camera_fps');
     $camera_fpsField->addOptions($camera_fpsArr);
     $camera_fpsField->setRequired();
     $camera_fpsField->setHasInvitation(false);
     $this->addElement($camera_fpsField->setLabel($language->text('vwvr', 'camera_fps')));
     // Microphone Rate Field
     $microphone_rateArr = array('11' => '11', '22' => '22', '44' => '44', '48' => '48');
     $microphone_rateField = new Selectbox('microphone_rate');
     $microphone_rateField->addOptions($microphone_rateArr);
     $microphone_rateField->setRequired();
     $microphone_rateField->setHasInvitation(false);
     $this->addElement($microphone_rateField->setLabel($language->text('vwvr', 'microphone_rate')));
     // Bandwidth Field
     $bandwidthField = new TextField('bandwidth');
     $bandwidthField->setRequired(true);
     $this->addElement($bandwidthField->setLabel($language->text('vwvr', 'bandwidth')));
     // Layout Code Field
     $layout_codeField = new Textarea('layout_code');
     $this->addElement($layout_codeField->setLabel($language->text('vwvr', 'layout_code')));
     // Fill window Field
     $fill_windowField = new Selectbox('fill_window');
     $fill_windowField->addOptions($arr1);
     $fill_windowField->setRequired();
     $fill_windowField->setHasInvitation(false);
     $this->addElement($fill_windowField->setLabel($language->text('vwvr', 'fill_window')));
     // baseSwf_url Field
     $baseSwf_urlField = new TextField('baseSwf_url');
     $baseSwf_urlField->addAttribute('readonly', 'readonly');
     $this->addElement($baseSwf_urlField->setLabel($language->text('vwvr', 'baseSwf_url')));
     // server Field
     $serverField = new TextField('server');
     $serverField->setRequired(true);
     $this->addElement($serverField->setLabel($language->text('vwvr', 'server')));
     // serverAMF Field
     $serverAMFField = new TextField('serverAMF');
     $serverAMFField->setRequired(true);
     $this->addElement($serverAMFField->setLabel($language->text('vwvr', 'serverAMF')));
     // videoCodec Field
     $videoCodecField = new TextField('videoCodec');
     $videoCodecField->setRequired(true);
     $this->addElement($videoCodecField->setLabel($language->text('vwvr', 'videoCodec')));
     // codecLevel Field
     $codecLevelField = new TextField('codecLevel');
     $codecLevelField->setRequired(true);
     $this->addElement($codecLevelField->setLabel($language->text('vwvr', 'codecLevel')));
     // soundQuality Field
     $soundQualityField = new TextField('soundQuality');
     $soundQualityField->setRequired(true);
     $this->addElement($soundQualityField->setLabel($language->text('vwvr', 'soundQuality')));
     // codecProfile Field
     $codecProfileArr = array('main' => 'main', 'baseline' => 'baseline');
     $codecProfileField = new Selectbox('codecProfile');
     $codecProfileField->addOptions($codecProfileArr);
     $codecProfileField->setRequired();
     $codecProfileField->setHasInvitation(false);
     $this->addElement($codecProfileField->setLabel($language->text('vwvr', 'codecProfile')));
     // soundCodec Field
     $soundCodecArr = array('Speex' => 'Speex', 'Nellymoser' => 'Nellymoser');
     $soundCodecField = new Selectbox('soundCodec');
     $soundCodecField->addOptions($soundCodecArr);
     $soundCodecField->setRequired();
     $soundCodecField->setHasInvitation(false);
     $this->addElement($soundCodecField->setLabel($language->text('vwvr', 'soundCodec')));
     // camMaxBandwidth Field
     $camMaxBandwidthField = new TextField('camMaxBandwidth');
     $camMaxBandwidthField->setRequired(true);
     $this->addElement($camMaxBandwidthField->setLabel($language->text('vwvr', 'camMaxBandwidth')));
     // bufferLive Field
     $bufferLiveField = new TextField('bufferLive');
     $bufferLiveField->setRequired(true);
     $this->addElement($bufferLiveField->setLabel($language->text('vwvr', 'bufferLive')));
     // bufferFull Field
     $bufferFullField = new TextField('bufferFull');
     $bufferFullField->setRequired(true);
     $this->addElement($bufferFullField->setLabel($language->text('vwvr', 'bufferFull')));
     // bufferLivePlayback Field
     $bufferLivePlaybackField = new TextField('bufferLivePlayback');
     $bufferLivePlaybackField->setRequired(true);
     $this->addElement($bufferLivePlaybackField->setLabel($language->text('vwvr', 'bufferLivePlayback')));
     // bufferFullPlayback Field
     $bufferFullPlaybackField = new TextField('bufferFullPlayback');
     $bufferFullPlaybackField->setRequired(true);
     $this->addElement($bufferFullPlaybackField->setLabel($language->text('vwvr', 'bufferFullPlayback')));
     // availability Field
     $availabilityField = new TextField('availability');
     $availabilityField->setRequired(true);
     $this->addElement($availabilityField->setLabel($language->text('vwvr', 'availability')));
     // status Field
     $statusBox = array('approved' => 'approved', 'pending' => 'pending');
     $statusField = new Selectbox('status');
     $statusField->addOptions($statusBox);
     $statusField->setRequired();
     $statusField->setHasInvitation(false);
     $this->addElement($statusField->setLabel($language->text('vwvr', 'status')));
     // who can create room Field
     $memberBox = array('all' => 'all', 'member' => 'member list');
     $memberField = new Selectbox('member');
     $memberField->addOptions($memberBox);
     $memberField->setRequired();
     $memberField->setHasInvitation(false);
     $this->addElement($memberField->setLabel($language->text('vwvr', 'member')));
     // member_list Field
     $member_listField = new Textarea('member_list');
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById(OW::getUser()->getId());
     $username = $user->getUsername();
     $member_listField->setValue($username);
     $this->addElement($member_listField->setLabel($language->text('vwvr', 'member_list')));
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('vwvr', 'btn_edit'));
     $this->addElement($submit);
 }
Esempio n. 21
0
 /**
  * @return Constructor.
  */
 public function __construct($metaData, $uri, $frontend = true)
 {
     parent::__construct();
     $this->metaService = OASEO_BOL_Service::getInstance();
     $language = OW::getLanguage();
     $uriArray = parse_url($uri);
     $uri = !empty($uriArray['path']) ? $uriArray['path'] : '';
     // need to get uri if url provided
     if (substr($uri, 0, 7) == 'http://') {
         $uri = substr($uri, strlen(OW_URL_HOME));
     } elseif (UTIL_String::removeFirstAndLastSlashes(substr($uri, 0, strlen(OW_URL_HOME) - 7)) == UTIL_String::removeFirstAndLastSlashes(substr(OW_URL_HOME, 7))) {
         $uri = UTIL_String::removeFirstAndLastSlashes(substr($uri, strlen(OW_URL_HOME) - 7));
     } else {
         $uri = trim($uri);
     }
     $metaData['routeData'] = $this->metaService->getRouteData($uri);
     $dispatchAttrs = $this->metaService->getDispatchParamsForUri($uri);
     if ($dispatchAttrs === false) {
         $this->assign('no_compile', true);
         return;
     }
     $entry = $this->metaService->getEntryForDispatchParams($dispatchAttrs);
     if ($entry !== null) {
         $metaArr = json_decode($entry->getMeta(), true);
         if (isset($metaArr['title'])) {
             $titleString = $metaArr['title'];
         }
         if (isset($metaArr['keywords'])) {
             $keywords = $metaArr['keywords'];
         }
         if (isset($metaArr['desc'])) {
             $descString = $metaArr['desc'];
         }
     }
     if (!isset($titleString)) {
         $titleString = $metaData['title'];
     }
     if (!isset($keywords)) {
         $keywords = explode(',', $metaData['keywords']);
         $keywords = array_map('trim', $keywords);
     }
     if (!isset($descString)) {
         $descString = $metaData['desc'];
     }
     $form = new Form('meta_edit');
     $form->setAction(OW::getRouter()->urlFor('OASEO_CTRL_Base', 'updateMeta'));
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $this->addForm($form);
     $title = new TextField('title');
     $title->setLabel($language->text('oaseo', 'meta_edit_form_title_label'));
     $title->setDescription($language->text('oaseo', 'meta_edit_form_title_fr_desc'));
     $title->setValue($titleString);
     $form->addElement($title);
     $keyword = new OA_CCLASS_TagsField('keywords');
     $keyword->setLabel($language->text('oaseo', 'meta_edit_form_keyword_label'));
     $keyword->setDescription($language->text('oaseo', 'meta_edit_form_keyword_fr_desc'));
     $keyword->setValue($keywords);
     $form->addElement($keyword);
     $desc = new Textarea('desc');
     $desc->setLabel($language->text('oaseo', 'meta_edit_form_desc_label'));
     $desc->setDescription($language->text('oaseo', 'meta_edit_form_desc_fr_desc'));
     $desc->setValue($descString);
     $form->addElement($desc);
     $hidTitle = new HiddenField('hidTitle');
     $hidTitle->setValue($titleString);
     $form->addElement($hidTitle);
     $hidKeyword = new HiddenField('hidKeywords');
     $hidKeyword->setValue(implode('+|+', $keywords));
     $form->addElement($hidKeyword);
     $hidDesc = new HiddenField('hidDesc');
     $hidDesc->setValue($descString);
     $form->addElement($hidDesc);
     if (!empty($metaData['routeData']) && $uri && $dispatchAttrs['controller'] != 'BASE_CTRL_StaticDocument') {
         $this->assign('urlAvail', true);
         $urlField = new OASEO_UrlField('url');
         $urlField->setValue($metaData['routeData']['path']);
         $urlField->setLabel($language->text('oaseo', 'meta_edit_form_url_label'));
         $urlField->setDescription($language->text('oaseo', 'meta_edit_form_url_desc'));
         $form->addElement($urlField);
         $routeName = new HiddenField('routeName');
         $routeName->setValue($metaData['routeData']['name']);
         $form->addElement($routeName);
     }
     $uriEl = new HiddenField('uri');
     $uriEl->setValue($uri);
     $form->addElement($uriEl);
     $submit = new Submit('submit');
     $submit->setValue($language->text('oaseo', 'meta_edit_form_submit_label'));
     $form->addElement($submit);
     $id = uniqid();
     $this->assign('id', $id);
     $this->assign('frontend', $frontend);
     $form->bindJsFunction('success', "function(data){if(data.status){OW.info(data.msg);window.oaseoFB.close();}else{OW.error(data.msg);}}");
     if ($frontend) {
         OW::getDocument()->addOnloadScript("\$('#aoseo_button_{$id}').click(\n            function(){\n                window.oaseoFB = new OA_FloatBox({\n                \$title: '{$language->text('oaseo', 'meta_edit_form_cmp_title')}',\n                \$contents: \$('#oaseo_edit_form_{$id}'),\n                width: 900,\n                icon_class: 'ow_ic_gear'\n            });\n            }\n        );");
     }
 }
Esempio n. 22
0
 /**
  * Class constructor
  *
  */
 public function __construct($clipId)
 {
     parent::__construct('vwlsEditForm');
     $language = OW::getLanguage();
     // clip id field
     $clipIdField = new HiddenField('id');
     $clipIdField->setRequired(true);
     $this->addElement($clipIdField);
     // select box for broadcasting
     $arr1 = array('1' => 'yes', '0' => 'no');
     $arr0 = array('0' => 'no', '1' => 'yes');
     // select box for permission
     $permArr0 = array('1' => 'moderators', '3' => 'none', '2' => 'owner', '0' => 'all');
     $permArr1 = array('0' => 'all', '3' => 'none', '2' => 'owner', '1' => 'moderators');
     $permArr2 = array('3' => 'none', '2' => 'owner', '1' => 'moderators', '0' => 'all');
     // room_name Field
     $generated = base_convert(time() - 1224000000 . rand(0, 10), 10, 36);
     $room_nameField = new TextField('room_name');
     $sValidator = new StringValidator(1, 22);
     $room_nameField->addValidator($sValidator);
     $room_nameField->setRequired(true);
     $room_nameField->setValue($generated);
     $this->addElement($room_nameField->setLabel($language->text('vwls', 'room_name')));
     // Description Field
     $descriptionField = new Textarea('description');
     $this->addElement($descriptionField->setLabel($language->text('vwls', 'description')));
     // Room limit Field
     $room_limitField = new TextField('room_limit');
     $room_limitField->setRequired(false);
     $room_limitField->setValue(0);
     $this->addElement($room_limitField->setLabel($language->text('vwls', 'room_limit')));
     // Show Camera Settings Field
     $show_camera_settingsField = new Selectbox('show_camera_settings');
     $show_camera_settingsField->addOptions($arr1);
     $show_camera_settingsField->setRequired();
     $show_camera_settingsField->setHasInvitation(false);
     $this->addElement($show_camera_settingsField->setLabel($language->text('vwls', 'show_camera_settings')));
     // Advanced Camera Settings Field
     $advanced_camera_settingsField = new Selectbox('advanced_camera_settings');
     $advanced_camera_settingsField->addOptions($arr1);
     $advanced_camera_settingsField->setRequired();
     $advanced_camera_settingsField->setHasInvitation(false);
     $this->addElement($advanced_camera_settingsField->setLabel($language->text('vwls', 'advanced_camera_settings')));
     // Configure Source Field
     $configure_sourceField = new Selectbox('configure_source');
     $configure_sourceField->addOptions($arr1);
     $configure_sourceField->setRequired();
     $configure_sourceField->setHasInvitation(false);
     $this->addElement($configure_sourceField->setLabel($language->text('vwls', 'configure_source')));
     // user_list Field
     $user_listField = new Textarea('user_list');
     $this->addElement($user_listField->setLabel($language->text('vwls', 'user_list')));
     // moderator_list Field
     $moderator_listField = new Textarea('moderator_list');
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById(OW::getUser()->getId());
     $username = $user->getUsername();
     $moderator_listField->setValue($username);
     $this->addElement($moderator_listField->setLabel($language->text('vwls', 'moderator_list')));
     // administrator Field
     /**        $administratorField = new Selectbox('administrator');
             $administratorField->addOptions($permArr0);
             $administratorField->setRequired();
             $administratorField->setHasInvitation(false);
             $this->addElement($administratorField->setLabel($language->text('vwls', 'administrator')));
     */
     // clean_up Field
     $clean_upField = new TextField('clean_up');
     $clean_upField->setValue(0);
     $this->addElement($clean_upField->setLabel($language->text('vwls', 'clean_up')));
     // Broadcasting
     // welcome Field
     $welcomeField = new Textarea('welcome');
     $welcomeField->setValue($language->text('vwls', 'welcome_default'));
     $this->addElement($welcomeField->setLabel($language->text('vwls', 'welcome')));
     // Only video Field
     $only_videoField = new Selectbox('only_video');
     $only_videoField->addOptions($arr0);
     $only_videoField->setRequired();
     $only_videoField->setHasInvitation(false);
     $this->addElement($only_videoField->setLabel($language->text('vwls', 'only_video')));
     // No Video Field
     $no_videoField = new Selectbox('no_video');
     $no_videoField->addOptions($arr0);
     $no_videoField->setRequired();
     $no_videoField->setHasInvitation(false);
     $this->addElement($no_videoField->setLabel($language->text('vwls', 'no_video')));
     // No Embeds Field
     $no_embedsField = new Selectbox('no_embeds');
     $no_embedsField->addOptions($arr0);
     $no_embedsField->setRequired();
     $no_embedsField->setHasInvitation(false);
     $this->addElement($no_embedsField->setLabel($language->text('vwls', 'no_embeds')));
     // Show Timer Field
     $show_timerField = new Selectbox('show_timer');
     $show_timerField->addOptions($arr1);
     $show_timerField->setRequired();
     $show_timerField->setHasInvitation(false);
     $this->addElement($show_timerField->setLabel($language->text('vwls', 'show_timer')));
     // writeText Field
     $write_textField = new Selectbox('write_text');
     $write_textField->addOptions($arr1);
     $write_textField->setRequired();
     $write_textField->setHasInvitation(false);
     $this->addElement($write_textField->setLabel($language->text('vwls', 'write_text')));
     // resolution Field
     $resolutionArr = array('320x240' => '320x240', '160x120' => '160x120', '176x144' => '176x144', '352x288' => '352x288', '640x480' => '640x480');
     $resolutionField = new Selectbox('resolution');
     $resolutionField->addOptions($resolutionArr);
     $resolutionField->setRequired();
     $resolutionField->setHasInvitation(false);
     $this->addElement($resolutionField->setLabel($language->text('vwls', 'resolution')));
     // camera_fps Field
     $camera_fpsArr = array('10' => '10', '12' => '12', '20' => '20', '25' => '25', '30' => '30');
     $camera_fpsField = new Selectbox('camera_fps');
     $camera_fpsField->addOptions($camera_fpsArr);
     $camera_fpsField->setRequired();
     $camera_fpsField->setHasInvitation(false);
     $this->addElement($camera_fpsField->setLabel($language->text('vwls', 'camera_fps')));
     // Microphone Rate Field
     $microphone_rateArr = array('11' => '11', '22' => '22', '44' => '44', '48' => '48');
     $microphone_rateField = new Selectbox('microphone_rate');
     $microphone_rateField->addOptions($microphone_rateArr);
     $microphone_rateField->setRequired();
     $microphone_rateField->setHasInvitation(false);
     $this->addElement($microphone_rateField->setLabel($language->text('vwls', 'microphone_rate')));
     // soundQuality Field
     $soundQualityField = new TextField('soundQuality');
     $soundQualityField->setRequired(true);
     $this->addElement($soundQualityField->setLabel($language->text('vwls', 'soundQuality')));
     // Bandwidth Field
     $bandwidthField = new TextField('bandwidth');
     $bandwidthField->setRequired(true);
     $bandwidthField->setValue(40960);
     $this->addElement($bandwidthField->setLabel($language->text('vwls', 'bandwidth')));
     // FloodProtection Field
     $flood_protectionField = new TextField('flood_protection');
     $flood_protectionField->setValue(3);
     $this->addElement($flood_protectionField->setLabel($language->text('vwls', 'flood_protection')));
     // verbose_level Field
     $verbose_levelArr = array('2' => 'warning/recoverable failure', '0' => 'nothing', '1' => 'failure', '3' => 'success', '4' => 'action');
     $verbose_levelField = new Selectbox('verbose_level');
     $verbose_levelField->addOptions($verbose_levelArr);
     $verbose_levelField->setRequired();
     $verbose_levelField->setHasInvitation(false);
     $this->addElement($verbose_levelField->setLabel($language->text('vwls', 'verbose_level')));
     // Label Color Field
     $label_colorField = new TextField('label_color');
     $label_colorField->setValue('FFFFFF');
     $this->addElement($label_colorField->setLabel($language->text('vwls', 'label_color')));
     // privateTextchat Field
     $private_textchatField = new Selectbox('private_textchat');
     $private_textchatField->addOptions($arr1);
     $private_textchatField->setRequired();
     $private_textchatField->setHasInvitation(false);
     $this->addElement($private_textchatField->setLabel($language->text('vwls', 'private_textchat')));
     // Layout Code Field
     $layout_codeField = new Textarea('layout_code');
     $this->addElement($layout_codeField->setLabel($language->text('vwls', 'layout_code')));
     // Fill window Field
     $fill_windowField = new Selectbox('fill_window');
     $fill_windowField->addOptions($arr1);
     $fill_windowField->setRequired();
     $fill_windowField->setHasInvitation(false);
     $this->addElement($fill_windowField->setLabel($language->text('vwls', 'fill_window')));
     // Video / Watch
     // welcome Field
     $welcome2Field = new Textarea('welcome2');
     $welcome2Field->setValue($language->text('vwls', 'welcome_default2'));
     $this->addElement($welcome2Field->setLabel($language->text('vwls', 'welcome2')));
     // Offline message Field
     $offline_messageField = new Textarea('offline_message');
     $this->addElement($offline_messageField->setLabel($language->text('vwls', 'offline_message')));
     // FloodProtection2 Field
     $flood_protection2Field = new TextField('flood_protection2');
     $flood_protection2Field->setValue(3);
     $this->addElement($flood_protection2Field->setLabel($language->text('vwls', 'flood_protection2')));
     // Filter regex Field
     $filter_regexField = new TextField('filter_regex');
     $filter_regexField->setValue('(?i)(f**k|c**t)(?-i)');
     $this->addElement($filter_regexField->setLabel($language->text('vwls', 'filter_regex')));
     // Filter replace Field
     $filter_replaceField = new TextField('filter_replace');
     $filter_replaceField->setValue('**');
     $this->addElement($filter_replaceField->setLabel($language->text('vwls', 'filter_replace')));
     // Layout Code2 Field
     $layout_code2Field = new Textarea('layout_code2');
     $this->addElement($layout_code2Field->setLabel($language->text('vwls', 'layout_code2')));
     // Fill window2 Field
     $fill_window2Field = new Selectbox('fill_window2');
     $fill_window2Field->addOptions($permArr0);
     $fill_window2Field->setRequired();
     $fill_window2Field->setHasInvitation(false);
     $this->addElement($fill_window2Field->setLabel($language->text('vwls', 'fill_window2')));
     // writeText2 Field
     $write_text2Field = new Selectbox('write_text2');
     $write_text2Field->addOptions($permArr1);
     $write_text2Field->setRequired();
     $write_text2Field->setHasInvitation(false);
     $this->addElement($write_text2Field->setLabel($language->text('vwls', 'write_text2')));
     // Enable Video Field
     $enable_videoField = new Selectbox('enable_video');
     $enable_videoField->addOptions($permArr1);
     $enable_videoField->setRequired();
     $enable_videoField->setHasInvitation(false);
     $this->addElement($enable_videoField->setLabel($language->text('vwls', 'enable_video')));
     // Enable chat Field
     $enable_chatField = new Selectbox('enable_chat');
     $enable_chatField->addOptions($permArr1);
     $enable_chatField->setRequired();
     $enable_chatField->setHasInvitation(false);
     $this->addElement($enable_chatField->setLabel($language->text('vwls', 'enable_chat')));
     // Enable users Field
     $enable_usersField = new Selectbox('enable_users');
     $enable_usersField->addOptions($permArr1);
     $enable_usersField->setRequired();
     $enable_usersField->setHasInvitation(false);
     $this->addElement($enable_usersField->setLabel($language->text('vwls', 'enable_users')));
     $entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'vwls');
     if ($entityTags) {
         $tags = array();
         foreach ($entityTags as $entityTag) {
             $tags[] = $entityTag->label;
         }
         $tagsField = new TagsField('tags', $tags);
     } else {
         $tagsField = new TagsField('tags');
     }
     $this->addElement($tagsField->setLabel($language->text('vwls', 'tags')));
     $submit = new Submit('edit');
     $submit->setValue($language->text('vwls', 'btn_edit'));
     $this->addElement($submit);
 }
Esempio n. 23
0
 public function __construct($widgetUniqName = null, $content = null)
 {
     parent::__construct('about_me_form');
     $this->widgetUniqName = $widgetUniqName;
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_ComponentPanel', 'ajaxSaveAboutMe'));
     $input = new Textarea('about_me');
     $input->addAttribute('style', 'width: 93%');
     $input->setId('about_me_widget_input');
     $input->setHasInvitation(true);
     $input->setInvitation(OW::getLanguage()->text('base', 'about_me_widget_inv_text'));
     //$input->setRequired(true);
     $input->setValue($content);
     $this->addElement($input);
     $hidden = new HiddenField('widget_uniq_name');
     $hidden->setValue($widgetUniqName);
     $this->addElement($hidden);
     $submit = new Submit('save');
     //$submit->setLabel(OW::getLanguage()->text('base', 'widget_about_me_save_btn'));
     $this->addElement($submit);
     OW::getDocument()->addOnloadScript('
        window.owForms["about_me_form"].bind("success", function(data){
             OW.info(data.message);
        });
        window.owForms["about_me_form"].reset = false;
     ');
 }
Esempio n. 24
0
 /**
  * 
  * Constructor
  * @param $prefix
  * @param $key
  * @param BASE_CMP_LanguageValueEdit $parent
  */
 public function __construct($prefix, $key, $parent)
 {
     parent::__construct('lang-values-edit');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'ajaxEditLangs') . "?prefix={$prefix}&key={$key}");
     $languageService = BOL_LanguageService::getInstance();
     $list = $languageService->findActiveList();
     $parent->assign('langs', $list);
     $parent->assign('prefix', $prefix);
     $parent->assign('key', $key);
     foreach ($list as $item) {
         $textArea = new Textarea("lang[{$item->getId()}][{$prefix}][{$key}]");
         $dto = $languageService->getValue($item->getId(), $prefix, $key);
         $value = $dto !== null ? $dto->getValue() : '';
         $textArea->setValue($value);
         $this->addElement($textArea);
     }
     $submit = new Submit('submit');
     $submit->setValue('Save');
     if (!$parent->eventBased) {
         $jsString = 'owForms[{$formName}].bind("success", function(json){
             if ( json["result"] == "success") {
                 var fb = document.ajaxLangValueEditForms[ json["prefix"] +"-"+ json["key"] ];
                 var ff = document.ajaxLangValueEditForms[json["prefix"] +"-"+json["key"]+"callback"];
                 ff(json);
                 fb.close();
             }
         })';
     } else {
         $jsString = 'owForms[{$formName}].bind("success", function(json){
             if ( json["result"] == "success") {
                 OW.trigger("admin.language_key_edit_success", [json], this);
             }
         })';
     }
     $script = UTIL_JsGenerator::composeJsString($jsString, array('formName' => $this->getName()));
     OW::getDocument()->addOnloadScript($script);
     $this->addElement($submit);
 }
 /**
  *
  * Constructor
  * @param $prefix
  * @param $key
  * @param BASE_CMP_LanguageValueEdit $parent
  */
 public function __construct(BOL_QuestionAccountType $accountType, $formName = '')
 {
     if (empty($formName)) {
         $formName = 'account_type_' . sha1(rand(0, 99999999));
     }
     parent::__construct($formName);
     $key = BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name);
     $prefix = 'base';
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
     $hidden = new HiddenField('command');
     $hidden->setValue('AddAccountType');
     $this->addElement($hidden);
     $hidden = new HiddenField('key');
     $hidden->setValue($key);
     $this->addElement($hidden);
     $hidden = new HiddenField('prefix');
     $hidden->setValue($prefix);
     $this->addElement($hidden);
     $hidden = new HiddenField('accountTypeName');
     $hidden->setValue($accountType->name);
     $this->addElement($hidden);
     $languageService = BOL_LanguageService::getInstance();
     $list = $languageService->findActiveList();
     foreach ($list as $item) {
         $textArea = new Textarea("lang[{$item->getId()}][{$prefix}][{$key}]");
         $dto = $languageService->getValue($item->getId(), $prefix, $key);
         $value = $dto !== null ? $dto->getValue() : '';
         $textArea->setValue($value);
         $textArea->addAttribute('style', 'height: 32px;');
         $this->addElement($textArea);
     }
     $roleList = BOL_AuthorizationService::getInstance()->findNonGuestRoleList();
     $defaultRole = null;
     if (!empty($accountType->roleId)) {
         $defaultRole = BOL_AuthorizationService::getInstance()->getRoleById($accountType->roleId);
     }
     if (empty($defaultRole)) {
         $defaultRole = BOL_AuthorizationService::getInstance()->getDefaultRole();
     }
     $options = array();
     foreach ($roleList as $role) {
         $options[$role->id] = BOL_AuthorizationService::getInstance()->getRoleLabel($role->name);
     }
     $roleFormElement = new Selectbox('role');
     $roleFormElement->setOptions($options);
     $roleFormElement->setValue($defaultRole->id);
     $roleFormElement->setHasInvitation(false);
     $this->addElement($roleFormElement);
     if (!empty($accountType->id)) {
         $accountTypes = BOL_QuestionService::getInstance()->findAllAccountTypes();
         if (count($accountTypes) > 1) {
             $options = array();
             $i = 1;
             foreach ($accountTypes as $dto) {
                 /* @var $dto BOL_QuestionAccountType  */
                 $options[$dto->sortOrder] = $i;
                 $i++;
             }
             $orderFormElement = new Selectbox('order');
             $orderFormElement->setOptions($options);
             $orderFormElement->setValue($accountType->sortOrder);
             $orderFormElement->setHasInvitation(false);
             $this->addElement($orderFormElement);
         }
     }
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'questions_add_new_account_type'));
     $jsString = ' owForms[{$formName}].bind("success", function(json){
         if ( json.result.add == true) {
             OW.registerLanguageKey("base", ' . json_encode($key) . ', json.accountTypeName);
             OW.trigger("admin.add_account_type", [json], this);
         }
     }); ';
     OW::getLanguage()->addKeyForJs($prefix, $key);
     if (!empty($accountType->id)) {
         $jsString = ' owForms[{$formName}].bind("success", function(json){
             if ( json.result.update == true) {
                 OW.registerLanguageKey("base", ' . json_encode($key) . ', json.accountTypeName);
                 OW.trigger("admin.update_account_type", [json], this);
             }
         }); ';
     }
     $script = UTIL_JsGenerator::composeJsString($jsString, array('formName' => $this->getName()));
     OW::getDocument()->addOnloadScript($script);
     if ($accountType->id) {
         $submit->setValue(OW::getLanguage()->text('admin', 'questions_save_account_type'));
     }
     $this->addElement($submit);
 }