Exemplo n.º 1
0
        protected virtual void OnEditButtonClicked(object sender, System.EventArgs e)
        {
            //userTreeview.Selection.GetSelected(out iter);

            Gtk.TreePath[] path_array = userTreeview.Selection.GetSelectedRows();

            if (path_array.Length == 1)
            {
                Gtk.TreeIter iter;
                store.GetIter(out iter, path_array[0]);
                //Console.WriteLine(store.GetValue(iter,0));
                LdapUser return_user = null;
                foreach (LdapUser user in user_list)
                {
                    if (user.uid == (string)store.GetValue(iter, 0))
                    {
                        return_user = user;
                        break;
                    }
                }

                llum.Core core = llum.Core.getCore();

                core.edit_user_wid = new EditUser(return_user);
                core.mw.setCurrentWidget(core.edit_user_wid);
            }
        }
Exemplo n.º 2
0
        public EditUser(LdapUser user)
        {
            this.Build();



            this.user = user;

            if ((llum.Core.getCore().user_group != "admin") && (llum.Core.getCore().user_group != "promoted-teacher"))
            {
                //expander1.Sensitive=false;
                nameEntry.Sensitive         = false;
                surnameEntry.Sensitive      = false;
                undoButton.Sensitive        = false;
                applyButton.Sensitive       = false;
                addGroupButton.Sensitive    = false;
                removeGroupButton.Sensitive = false;
            }

            if (this.user.main_group == "admin")
            {
                expander1.Sensitive = false;
            }


            uidLabel.Text    = user.uid;
            uidNumLabel.Text = user.uidn;
            groupLabel.Text  = user.main_group;

            nameEntry.Text    = user.name;
            surnameEntry.Text = user.surname;
            //changePasswordButton.Sensitive=false;


            niaEntry.Text = user.nia;
            dniEntry.Text = user.dni;

            llum.Core core = llum.Core.getCore();

            switch (user.main_group)
            {
            case "students":
                dniEntry.Sensitive = false;

                if (niaEntry.Text != "" && (core.user_group != "admin" || core.user_group != "promoted-teacher"))
                {
                    niaButton.Hide();
                    niaEntry.Sensitive = false;
                }

                break;

            case "teachers":
                niaEntry.Sensitive = false;
                if (dniEntry.Text != "" && (core.user_group != "admin" || core.user_group != "promoted-teacher"))
                {
                    niaButton.Hide();
                    dniEntry.Sensitive = false;
                }

                break;

            default:
                niaButton.Sensitive = false;
                niaEntry.Sensitive  = false;
                dniEntry.Sensitive  = false;
                niaButton.Hide();
                break;
            }


            belongTreeview.Selection.Mode = Gtk.SelectionMode.Multiple;
            belong_store = new Gtk.TreeStore(typeof(string));
            Gtk.TreeViewColumn belong_column = new Gtk.TreeViewColumn();
            belong_column.Title = Mono.Unix.Catalog.GetString("Belongs to");
            Gtk.CellRendererText cell = new Gtk.CellRendererText();
            belong_column.PackStart(cell, true);
            belong_column.AddAttribute(cell, "text", 0);
            belongTreeview.AppendColumn(belong_column);
            //Console.WriteLine(user.groups.Length);

            belongTreeview.Model = belong_store;
            belongTreeview.ShowAll();

            availableTreeview.Selection.Mode = Gtk.SelectionMode.Multiple;
            available_store = new Gtk.TreeStore(typeof(string));
            Gtk.TreeViewColumn available_column = new Gtk.TreeViewColumn();
            available_column.Title = Mono.Unix.Catalog.GetString("Available groups");
            Gtk.CellRendererText available_cell = new Gtk.CellRendererText();
            available_column.PackStart(available_cell, true);
            available_column.AddAttribute(available_cell, "text", 0);
            availableTreeview.AppendColumn(available_column);
            availableTreeview.Model = available_store;
            availableTreeview.ShowAll();

            //llum.Core core=llum.Core.get


            populateTrees();
        }