6 require_once 'plc_login.php';
8 // Get session and API handles
9 require_once 'plc_session.php';
13 require_once 'plc_drupal.php';
14 include 'plc_header.php';
17 require_once 'plc_functions.php';
18 require_once 'linetabs.php';
19 require_once 'table.php';
20 require_once 'form.php';
22 // --------------------
23 // recognized URL arguments
24 $pattern=$_GET['pattern'];
30 $tabs []= tab_nodes_local();
31 $tabs []= tab_slices();
33 // --------------------
34 drupal_set_title($title);
35 plekit_linetabs($tabs);
37 $tag_type_columns = array( "tag_type_id", "tagname", "category", "description", "min_role_id" );
39 $tag_type_filter=NULL;
41 $tag_type_filter['category']=$pattern;
44 $tag_types= $api->GetTagTypes($tag_type_filter, $tag_type_columns);
48 $headers['Name']="string";
49 $headers['Description']="string";
50 $headers['Category']="string";
51 $headers['Min role']="string";
52 // xxx ref count would be helpful
53 //if (plc_is_admin()) $headers['#']='int';
55 if (plc_is_admin()) $headers[plc_delete_icon()]="none";
57 $form=new PlekitForm(l_actions(),NULL);
60 $table = new PlekitTable("tags",$headers,0);
63 $roles_hash=plc_role_global_hash($api);
65 $description_width=40;
67 foreach( $tag_types as $tag_type ) {
68 $role_name=$roles_hash[$tag_type['min_role_id']];
71 $tag_type_id=$tag_type['tag_type_id'];
72 $table->cell(href(l_tag($tag_type_id),$tag_type['tagname']));
73 $table->cell(wordwrap($tag_type['description'],$description_width,"<br/>"));
74 $table->cell($tag_type['category']);
75 $table->cell($role_name);
77 // if (plc_is_admin()) $table->cell('xxx');
78 $table->cell($tag_type_id);
80 $table->cell ($form->checkbox_html('tag_type_ids[]',$tag_type_id));
85 $table->tfoot_start();
88 $table->cell($form->submit_html ("delete-tag-types","Remove tags"),
89 $table->columns(),"right");
92 // an inline area to add a tag type
95 // build the role selector
96 $relevant_roles = $api->GetRoles( array("~role_id"=>$role_ids));
97 function selector_argument ($role) { return array('display'=>$role['name'],"value"=>$role['role_id']); }
98 $selectors=array_map("selector_argument",$relevant_roles);
99 $role_input=$form->select_html("min_role_id",$selectors,array('label'=>"Role"));
101 $table->cell($form->text_html('tagname',''));
102 $table->cell($form->textarea_html('description','',$description_width,2));
103 $table->cell($form->text_html('category',''));
104 $table->cell($role_input);
105 $table->cell($form->submit_html("add-tag-type","Add Type"),2);
112 //plekit_linetabs ($tabs,"bottom");
115 include 'plc_footer.php';