Bugzilla – Attachment 63588 Details for
Bug 18060
Add onboarding functionality to guide users through setting up labels for the first time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug 18060 - Implemented redirect to label-edit-profile.pl after the user has created a template using the label onboarding tool
Bug-18060---Implemented-redirect-to-label-edit-pro.patch (text/plain), 14.14 KB, created by
Alex Buckley
on 2017-05-21 13:18:06 UTC
(
hide
)
Description:
Bug 18060 - Implemented redirect to label-edit-profile.pl after the user has created a template using the label onboarding tool
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-05-21 13:18:06 UTC
Size:
14.14 KB
patch
obsolete
>From 3945397a2eb8f529c74df75559e44cf1a6d33554 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 17 May 2017 09:57:41 +0000 >Subject: [PATCH] Bug 18060 - Implemented redirect to label-edit-profile.pl > after the user has created a template using the label onboarding tool > >--- > C4/Creators/Profile.pm | 11 +++ > .../prog/en/includes/onboardinginclude1.inc | 15 +--- > .../prog/en/includes/onboardinginclude2.inc | 14 +--- > .../prog/en/includes/onboardinginclude3.inc | 85 +++++++++++++++++++++- > labels/label-edit-layout.pl | 17 ++++- > labels/label-edit-template.pl | 11 ++- > labels/label-home.pl | 26 +++---- > 7 files changed, 135 insertions(+), 44 deletions(-) > >diff --git a/C4/Creators/Profile.pm b/C4/Creators/Profile.pm >index 37512fa..ba82145 100644 >--- a/C4/Creators/Profile.pm >+++ b/C4/Creators/Profile.pm >@@ -90,6 +90,17 @@ sub retrieve { > return $self; > } > >+sub retrieve_all { >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("select count(*) from printers_profile where creator = 'Labels' group by creator"); >+ my $profile = $sth->execute(); >+ if ($profile == '0E0'){ >+ return 0; >+ } else { >+ return $profile; >+ } >+} >+ > sub delete { > my $self = {}; > my %opts = (); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc >index 55324ee..2d33777 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc >@@ -1,15 +1,7 @@ > <style type="text/css"> > #onboardingModal{ >- z-index:1; > background-color:#EDF4F6; >- padding:20px; >- width:70%; >- position:fixed; >- left:auto; >- top:auto; >- right:auto; >- bottom:auto; >-} >+ } > </style> > > [% BLOCK translate_justification_types %] >@@ -88,7 +80,7 @@ > <ol> > <li> > <label for="layout_name">Layout name: </label> >- <input type="text" name="layout_name" id="layout_name" size="20" value="[% layout_name %]" /> >+ <input type="text" name="layout_name" id="layout_name" size="20" value="DEFAULT" /> > </li> > <li> > <label for="barcode_type">Choose barcode type (encoding): </label> >@@ -184,7 +176,7 @@ > </li> > <li> > <label for="font_size">Font size: </label> >- <input type="text" name="font_size" id="font_size" size="2" value="[% font_size |html %]" /> >+ <input type="text" name="font_size" id="font_size" size="2" value="3" /> > </li> > <li> > <label for="oblique_title">Oblique title: </label> >@@ -201,6 +193,7 @@ > <a class="cancel" href="/cgi-bin/koha/labels/label-manage.pl?label_element=layout">Cancel</a> > <input type="hidden" name="op" value="save" /> > <input type="hidden" name="layout_id" value="[% layout_id %]" /> >+ <input type="hidden" name="layoutsubmitted" value=1 /> > </fieldset> > </form> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc >index 08d2bc4..031492e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc >@@ -1,15 +1,7 @@ > <style type="text/css"> > #onboardingModal{ >- z-index:1; > background-color:#EDF4F6; >- padding:20px; >- width:70%; >- position:fixed; >- left:auto; >- top:auto; >- right:auto; >- bottom:auto; >-} >+ } > </style> > <div id="onboardingModal"> > [% IF displayonboarding == "acquisitions" %] >@@ -68,11 +60,11 @@ > </li> > <li> > <label for="template_code">Template code:</label> >- <input type="text" size="30" maxlength="43" name="template_code" id="template_code" value="[% template_code %]" /> >+ <input type="text" size="30" maxlength="43" name="template_code" id="template_code" value="DEFAULT TEMPLATE"/> > </li> > <li> > <label for="template_desc">Template description:</label> >- <textarea cols="30" rows="3" id="template_desc" name="template_desc">[% template_desc %]</textarea> >+ <textarea cols="30" rows="3" id="template_desc" name="template_desc">Default description</textarea> > </li> > <li> > <label for="units">Units:</label> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc >index 954869e..f4d1b5b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc >@@ -13,6 +13,7 @@ > </style> > > <div id="onboardingModal"> >+ [% IF displayonboarding == "label" %] > <h2> Acquisition onboarding wizard</h2> > <p> Fill out this form to create a fund which will be assigned to the budget you just created. <br> > A fund is an accounting value you will use to set up orders</p> >@@ -69,5 +70,87 @@ > <input type="hidden" name="budget_period_id" value="1" /> > </fieldset> > </form> >- >+[% ELSIF displayonboarding == "label" %] >+ <form name="input" action="/cgi-bin/koha/labels/label-edit-profile.pl" method="get"> >+ <fieldset class="rows"><legend>Profile settings</legend> >+ <ol> >+ <li> >+ [% IF ( profile_id ) %] >+ <span class="label">Printer name:</span>[% printer_name %] >+ <input type="hidden" name="printer_name" value="[% printer_name %]" /> >+ [% ELSE %] >+ <label for="printer_name">Printer name:</label><input type="text" size="20" name="printer_name" id="printer_name" /> >+ [% END %] >+ </li> >+ <li> >+ [% IF ( profile_id ) %] >+ <span class="label">Paper bin:</span> [% paper_bin %] >+ <input type="hidden" name="paper_bin" value="[% paper_bin %]" /> >+ [% ELSE %] >+ <label for="paper_bin">Paper bin:</label><input type="text" size="20" name="paper_bin" id="paper_bin" /> >+ [% END %] >+ </li> >+ <li> >+ [% IF ( label_template ) %] >+ <label for="template_name">Template name:</label> [% label_template %] >+ [% ELSE %] >+ <span class="label">Template name:</span> Profile unassigned >+ [% END %] >+ </li> >+ <li> >+ <label for="units">Units: </label> >+ <select id="units" name="units"> >+ [% FOREACH unit IN units %] >+ [% IF ( unit.selected ) %] >+ <option value="[% unit.type %]" selected="selected"> >+ [% ELSE %] >+ <option value="[% unit.type %]"> >+ [% END %] >+ [% SWITCH unit.type %] >+ [% CASE 'POINT' %] >+ PostScript Points >+ [% CASE 'AGATE' %] >+ Adobe Agates >+ [% CASE 'INCH' %] >+ US Inches >+ [% CASE 'MM' %] >+ SI Millimeters >+ [% CASE 'CM' %] >+ SI Centimeters >+ [% END %] >+ </option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="rows"><legend>Offset:</legend> >+ <ol> >+ <li> >+ <label for="offset_horz">Horizontal: </label><input type="text" size="4" name="offset_horz" id="offset_horz" value="[% offset_horz %]" /> >+ </li> >+ <li> >+ <label for="offset_vert">Vertical: </label><input type="text" size="4" name="offset_vert" id="offset_vert" value="[% offset_vert %]" /> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="rows"><legend>Creep:</legend> >+ <ol> >+ <li> >+ <label for="creep_horz">Horizontal: </label><input type="text" size="4" name="creep_horz" id="creep_horz" value="[% creep_horz %]" /> >+ </li> >+ <li> >+ <label for="creep_vert">Vertical: </label><input type="text" size="4" name="creep_vert" id="creep_vert" value="[% creep_vert %]" /> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Save" /> >+ <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=profile" class="cancel">Cancel</a> >+ <input type="hidden" name="op" value="save" /> >+ <input type="hidden" name="profile_id" value="[% profile_id %]" /> >+ </fieldset> >+ </form> >+[% END %] > </div> >+ >diff --git a/labels/label-edit-layout.pl b/labels/label-edit-layout.pl >index f9e9e9d..8ee664c 100755 >--- a/labels/label-edit-layout.pl >+++ b/labels/label-edit-layout.pl >@@ -123,8 +123,20 @@ elsif ($op eq 'save') { > $layout = C4::Labels::Layout->new(@params); > $layout_id = $layout->save(); > } >- print $cgi->redirect("label-manage.pl?label_element=layout" . ($layout_id == -1 ? "&element_id=$layout_id&op=$op&error=1" : '')); >- exit; >+ >+ my $layoutvalue = C4::Creators::Layout->retrieve_all(); >+ my $templatecount = C4::Creators::Template->retrieve_all(); >+ $template->param( layoutvalue => $layoutvalue, >+ templatevalue => $templatecount, >+ ); >+ >+ if ($templatecount == 0) { >+ print $cgi->redirect("/cgi-bin/koha/labels/label-home.pl"); >+ exit; >+ } else { >+ print $cgi->redirect("label-manage.pl?label_element=layout" . ($layout_id == -1 ? "&element_id=$layout_id&op=$op&error=1" : '')); >+ exit; >+ } > } > else { # if we get here, this is a new layout > $layout = C4::Labels::Layout->new(); >@@ -152,4 +164,5 @@ else { # if we get here, this is a new layout > format_string => $layout->get_attr('format_string'), > layout_string => 1, # FIXME: This should not be hard-coded; It should perhaps be yet another syspref... CN > ); >+ > output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/labels/label-edit-template.pl b/labels/label-edit-template.pl >index bcee714..d7d891b 100755 >--- a/labels/label-edit-template.pl >+++ b/labels/label-edit-template.pl >@@ -111,8 +111,15 @@ elsif ($op eq 'save') { > $profile->save(); > } > } >- print $cgi->redirect("label-manage.pl?label_element=template"); >- exit; >+ >+ my $profilevalue = C4::Creators::Profile->retrieve_all(); >+ if ($profilevalue == 0) { >+ print $cgi->redirect("label-edit-profile.pl"); >+ exit; >+ }else{ >+ print $cgi->redirect("/cgi-bin/koha/labels/label-home.pl"); >+ exit; >+ } > } > else { # if we get here, this is a new layout > $label_template = C4::Labels::Template->new(); >diff --git a/labels/label-home.pl b/labels/label-home.pl >index 44dbf0c..4c5645b 100755 >--- a/labels/label-home.pl >+++ b/labels/label-home.pl >@@ -43,18 +43,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-warn my $layoutvalue = C4::Creators::Layout->retrieve_all(); >-warn my $templatecount = C4::Creators::Template->retrieve_all(); >-$template->param( layoutvalue => $layoutvalue, >- templatevalue => $templatecount, >-); >- > my $op = $cgi->param('op') || ''; > my $layout_id = $cgi->param('layout_id') || $cgi->param('element_id') || ''; > my $layout_choice = $cgi->param('layout_choice') || ''; > my $layout = C4::Labels::Layout->new(); > >- > sub _set_selected { > my ($type_list, $object, $data_type) = @_; > SET_SELECTED: >@@ -78,7 +71,6 @@ sub _select_format_string { # generate field table based on format_string > my @text_fields = grep /\w/, split /\s*,\s/, $format_string; > my %tf = map {$_ => 1} @text_fields; > my @missing_fields = grep { !$tf{$_} } @{ C4::Labels::Layout->PRESET_FIELDS }; >-# > my $field_count = scalar(@text_fields) + scalar( @missing_fields); > > my @fields; >@@ -98,22 +90,22 @@ my $label_types = _set_selected(get_label_types(), $layout, 'printing_type'); > my $font_types = _set_selected(get_font_types(), $layout, 'font'); > my $text_justification_types = _set_selected(get_text_justification_types(), $layout, 'text_justify'); > my ($select_text_fields, $select_text_fields_cnt) = _select_format_string($layout->get_attr('format_string')); >+my $units = get_unit_values(); > > $template->param( > barcode_types => $barcode_types, >-# label_types => $label_types, >+ label_types => $label_types, > font_types => $font_types, > text_justification_types => $text_justification_types, > fields => $select_text_fields, > field_count => $select_text_fields_cnt, >-# layout_id => $layout->get_attr('layout_id') > -1 ? $layout->get_attr('layout_id') : '', >-# layout_name => $layout->get_attr('layout_name'), >-# guidebox => $layout->get_attr('guidebox'), >-# oblique_title => $layout->get_attr('oblique_title'), >-# font_size => $layout->get_attr('font_size'), >-# callnum_split => $layout->get_attr('callnum_split'), >-# format_string => $layout->get_attr('format_string'), >-# layout_string => 1, # FIXME: This should not be hard-coded; It should perhaps be yet another syspref... CN >+ units => $units, >+); >+ >+my $layoutvalue = C4::Creators::Layout->retrieve_all(); >+my $templatevalue = C4::Creators::Template->retrieve_all(); >+$template->param( layoutvalue => $layoutvalue, >+ templatevalue => $templatevalue, > ); > > output_html_with_http_headers $cgi, $cookie, $template->output; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 18060
:
63224
|
63225
|
63228
|
63229
|
63587
|
63588
|
63589
|
64733
|
64766
|
64951
|
67663