default: dso = null;
}
// DIVISION: edit-container-policies
Division main = body.addInteractiveDivision("edit-policy",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization");
if (policyID >= 0) {
objectID = policy.getResourceID();
objectType = policy.getResourceType();
main.setHead(T_main_head_edit.parameterize(policyID,Constants.typeText[objectType],objectID));
}
else
main.setHead(T_main_head_new.parameterize(Constants.typeText[objectType],objectID));
int resourceRelevance = 1 << objectType;
// DIVISION: authorization-actions
Division actions = main.addDivision("edit-policy-actions");
List actionsList = actions.addList("actions","form");
// actions radio buttons
actionsList.addLabel(T_label_action);
Item actionSelectItem = actionsList.addItem();
Radio actionSelect = actionSelectItem.addRadio("action_id");
actionSelect.setLabel(T_label_action);
//Select actionSelect = actionSelectItem.addSelect("action_id");
//actionsBox.addContent(T_label_action);
//Select actionSelect = actionsBox.addSelect("action_id");
for( int i = 0; i < Constants.actionText.length; i++ )
{
// only display if action i is relevant
// to resource type resourceRelevance
if( (Constants.actionTypeRelevance[i] & resourceRelevance) > 0)
{
if (actionID == i)
actionSelect.addOption(true, i, Constants.actionText[i]);
else
actionSelect.addOption(i, Constants.actionText[i]);
}
}
if (errors.contains("action_id"))
actionSelect.addError(T_error_no_action);
// currently set group
actionsList.addLabel(T_policy_currentGroup);
Select groupSelect = actionsList.addItem().addSelect("group_id");
groupSelect.setSize(5);
for (Group group : Group.findAll(context, Group.NAME))
{
if (group == currentGroup)
groupSelect.addOption(true, group.getID(), group.getName());
else
groupSelect.addOption(group.getID(), group.getName());
}
if (errors.contains("group_id"))
groupSelect.addError(T_error_no_group);
// the search function
actionsList.addLabel(T_label_search);
Item searchItem = actionsList.addItem();
Text searchText = searchItem.addText("query");
if (!query.equals(new String("-1")))
searchText.setValue(query);
searchItem.addButton("submit_search_groups").setValue(T_submit_search_groups);
actionsList.addLabel();
Item buttons = actionsList.addItem();
buttons.addButton("submit_save").setValue(T_submit_save);
buttons.addButton("submit_cancel").setValue(T_submit_cancel);
// Display the search results table
if (!query.equals(new String("-1"))) {
Division groupsList = main.addDivision("edit-policy-groupsList");
groupsList.setHead(T_groups_head);
this.addGroupSearch(groupsList, currentGroup, dso, query, page);
}
main.addHidden("administrative-continue").setValue(knot.getId());
}