| | |
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.form.Button;
|
| | | import org.apache.wicket.markup.html.form.CheckBox;
|
| | | import org.apache.wicket.markup.html.form.ChoiceRenderer;
|
| | | import org.apache.wicket.markup.html.form.DropDownChoice;
|
| | | import org.apache.wicket.markup.html.form.Form;
|
| | | import org.apache.wicket.markup.html.form.IChoiceRenderer;
|
| | |
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RegistrantAccessPermission;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserChoice;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.ArrayUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
| | | final RegistrantPermissionsPanel usersPalette = new RegistrantPermissionsPanel("users",
|
| | | RegistrantType.USER, app().users().getAllUsernames(), repositoryUsers, getAccessPermissions());
|
| | | final RegistrantPermissionsPanel teamsPalette = new RegistrantPermissionsPanel("teams",
|
| | | RegistrantType.TEAM, app().users().getAllTeamnames(), repositoryTeams, getAccessPermissions());
|
| | | RegistrantType.TEAM, app().users().getAllTeamNames(), repositoryTeams, getAccessPermissions());
|
| | |
|
| | | // owners palette
|
| | | List<String> owners = new ArrayList<String>(repositoryModel.owners);
|
| | | List<String> persons = app().users().getAllUsernames();
|
| | | final Palette<String> ownersPalette = new Palette<String>("owners", new ListModel<String>(owners), new CollectionModel<String>(
|
| | | persons), new StringChoiceRenderer(), 12, true);
|
| | | List<UserChoice> owners = new ArrayList<UserChoice>();
|
| | | for (String owner : repositoryModel.owners) {
|
| | | UserModel o = app().users().getUserModel(owner);
|
| | | if (o != null) {
|
| | | owners.add(new UserChoice(o.getDisplayName(), o.username, o.emailAddress));
|
| | | } else {
|
| | | owners.add(new UserChoice(owner));
|
| | | }
|
| | | }
|
| | | List<UserChoice> persons = new ArrayList<UserChoice>();
|
| | | for (String person : app().users().getAllUsernames()) {
|
| | | UserModel o = app().users().getUserModel(person);
|
| | | if (o != null) {
|
| | | persons.add(new UserChoice(o.getDisplayName(), o.username, o.emailAddress));
|
| | | } else {
|
| | | persons.add(new UserChoice(person));
|
| | | }
|
| | | }
|
| | | final Palette<UserChoice> ownersPalette = new Palette<UserChoice>("owners", new ListModel<UserChoice>(owners), new CollectionModel<UserChoice>(
|
| | | persons), new ChoiceRenderer<UserChoice>(null, "userId"), 12, true);
|
| | |
|
| | | // indexed local branches palette
|
| | | List<String> allLocalBranches = new ArrayList<String>();
|
| | |
| | |
|
| | | // owners
|
| | | repositoryModel.owners.clear();
|
| | | Iterator<String> owners = ownersPalette.getSelectedChoices();
|
| | | Iterator<UserChoice> owners = ownersPalette.getSelectedChoices();
|
| | | while (owners.hasNext()) {
|
| | | repositoryModel.addOwner(owners.next());
|
| | | repositoryModel.addOwner(owners.next().getUserId());
|
| | | }
|
| | |
|
| | | // pre-receive scripts
|
| | |
| | | form.add(new DropDownChoice<String>("HEAD", availableRefs).setEnabled(availableRefs.size() > 0));
|
| | |
|
| | | boolean gcEnabled = app().settings().getBoolean(Keys.git.enableGarbageCollection, false);
|
| | | int defaultGcPeriod = app().settings().getInteger(Keys.git.defaultGarbageCollectionPeriod, 7);
|
| | | if (repositoryModel.gcPeriod == 0) {
|
| | | repositoryModel.gcPeriod = defaultGcPeriod;
|
| | | }
|
| | | List<Integer> gcPeriods = Arrays.asList(1, 2, 3, 4, 5, 7, 10, 14 );
|
| | | form.add(new DropDownChoice<Integer>("gcPeriod", gcPeriods, new GCPeriodRenderer()).setEnabled(gcEnabled));
|
| | | form.add(new TextField<String>("gcThreshold").setEnabled(gcEnabled));
|