Пример #1
0
 /**
  * Class Constructor
  * @param $value Label's text
  */
 public function __construct($value)
 {
     parent::__construct();
     parent::set_size_request(-1, -1);
     $this->setValue($value);
     $this->set_alignment(0, 0.5);
     parent::set_use_markup(TRUE);
 }
Пример #2
0
 public function __construct($username)
 {
     parent::__construct();
     $this->username = $username;
     $this->strings = KioskClient::getStrings();
     #    $this->set_default_size( 300, 200 );
     $this->set_resizable(false);
     $this->set_modal(true);
     $this->set_keep_above(true);
     $this->set_title($this->strings['setPassword']);
     $this->messageLabel = new GtkLabel();
     $this->messageLabel->set_use_markup(true);
     $this->messageLabel->set_markup($this->strings['setPassword']);
     $passwordLabel1 = new GtkLabel();
     $passwordLabel1->set_use_markup(true);
     $passwordLabel1->set_label($this->strings['passwordLabel']);
     $this->passwordEntry1 = new GtkEntry();
     $this->passwordEntry1->set_visibility(0);
     $passwordBox1 = new GtkHBox();
     $passwordBox1->pack_start($passwordLabel1);
     $passwordBox1->pack_start($this->passwordEntry1);
     $passwordLabel2 = new GtkLabel();
     $passwordLabel2->set_use_markup(true);
     $passwordLabel2->set_label($this->strings['passwordLabel']);
     $this->passwordEntry2 = new GtkEntry();
     $this->passwordEntry2->set_visibility(0);
     $passwordBox2 = new GtkHBox();
     $passwordBox2->pack_start($passwordLabel2);
     $passwordBox2->pack_start($this->passwordEntry2);
     $this->setPasswordButton = new GtkButton($this->strings['setPasswordButton']);
     $mainBox = new GtkVBox();
     $mainBox->pack_start($this->messageLabel);
     $mainBox->pack_start($passwordBox1);
     $mainBox->pack_start($passwordBox2);
     $mainBox->pack_start($this->setPasswordButton);
     $this->add($mainBox);
     $this->connect('key-press-event', array(&$this, 'onKey'), $input);
     $this->setPasswordButton->connect_simple('clicked', array(&$this, 'onClick'));
     $this->show_all();
 }
Пример #3
0
 public function __construct($message)
 {
     parent::__construct();
     $this->strings = KioskClient::getStrings();
     $this->set_position(GtK::WIN_POS_CENTER_ALWAYS);
     $this->set_default_size(200, 100);
     $this->set_resizable(false);
     $this->set_modal(false);
     $alertMessage = new GtkLabel();
     $alertMessage->set_use_markup(true);
     $alertMessage->set_markup($message);
     $this->vbox->pack_start($hbox = new GtkHBox());
     $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG);
     $hbox->pack_start($stock, 0, 0);
     $hbox->pack_start($alertMessage);
     $this->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK);
     $this->action_area->set_layout(Gtk::BUTTONBOX_SPREAD);
     $this->set_has_separator(false);
     $this->show_all();
     $this->run();
     $this->destroy();
 }
Пример #4
0
 /**
  * Define the menu based on user profile
  */
 public function configureMenu()
 {
     if ($this->scroll->get_child()) {
         $this->scroll->remove($this->scroll->get_child());
     }
     TTransaction::open('library');
     $member = User::newFromLogin(TSession::getValue('login'));
     if ($member->role->mnemonic == 'LIBRARIAN') {
         $buttons = array();
         $buttons[] = array('<b>' . _t('Cataloging') . '</b>');
         $buttons[] = array(_t('Books'), 'BookList');
         $buttons[] = array(_t('Collections'), 'CollectionFormList');
         $buttons[] = array(_t('Classifications'), 'ClassificationFormList');
         $buttons[] = array(_t('Subjects'), 'SubjectList');
         $buttons[] = array(_t('Authors'), 'AuthorList');
         $buttons[] = array(_t('Publishers'), 'PublisherList');
         $buttons[] = array(_t('Status'), 'StatusFormList');
         $buttons[] = array('<b>' . _t('Members') . '</b>');
         $buttons[] = array(_t('Members'), 'MemberList');
         $buttons[] = array(_t('Categories'), 'CategoryFormList');
         $buttons[] = array(_t('Cities'), 'CityList');
         $buttons[] = array('<b>' . _t('Circulation') . '</b>');
         $buttons[] = array(_t('Check in'), 'CheckInForm');
         $buttons[] = array(_t('Check out'), 'CheckOutForm');
         $buttons[] = array('<b>' . _t('Reports') . '</b>');
         $buttons[] = array(_t('Loans'), 'LoanReport');
         $buttons[] = array(_t('Member'), 'MemberReport');
         $buttons[] = array(_t('Books'), 'BookReport');
         $buttons[] = array('Logout', array('LoginForm', 'onLogout'));
     } else {
         if ($member->role->mnemonic == 'OPERATOR') {
             $buttons = array();
             $buttons[] = array('<b>' . _t('Members') . '</b>');
             $buttons[] = array(_t('Members'), 'MemberList');
             $buttons[] = array(_t('Categories'), 'CategoryFormList');
             $buttons[] = array(_t('Cities'), 'CityList');
             $buttons[] = array('<b>' . _t('Circulation') . '</b>');
             $buttons[] = array(_t('Check in'), 'CheckInForm');
             $buttons[] = array(_t('Check out'), 'CheckOutForm');
             $buttons[] = array('<b>' . _t('Reports') . '</b>');
             $buttons[] = array(_t('Loans'), 'LoanReport');
             $buttons[] = array(_t('Member'), 'MemberReport');
             $buttons[] = array(_t('Books'), 'BookReport');
             $buttons[] = array('Logout', array('LoginForm', 'onLogout'));
         } else {
             if ($member->role->mnemonic == 'ADMINISTRATOR') {
                 $buttons = array();
                 $buttons[] = array('<b>' . 'Admin' . '</b>');
                 $buttons[] = array(_t('Users'), 'UserList');
                 $buttons[] = array(_t('Roles'), 'RoleList');
                 $buttons[] = array('Logout', array('LoginForm', 'onLogout'));
             }
         }
     }
     TTransaction::close();
     $vbox_buttons = new GtkVBox(FALSE, 0);
     $this->scroll->add_with_viewport($vbox_buttons);
     $this->scroll->get_child()->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse('#EFEFEF'));
     foreach ($buttons as $button_info) {
         if (!isset($button_info[1])) {
             $button = new GtkEventBox();
             $button->add($label = new GtkLabel($button_info[0]));
             $button->set_size_request(-1, 20);
             $label->set_use_markup(TRUE);
             $button->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse('#C0C0C0'));
         } else {
             $button = new GtkButton($button_info[0]);
             $button->get_child()->set_alignment(0, 0);
             $button->set_property('can-focus', FALSE);
             $button->set_relief(Gtk::RELIEF_NONE);
             $button->modify_bg(Gtk::STATE_PRELIGHT, GdkColor::parse('#CFCFCF'));
             $button->modify_bg(Gtk::STATE_ACTIVE, GdkColor::parse('#CFCFCF'));
             $button->set_size_request(-1, 24);
             $button->connect_simple('clicked', array($this, 'run'), $button_info[1]);
         }
         $vbox_buttons->pack_start($button, FALSE, FALSE, 0);
     }
     $this->scroll->show_all();
 }
Пример #5
0
 public function __construct($status = null)
 {
     if (DEBUG) {
         echo "LoginWindow::__construct( \$status = {$status} )\n";
     }
     parent::__construct();
     $this->strings = KioskClient::getStrings();
     $this->status = $status;
     $screen = GdkScreen::get_default();
     $screenWidth = $screen->get_width();
     $screenHeight = $screen->get_height();
     $this->set_decorated(1);
     $this->set_default_size(800, 600);
     ##Temporary Changed for testing  ($screenWidth, $screenHeight)
     #$this->fullscreen();
     $this->set_keep_above(0);
     $this->set_modal(1);
     $messageBox = new GtkHBox();
     $this->loginBox = new GtkVBox();
     $this->errorBox = new GtkVBox();
     $usernameBox = new GtkHBox();
     $passwordBox = new GtkHBox();
     ## Build the login box
     $this->messageLabel = new GtkLabel();
     $this->messageLabel->set_use_markup(true);
     $this->messageLabel->set_label($this->strings['promptLabel']);
     $usernameLabel = new GtkLabel();
     $usernameLabel->set_use_markup(true);
     $usernameLabel->set_label($this->strings['usernameLabel']);
     $this->usernameEntry = new GtkEntry();
     $passwordLabel = new GtkLabel();
     $passwordLabel->set_use_markup(true);
     $passwordLabel->set_label($this->strings['passwordLabel']);
     $this->passwordEntry = new GtkEntry();
     $this->passwordEntry->set_visibility(0);
     $this->loginButton = new GtkButton($this->strings['loginButton']);
     $messageBox->pack_start($this->messageLabel);
     $usernameBox->pack_start($usernameLabel);
     $usernameBox->pack_start($this->usernameEntry);
     $passwordBox->pack_start($passwordLabel);
     $passwordBox->pack_start($this->passwordEntry);
     $this->loginBox->pack_start($messageBox);
     $this->loginBox->pack_start($usernameBox);
     $this->loginBox->pack_start($passwordBox);
     $this->loginBox->pack_start($this->loginButton);
     ## Build the error message box
     $this->errorLabel = new GtkLabel();
     $this->errorLabel->set_use_markup(true);
     $this->errorLabel->set_label('Error : Username and Password Do Not Match');
     $errorLabelBox = new GtkHBox();
     $errorLabelBox->pack_start($this->errorLabel);
     $this->errorButton = new GtkButton('OK');
     $errorButtonBox = new GtkHBox();
     $errorButtonBox->pack_start($this->errorButton);
     $this->errorBox->pack_start($errorLabelBox);
     $this->errorBox->pack_start($errorButtonBox);
     if (DEBUG) {
         $this->quitButton = new GtkButton("Quit");
         $this->loginBox->pack_start($this->quitButton);
     }
     $this->connect_simple('destroy', array('Gtk', 'main_quit'));
     $centerHBox = new GtkHBox();
     $centerVBox = new GtkVBox();
     $leftBox = new GtkHBox();
     $rightBox = new GtkHBox();
     $topBox = new GtkHBox();
     $bottomBox = new GtkHBox();
     $insideTopBox = new GtkVBox();
     $this->topLabel = new GtkLabel();
     $this->topLabel->set_use_markup(true);
     $this->topLabel->set_label($this->strings['topLabel']);
     $insideTopBox->pack_start($this->topLabel);
     if (file_exists('/etc/libki/logo.png')) {
         $logo = GtkImage::new_from_file('/etc/libki/logo.png');
         $insideTopBox->pack_start($logo);
     } elseif (file_exists('logo.png')) {
         $logo = GtkImage::new_from_file('logo.png');
         $insideTopBox->pack_start($logo);
     }
     $topBox->pack_start($insideTopBox);
     $centerHBox->pack_start($leftBox, true);
     $centerHBox->pack_start($this->loginBox, false);
     $centerHBox->pack_start($this->errorBox, false);
     $centerHBox->pack_start($rightBox, true);
     $centerVBox->pack_start($topBox, true);
     $centerVBox->pack_start($centerHBox, false);
     $centerVBox->pack_start($bottomBox, true);
     $this->add($centerVBox);
 }