From: <mv...@tr...> - 2004-12-09 19:01:07
|
Log Message: ----------- added code for deploy_selected on template find page Modified Files: -------------- krang/conf: messages.conf krang/templates/Template: list_view.tmpl krang/lib/Krang/CGI: Template.pm Revision Data ------------- Index: messages.conf =================================================================== RCS file: /usr/local/krang-cvs/krang/conf/messages.conf,v retrieving revision 1.102 retrieving revision 1.103 diff -Lconf/messages.conf -Lconf/messages.conf -u -r1.102 -r1.103 --- conf/messages.conf +++ conf/messages.conf @@ -205,6 +205,7 @@ message_saved "Template saved." checkin_template "Saved and Checked In template $id." message_selected_deleted "Checked templates deleted." + message_selected_deployed "Checked templates deployed." deployed "Deployed template $id." selected_template_checkin "The selected templates have been checked in." </Module> Index: list_view.tmpl =================================================================== RCS file: /usr/local/krang-cvs/krang/templates/Template/list_view.tmpl,v retrieving revision 1.10 retrieving revision 1.11 diff -Ltemplates/Template/list_view.tmpl -Ltemplates/Template/list_view.tmpl -u -r1.10 -r1.11 --- templates/Template/list_view.tmpl +++ templates/Template/list_view.tmpl @@ -15,7 +15,7 @@ } function delete_selected () { - if (confirm("Are you SURE you want to delete the checked template?")) { + if (confirm("Are you SURE you want to delete the checked templates?")) { var myform = document.krang_pager_form; myform.rm.value = 'delete_selected'; myform.submit(); @@ -39,6 +39,14 @@ myform.submit(); } + function do_deploy () { + if (confirm("Are you SURE you want to deploy the checked templates?")) { + var myform = document.krang_pager_form; + myform.rm.value = 'deploy_selected'; + myform.submit(); + } + } + </script> Index: Template.pm =================================================================== RCS file: /usr/local/krang-cvs/krang/lib/Krang/CGI/Template.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -Llib/Krang/CGI/Template.pm -Llib/Krang/CGI/Template.pm -u -r1.37 -r1.38 --- lib/Krang/CGI/Template.pm +++ lib/Krang/CGI/Template.pm @@ -72,6 +72,7 @@ delete delete_selected deploy + deploy_selected checkout_and_edit edit edit_cancel @@ -523,6 +524,31 @@ } +=item deploy_selected + +Deploys selected templates from the find interface. + +=cut + +sub deploy_selected { + my $self = shift; + my $q = $self->query; + + my @template_ids = $q->param('krang_pager_rows_checked'); + + return $self->search unless @template_ids; + + for my $t(@template_ids) { + my $template = (Krang::Template->find( template_id => $t ))[0]; + $template->deploy; + } + + add_message('message_selected_deployed'); + + return $self->search; + +} + =item edit |