コード例 #1
0
ファイル: Settings.php プロジェクト: Dulciane/jaws
 /**
  * Builds the management UI for gadget properties
  *
  * @access  public
  * @return  string  XHTML form
  */
 function Properties()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('StaticPage.html');
     $tpl->SetBlock('Properties');
     $action = jaws()->request->fetch('action', 'get');
     $tpl->SetVariable('menubar', $this->MenuBar($action));
     $model = $this->gadget->model->load('Page');
     //Build the form
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'POST');
     $form->SetId('frm_settings');
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet(_t('GLOBAL_PROPERTIES'));
     //Default page (combo)
     $defaultPage =& Piwi::CreateWidget('Combo', 'default_page');
     $defaultPage->setTitle(_t('STATICPAGE_DEFAULT_PAGE'));
     $pages = $model->GetPages();
     if (Jaws_Error::isError($pages)) {
         $pages = array();
     }
     foreach ($pages as $page) {
         $defaultPage->addOption($page['title'], $page['base_id']);
     }
     $defaultPage->setDefault($this->gadget->registry->fetch('default_page'));
     $fieldset->add($defaultPage);
     // Use multilanguage pages?
     $multiLanguage =& Piwi::CreateWidget('Combo', 'multilanguage');
     $multiLanguage->setTitle(_t('STATICPAGE_USE_MULTILANGUAGE'));
     $multiLanguage->addOption(_t('GLOBAL_YES'), 'yes');
     $multiLanguage->addOption(_t('GLOBAL_NO'), 'no');
     $multiLanguage->setDefault($this->gadget->registry->fetch('multilanguage'));
     $fieldset->add($multiLanguage);
     // Save Button
     $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
     $save->AddEvent(ON_CLICK, 'javascript:updateSettings(this.form);');
     $buttonbox =& Piwi::CreateWidget('HBox');
     $buttonbox->SetClass('actions');
     $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $buttonbox->PackStart($save);
     $form->Add($fieldset);
     $form->Add($buttonbox);
     $tpl->SetVariable('form', $form->Get());
     $tpl->ParseBlock('Properties');
     return $tpl->Get();
 }
コード例 #2
0
ファイル: Aliases.php プロジェクト: Dulciane/jaws
 /**
  * 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();
 }
コード例 #3
0
ファイル: Upload.php プロジェクト: juniortux/jaws
 /**
  * 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();
 }
コード例 #4
0
ファイル: ServerTime.php プロジェクト: Dulciane/jaws
 /**
  * Displays the administration page
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function Admin()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('ServerTime.html');
     $tpl->SetBlock('servertime');
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'ServerTime'));
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateProperties'));
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet($this->gadget->title);
     $fieldset->SetDirection('vertical');
     $fieldset->SetStyle('white-space: nowrap;');
     $now = time();
     $objDate = Jaws_Date::getInstance();
     $dFormat =& Piwi::CreateWidget('Combo', 'date_format');
     $dFormat->SetID('date_format');
     $dFormat->SetTitle(_t('SERVERTIME_FORMAT_TEXT'));
     $dFormat->SetStyle('width: 300px;');
     $dFormat->AddOption($objDate->Format($now, 'MN j, g:i a'), 'MN j, g:i a');
     $dFormat->AddOption($objDate->Format($now, 'j.m.y'), 'j.m.y');
     $dFormat->AddOption($objDate->Format($now, 'j MN, g:i a'), 'j MN, g:i a');
     $dFormat->AddOption($objDate->Format($now, 'y.m.d, g:i a'), 'y.m.d, g:i a');
     $dFormat->AddOption($objDate->Format($now, 'd MN Y'), 'd MN Y');
     $dFormat->AddOption($objDate->Format($now, 'DN d MN Y'), 'DN d MN Y');
     $dFormat->AddOption($objDate->Format($now, 'DN d MN Y g:i a'), 'DN d MN Y g:i a');
     $dFormat->AddOption($objDate->Format($now, 'j MN y'), 'j MN y');
     $dFormat->SetDefault($this->gadget->registry->fetch('date_format'));
     $fieldset->Add($dFormat);
     $form->Add($fieldset);
     $submit =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_UPDATE', _t('GLOBAL_SETTINGS')), STOCK_SAVE);
     $submit->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $submit->AddEvent(ON_CLICK, 'javascript:updateProperties(this.form);');
     $form->Add($submit);
     $tpl->SetVariable('form', $form->Get());
     $tpl->ParseBlock('servertime');
     return $tpl->Get();
 }
コード例 #5
0
ファイル: Settings.php プロジェクト: juniortux/jaws
 /**
  * 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();
 }
コード例 #6
0
ファイル: Emblems.php プロジェクト: juniortux/jaws
 /**
  * Builds emblems administration UI
  *
  * @access  public
  * @return  string   XHTML UI
  */
 function Emblems()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Emblems.html');
     $tpl->SetBlock('emblems');
     $addform =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post', 'multipart/form-data', 'frm_emblem');
     $addform->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Emblems'));
     $addform->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'AddEmblem'));
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fs = new Jaws_Widgets_FieldSet(_t('EMBLEMS_ADD_EMBLEM'));
     $fs->SetDirection('vertical');
     $title =& Piwi::CreateWidget('Entry', 'title', '');
     $title->SetTitle(_t('GLOBAL_TITLE'));
     $fs->Add($title);
     $url =& Piwi::CreateWidget('Entry', 'url', 'http://');
     $url->SetTitle(_t('GLOBAL_URL'));
     $fs->Add($url);
     $image =& Piwi::CreateWidget('FileEntry', 'image', '');
     $image->SetTitle(_t('GLOBAL_FILE'));
     $fs->Add($image);
     $type =& Piwi::CreateWidget('Combo', 'type');
     $type->SetTitle(_t('EMBLEMS_TYPE'));
     for ($i = 1; $i <= 15; $i++) {
         $type_str = "EMBLEMS_TYPE_{$i}";
         if (_t($type_str) != $type_str) {
             $type->AddOption(_t($type_str), $i);
         }
     }
     $fs->Add($type);
     $published =& Piwi::CreateWidget('Combo', 'published');
     $published->SetTitle(_t('GLOBAL_PUBLISHED'));
     $published->AddOption(_t('GLOBAL_YES'), 1);
     $published->AddOption(_t('GLOBAL_NO'), 0);
     $fs->Add($published);
     $addsubmit =& Piwi::CreateWidget('Button', 'submitadd', _t('EMBLEMS_ADD_EMBLEM'), STOCK_NEW);
     $addsubmit->SetSubmit();
     $addform->Add($fs);
     $addform->Add($addsubmit);
     $tpl->SetVariable('form', $addform->Get());
     $tpl->SetVariable('base_script', BASE_SCRIPT);
     $tpl->SetVariable('confirmDelete', _t('EMBLEMS_CONFIRM_DELETE'));
     $tpl->SetVariable('grid', $this->Datagrid());
     $tpl->ParseBlock('emblems');
     return $tpl->Get();
 }
コード例 #7
0
ファイル: Properties.php プロジェクト: Dulciane/jaws
 /**
  * Builds Properties UI
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function Properties()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Properties.html');
     $tpl->SetBlock('Properties');
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'POST');
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet(_t('GLOBAL_PROPERTIES'));
     $fieldset->SetDirection('vertical');
     $useMapCombo =& Piwi::CreateWidget('Combo', 'enabled');
     $useMapCombo->SetTitle(_t('URLMAPPER_SETTINGS_MAP_ENABLED'));
     $useMapCombo->AddOption(_t('GLOBAL_YES'), 'true');
     $useMapCombo->AddOption(_t('GLOBAL_NO'), 'false');
     $useMapCombo->SetDefault($this->gadget->registry->fetch('map_enabled'));
     $precedence =& Piwi::CreateWidget('Combo', 'custom_precedence');
     $precedence->SetTitle(_t('URLMAPPER_CUSTOM_MAP_PRECEDENCE'));
     $precedence->AddOption(_t('GLOBAL_YES'), 'true');
     $precedence->AddOption(_t('GLOBAL_NO'), 'false');
     $precedence->SetDefault($this->gadget->registry->fetch('map_custom_precedence'));
     $useAliasesCombo =& Piwi::CreateWidget('Combo', 'use_aliases');
     $useAliasesCombo->SetTitle(_t('URLMAPPER_SETTINGS_MAP_USE_ALIASES'));
     $useAliasesCombo->AddOption(_t('GLOBAL_YES'), 'true');
     $useAliasesCombo->AddOption(_t('GLOBAL_NO'), 'false');
     $useAliasesCombo->SetDefault($this->gadget->registry->fetch('map_use_aliases'));
     $extension =& Piwi::CreateWidget('Entry', 'extension', $this->gadget->registry->fetch('map_extensions'));
     $extension->SetTitle(_t('URLMAPPER_SETTINGS_MAP_EXTENSION'));
     $extension->SetStyle('direction: ltr;');
     $fieldset->Add($useMapCombo);
     $fieldset->Add($useAliasesCombo);
     $fieldset->Add($precedence);
     $fieldset->Add($extension);
     $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
     $save->AddEvent(ON_CLICK, 'javascript:updateProperties(this.form);');
     $buttonbox =& Piwi::CreateWidget('HBox');
     $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $buttonbox->PackStart($save);
     $form->Add($fieldset);
     $form->Add($buttonbox);
     $tpl->SetVariable('menubar', $this->MenuBar('Properties'));
     $tpl->SetVariable('form', $form->Get());
     $tpl->ParseBlock('Properties');
     return $tpl->Get();
 }
コード例 #8
0
ファイル: Properties.php プロジェクト: uda/jaws
 /**
  * Builds admin properties UI
  *
  * @access  public
  * @return  string  XHTML form
  */
 function Properties()
 {
     $this->gadget->CheckPermission('ManageProperties');
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Properties.html');
     $tpl->SetBlock('Properties');
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Users'));
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'SaveProperties'));
     $authtype =& Piwi::CreateWidget('Combo', 'authtype');
     $authtype->SetTitle(_t('GLOBAL_AUTHTYPE'));
     foreach ($GLOBALS['app']->GetAuthTypes() as $method) {
         $authtype->AddOption($method, $method);
     }
     $authtype->SetDefault($this->gadget->registry->fetch('authtype'));
     $authtype->SetEnabled($this->gadget->GetPermission('ManageAuthenticationMethod'));
     $anonRegister =& Piwi::CreateWidget('Combo', 'anon_register');
     $anonRegister->SetTitle(_t('USERS_PROPERTIES_ANON_REGISTER'));
     $anonRegister->AddOption(_t('GLOBAL_YES'), 'true');
     $anonRegister->AddOption(_t('GLOBAL_NO'), 'false');
     $anonRegister->SetDefault($this->gadget->registry->fetch('anon_register'));
     $anonactivate =& Piwi::CreateWidget('Combo', 'anon_activation');
     $anonactivate->SetTitle(_t('USERS_PROPERTIES_ANON_ACTIVATION'));
     $anonactivate->AddOption(_t('USERS_PROPERTIES_ACTIVATION_AUTO'), 'auto');
     $anonactivate->AddOption(_t('USERS_PROPERTIES_ACTIVATION_BY_USER'), 'user');
     $anonactivate->AddOption(_t('USERS_PROPERTIES_ACTIVATION_BY_ADMIN'), 'admin');
     $anonactivate->SetDefault($this->gadget->registry->fetch('anon_activation'));
     $userModel = new Jaws_User();
     $anonGroup =& Piwi::CreateWidget('Combo', 'anon_group');
     $anonGroup->SetID('anon_group');
     $anonGroup->SetTitle(_t('USERS_PROPERTIES_ANON_GROUP'));
     $anonGroup->AddOption(_t('USERS_GROUPS_NOGROUP'), 0);
     $groups = $userModel->GetGroups(null, 'title');
     if (!Jaws_Error::IsError($groups)) {
         foreach ($groups as $group) {
             $anonGroup->AddOption($group['title'], $group['id']);
         }
     }
     $anonGroup->SetDefault($this->gadget->registry->fetch('anon_group'));
     $passRecovery =& Piwi::CreateWidget('Combo', 'password_recovery');
     $passRecovery->SetTitle(_t('USERS_PROPERTIES_PASS_RECOVERY'));
     $passRecovery->AddOption(_t('GLOBAL_YES'), 'true');
     $passRecovery->AddOption(_t('GLOBAL_NO'), 'false');
     $passRecovery->SetDefault($this->gadget->registry->fetch('password_recovery'));
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet('');
     $fieldset->SetTitle('vertical');
     $fieldset->Add($authtype);
     $fieldset->Add($anonRegister);
     $fieldset->Add($anonactivate);
     $fieldset->Add($anonGroup);
     $fieldset->Add($passRecovery);
     $form->Add($fieldset);
     $buttons =& Piwi::CreateWidget('HBox');
     $buttons->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
     $save->AddEvent(ON_CLICK, 'javascript:saveSettings();');
     $buttons->Add($save);
     $form->Add($buttons);
     $tpl->SetVariable('form', $form->Get());
     $tpl->SetVariable('menubar', $this->MenuBar('Properties'));
     $tpl->ParseBlock('Properties');
     return $tpl->Get();
 }
コード例 #9
0
ファイル: Webcam.php プロジェクト: juniortux/jaws
 /**
  * Builds the admin section
  *
  * @access  public
  * @return  string  XHTML content of Admin
  */
 function ManageWebcams()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Webcam.html');
     $tpl->SetBlock('webcam');
     $tpl->SetVariable('grid', $this->DataGrid());
     if ($this->gadget->GetPermission('AddWebcam')) {
         $cam_form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post', '', 'webcam_form');
         $cam_form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Webcam'));
         $cam_form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'AddWebcam'));
         $cam_form->Add(Piwi::CreateWidget('HiddenEntry', 'id', ''));
         $fieldset_webcam = new Jaws_Widgets_FieldSet($this->gadget->title);
         $titleentry =& Piwi::CreateWidget('Entry', 'title', '');
         $titleentry->SetTitle(_t('GLOBAL_TITLE'));
         $fieldset_webcam->Add($titleentry);
         $urlentry =& Piwi::CreateWidget('Entry', 'url', 'http://');
         $urlentry->SetTitle(_t('GLOBAL_URL'));
         $fieldset_webcam->Add($urlentry);
         $refresh =& Piwi::CreateWidget('SpinButton', 'refresh', 60, '', 5);
         $refresh->SetTitle(_t('WEBCAM_REFRESH_TIME'));
         $refresh->SetDefault(10);
         $fieldset_webcam->Add($refresh);
         $buttonbox =& Piwi::CreateWidget('HBox');
         $buttonbox->SetStyle('float: right;');
         //hig style
         $submit =& Piwi::CreateWidget('Button', 'addnewwebcam', _t('GLOBAL_SAVE', $this->gadget->title), STOCK_SAVE);
         $submit->AddEvent(ON_CLICK, 'javascript: submitForm(this.form);');
         $cancel =& Piwi::CreateWidget('Button', 'cancelform', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
         $cancel->AddEvent(ON_CLICK, 'javascript: cleanForm(this.form);');
         $buttonbox->Add($cancel);
         $buttonbox->Add($submit);
         $cam_form->Add($fieldset_webcam);
         $cam_form->Add($buttonbox);
         $tpl->SetVariable('webcam_form', $cam_form->Get());
     }
     if ($this->gadget->GetPermission('UpdateProperties')) {
         $config_form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'POST');
         $config_form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Webcam'));
         $config_form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateProperties'));
         $fieldset_config = new Jaws_Widgets_FieldSet(_t('GLOBAL_PROPERTIES'));
         $fieldset_config->SetDirection('vertical');
         $fieldset_config->SetStyle('width: 200px;');
         $limitcombo =& Piwi::CreateWidget('Combo', 'limit_random');
         $limitcombo->SetTitle(_t('WEBCAM_RANDOM_LIMIT'));
         for ($i = 1; $i <= 10; $i++) {
             $limitcombo->AddOption($i, $i);
         }
         $limit = $this->gadget->registry->fetch('limit_random');
         if (!$limit || Jaws_Error::IsError($limit)) {
             $limit = 10;
         }
         $limitcombo->SetDefault($limit);
         $fieldset_config->Add($limitcombo);
         $config_form->Add($fieldset_config);
         $submit_config =& Piwi::CreateWidget('Button', 'saveproperties', _t('GLOBAL_UPDATE', _t('GLOBAL_PROPERTIES')), STOCK_SAVE);
         $submit_config->SetStyle('float: right;');
         $submit_config->AddEvent(ON_CLICK, 'javascript: updateProperties(this.form);');
         $config_form->Add($submit_config);
         $tpl->SetVariable('config_form', $config_form->Get());
     }
     $tpl->SetVariable('incompleteWebcamFields', _t('GLOBAL_ERROR_INCOMPLETE_FIELDS'));
     $tpl->ParseBlock('webcam');
     return $tpl->Get();
 }
コード例 #10
0
ファイル: Trackbacks.php プロジェクト: Dulciane/jaws
 /**
  * Displays blog trackback to be edited
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function ViewTrackback()
 {
     $this->gadget->CheckPermission('ManageTrackbacks');
     $tModel = $this->gadget->model->loadAdmin('Trackbacks');
     $pModel = $this->gadget->model->loadAdmin('Posts');
     // Fetch the trackback
     $trackback = $tModel->GetTrackback(jaws()->request->fetch('id', 'get'));
     if (Jaws_Error::IsError($trackback)) {
         Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog&action=ManageTrackbacks');
     }
     // Fetch the entry
     $entry = $pModel->getEntry($trackback['parent_id']);
     if (Jaws_Error::IsError($entry)) {
         Jaws_Header::Location(BASE_SCRIPT . '?gadget=Blog&action=ManageTrackbacks');
     }
     $tpl = $this->gadget->template->loadAdmin('Trackback.html');
     $tpl->SetBlock('view_trackback');
     $tpl->SetVariable('menubar', $this->MenuBar('ManageTrackbacks'));
     $date = Jaws_Date::getInstance();
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet(_t('BLOG_VIEW_TRACKBACK'));
     $text = '<strong>' . $entry['title'] . '</strong>';
     $staticText =& Piwi::CreateWidget('StaticEntry', _t('BLOG_TRACKBACKS_CURRENTLY_UPDATING_FOR', $text));
     $blog_name =& Piwi::CreateWidget('Entry', 'blog_name', Jaws_XSS::filter($trackback['blog_name']));
     $blog_name->SetTitle(_t('BLOG_TRACKBACK_BLOGNAME'));
     $blog_name->SetStyle('width: 400px;');
     $url =& Piwi::CreateWidget('Entry', 'url', Jaws_XSS::filter($trackback['url']));
     $url->SetStyle('direction: ltr;');
     $url->SetTitle(_t('GLOBAL_URL'));
     $url->SetStyle('width: 400px;');
     $createTime =& Piwi::CreateWidget('Entry', 'create_time', $date->Format($trackback['createtime']));
     $createTime->SetTitle(_t('GLOBAL_CREATETIME'));
     $createTime->SetStyle('direction: ltr;');
     $createTime->SetEnabled(false);
     $updateTime =& Piwi::CreateWidget('Entry', 'update_time', $date->Format($trackback['updatetime']));
     $updateTime->SetTitle(_t('GLOBAL_UPDATETIME'));
     $updateTime->SetStyle('direction: ltr;');
     $updateTime->SetEnabled(false);
     $ip =& Piwi::CreateWidget('Entry', 'ip', $trackback['ip']);
     $ip->SetTitle(_t('GLOBAL_IP'));
     $ip->SetStyle('direction: ltr;');
     $ip->SetEnabled(false);
     $subject =& Piwi::CreateWidget('Entry', 'title', Jaws_XSS::filter($trackback['title']));
     $subject->SetTitle(_t('GLOBAL_TITLE'));
     $subject->SetStyle('width: 400px;');
     $excerpt =& Piwi::CreateWidget('TextArea', 'excerpt', $trackback['excerpt']);
     $excerpt->SetRows(5);
     $excerpt->SetColumns(60);
     $excerpt->SetStyle('width: 400px;');
     $excerpt->SetTitle(_t('BLOG_TRACKBACK_EXCERPT'));
     $cancelButton =& Piwi::CreateWidget('Button', 'previewButton', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
     $cancelButton->AddEvent(ON_CLICK, 'history.go(-1);');
     $buttonbox =& Piwi::CreateWidget('HBox');
     $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $buttonbox->PackStart($cancelButton);
     $fieldset->Add($staticText);
     $fieldset->Add($blog_name);
     $fieldset->Add($url);
     $fieldset->Add($createTime);
     $fieldset->Add($updateTime);
     $fieldset->Add($ip);
     $fieldset->Add($subject);
     $fieldset->Add($excerpt);
     $tpl->SetVariable('field', $fieldset->Get());
     $tpl->SetVariable('buttonbox', $buttonbox->Get());
     $tpl->ParseBlock('view_trackback');
     return $tpl->Get();
 }
コード例 #11
0
ファイル: VisitCounter.php プロジェクト: juniortux/jaws
 /**
  * Builds the administration UI
  *
  * @access  public
  * @return  string  XHTML content
  */
 function VisitCounter()
 {
     $this->AjaxMe('script.js');
     $model = $this->gadget->model->load('Visitors');
     $num_online = $model->GetOnlineVisitors();
     $uniqueToday = $model->GetTodayVisitors('unique');
     $impressionsToday = $model->GetTodayVisitors('impressions');
     $uniqueYesterday = $model->GetYesterdayVisitors('unique');
     $imprsnsYesterday = $model->GetYesterdayVisitors('impressions');
     $uniqueTotal = $model->GetTotalVisitors('unique');
     $impressionsTotal = $model->GetTotalVisitors('impressions');
     $startDate = $model->GetStartDate();
     $tpl = $this->gadget->template->loadAdmin('VisitCounter.html');
     $tpl->SetBlock('visitcounter');
     $tpl->SetVariable('grid', $this->DataGrid());
     //Ok, the config..
     if ($this->gadget->GetPermission('UpdateProperties')) {
         $config_form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
         $config_form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'VisitCounter'));
         $config_form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateProperties'));
         include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
         $fieldset_config = new Jaws_Widgets_FieldSet(_t('VISITCOUNTER_PROPERTIES'));
         $fieldset_config->SetDirection('vertical');
         $visit_counters = explode(',', $this->gadget->registry->fetch('visit_counters'));
         $check_counters =& Piwi::CreateWidget('CheckButtons', 'c_kind', 'vertical');
         $check_counters->SetTitle(_t('VISITCOUNTER_DISPLAY_COUNTER'));
         $check_counters->AddOption(_t('VISITCOUNTER_ONLINE_VISITORS'), 'online', null, in_array('online', $visit_counters));
         $check_counters->AddOption(_t('VISITCOUNTER_TODAY_VISITORS'), 'today', null, in_array('today', $visit_counters));
         $check_counters->AddOption(_t('VISITCOUNTER_YESTERDAY_VISITORS'), 'yesterday', null, in_array('yesterday', $visit_counters));
         $check_counters->AddOption(_t('VISITCOUNTER_TOTAL_VISITORS'), 'total', null, in_array('total', $visit_counters));
         $check_counters->AddOption(_t('VISITCOUNTER_CUSTOM_VISITORS'), 'custom', null, in_array('custom', $visit_counters));
         $fieldset_config->Add($check_counters);
         $type =& Piwi::CreateWidget('Combo', 'type');
         $type->SetTitle(_t('VISITCOUNTER_TYPE'));
         $type->AddOption(_t('VISITCOUNTER_UNIQUE'), 'unique');
         $type->AddOption(_t('VISITCOUNTER_BY_IMPRESSIONS'), 'impressions');
         $type->SetDefault($model->GetVisitType());
         $fieldset_config->Add($type);
         $period =& Piwi::CreateWidget('Combo', 'period');
         $period->SetTitle(_t('VISITCOUNTER_COOKIE_PERIOD'));
         for ($i = 0; $i <= 15; $i += 1) {
             $period->AddOption($i, $i);
         }
         $period->SetDefault($model->GetCookiePeriod());
         $fieldset_config->Add($period);
         $mode =& Piwi::CreateWidget('Combo', 'mode');
         $mode->SetTitle(_t('VISITCOUNTER_MODE'));
         $mode_reg = $this->gadget->registry->fetch('mode');
         $mode->AddOption(_t('VISITCOUNTER_MODE_TEXT'), 'text');
         $mode->AddOption(_t('VISITCOUNTER_MODE_IMAGE'), 'image');
         $mode->SetDefault($mode_reg);
         $mode->SetId('custom');
         $fieldset_config->Add($mode);
         $custom_reg = stripslashes($this->gadget->registry->fetch('custom_text'));
         $customText =& Piwi::CreateWidget('Entry', 'custom_text');
         $customText->SetTitle(_t('VISITCOUNTER_CUSTOM_TEXT'));
         $customText->SetValue($custom_reg);
         $fieldset_config->Add($customText);
         $config_form->Add($fieldset_config);
         $submit_config =& Piwi::CreateWidget('Button', 'saveproperties', _t('VISITCOUNTER_UPDATE_PROPS'), STOCK_SAVE);
         $submit_config->AddEvent(ON_CLICK, 'javascript: updateProperties(this.form);');
         $config_form->Add($submit_config);
         //$tpl->SetVariable('menubar', $this->menubar(''));
         $tpl->SetVariable('config_form', $config_form->Get());
     }
     //Stats..
     $tpl->SetVariable('visitor_stats', _t('VISITCOUNTER_VISITOR_STATS'));
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_STATS_FROM'));
     $date = Jaws_Date::getInstance();
     $tpl->SetVariable('value', $date->Format($startDate, 'Y-m-d'));
     $tpl->SetVariable('item_id', 'stats_from');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_ONLINE_VISITORS'));
     $tpl->SetVariable('value', $num_online);
     $tpl->SetVariable('item_id', 'visitors');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_TODAY_UNIQUE_VISITORS'));
     $tpl->SetVariable('value', $uniqueToday);
     $tpl->SetVariable('item_id', 'impressions');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_TODAY_PAGE_IMPRESSIONS'));
     $tpl->SetVariable('value', $impressionsToday);
     $tpl->SetVariable('item_id', 'impressions');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_YESTERDAY_UNIQUE_VISITORS'));
     $tpl->SetVariable('value', $uniqueYesterday);
     $tpl->SetVariable('item_id', 'impressions');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_YESTERDAY_PAGE_IMPRESSIONS'));
     $tpl->SetVariable('value', $imprsnsYesterday);
     $tpl->SetVariable('item_id', 'impressions');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_TOTAL_UNIQUE_VISITORS'));
     $tpl->SetVariable('value', $uniqueTotal);
     $tpl->SetVariable('item_id', 'impressions');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->SetBlock('visitcounter/item');
     $tpl->SetVariable('label', _t('VISITCOUNTER_TOTAL_PAGE_IMPRESSIONS'));
     $tpl->SetVariable('value', $impressionsTotal);
     $tpl->SetVariable('item_id', 'impressions');
     $tpl->ParseBlock('visitcounter/item');
     $tpl->ParseBlock('visitcounter');
     return $tpl->Get();
 }
コード例 #12
0
ファイル: Settings.php プロジェクト: Dulciane/jaws
 /**
  * Displays phoo settings administration panel
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function AdditionalSettings()
 {
     $this->gadget->CheckPermission('Settings');
     $tpl = $this->gadget->template->loadAdmin('AdditionalSettings.html');
     $tpl->SetBlock('additional');
     // Header
     $tpl->SetVariable('menubar', $this->MenuBar('AdditionalSettings'));
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Phoo'));
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'SaveAdditionalSettings'));
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet(_t('PHOO_ADDITIONAL_SETTINGS'));
     // Save Button
     $save =& Piwi::CreateWidget('Button', 'save', _t('PHOO_SAVE_SETTINGS'), STOCK_SAVE);
     $save->SetSubmit();
     // Reset Button
     $reset =& Piwi::CreateWidget('Button', 'reset', _t('GLOBAL_RESET'), STOCK_RESET);
     $reset->setReset(true);
     $sModel = $this->gadget->model->load('Settings');
     $aModel = $this->gadget->model->load('Albums');
     $settings = $sModel->GetSettings();
     // Default View
     $tpl->SetVariable('label', _t('PHOO_DEFAULT_VIEW'));
     $viewCombo =& Piwi::CreateWidget('Combo', 'default_action');
     $viewCombo->setContainerClass('oneline');
     $viewCombo->SetTitle(_t('PHOO_DEFAULT_VIEW'));
     $viewCombo->AddOption(_t('PHOO_ALBUM_LIST'), 'AlbumList');
     $viewCombo->AddOption(_t('PHOO_PHOTOBLOG'), 'PhotoblogPortrait');
     $viewCombo->SetDefault($settings['default_action']);
     // Default status
     $statusCombo =& Piwi::CreateWidget('Combo', 'published');
     $statusCombo->setContainerClass('oneline');
     $statusCombo->SetTitle(_t('PHOO_DEFAULT_STATUS'));
     $statusCombo->AddOption(_t('PHOO_PUBLISHED'), 'true');
     $statusCombo->AddOption(_t('PHOO_HIDDEN'), 'false');
     $statusCombo->SetDefault($settings['published']);
     // Albums Order type
     $albumsorderType =& Piwi::CreateWidget('Combo', 'albums_order_type');
     $albumsorderType->setContainerClass('oneline');
     $albumsorderType->SetTitle(_t('PHOO_ALBUMS_ORDER_TYPE'));
     $albumsorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_CREATETIME') . ' &darr;', 'createtime');
     $albumsorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_CREATETIME') . ' &uarr;', 'createtime desc');
     $albumsorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_NAME') . ' &darr;', 'name');
     $albumsorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_NAME') . ' &uarr;', 'name desc');
     $albumsorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_ID') . ' &darr;', 'id');
     $albumsorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_ID') . ' &uarr;', 'id desc');
     $albumsorderType->SetDefault($settings['albums_order_type']);
     // Photos Order type
     $photosorderType =& Piwi::CreateWidget('Combo', 'photos_order_type');
     $photosorderType->setContainerClass('oneline');
     $photosorderType->SetTitle(_t('PHOO_PHOTOS_ORDER_TYPE'));
     $photosorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_CREATETIME') . ' &darr;', 'createtime');
     $photosorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_CREATETIME') . ' &uarr;', 'createtime desc');
     $photosorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_NAME') . ' &darr;', 'title');
     $photosorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_NAME') . ' &uarr;', 'title desc');
     $photosorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_ID') . ' &darr;', 'id');
     $photosorderType->AddOption(_t('PHOO_ORDER_TYPE_BY_ID') . ' &uarr;', 'id desc');
     $photosorderType->SetDefault($settings['photos_order_type']);
     // Comments
     $commCombo =& Piwi::CreateWidget('Combo', 'allow_comments');
     $commCombo->setContainerClass('oneline');
     $commCombo->SetTitle(_t('PHOO_COMMENTS'));
     $commCombo->AddOption(_t('GLOBAL_ENABLED'), 'true');
     $commCombo->AddOption(_t('GLOBAL_DISABLED'), 'false');
     $commCombo->SetDefault($settings['allow_comments']);
     // Moderate comments
     $moderateCombo =& Piwi::CreateWidget('Combo', 'comment_status');
     $moderateCombo->setContainerClass('oneline');
     $moderateCombo->SetTitle(_t('PHOO_MODERATE_COMMENTS'));
     $moderateCombo->AddOption(_t('GLOBAL_YES'), 'waiting');
     $moderateCombo->AddOption(_t('GLOBAL_NO'), 'approved');
     $moderateCombo->SetDefault($settings['comment_status']);
     // Keep original
     $keepCombo =& Piwi::CreateWidget('Combo', 'keep_original');
     $keepCombo->setContainerClass('oneline');
     $keepCombo->SetTitle(_t('PHOO_KEEP_ORIGINAL'));
     $keepCombo->AddOption(_t('GLOBAL_ENABLED'), 'true');
     $keepCombo->AddOption(_t('GLOBAL_DISABLED'), 'false');
     $keepCombo->SetDefault($settings['keep_original']);
     // Show EXIF info
     $exifCombo =& Piwi::CreateWidget('Combo', 'show_exif_info');
     $exifCombo->setContainerClass('oneline');
     $exifCombo->SetTitle(_t('PHOO_SHOW_EXIF_INFO'));
     $exifCombo->AddOption(_t('GLOBAL_ENABLED'), 'true');
     $exifCombo->AddOption(_t('GLOBAL_DISABLED'), 'false');
     $exifCombo->SetDefault($settings['show_exif_info']);
     // Moblog
     $moblogLimitCombo =& Piwi::CreateWidget('Combo', 'moblog_limit', _t('PHOO_MOBLOG_LIMIT'));
     $moblogLimitCombo->setContainerClass('oneline');
     $moblogLimitCombo->AddOption('5', '5');
     $moblogLimitCombo->AddOption('10', '10');
     $moblogLimitCombo->AddOption('15', '15');
     $moblogLimitCombo->AddOption('20', '20');
     $moblogLimitCombo->SetDefault($settings['moblog_limit']);
     // Photoblog
     $albums = $aModel->GetAlbums('name', 'ASC');
     $photoblogAlbumCombo =& Piwi::CreateWidget('Combo', 'photoblog_album', _t('PHOO_PHOTOBLOG_ALBUM'));
     $photoblogAlbumCombo->setContainerClass('oneline');
     $photoblogAlbumCombo->AddOption('&nbsp;', '');
     if (!Jaws_Error::IsError($albums)) {
         $date = Jaws_Date::getInstance();
         foreach ($albums as $a) {
             // FIXME: Ugly hack to add title to photoblogAlbumCombo
             $o =& Piwi::CreateWidget('ComboOption', $a['name'], $a['name']);
             $o->SetTitle(_t('PHOO_NUM_PHOTOS_ALBUM', $a['howmany']) . ' / ' . _t('PHOO_ALBUM_CREATION_DATE') . ': ' . $date->Format($a['createtime']));
             $photoblogAlbumCombo->_options[$a['name']] = $o;
         }
     }
     $photoblogAlbumCombo->SetDefault($settings['photoblog_album']);
     $photoblogLimitCombo =& Piwi::CreateWidget('Combo', 'photoblog_limit', _t('PHOO_PHOTOBLOG_LIMIT'));
     $photoblogLimitCombo->setContainerClass('oneline');
     $photoblogLimitCombo->AddOption('5', '5');
     $photoblogLimitCombo->AddOption('10', '10');
     $photoblogLimitCombo->AddOption('15', '15');
     $photoblogLimitCombo->AddOption('20', '20');
     $photoblogLimitCombo->SetDefault($settings['photoblog_limit']);
     // Images per Page
     $thumbnailLimitCombo =& Piwi::CreateWidget('Combo', 'thumbnail_limit', _t('PHOO_THUMBNAIL_LIMIT'));
     $thumbnailLimitCombo->setContainerClass('oneline');
     $thumbnailLimitCombo->AddOption(_t('PHOO_FULL_ALBUM'), '0');
     $thumbnailLimitCombo->AddOption('10', '10');
     $thumbnailLimitCombo->AddOption('20', '20');
     $thumbnailLimitCombo->AddOption('40', '40');
     $thumbnailLimitCombo->SetDefault($settings['thumbnail_limit']);
     $fieldset->Add($viewCombo);
     $fieldset->Add($thumbnailLimitCombo);
     $fieldset->Add($statusCombo);
     $fieldset->Add($albumsorderType);
     $fieldset->Add($photosorderType);
     $fieldset->Add($commCombo);
     $fieldset->Add($moderateCombo);
     $fieldset->Add($keepCombo);
     $fieldset->Add($exifCombo);
     $fieldset->Add($moblogLimitCombo);
     $fieldset->Add($photoblogAlbumCombo);
     $fieldset->Add($photoblogLimitCombo);
     $fieldset->SetDirection('vertical');
     $form->Add($fieldset);
     $buttonbox =& Piwi::CreateWidget('HBox');
     $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $buttonbox->PackStart($reset);
     $buttonbox->PackStart($save);
     $form->Add($buttonbox);
     $tpl->SetVariable('form', $form->Get());
     $tpl->ParseBlock('additional');
     return $tpl->Get();
 }
コード例 #13
0
ファイル: Friends.php プロジェクト: juniortux/jaws
 /**
  * Creates and prints the administration template
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function Friends()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Friends.html');
     $tpl->SetBlock('friends');
     $tpl->SetVariable('grid', $this->Datagrid());
     ///Config properties
     if ($this->gadget->GetPermission('UpdateProperties')) {
         $config_form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
         $config_form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Friends'));
         $config_form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateProperties'));
         include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
         $fieldset_config = new Jaws_Widgets_FieldSet(_t('GLOBAL_PROPERTIES'));
         $fieldset_config->SetDirection('vertical');
         $limitcombo =& Piwi::CreateWidget('Combo', 'limit_random');
         $limitcombo->SetTitle(_t('FRIENDS_LIMIT_RANDOM'));
         for ($i = 1; $i <= 10; $i++) {
             $limitcombo->AddOption($i, $i);
         }
         $limit = $this->gadget->registry->fetch('limit');
         if (Jaws_Error::IsError($limit) || !$limit) {
             $limit = 10;
         }
         $limitcombo->SetDefault($limit);
         $fieldset_config->Add($limitcombo);
         $config_form->Add($fieldset_config);
         $submit_config =& Piwi::CreateWidget('Button', 'saveproperties', _t('GLOBAL_UPDATE', _t('GLOBAL_PROPERTIES')), STOCK_SAVE);
         $submit_config->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
         $submit_config->AddEvent(ON_CLICK, 'javascript: updateProperties(this.form);');
         $config_form->Add($submit_config);
         $tpl->SetVariable('config_form', $config_form->Get());
     }
     if ($this->gadget->GetPermission('AddFriend')) {
         $friend = array();
         $friends_form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post', '', 'friends_form');
         $friends_form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Friends'));
         $friends_form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'AddFriend'));
         $friends_form->Add(Piwi::CreateWidget('HiddenEntry', 'id', ''));
         include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
         $fieldset_friebd = new Jaws_Widgets_FieldSet(_t('FRIENDS_FRIEND'));
         $fieldset_friebd->SetDirection('vertical');
         $action = jaws()->request->fetch('action', 'get');
         $action = !(is_null($action) ? $action : '');
         $friendentry =& Piwi::CreateWidget('Entry', 'friend', isset($friend['friend']) ? Jaws_XSS::filter($friend['friend']) : '');
         $friendentry->SetTitle(_t('FRIENDS_FRIEND'));
         $friendentry->SetStyle('width: 250px;');
         $fieldset_friebd->Add($friendentry);
         $urlentry =& Piwi::CreateWidget('Entry', 'url', isset($friend['url']) ? Jaws_XSS::filter($friend['url']) : 'http://');
         $urlentry->SetTitle(_t('GLOBAL_URL'));
         $urlentry->SetStyle('direction: ltr; width: 250px;');
         $fieldset_friebd->Add($urlentry);
         $buttonbox =& Piwi::CreateWidget('HBox');
         $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
         //hig style
         $submit =& Piwi::CreateWidget('Button', 'addnewfriend', _t('GLOBAL_SAVE'), STOCK_SAVE);
         $submit->AddEvent(ON_CLICK, 'javascript: submitForm(this.form);');
         $cancel =& Piwi::CreateWidget('Button', 'cancelform', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
         $cancel->AddEvent(ON_CLICK, "cleanForm(this.form);");
         $buttonbox->Add($cancel);
         $buttonbox->Add($submit);
         $friends_form->Add($fieldset_friebd);
         $friends_form->Add($buttonbox);
         $tpl->SetVariable('friend_form', $friends_form->Get());
     }
     $tpl->ParseBlock('friends');
     return $tpl->Get();
 }
コード例 #14
0
ファイル: Settings.php プロジェクト: juniortux/jaws
 /**
  * Displays blog settings administration panel
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function AdditionalSettings()
 {
     $this->gadget->CheckPermission('Settings');
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Settings.html');
     $tpl->SetBlock('additional');
     // Header
     $tpl->SetVariable('menubar', $this->MenuBar('AdditionalSettings'));
     $form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'POST');
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Blog'));
     $form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'SaveAdditionalSettings'));
     include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
     $fieldset = new Jaws_Widgets_FieldSet(_t('BLOG_ADDITIONAL_SETTINGS'));
     // $fieldset =& Piwi::CreateWidget('FieldSet', _t('BLOG_ADDITIONAL_SETTINGS'));
     // Save Button
     $save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
     $save->AddEvent(ON_CLICK, 'javascript: saveSettings(this.form);');
     $sModel = $this->gadget->model->loadAdmin('Settings');
     $cModel = $this->gadget->model->load('Categories');
     $settings = $sModel->GetSettings();
     if (Jaws_Error::IsError($settings)) {
         $settings = array();
     }
     // Default View
     $tpl->SetVariable('label', _t('BLOG_DEFAULT_VIEW'));
     $viewCombo =& Piwi::CreateWidget('Combo', 'default_view');
     $viewCombo->setContainerClass('oneline');
     $viewCombo->SetTitle(_t('BLOG_DEFAULT_VIEW'));
     $viewCombo->AddOption(_t('BLOG_MONTHLY'), 'monthly');
     $viewCombo->AddOption(_t('BLOG_LATEST_ENTRY'), 'latest_entry');
     $viewCombo->AddOption(_t('BLOG_LAST_ENTRIES'), 'last_entries');
     $viewCombo->AddOption(_t('BLOG_DEFAULT_CATEGORY'), 'default_category');
     $viewCombo->SetDefault(isset($settings['default_view']) ? $settings['default_view'] : '');
     // Last entries limit
     $limitCombo =& Piwi::CreateWidget('Combo', 'last_entries_limit');
     $limitCombo->setContainerClass('oneline');
     $limitCombo->SetTitle(_t('BLOG_LAST_ENTRIES_LIMIT'));
     for ($i = 5; $i <= 30; $i += 5) {
         $limitCombo->AddOption($i, $i);
     }
     $limitCombo->SetDefault(isset($settings['last_entries_limit']) ? $settings['last_entries_limit'] : '');
     // Popular limit
     $popCombo =& Piwi::CreateWidget('Combo', 'popular_limit');
     $popCombo->setContainerClass('oneline');
     $popCombo->SetTitle(_t('BLOG_POPULAR_ENTRIES_LIMIT'));
     for ($i = 5; $i <= 30; $i += 5) {
         $popCombo->AddOption($i, $i);
     }
     $popCombo->SetDefault(isset($settings['popular_limit']) ? $settings['popular_limit'] : '');
     // Last comments limit
     $commentslimitCombo =& Piwi::CreateWidget('Combo', 'last_comments_limit');
     $commentslimitCombo->setContainerClass('oneline');
     $commentslimitCombo->SetTitle(_t('BLOG_LAST_COMMENTS_LIMIT'));
     for ($i = 5; $i <= 30; $i += 5) {
         $commentslimitCombo->AddOption($i, $i);
     }
     $commentslimitCombo->SetDefault(isset($settings['last_comments_limit']) ? $settings['last_comments_limit'] : '');
     // Last recent comments
     $recentcommentsLimitCombo =& Piwi::CreateWidget('Combo', 'last_recentcomments_limit');
     $recentcommentsLimitCombo->setContainerClass('oneline');
     $recentcommentsLimitCombo->SetTitle(_t('BLOG_LAST_RECENTCOMMENTS_LIMIT'));
     for ($i = 5; $i <= 30; $i += 5) {
         $recentcommentsLimitCombo->AddOption($i, $i);
     }
     $recentcommentsLimitCombo->SetDefault(isset($settings['last_recentcomments_limit']) ? $settings['last_recentcomments_limit'] : '');
     $categories = $cModel->GetCategories();
     if (!Jaws_Error::IsError($categories)) {
         // Default category
         $catCombo =& Piwi::CreateWidget('Combo', 'default_category');
         $catCombo->setContainerClass('oneline');
         $catCombo->SetTitle(_t('BLOG_DEFAULT_CATEGORY'));
         foreach ($categories as $cat) {
             $catCombo->AddOption($cat['name'], $cat['id']);
         }
         $catCombo->SetDefault(isset($settings['default_category']) ? $settings['default_category'] : '');
     }
     // RSS/Atom limit
     $xmlCombo =& Piwi::CreateWidget('Combo', 'xml_limit');
     $xmlCombo->setContainerClass('oneline');
     $xmlCombo->SetTitle(_t('BLOG_RSS_ENTRIES_LIMIT'));
     for ($i = 5; $i <= 50; $i += 5) {
         $xmlCombo->AddOption($i, $i);
     }
     $xmlCombo->SetDefault(isset($settings['xml_limit']) ? $settings['xml_limit'] : '');
     Jaws_Translate::getInstance()->LoadTranslation('Comments', JAWS_COMPONENT_GADGET);
     // Comments
     $commCombo =& Piwi::CreateWidget('Combo', 'comments');
     $commCombo->setContainerClass('oneline');
     $commCombo->SetTitle(_t('BLOG_COMMENTS'));
     $commCombo->AddOption(_t('GLOBAL_ENABLED'), 'true');
     $commCombo->AddOption(_t('GLOBAL_DISABLED'), 'false');
     $commCombo->SetDefault(isset($settings['comments']) ? $settings['comments'] : '');
     // Trackback
     $tbCombo =& Piwi::CreateWidget('Combo', 'trackback');
     $tbCombo->setContainerClass('oneline');
     $tbCombo->SetTitle(_t('BLOG_TRACKBACK'));
     $tbCombo->AddOption(_t('GLOBAL_ENABLED'), 'true');
     $tbCombo->AddOption(_t('GLOBAL_DISABLED'), 'false');
     $tbCombo->SetDefault($settings['trackback']);
     // Trackback status
     $tbStatusCombo =& Piwi::CreateWidget('Combo', 'trackback_status');
     $tbStatusCombo->setContainerClass('oneline');
     $tbStatusCombo->SetTitle(_t('BLOG_DEFAULT_STATUS', _t('BLOG_TRACKBACK')));
     $tbStatusCombo->AddOption(_t('COMMENTS_STATUS_APPROVED'), 'approved');
     $tbStatusCombo->AddOption(_t('COMMENTS_STATUS_WAITING'), 'waiting');
     $tbStatusCombo->SetDefault($settings['trackback_status']);
     // Pingback
     $pbCombo =& Piwi::CreateWidget('Combo', 'pingback');
     $pbCombo->setContainerClass('oneline');
     $pbCombo->SetTitle(_t('BLOG_PINGBACK'));
     $pbCombo->AddOption(_t('GLOBAL_ENABLED'), 'true');
     $pbCombo->AddOption(_t('GLOBAL_DISABLED'), 'false');
     $pbCombo->SetDefault($settings['pingback']);
     $fieldset->Add($viewCombo);
     $fieldset->Add($limitCombo);
     $fieldset->Add($popCombo);
     $fieldset->Add($commentslimitCombo);
     $fieldset->Add($recentcommentsLimitCombo);
     if (!Jaws_Error::IsError($categories)) {
         $fieldset->Add($catCombo);
     }
     $fieldset->Add($xmlCombo);
     $fieldset->Add($commCombo);
     $fieldset->Add($tbCombo);
     $fieldset->Add($tbStatusCombo);
     $fieldset->Add($pbCombo);
     $fieldset->SetDirection('vertical');
     $form->Add($fieldset);
     $buttonbox =& Piwi::CreateWidget('HBox');
     $buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
     $buttonbox->PackStart($save);
     $form->Add($buttonbox);
     $tpl->SetVariable('form', $form->Get());
     $tpl->ParseBlock('additional');
     return $tpl->Get();
 }