| | 1173 | sub dialog_select_author { |
| | 1174 | my $app = shift; |
| | 1175 | |
| | 1176 | my $hasher = sub { |
| | 1177 | my ( $obj, $row ) = @_; |
| | 1178 | $row->{label} = $row->{name}; |
| | 1179 | $row->{description} = $row->{nickname}; |
| | 1180 | }; |
| | 1181 | |
| | 1182 | $app->listing( |
| | 1183 | { |
| | 1184 | type => 'author', |
| | 1185 | terms => { |
| | 1186 | type => MT::Author::AUTHOR(), |
| | 1187 | status => MT::Author::ACTIVE(), |
| | 1188 | }, |
| | 1189 | args => { |
| | 1190 | sort => 'name', |
| | 1191 | join => MT::Permission->join_on( |
| | 1192 | 'author_id', |
| | 1193 | { |
| | 1194 | permissions => "\%'create_post'\%", |
| | 1195 | blog_id => $app->blog->id, |
| | 1196 | }, |
| | 1197 | { 'like' => { 'permissions' => 1 } } |
| | 1198 | ), |
| | 1199 | }, |
| | 1200 | code => $hasher, |
| | 1201 | template => 'dialog/select_users.tmpl', |
| | 1202 | params => { |
| | 1203 | dialog_title => |
| | 1204 | $app->translate("Select a entry author"), |
| | 1205 | items_prompt => |
| | 1206 | $app->translate("Selected author"), |
| | 1207 | search_prompt => $app->translate( |
| | 1208 | "Type a username to filter the choices below."), |
| | 1209 | panel_label => $app->translate("Entry author"), |
| | 1210 | panel_description => $app->translate("Name"), |
| | 1211 | panel_type => 'author', |
| | 1212 | panel_multi => defined $app->param('multi') |
| | 1213 | ? $app->param('multi') |
| | 1214 | : 0, |
| | 1215 | panel_searchable => 1, |
| | 1216 | panel_first => 1, |
| | 1217 | panel_last => 1, |
| | 1218 | list_noncron => 1, |
| | 1219 | idfield => $app->param('idfield'), |
| | 1220 | namefield => $app->param('namefield'), |
| | 1221 | }, |
| | 1222 | } |
| | 1223 | ); |
| | 1224 | } |
| | 1225 | |