/** * Displays phoo groups administration panel * * @access public * @return string XHTML template content */ function Groups() { $this->gadget->CheckPermission('Groups'); $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Groups.html'); $tpl->SetBlock('groups'); // Header $tpl->SetVariable('menubar', $this->MenuBar('Groups')); // Meta keywords $name =& Piwi::CreateWidget('Entry', 'name', ''); $tpl->SetVariable('lbl_name', _t('GLOBAL_NAME')); $tpl->SetVariable('name', $name->Get()); // Fast URL $fastUrlEntry =& Piwi::CreateWidget('Entry', 'fast_url', ''); $fastUrlEntry->SetId('fast_url'); $fastUrlEntry->SetStyle('width: 100%'); $tpl->SetVariable('lbl_fast_url', _t('PHOO_FASTURL')); $tpl->SetVariable('fast_url', $fastUrlEntry->Get()); // Meta keywords $metaKeywords =& Piwi::CreateWidget('Entry', 'meta_keywords', ''); $metaKeywords->SetStyle('width: 100%;'); $tpl->SetVariable('lbl_meta_keywords', _t('GLOBAL_META_KEYWORDS')); $tpl->SetVariable('meta_keywords', $metaKeywords->Get()); // Meta Description $metaDesc =& Piwi::CreateWidget('Entry', 'meta_description', ''); $metaDesc->SetStyle('width: 100%;'); $tpl->SetVariable('lbl_meta_description', _t('GLOBAL_META_DESCRIPTION')); $tpl->SetVariable('meta_description', $metaDesc->Get()); // description $entry =& Piwi::CreateWidget('TextArea', 'description', ''); $entry->SetId('description'); $entry->SetRows(4); $entry->SetColumns(30); $entry->SetStyle('width: 99%; direction: ltr; white-space: nowrap;'); $tpl->SetVariable('lbl_description', _t('GLOBAL_DESCRIPTION')); $tpl->SetVariable('description', $entry->Get()); $tpl->SetVariable('addGroupTitle', _t('PHOO_GROUPS_ADD_GROUP')); $tpl->SetVariable('editGroupTitle', _t('PHOO_GROUPS_EDIT_GROUP')); $tpl->SetVariable('confirmGroupDelete', _t('PHOO_GROUPS_CONFIRM_DELETE')); $tpl->SetVariable('incompleteGroupFields', _t('PHOO_GROUPS_INCOMPLETE_GROUP_FIELDS')); $tpl->SetVariable('delete', _t('GLOBAL_DELETE')); $tpl->SetVariable('cancel', _t('GLOBAL_CANCEL')); $tpl->SetVariable('save', _t('GLOBAL_SAVE')); $tpl->SetVariable('delete_icon', STOCK_DELETE); $tpl->SetVariable('save_icon', STOCK_SAVE); $tpl->SetVariable('cancel_icon', STOCK_CANCEL); //Fill the groups combo.. $comboGroups =& Piwi::CreateWidget('Combo', 'groups_combo'); $comboGroups->SetSize(14); $comboGroups->AddEvent(ON_CHANGE, 'javascript:editGroup(this.value);'); $comboGroups->SetStyle('width: 100%;'); $model = $this->gadget->model->load('Groups'); $groups = $model->GetGroups(); foreach ($groups as $group) { $comboGroups->AddOption($group['name'], $group['id']); } $tpl->SetVariable('combo', $comboGroups->Get()); $tpl->ParseBlock('groups'); return $tpl->Get(); }
/** * View report * * @access public * @return string XHTML template content */ function Reports() { $this->gadget->CheckPermission('ViewReports'); $this->AjaxMe('script.js'); $model = $this->gadget->model->load('Group'); $tpl = $this->gadget->template->loadAdmin('Reports.html'); $tpl->SetBlock('Reports'); //Menu bar $tpl->SetVariable('menubar', $this->MenuBar('Reports')); $tpl->SetVariable('lbl_pollgroups', _t('POLL_GROUPS')); $groupsCombo =& Piwi::CreateWidget('Combo', 'pollgroups'); $groupsCombo->SetID('pollgroups'); $groupsCombo->AddEvent(ON_CHANGE, "javascript:getGroupPolls(this.value);"); $groups = $model->GetPollGroups(); $groupsCombo->AddOption('', 0); foreach ($groups as $group) { $groupsCombo->AddOption($group['title'], $group['id']); } $tpl->SetVariable('pollgroups_combo', $groupsCombo->Get()); $tpl->SetVariable('lbl_grouppolls', _t('POLL_POLLS')); $pollsCombo =& Piwi::CreateWidget('Combo', 'grouppolls'); $pollsCombo->SetID('grouppolls'); $pollsCombo->SetSize(15); $pollsCombo->AddEvent(ON_CHANGE, 'javascript:showResult(this.value);'); $tpl->SetVariable('grouppolls_combo', $pollsCombo->Get()); $tpl->ParseBlock('Reports'); return $tpl->Get(); }
/** * Fetches list of system user groups * * @access public * @return array Array of groups or an empty array */ function ShareForm() { $tpl = $this->gadget->template->load('Share.html'); $tpl->SetBlock('share'); $tpl->SetVariable('lbl_shared_for', _t('DIRECTORY_SHARED_FOR')); $tpl->SetVariable('lbl_public', _t('DIRECTORY_FILE_PUBLIC_URL')); $tpl->SetVariable('lbl_make_public', _t('DIRECTORY_FILE_MAKE_PUBLIC')); // Edit UI if ($this->gadget->GetPermission('ShareFile')) { $tpl->SetBlock('share/edit'); $tpl->SetVariable('lbl_groups', _t('DIRECTORY_GROUPS')); $tpl->SetVariable('lbl_users', _t('DIRECTORY_USERS')); $uModel = new Jaws_User(); $groups = $uModel->GetGroups(true, 'title'); if (!Jaws_Error::IsError($groups)) { $combo =& Piwi::CreateWidget('Combo', 'groups'); $combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)'); $combo->AddOption('All Users', 0); foreach ($groups as $group) { $combo->AddOption($group['title'], $group['id']); } $tpl->SetVariable('groups', $combo->Get()); } $tpl->ParseBlock('share/edit'); $tpl->SetBlock('share/actions'); $tpl->SetVariable('lbl_ok', _t('GLOBAL_OK')); $tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL')); $tpl->ParseBlock('share/actions'); } $tpl->ParseBlock('share'); return $tpl->Get(); }
/** * Builds admin properties UI * * @access public * @return string XHTML form */ function Properties() { $this->gadget->CheckPermission('Settings'); $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Settings.html'); $tpl->SetBlock('Settings'); // view tag result limit $limit = (int) $this->gadget->registry->fetch('tag_results_limit'); $limitCombo =& Piwi::CreateWidget('Combo', 'tag_results_limit'); $limitCombo->SetTitle(_t('TAGS_DISPLAY_RESULTS_LIMIT')); $limitCombo->AddOption(5, 5); $limitCombo->AddOption(10, 10); $limitCombo->AddOption(15, 15); $limitCombo->AddOption(20, 20); $limitCombo->AddOption(30, 30); $limitCombo->AddOption(50, 50); $limitCombo->SetDefault($limit > 0 ? $limit : 10); $tpl->SetVariable('lbl_tag_results_limit', _t('TAGS_RESULT_LIMIT')); $tpl->SetVariable('tag_results_limit', $limitCombo->Get()); $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE); $save->AddEvent(ON_CLICK, 'javascript:saveSettings();'); $tpl->SetVariable('btn_save', $save->Get()); $tpl->SetVariable('menubar', $this->MenuBar('Properties')); $tpl->ParseBlock('Settings'); return $tpl->Get(); }
/** * Builds admin settings UI * * @access public * @return string XHTML form */ function Settings() { $this->gadget->CheckPermission('ManageSettings'); $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Settings.html'); $tpl->SetBlock('Settings'); // Log Priority Level $priority_level = (int) $this->gadget->registry->fetch('log_priority_level'); $priorityCombo =& Piwi::CreateWidget('Combo', 'priority'); $priorityCombo->AddOption(_t('LOGS_PRIORITY_5'), JAWS_WARNING, false); $priorityCombo->AddOption(_t('LOGS_PRIORITY_6'), JAWS_NOTICE, false); $priorityCombo->AddOption(_t('LOGS_PRIORITY_7'), JAWS_INFO, false); $priorityCombo->SetDefault($priority_level); $tpl->SetVariable('lbl_priority', _t('LOGS_SETTINGS_DEFAULT_LOG_PRIORITY')); $tpl->SetVariable('priority', $priorityCombo->Get()); // Log Parameters? $log_parameters = (int) $this->gadget->registry->fetch('log_parameters'); $logParametersCombo =& Piwi::CreateWidget('Combo', 'log_parameters'); $logParametersCombo->AddOption(_t('GLOBAL_YES'), 1, false); $logParametersCombo->AddOption(_t('GLOBAL_NO'), 0, false); $logParametersCombo->SetDefault($log_parameters); $tpl->SetVariable('lbl_log_parameters', _t('LOGS_SETTINGS_LOG_PARAMETERS')); $tpl->SetVariable('log_parameters', $logParametersCombo->Get()); $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE); $save->AddEvent(ON_CLICK, 'javascript:saveSettings();'); $tpl->SetVariable('btn_save', $save->Get()); $tpl->SetVariable('menubar', $this->MenuBar('Settings')); $tpl->ParseBlock('Settings'); return $tpl->Get(); }
/** * Edit a category * * @access public * @return string XHTML Category form content */ function EditCategory() { $this->gadget->CheckPermission('ManageCategories'); $this->AjaxMe('script.js'); $category = jaws()->request->fetch('category', 'get'); if (!is_null($category)) { $model = $this->gadget->model->loadAdmin('Category'); $cat = $model->GetCategory($category); } $tpl = $this->gadget->template->loadAdmin('Faq.html'); $tpl->SetBlock('edit_category'); $tpl->SetVariable('menubar', $this->MenuBar('AddNewCategory')); //Add Faq Form $faqform =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post'); $faqform->SetStyle('width: 100%;'); $faqform->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Faq')); if (isset($cat)) { $faqform->Add(Piwi::CreateWidget('HiddenEntry', 'id', $category)); $faqform->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateCategory')); } else { $faqform->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'NewCategory')); } $catbox =& Piwi::CreateWidget('VBox'); $catTitle = isset($cat) ? $cat['category'] : ''; $catentry =& Piwi::CreateWidget('Entry', 'category', $catTitle); $catentry->SetTitle(_t('FAQ_CATEGORY')); $catentry->SetStyle('width: 500px;'); $catbox->PackStart($catentry); $fasturl = isset($cat) ? $cat['fast_url'] : ''; $cfasturl =& Piwi::CreateWidget('Entry', 'fast_url', $fasturl); $cfasturl->SetTitle(_t('FAQ_FASTURL')); $cfasturl->SetStyle('direction: ltr; width: 500px;'); $catbox->PackStart($cfasturl); $desc = isset($cat) ? $cat['description'] : ''; $editor =& $GLOBALS['app']->LoadEditor('Faq', 'description', $desc, false, _t('GLOBAL_DESCRIPTION')); $editor->TextArea->SetStyle('width: 100%;'); $editor->TextArea->SetRows(8); $faqform->Add($catbox); $faqform->Add($editor); if (isset($cat)) { $submit =& Piwi::CreateWidget('Button', 'updcat', _t('FAQ_UPDATE_CATEGORY'), STOCK_SAVE); } else { $submit =& Piwi::CreateWidget('Button', 'newcat', _t('FAQ_ADD_CATEGORY'), STOCK_SAVE); } $submit->SetSubmit(); $cancel =& Piwi::CreateWidget('Button', 'cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL); $cancel->AddEvent(ON_CLICK, "javascript: window.location = '" . BASE_SCRIPT . '?gadget=Faq' . "';"); $preview =& Piwi::CreateWidget('Button', 'previewButton', _t('GLOBAL_PREVIEW'), STOCK_PRINT_PREVIEW); $preview->AddEvent(ON_CLICK, 'javascript: parseCategoryText(this.form);'); $buttonbox =& Piwi::CreateWidget('HBox'); $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;'); $buttonbox->PackStart($preview); $buttonbox->PackStart($cancel); $buttonbox->PackStart($submit); $faqform->Add($buttonbox); $tpl->SetVariable('form', $faqform->Get()); $tpl->ParseBlock('edit_category'); return $tpl->Get(); }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $button =& Piwi::CreateWidget('Button', 'addalbumcover', '', $GLOBALS['app']->getSiteURL('/plugins/AlbumCover/images/stock-album.png', true)); $button->SetTitle(_t('PLUGINS_ALBUMCOVER_ADD') . ' ALT+A'); $button->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}','[AlbumCover Artist=\\'\\' Album=\\'\\']','','');"); $button->SetAccessKey('A'); return $button; }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $button =& Piwi::CreateWidget('Button', 'addbridge', '', $GLOBALS['app']->getSiteURL('/plugins/SmartBridge/images/smart-bridge-stock.png', true)); $button->SetTitle(_t('PLUGINS_SMARTBRIDGE_ADD') . ' ALT+B'); $button->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}','[a:Gadget:FastURL]','[/a]','" . _t('PLUGINS_SMARTBRIDGE_SAMPLE') . "');"); $button->SetAccessKey('B'); return $button; }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $button =& Piwi::CreateWidget('Button', 'addspellnumber', '', $GLOBALS['app']->getSiteURL('/plugins/SpellNumber/images/stock-spell_number.png', true)); $button->SetTitle(_t('PLUGINS_SPELLNUMBER_ADD') . ' ALT+N'); $button->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '[number]','[/number]','');"); $button->SetAccessKey('N'); return $button; }
/** * Displays blog categories manager * * @access public * @param string $second_action * @return string XHTML template content */ function ManageCategories($second_action = '') { $this->gadget->CheckPermission('ManageCategories'); $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Categories.html'); $tpl->SetBlock('categories'); // Menubar $tpl->SetVariable('menubar', $this->MenuBar('ManageCategories')); $tpl->SetVariable('categories', _t('BLOG_CATEGORIES')); $model = $this->gadget->model->load('Categories'); $categories = $model->GetCategories(); $combo =& Piwi::CreateWidget('Combo', 'category_id'); $combo->SetID('category_id'); $combo->SetStyle('width: 100%; margin-bottom: 10px;'); $combo->SetSize(18); $combo->AddEvent(ON_CHANGE, 'editCategory(this.value)'); foreach ($categories as $cat) { $combo->AddOption($cat['name'], $cat['id']); } $tpl->SetVariable('combo', $combo->Get()); // Category form $catName =& Piwi::CreateWidget('Entry', 'name', ''); $catName->setStyle('width: 300px;'); $tpl->SetVariable('lbl_name', _t('BLOG_CATEGORY')); $tpl->SetVariable('name', $catName->Get()); $catFastURL =& Piwi::CreateWidget('Entry', 'fast_url', ''); $catFastURL->setStyle('width: 300px;'); $tpl->SetVariable('lbl_fast_url', _t('BLOG_FASTURL')); $tpl->SetVariable('fast_url', $catFastURL->Get()); $metaKeywords =& Piwi::CreateWidget('Entry', 'meta_keywords', ''); $metaKeywords->setStyle('width: 300px;'); $tpl->SetVariable('lbl_meta_keywords', _t('GLOBAL_META_KEYWORDS')); $tpl->SetVariable('meta_keywords', $metaKeywords->Get()); $metaDesc =& Piwi::CreateWidget('Entry', 'meta_desc', ''); $metaDesc->setStyle('width: 300px;'); $tpl->SetVariable('lbl_meta_desc', _t('GLOBAL_META_DESCRIPTION')); $tpl->SetVariable('meta_desc', $metaDesc->Get()); $catDescription =& Piwi::CreateWidget('TextArea', 'description', ''); $catDescription->setStyle('width: 300px;'); $tpl->SetVariable('lbl_description', _t('GLOBAL_DESCRIPTION')); $tpl->SetVariable('description', $catDescription->Get()); $btnDelete =& Piwi::CreateWidget('Button', 'btn_delete', _t('GLOBAL_DELETE'), STOCK_DELETE); $btnDelete->AddEvent(ON_CLICK, 'javascript:deleteCategory();'); $btnDelete->SetStyle('display: none;'); $tpl->SetVariable('btn_delete', $btnDelete->Get()); $btnCancel =& Piwi::CreateWidget('Button', 'btn_cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL); $btnCancel->AddEvent(ON_CLICK, 'javascript:stopAction();'); $tpl->SetVariable('btn_cancel', $btnCancel->Get()); $btnSave =& Piwi::CreateWidget('Button', 'btn_save', _t('GLOBAL_SAVE'), STOCK_SAVE); $btnSave->AddEvent(ON_CLICK, 'javascript:saveCategory(this.form);'); $tpl->SetVariable('btn_save', $btnSave->Get()); $tpl->SetVariable('delete_message', _t('BLOG_DELETE_CONFIRM_CATEGORY')); $tpl->SetVariable('incompleteCategoryFields', _t('BLOG_CATEGORY_INCOMPLETE_FIELDS')); $tpl->SetVariable('addCategory_title', _t('BLOG_NEW_CATEGORY')); $tpl->SetVariable('editCategory_title', _t('BLOG_EDIT_CATEGORY')); $tpl->ParseBlock('categories'); return $tpl->Get(); }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $url = BASE_SCRIPT . '?gadget=FileBrowser&action=BrowseFile'; $popbutton =& Piwi::CreateWidget('Button', 'popbutton', '', 'plugins/FileExplorer/images/file-explorer.png'); $popbutton->SetTitle(_t('PLUGINS_FILEEXPLORER_BROWSE_SERVER')); $popbutton->AddEvent(ON_CLICK, "browse('{$textarea}', '{$url}')"); $popbutton->AddFile('plugins/FileExplorer/Resources/file-explorer.js'); return $popbutton; }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $url = BASE_SCRIPT . '?gadget=Phoo&action=BrowsePhoo'; $popbutton =& Piwi::CreateWidget('Button', 'popbutton', '', 'plugins/PhooInsert/images/image.png'); $popbutton->SetTitle(_t('PLUGINS_PHOOINSERT_INSERT_IMAGE')); $popbutton->AddEvent(ON_CLICK, "browsePhoo('{$textarea}', '{$url}')"); $popbutton->AddFile('plugins/PhooInsert/Resources/PhooInsert.js'); return $popbutton; }
/** * Changes when to display a given gadget * * @access public * @return XHTML template content */ function DisplayWhen() { $rqst = jaws()->request->fetch(array('id', 'layout'), 'get'); $layout = empty($rqst['layout']) ? 'Layout' : $rqst['layout']; // check permissions if ($layout == 'Index.Dashboard') { $GLOBALS['app']->Session->CheckPermission('Users', 'ManageDashboard'); } else { $GLOBALS['app']->Session->CheckPermission('Users', 'ManageLayout'); } $model = $this->gadget->model->loadAdmin('Elements'); $tpl = $this->gadget->template->load('DisplayWhen.html'); $tpl->SetBlock('template'); $direction = _t('GLOBAL_LANG_DIRECTION'); $dir = $direction == 'rtl' ? '.' . $direction : ''; $brow = $GLOBALS['app']->GetBrowserFlag(); $brow = empty($brow) ? '' : '.' . $brow; $base_url = $GLOBALS['app']->GetSiteURL('/'); $tpl->SetVariable('BASE_URL', $base_url); $tpl->SetVariable('.dir', $dir); $tpl->SetVariable('.browser', $brow); $tpl->SetVariable('base_script', BASE_SCRIPT); $tpl->SetVariable('lbl_when', _t('LAYOUT_DISPLAY')); $layoutElement = $model->GetElement($rqst['id']); if (is_array($layoutElement) && !empty($layoutElement)) { $dw_value = $layoutElement['when']; } $displayCombo =& Piwi::CreateWidget('Combo', 'display_in'); $displayCombo->AddOption(_t('LAYOUT_ALWAYS'), 'always'); $displayCombo->AddOption(_t('LAYOUT_ONLY_IN_GADGET'), 'selected'); if ($dw_value == '*') { $displayCombo->SetDefault('always'); $tpl->SetVariable('selected_display', 'none'); } else { $displayCombo->SetDefault('selected'); $tpl->SetVariable('selected_display', 'block'); } $displayCombo->AddEvent(ON_CHANGE, "showGadgets();"); $tpl->SetVariable('display_in_combo', $displayCombo->Get()); // Display in list $selectedGadgets = explode(',', $dw_value); // for index... $gadget_field =& Piwi::CreateWidget('CheckButtons', 'checkbox_index', 'vertical'); $gadget_field->AddOption(_t('LAYOUT_INDEX'), 'index', null, in_array('index', $selectedGadgets)); $cmpModel = Jaws_Gadget::getInstance('Components')->model->load('Gadgets'); $gadget_list = $cmpModel->GetGadgetsList(null, true, true, true); foreach ($gadget_list as $g) { $gadget_field->AddOption($g['title'], $g['name'], null, in_array($g['name'], $selectedGadgets)); } $tpl->SetVariable('selected_gadgets', $gadget_field->Get()); $saveButton =& Piwi::CreateWidget('Button', 'ok', _t('GLOBAL_SAVE'), STOCK_SAVE); $saveButton->AddEvent(ON_CLICK, "parent.parent.saveChangeDW(" . $layoutElement['id'] . ", getSelectedGadgets());"); $tpl->SetVariable('save', $saveButton->Get()); $tpl->ParseBlock('template'); return $tpl->Get(); }
/** * Displays shoutbox Settings * * @access public * @return string XHTML template content */ function Settings() { $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Settings.html'); $tpl->SetBlock('settings'); $tpl->SetVariable('menubar', $this->MenuBar('Settings')); ///Config properties if ($this->gadget->GetPermission('UpdateProperties')) { $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'POST'); $form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Shoutbox')); $form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateProperties')); include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php'; $fieldset = new Jaws_Widgets_FieldSet(_t('SHOUTBOX_SETTINGS')); $fieldset->SetDirection('vertical'); // $limitcombo =& Piwi::CreateWidget('Combo', 'limit_entries'); $limitcombo->SetTitle(_t('SHOUTBOX_ENTRY_LIMIT')); for ($i = 1; $i <= 20; ++$i) { $limitcombo->AddOption($i, $i); } $limit = $this->gadget->registry->fetch('limit'); if (Jaws_Error::IsError($limit)) { $limit = 10; } $limitcombo->SetDefault($limit); $fieldset->Add($limitcombo); // max length $max_lencombo =& Piwi::CreateWidget('Combo', 'max_strlen'); $max_lencombo->SetTitle(_t('SHOUTBOX_ENTRY_MAX_LEN')); for ($i = 1; $i <= 10; ++$i) { $max_lencombo->AddOption($i * 25, $i * 25); } $max_strlen = $this->gadget->registry->fetch('max_strlen'); if (Jaws_Error::IsError($max_strlen)) { $max_strlen = 125; } $max_lencombo->SetDefault($max_strlen); $fieldset->Add($max_lencombo); //Anonymous post authority $authority =& Piwi::CreateWidget('Combo', 'authority'); $authority->SetTitle(_t('SHOUTBOX_ANON_POST_AUTHORITY')); $authority->AddOption(_t('GLOBAL_DISABLED'), 'false'); $authority->AddOption(_t('GLOBAL_ENABLED'), 'true'); $anon_authority = $this->gadget->registry->fetch('anon_post_authority'); $authority->SetDefault($anon_authority == 'true' ? 'true' : 'false'); $fieldset->Add($authority); $form->Add($fieldset); $submit =& Piwi::CreateWidget('Button', 'saveproperties', _t('GLOBAL_SAVE'), STOCK_SAVE); $submit->AddEvent(ON_CLICK, 'javascript: updateProperties(this.form);'); $form->Add($submit); $tpl->SetVariable('config_form', $form->Get()); } $tpl->ParseBlock('settings'); return $tpl->Get(); }
/** * Import pictures in 'import' folder * * @access public * @return string XHTML template content */ function Import() { $this->gadget->CheckPermission('Import'); $tpl = $this->gadget->template->loadAdmin('Import.html'); $tpl->SetBlock('import'); $tpl->SetVariable('base_script', BASE_SCRIPT); $tpl->SetVariable('menubar', $this->MenuBar('Import')); $iModel = $this->gadget->model->loadAdmin('Import'); $aModel = $this->gadget->model->load('Albums'); $items = $iModel->GetItemsToImport(); if (count($items) > 0) { $tpl->SetBlock('import/pictures'); $tpl->SetVariable('ready_to_import', _t('PHOO_READY_TO_IMPORT', count($items))); $gadget =& Piwi::CreateWidget('HiddenEntry', 'gadget', 'Phoo'); $tpl->SetVariable('gadget_hidden', $gadget->Get()); $action =& Piwi::CreateWidget('HiddenEntry', 'action', 'FinishImport'); $tpl->SetVariable('action_hidden', $action->Get()); $tpl->SetVariable('import_message', _t('PHOO_IMPORT_MESSAGE')); $albumcombo =& Piwi::CreateWidget('Combo', 'album', _t('PHOO_ALBUM')); $first = false; $albums = $aModel->GetAlbums('name', 'ASC'); if (!Jaws_Error::IsError($albums) && !empty($albums)) { foreach ($albums as $a) { if (!$first) { $first = $a['id']; } $albumcombo->AddOption($a['name'], $a['id']); } } $albumcombo->SetDefault($first); $tpl->SetVariable('albums_combo', $albumcombo->Get()); $b =& Piwi::CreateWidget('Button', 'import_button', _t('PHOO_IMPORT'), STOCK_DOWN); $b->SetSubmit(true); $tpl->SetVariable('import_button', $b->Get()); $counter = 0; include_once JAWS_PATH . 'include/Jaws/Image.php'; foreach ($items as $i) { $tpl->SetBlock('import/pictures/item'); $tpl->SetVariable('thumb', BASE_SCRIPT . '?gadget=Phoo&action=Thumb&image=' . $i); $tpl->SetVariable('filename', $i); $tpl->SetVariable('entryname', md5($i)); $tpl->SetVariable('counter', (string) $counter); $tpl->ParseBlock('import/pictures/item'); $counter++; } $tpl->ParseBlock('import/pictures'); } else { $tpl->SetBlock('import/noitems'); $tpl->SetVariable('no_items_to_import', _t('PHOO_NO_IMAGES_TO_IMPORT')); $tpl->SetVariable('message', _t('PHOO_IMPORT_INSTRUCTIONS')); $tpl->ParseBlock('import/noitems'); } $tpl->ParseBlock('import'); return $tpl->Get(); }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { if (file_exists(JAWS_PATH . 'gadgets/Friends/Model.php') && Jaws_Gadget::IsGadgetInstalled('Friends')) { $button =& Piwi::CreateWidget('Button', 'addfriend', '', $GLOBALS['app']->getSiteURL('/plugins/FindFriend/images/stock-friends.png', true)); $button->SetTitle(_t('PLUGINS_FINDFRIEND_ADD') . ' ALT+F'); $button->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}','[friend]','[/friend]','" . _t('PLUGINS_FINDFRIEND_FRIEND') . "');"); $button->SetAccessKey('F'); return $button; } return ''; }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { if (Jaws_Gadget::IsGadgetInstalled('Glossary')) { $glossarybutton =& Piwi::CreateWidget('Button', 'glossarybutton', '', $GLOBALS['app']->getSiteURL('/plugins/GlossaGlossy/images/stock-glossary.png', true)); $glossarybutton->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '[term]','[/term]','" . _t('PLUGINS_GLOSSAGLOSSY_YOURTERM') . "');"); $glossarybutton->SetTitle(_t('PLUGINS_GLOSSAGLOSSY_ADD') . ' ALT+G'); $glossarybutton->SetAccessKey('G'); return $glossarybutton; } return ''; }
/** * Builds sharing UI * * @access public * @return string XHTML UI */ function ShareEvent() { // Fetch event $id = (int) jaws()->request->fetch('id', 'get'); $model = $this->gadget->model->load('Event'); $uid = (int) $GLOBALS['app']->Session->GetAttribute('user'); $event = $model->GetEvent($id, $uid); if (Jaws_Error::IsError($event) || empty($event) || $event['user'] != $uid) { return; } $this->AjaxMe('site_script.js'); $tpl = $this->gadget->template->load('ShareEvent.html'); $tpl->SetBlock('share'); $tpl->SetVariable('title', _t('EVENTSCALENDAR_SHARE')); $tpl->SetVariable('id', $id); $tpl->SetVariable('UID', $uid); $tpl->SetVariable('subject', $event['subject']); $tpl->SetVariable('lbl_users', _t('EVENTSCALENDAR_USERS')); $tpl->SetVariable('events_url', $this->gadget->urlMap('ManageEvents')); // User groups $uModel = new Jaws_User(); $groups = $uModel->GetGroups($uid, true, 'title'); if (!Jaws_Error::IsError($groups)) { $combo =& Piwi::CreateWidget('Combo', 'sys_groups'); $combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)'); $combo->AddOption(_t('EVENTSCALENDAR_ALL_USERS'), 0); foreach ($groups as $group) { $combo->AddOption($group['title'], $group['id']); } $tpl->SetVariable('groups', $combo->Get()); } $tpl->SetVariable('lbl_groups', _t('EVENTSCALENDAR_GROUPS')); // Event users $model = $this->gadget->model->load('Share'); $combo =& Piwi::CreateWidget('Combo', 'event_users'); $combo->SetSize(10); $users = $model->GetEventUsers($id); if (!Jaws_Error::IsError($users) && !empty($users)) { foreach ($users as $user) { if ($user['user'] != $uid) { $combo->AddOption($user['nickname'] . ' (' . $user['username'] . ')', $user['user']); } } } $tpl->SetVariable('event_users', $combo->Get()); $tpl->SetVariable('lbl_event_users', _t('EVENTSCALENDAR_SHARED_FOR')); // Actions $tpl->SetVariable('lbl_ok', _t('GLOBAL_OK')); $tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL')); $tpl->SetVariable('url_back', $this->gadget->urlMap('ViewEvent', array('id' => $id))); $tpl->ParseBlock('share'); return $tpl->Get(); }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $buttonbox =& Piwi::CreateWidget('Division'); $bold =& Piwi::CreateWidget('Button', 'bold', '', STOCK_TEXT_BOLD); $bold->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '**','**','" . _t('PLUGINS_NICEFORMAT_TEXT_BOLD') . "');"); $bold->SetTitle(_t('PLUGINS_NICEFORMAT_TEXT_BOLD') . ' ALT+B'); $bold->SetAccessKey('B'); $italic =& Piwi::CreateWidget('Button', 'italic', '', STOCK_TEXT_ITALIC); $italic->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '\\'\\'','\\'\\'','" . _t('PLUGINS_NICEFORMAT_TEXT_ITALIC') . "');"); $italic->SetTitle(_t('PLUGINS_NICEFORMAT_TEXT_ITALIC') . ' ALT+I'); $italic->SetAccessKey('I'); $hrule =& Piwi::CreateWidget('Button', 'hrule', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-hrule.png', true)); $hrule->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '----\\n','','');"); $hrule->SetTitle(_t('PLUGINS_NICEFORMAT_HRULE') . ' ALT+H'); $hrule->SetAccessKey('H'); $heading1 =& Piwi::CreateWidget('Button', 'heading1', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-heading1.png', true)); $heading1->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '=======','=======','" . _t('PLUGINS_NICEFORMAT_LEVEL_1') . "');"); $heading1->SetTitle(_t('PLUGINS_NICEFORMAT_LEVEL_1') . ' ALT+1'); $heading1->SetAccessKey('1'); $heading2 =& Piwi::CreateWidget('Button', 'heading2', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-heading2.png', true)); $heading2->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '======','======','" . _t('PLUGINS_NICEFORMAT_LEVEL_2') . "');"); $heading2->SetTitle(_t('PLUGINS_NICEFORMAT_LEVEL_2') . ' ALT+2'); $heading2->SetAccessKey('2'); $heading3 =& Piwi::CreateWidget('Button', 'heading3', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-heading3.png', true)); $heading3->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '=====','=====','" . _t('PLUGINS_NICEFORMAT_LEVEL_3') . "');"); $heading3->SetTitle(_t('PLUGINS_NICEFORMAT_LEVEL_3') . ' ALT+3'); $heading3->SetAccessKey('3'); $heading4 =& Piwi::CreateWidget('Button', 'heading4', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-heading4.png', true)); $heading4->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '====','====','" . _t('PLUGINS_NICEFORMAT_LEVEL_4') . "');"); $heading4->SetTitle(_t('PLUGINS_NICEFORMAT_LEVEL_4') . ' ALT+4'); $heading4->SetAccessKey('4'); $heading5 =& Piwi::CreateWidget('Button', 'heading5', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-heading5.png', true)); $heading5->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '===','===','" . _t('PLUGINS_NICEFORMAT_LEVEL_5') . "');"); $heading5->SetTitle(_t('PLUGINS_NICEFORMAT_LEVEL_5') . ' ALT+5'); $heading5->SetAccessKey('5'); $listenum =& Piwi::CreateWidget('Button', 'listenum', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-listnum.png', true)); $listenum->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', ' - ','\\n','" . _t('PLUGINS_NICEFORMAT_LIST_NUMERIC') . "');"); $listenum->SetTitle(_t('PLUGINS_NICEFORMAT_LIST_NUMERIC')); $listbullet =& Piwi::CreateWidget('Button', 'listbullet', '', $GLOBALS['app']->getSiteURL('/plugins/NiceFormat/images/stock-listbullet.png', true)); $listbullet->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', ' * ','\\n','" . _t('PLUGINS_NICEFORMAT_LIST_BULLET') . "');"); $listbullet->SetTitle(_t('PLUGINS_NICEFORMAT_LIST_BULLET')); $buttonbox->PackStart($bold); $buttonbox->PackStart($italic); $buttonbox->PackStart($heading1); $buttonbox->PackStart($heading2); $buttonbox->PackStart($heading3); $buttonbox->PackStart($heading4); $buttonbox->PackStart($heading5); $buttonbox->PackStart($listenum); $buttonbox->PackStart($listbullet); $buttonbox->PackStart($hrule); return $buttonbox; }
/** * Builds sharing UI * * @access public * @return string XHTML UI */ function ShareNote() { // Fetch note $id = (int) jaws()->request->fetch('id', 'get'); $model = $this->gadget->model->load('Notepad'); $uid = (int) $GLOBALS['app']->Session->GetAttribute('user'); $note = $model->GetNote($id, $uid); if (Jaws_Error::IsError($note) || empty($note) || $note['user'] != $uid) { return; } $this->AjaxMe('site_script.js'); $tpl = $this->gadget->template->load('Share.html'); $tpl->SetBlock('share'); $tpl->SetVariable('id', $id); $tpl->SetVariable('UID', $uid); $tpl->SetVariable('note_title', $note['title']); $tpl->SetVariable('title', _t('NOTEPAD_SHARE')); $tpl->SetVariable('lbl_users', _t('NOTEPAD_USERS')); $tpl->SetVariable('notepad_url', $this->gadget->urlMap('Notepad')); // User groups $uModel = new Jaws_User(); $groups = $uModel->GetGroups(true, 'title'); if (!Jaws_Error::IsError($groups)) { $combo =& Piwi::CreateWidget('Combo', 'sys_groups'); $combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)'); $combo->AddOption(_t('NOTEPAD_ALL_USERS'), 0); foreach ($groups as $group) { $combo->AddOption($group['title'], $group['id']); } $tpl->SetVariable('groups', $combo->Get()); } $tpl->SetVariable('lbl_groups', _t('NOTEPAD_GROUPS')); // Note users $model = $this->gadget->model->load('Share'); $combo =& Piwi::CreateWidget('Combo', 'note_users'); $combo->SetSize(10); $users = $model->GetNoteUsers($id); if (!Jaws_Error::IsError($users) && !empty($users)) { foreach ($users as $user) { if ($user['user_id'] != $uid) { $combo->AddOption($user['nickname'] . ' (' . $user['username'] . ')', $user['user_id']); } } } $tpl->SetVariable('note_users', $combo->Get()); $tpl->SetVariable('lbl_note_users', _t('NOTEPAD_SHARED_FOR')); // Actions $tpl->SetVariable('lbl_ok', _t('GLOBAL_OK')); $tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL')); $tpl->SetVariable('url_back', $this->gadget->urlMap('Notepad')); $tpl->ParseBlock('share'); return $tpl->Get(); }
/** * Displays a form for adding new images. * * @access public * @return string XHTML template content */ function UploadPhotos() { $this->gadget->CheckPermission('AddPhotos'); $this->AjaxMe('script.js'); $album = jaws()->request->fetch('album', 'get'); $model = $this->gadget->model->load('Albums'); $tpl = $this->gadget->template->loadAdmin('UploadPhotos.html'); $tpl->SetBlock('upload'); $tpl->SetVariable('menubar', $this->MenuBar('UploadPhotos')); include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php'; $phooFieldset = new Jaws_Widgets_FieldSet(_t('PHOO_UPLOAD_PHOTOS')); $phooFieldset->SetDirection('vertical'); $phooFieldset->SetId('phoo_fieldset'); $phooForm =& Piwi::CreateWidget('Form', BASE_SCRIPT . '?gadget=Phoo', 'post', 'multipart/form-data'); $phooForm->Add(Piwi::CreateWidget('HiddenEntry', 'MAX_FILE_SIZE', '15000000')); $phooForm->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Phoo')); $phooForm->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UploadPhotosStep2')); $albumcombo =& Piwi::CreateWidget('Combo', 'album', _t('PHOO_ALBUM')); $albums = $model->GetAlbums('name', 'ASC'); if (!Jaws_Error::IsError($albums) && !empty($albums)) { $date = Jaws_Date::getInstance(); foreach ($albums as $a) { // FIXME: Ugly hack to add title to albumcombo $o =& Piwi::CreateWidget('ComboOption', $a['id'], $a['name']); $o->SetTitle(_t('PHOO_NUM_PHOTOS_ALBUM', $a['howmany']) . ' / ' . _t('PHOO_ALBUM_CREATION_DATE', $date->Format($a['createtime']))); $albumcombo->_options[$a['id']] = $o; } } $albumcombo->SetDefault((int) $album); $phooFieldset->Add($albumcombo); for ($i = 1; $i <= 5; $i++) { $imageEntry =& Piwi::CreateWidget('FileEntry', 'photo' . $i); $imageEntry->SetTitle(_t('PHOO_PHOTO') . ' ' . $i); $phooFieldset->Add($imageEntry); } $addEntryButton =& Piwi::CreateWidget('Button', 'addEntryButton', _t('PHOO_ADD_ANOTHER_PHOTO'), STOCK_ADD); $addEntryButton->AddEvent(ON_CLICK, "addEntry('" . _t('PHOO_PHOTO') . "');"); $addEntryUrl = '<span id="phoo_addentry6"><div><a href="#" onclick="addEntry(\'' . _t('PHOO_PHOTO') . '\');">' . _t('PHOO_ADD_ANOTHER_PHOTO') . '</a></div></span>'; $addEntryArea = '<span id="phoo_addentry6"><div>' . $addEntryButton->Get() . '</div></span>'; $addEntry =& Piwi::CreateWidget('StaticEntry', $addEntryArea); $phooFieldset->Add($addEntry); $buttonbox =& Piwi::CreateWidget('HBox'); $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;'); //hig style $submit =& Piwi::CreateWidget('Button', 'uploadphotos', _t('PHOO_UPLOAD_PHOTOS'), STOCK_SAVE); $submit->SetSubmit(); $buttonbox->Add($submit); $phooForm->Add($phooFieldset); $phooForm->Add($buttonbox); $tpl->SetVariable('form', $phooForm->Get()); $tpl->ParseBlock('upload'); return $tpl->Get(); }
/** * Builds aliases UI * * @access public * @return string XHTML template content */ function Aliases() { $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Aliases.html'); $tpl->SetBlock('Aliases'); $tpl->SetVariable('base_script', BASE_SCRIPT); $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post'); $form->Add(Piwi::CreateWidget('HiddenEntry', 'alias_id', '-')); include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php'; $fieldset = new Jaws_Widgets_FieldSet(_t('URLMAPPER_ALIASES_ALIAS')); $fieldset->SetDirection('vertical'); $fieldset->SetID('AliasFieldset'); $fieldset->SetStyle('width: 300px; min-width: 250px; max-width: 300px;'); $customUrl =& Piwi::CreateWidget('Entry', 'custom_url'); $customUrl->SetTitle(_t('URLMAPPER_ALIASES_LINK')); $customUrl->SetId('custom_url'); $customUrl->SetStyle('width: 230px;'); $fieldset->Add($customUrl); $alias =& Piwi::CreateWidget('Entry', 'alias', '', _t('URLMAPPER_ALIASES_ALIAS')); $alias->SetId('alias'); $alias->SetStyle('width: 230px;'); $fieldset->Add($alias); $hbox =& Piwi::CreateWidget('HBox'); $hbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;'); //hig style $delete =& Piwi::CreateWidget('Button', 'delete', _t('GLOBAL_DELETE'), STOCK_DELETE); $delete->AddEvent(ON_CLICK, 'deleteCurrentAlias();'); $delete->SetId('delete_button'); $delete->SetStyle('visibility: hidden;'); $hbox->Add($delete); $cancel =& Piwi::CreateWidget('Button', 'cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL); $cancel->AddEvent(ON_CLICK, 'stopAction();'); $cancel->SetId('cancel_button'); $hbox->Add($cancel); $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE); $save->SetId('save_button'); $save->AddEvent(ON_CLICK, 'javascript:saveAlias();'); $hbox->Add($save); $form->Add($fieldset); $form->Add($hbox); $tpl->SetVariable('edit_form', $form->Get()); $tpl->SetVariable('menubar', $this->MenuBar('Aliases')); $model = $this->gadget->model->loadAdmin('Aliases'); $aliases = $model->GetAliases(); foreach ($aliases as $alias) { $tpl->SetBlock('Aliases/alias'); $tpl->SetVariable('id', $alias['id']); $tpl->SetVariable('alias_value', $alias['alias_url']); $tpl->ParseBlock('Aliases/alias'); } $tpl->ParseBlock('Aliases'); return $tpl->Get(); }
/** * Builds registry UI * * @access public * @return string XHTML UI */ function RegistryUI() { $tpl = $this->gadget->template->loadAdmin('Registry.html'); $tpl->SetBlock('registry'); $button =& Piwi::CreateWidget('Button', '', _t('GLOBAL_SAVE'), STOCK_SAVE); $button->AddEvent(ON_CLICK, 'javascript:saveRegistry();'); $tpl->SetVariable('save', $button->Get()); $button =& Piwi::CreateWidget('Button', '', _t('GLOBAL_RESET'), STOCK_REFRESH); $button->AddEvent(ON_CLICK, 'componentRegistry(true);'); $tpl->SetVariable('reset', $button->Get()); $tpl->ParseBlock('registry'); return $tpl->Get(); }
/** * Builds a simple form to update user account info(nickname, email, password) * * @access public * @return string XHTML form */ function Account() { if (!$GLOBALS['app']->Session->Logged()) { Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true))))); } $this->gadget->CheckPermission('EditUserName,EditUserNickname,EditUserEmail,EditUserPassword', '', false); $response = $GLOBALS['app']->Session->PopResponse('Users.Account.Response'); if (!isset($response['data'])) { $jUser = new Jaws_User(); $account = $jUser->GetUser($GLOBALS['app']->Session->GetAttribute('user'), true, true); } else { $account = $response['data']; } // Menubar $account['menubar'] = $this->MenuBar('Account'); $account['submenubar'] = $this->SubMenuBar('Account', array('Account', 'Personal', 'Preferences', 'Contacts')); $account['title'] = _t('USERS_ACCOUNT_INFO'); $account['update'] = _t('USERS_USERS_ACCOUNT_UPDATE'); $account['lbl_username'] = _t('USERS_USERS_USERNAME'); $account['lbl_nickname'] = _t('USERS_USERS_NICKNAME'); $account['lbl_email'] = _t('GLOBAL_EMAIL'); $account['lbl_password'] = _t('USERS_USERS_PASSWORD'); $account['emptypassword'] = _t('USERS_NOCHANGE_PASSWORD'); $account['lbl_chkpassword'] = _t('USERS_USERS_PASSWORD_VERIFY'); if (!$this->gadget->GetPermission('EditUserName')) { $account['username_disabled'] = 'disabled="disabled"'; } if (!$this->gadget->GetPermission('EditUserNickname')) { $account['nickname_disabled'] = 'disabled="disabled"'; } if (!$this->gadget->GetPermission('EditUserEmail')) { $account['email_disabled'] = 'disabled="disabled"'; } if (!$this->gadget->GetPermission('EditUserPassword')) { $account['password_disabled'] = 'disabled="disabled"'; } if (empty($account['avatar'])) { $user_current_avatar = $GLOBALS['app']->getSiteURL('/gadgets/Users/Resources/images/photo128px.png'); } else { $user_current_avatar = $GLOBALS['app']->getDataURL() . "avatar/" . $account['avatar']; $user_current_avatar .= !empty($account['last_update']) ? "?" . $account['last_update'] . "" : ''; } $avatar =& Piwi::CreateWidget('Image', $user_current_avatar); $avatar->SetID('avatar'); $account['avatar'] = $avatar->Get(); $account['type'] = $response['type']; $account['text'] = $response['text']; // Load the template $tpl = $this->gadget->template->load('Account.html'); return $tpl->fetch($account); }
/** * Encryption action for the Policy gadget * * @access public * @return XHTML content */ function Encryption() { $this->gadget->CheckPermission('Encryption'); $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Encryption.html'); $tpl->SetBlock('encryption'); // Sidebar $tpl->SetVariable('sidebar', $this->SideBar('Encryption')); $tpl->SetVariable('legend_title', _t('POLICY_ENCRYPTION')); $useEncryption =& Piwi::CreateWidget('Combo', 'enabled'); $useEncryption->setID('enabled'); $useEncryption->AddOption(_t('GLOBAL_NO'), 'false'); $useEncryption->AddOption(_t('GLOBAL_YES'), 'true'); $useEncryption->SetDefault($this->gadget->registry->fetch('crypt_enabled')); $tpl->SetVariable('lbl_enabled', _t('GLOBAL_ENABLED')); $tpl->SetVariable('enabled', $useEncryption->Get()); $keyAge =& Piwi::CreateWidget('Combo', 'key_age'); $keyAge->setID('key_age'); $keyAge->AddOption(_t('GLOBAL_DATE_MINUTES', 10), 600); $keyAge->AddOption(_t('GLOBAL_DATE_HOURS', 1), 3600); $keyAge->AddOption(_t('GLOBAL_DATE_HOURS', 5), 18000); $keyAge->AddOption(_t('GLOBAL_DATE_DAYS', 1), 86400); $keyAge->AddOption(_t('GLOBAL_DATE_WEEKS', 1), 604800); $keyAge->SetDefault($this->gadget->registry->fetch('crypt_key_age')); $keyAge->SetEnabled($this->gadget->GetPermission('ManageEncryptionKey')); $tpl->SetVariable('lbl_key_age', _t('POLICY_ENCRYPTION_KEY_AGE')); $tpl->SetVariable('key_age', $keyAge->Get()); $keyLen =& Piwi::CreateWidget('Combo', 'key_len'); $keyLen->setID('key_len'); $keyLen->AddOption(_t('POLICY_ENCRYPTION_512BIT'), '512'); $keyLen->AddOption(_t('POLICY_ENCRYPTION_1024BIT'), '1024'); $keyLen->AddOption(_t('POLICY_ENCRYPTION_2048BIT'), '2048'); $keyLen->SetDefault($this->gadget->registry->fetch('crypt_key_len')); $keyLen->SetEnabled($this->gadget->GetPermission('ManageEncryptionKey')); $tpl->SetVariable('lbl_key_len', _t('POLICY_ENCRYPTION_KEY_LEN')); $tpl->SetVariable('key_len', $keyLen->Get()); $date = Jaws_Date::getInstance(); $keyStartDate =& Piwi::CreateWidget('Entry', 'key_start_date', $date->Format((int) $this->gadget->registry->fetch('crypt_key_start_date'))); $keyStartDate->setID('key_start_date'); $keyStartDate->setSize(30); $keyStartDate->SetEnabled(false); $tpl->SetVariable('lbl_key_start_date', _t('POLICY_ENCRYPTION_KEY_START_DATE')); $tpl->SetVariable('key_start_date', $keyStartDate->Get()); $btnSave =& Piwi::CreateWidget('Button', 'btn_save', _t('GLOBAL_SAVE'), STOCK_SAVE); $btnSave->AddEvent(ON_CLICK, 'javascript: saveEncryptionSettings();'); $tpl->SetVariable('btn_save', $btnSave->Get()); $tpl->ParseBlock('encryption'); return $tpl->Get(); }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $buttonbox =& Piwi::CreateWidget('Division'); $linkbutton =& Piwi::CreateWidget('Button', 'linkbutton', '', $GLOBALS['app']->getSiteURL('/plugins/FastLinks/images/stock-fastlink.png', true)); $linkbutton->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '[url]','[/url]','" . _t('PLUGINS_FASTLINKS_YOURLINK') . "');"); $linkbutton->SetTitle(_t('PLUGINS_FASTLINKS_ADD_SITE') . ' ALT+L'); $linkbutton->SetAccessKey('L'); $emailbutton =& Piwi::CreateWidget('Button', 'emailbutton', '', $GLOBALS['app']->getSiteURL('/plugins/FastLinks/images/stock-fastemail.png', true)); $emailbutton->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}', '[email]','[/email]','" . _t('PLUGINS_FASTLINKS_YOUREMAIL') . "');"); $emailbutton->SetTitle(_t('PLUGINS_FASTLINKS_ADD_EMAIL') . ' ALT+E'); $emailbutton->SetAccessKey('E'); $buttonbox->PackStart($linkbutton); $buttonbox->PackStart($emailbutton); return $buttonbox; }
/** * Main Constructor * * @access public * @param $gadget * @param $name * @param string $value * @param string $label * @return void */ function Jaws_Widgets_TextArea($gadget, $name, $value = '', $label = '') { $this->_Name = $name; $this->_Value = $value; $this->_Gadget = $gadget; $this->_ToolbarControl =& Piwi::CreateWidget('Toolbar'); $this->_ToolbarControl->SetID('toolbar_' . $name); $this->TextArea =& Piwi::CreateWidget('TextArea', $name, $value); $this->TextArea->SetClass('xx-large'); $this->_Label =& Piwi::CreateWidget('Label', $label, $this->TextArea); $this->_Container =& Piwi::CreateWidget('Division'); $this->_Container->SetClass('jaws_editor'); $this->_Container->AddFile('include/Jaws/Resources/TextArea.js'); parent::init(); $this->setID($name); }
/** * Show a form to edit a given forum * * @access public * @return string XHTML template content */ function GetForumUI() { $this->gadget->CheckPermission('default'); $tpl = $this->gadget->template->loadAdmin('ForumUI.html'); $tpl->SetBlock('ForumUI'); $gModel = $this->gadget->model->load('Groups'); $groups = $gModel->GetGroups(); $groupCombo =& Piwi::CreateWidget('Combo', 'gid'); $groupCombo->SetID('gid'); foreach ($groups as $group) { $groupCombo->AddOption($group['title'], $group['id']); } $tpl->SetVariable('lbl_gid', _t('FORUMS_GROUP')); $tpl->SetVariable('gid', $groupCombo->Get()); $title =& Piwi::CreateWidget('Entry', 'title', ''); $title->SetID('title'); $tpl->SetVariable('lbl_title', _t('GLOBAL_TITLE')); $tpl->SetVariable('title', $title->Get()); $description =& Piwi::CreateWidget('TextArea', 'description', ''); $description->SetID('description'); $tpl->SetVariable('lbl_description', _t('GLOBAL_DESCRIPTION')); $tpl->SetVariable('description', $description->Get()); $fasturl =& Piwi::CreateWidget('Entry', 'fast_url', ''); $fasturl->SetID('fast_url'); $tpl->SetVariable('lbl_fast_url', _t('FORUMS_FASTURL')); $tpl->SetVariable('fast_url', $fasturl->Get()); $order =& Piwi::CreateWidget('Combo', 'order'); $order->SetID('order'); $tpl->SetVariable('lbl_order', _t('FORUMS_ORDER')); $tpl->SetVariable('order', $order->Get()); $locked =& Piwi::CreateWidget('Combo', 'locked'); $locked->SetID('locked'); $locked->AddOption(_t('GLOBAL_NO'), 0); $locked->AddOption(_t('GLOBAL_YES'), 1); $locked->SetDefault(0); $tpl->SetVariable('lbl_locked', _t('FORUMS_LOCKED')); $tpl->SetVariable('locked', $locked->Get()); $published =& Piwi::CreateWidget('Combo', 'published'); $published->SetID('published'); $published->AddOption(_t('GLOBAL_NO'), 0); $published->AddOption(_t('GLOBAL_YES'), 1); $published->SetDefault(1); $tpl->SetVariable('lbl_published', _t('GLOBAL_PUBLISHED')); $tpl->SetVariable('published', $published->Get()); $tpl->ParseBlock('ForumUI'); return $tpl->Get(); }
/** * Builds Properties section of the gadget * * @access public * @return string XHTML content */ function Properties() { $this->gadget->CheckPermission('UpdateProperties'); $this->AjaxMe('script.js'); $tpl = $this->gadget->template->loadAdmin('Properties.html'); $tpl->SetBlock('Properties'); $tpl->SetVariable('menubar', $this->MenuBar('Properties')); $unit =& Piwi::CreateWidget('Combo', 'unit'); $unit->AddOption(_t('WEATHER_UNIT_METRIC'), 'metric'); $unit->AddOption(_t('WEATHER_UNIT_IMPERIAL'), 'imperial'); $unit->SetDefault($this->gadget->registry->fetch('unit')); $tpl->SetVariable('lbl_unit', _t('WEATHER_UNIT')); $tpl->SetVariable('unit', $unit->Get()); $period =& Piwi::CreateWidget('Combo', 'update_period'); $period->AddOption(_t('GLOBAL_DISABLE'), 0); $period->AddOption(_t('GLOBAL_DATE_MINUTES', 30), 1800); $period->AddOption(_t('GLOBAL_DATE_HOURS', 1), 3600); $period->AddOption(_t('GLOBAL_DATE_HOURS', 3), 10800); $period->AddOption(_t('GLOBAL_DATE_HOURS', 6), 21600); $period->AddOption(_t('GLOBAL_DATE_HOURS', 8), 28800); $period->AddOption(_t('GLOBAL_DATE_DAYS', 1), 86400); $period->SetDefault($this->gadget->registry->fetch('update_period')); $tpl->SetVariable('lbl_update_period', _t('WEATHER_UPDATE_PERIOD')); $tpl->SetVariable('update_period', $period->Get()); $now = time(); $objDate = Jaws_Date::getInstance(); $dFormat =& Piwi::CreateWidget('Combo', 'date_format'); $dFormat->setStyle('width:208px;'); $dFormat->AddOption($objDate->Format($now, 'DN'), 'DN'); $dFormat->AddOption($objDate->Format($now, 'd MN'), 'd MN'); $dFormat->AddOption($objDate->Format($now, 'DN d MN'), 'DN d MN'); $dFormat->SetDefault($this->gadget->registry->fetch('date_format')); $tpl->SetVariable('lbl_date_format', _t('WEATHER_DATE_FORMAT')); $tpl->SetVariable('date_format', $dFormat->Get()); $apikey =& Piwi::CreateWidget('Entry', 'api_key', $this->gadget->registry->fetch('api_key')); $apikey->setStyle('width:200px; direction: ltr;'); $tpl->SetVariable('lbl_api_key', _t('WEATHER_API_KEY')); $tpl->SetVariable('lbl_api_key_desc', _t('WEATHER_API_KEY_DESC')); $tpl->SetVariable('api_key', $apikey->Get()); if ($this->gadget->GetPermission('UpdateSetting')) { $btnupdate =& Piwi::CreateWidget('Button', 'btn_save', _t('GLOBAL_SAVE'), STOCK_SAVE); $btnupdate->AddEvent(ON_CLICK, 'updateProperties();'); $tpl->SetVariable('btn_save', $btnupdate->Get()); } $tpl->ParseBlock('Properties'); return $tpl->Get(); }
/** * Overrides, Gets the WebControl of this plugin * * @access public * @param string $textarea The textarea * @return string XHTML WebControl */ function GetWebControl($textarea) { $iconsmap = array(":-D" => 'face-smile-big.png', ":'(" => 'face-crying.png', ":-(" => 'face-sad.png', ":-)" => 'face-smile.png', ":-|" => 'face-plain.png', ":-P" => 'tongue.png', ":-/" => 'unsure.png', ";-)" => 'face-wink.png', "B-)" => 'face-glasses.png', "O:-)" => 'face-angel.png', ":-*" => 'face-kiss.png', ":-O" => 'face-surprise.png', ">:-)" => 'face-devil-grin.png'); $combo =& Piwi::CreateWidget('Combo', 'emoticons'); $combo->SetTitle(_t('PLUGINS_EMOTICONS_ADD')); $combo->AddEvent(ON_CHANGE, "javascript: insertTags('{$textarea}', this[this.selectedIndex].value,'','');"); $theme = $GLOBALS['app']->GetTheme(); $image_path = $theme['path'] . $this->_ImagePath; foreach ($iconsmap as $icon => $file) { $icons_file_url = $this->_ImagePath . '/' . $file; if (is_file($image_path . '/' . $file)) { $icons_file_url = $theme['url'] . $icons_file_url; } $combo->AddOption($icon, $icon); } return $combo; }