}
);
say $out "`OpacCatalogConcerns` preference added";
+
+ if ( ( $dbh->selectrow_array('SELECT COUNT(*) FROM additional_contents WHERE location=?', undef, 'CatalogConcernHelp') )[0] == 0 ) { # Check to make idempotent
+ $dbh->do(
+ q{
+ INSERT INTO additional_contents ( category, code, location, title, content, lang, published_on, expirationdate, number ) VALUES ('html_customizations', 'CatalogConcernHelp_1', 'CatalogConcernHelp', 'Catalog concern help text', 'Please describe your concern clearly and the library will try to deal with it as quickly as possible', 'default', CAST(NOW() AS date), '2099-01-10', 1 )
+ }
+ );
+ say $out "`CatalogConcernHelp` block added to html_customization";
+ }
+
+ if ( ( $dbh->selectrow_array('SELECT COUNT(*) FROM additional_contents WHERE location=?', undef, 'CatalogConcernTemplate') )[0] == 0 ) { # Check to make idempotent
+ my $cc_template = <<~ 'END_TEMPLATE';
+ **Describe the concern**
+ A clear and concise description of what the concern is.
+
+ **To Reproduce**
+ Steps to reproduce the behavior:
+ 1. Go to '...'
+ 2. Click on '....'
+ 3. Scroll down to '....'
+ 4. See error
+
+ **Expected behavior**
+ A clear and concise description of what you expected to happen.
+ END_TEMPLATE
+
+ $dbh->do(
+ qq{
+ INSERT INTO additional_contents ( category, code, location, title, content, lang, published_on, expirationdate, number ) VALUES ('html_customizations', 'CatalogConcernTemplate_1', 'CatalogConcernTemplate', 'Catalog concern template text', "$cc_template", 'default', CAST(NOW() AS date), '2099-01-10', 1 )
+ }
+ );
+ say $out "`CatalogConcernTemplate` block added to html_customization";
+ }
}
}
published_on: "2007-10-29 05:34:45"
expirationdate: "2099-01-10"
number: 2
+
+ - title: "Catalog concern help text"
+ category: "html_customizations"
+ location: "CatalogConcernHelp"
+ code: "CatalogConcernHelp_1"
+ content:
+ - "Please describe your concern clearly and the library will try to deal with it as quickly as possible"
+ lang: "default"
+ published_on: "2007-10-29 05:25:58"
+ expirationdate: "2099-01-10"
+ number: 1
+
+ - title: "Catalog concern template text"
+ category: "html_customizations"
+ location: "CatalogConcernTemplate"
+ code: "CatalogConcernTemplate_1"
+ content:
+ - "**Describe the concern**"
+ - "A clear and concise description of what the concern is."
+ - ""
+ - "**To Reproduce**"
+ - "Steps to reproduce the behavior:"
+ - "1. Go to '...'"
+ - "2. Click on '....'"
+ - "3. Scroll down to '....'"
+ - "4. See error"
+ - ""
+ - "**Expected behavior**"
+ - "A clear and concise description of what you expected to happen."
+ lang: "default"
+ published_on: "2007-10-29 05:25:58"
+ expirationdate: "2099-01-10"
+ number: 1
[% END %]
[% END %]
[% ELSE %]
- [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo' ] %]
+ [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate' ] %]
[% FOREACH l IN available_options.sort %]
[% IF l == location %]
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
width: 50%;
}
+.help-block {
+ display: block;
+ margin-top: 5px;
+ margin-bottom: 10px;
+ color: #737373;
+}
+
legend {
color: #727272;
font-size: 110%;
+[% USE raw %]
+[% USE AdditionalContents %]
+[% SET CatalogConcernHelp = AdditionalContents.get( location => "CatalogConcernHelp", lang => lang, library => logged_in_user.branchcode || default_branch ) %]
+[% SET CatalogConcernTemplate = AdditionalContents.get( location => "CatalogConcernTemplate", lang => lang, library => logged_in_user.branchcode || default_branch ) %]
<!-- Add concern modal -->
<div class="modal" id="addConcernModal" tabindex="-1" role="dialog" aria-labelledby="addConcernModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
</div>
<div class="form-group">
<label for="concern_body">Please describe your concerns: </label>
- <textarea class="form-control" name="concern_body" id="concern_body" required="required" rows="15"></textarea>
+ <textarea class="form-control" name="concern_body" id="concern_body" aria-describedby="helpBlock" required="required" rows="15"></textarea>
+ [%- IF CatalogConcernHelp && CatalogConcernHelp.content && CatalogConcernHelp.content.count > 0 -%]
+ [%- FOREACH help IN CatalogConcernHelp.content -%]
+ <p id="helpBlock" class="help-block">[%- help.content | $raw -%]</p>
+ [%- END -%]
+ [%- END -%]
+ <div id="concern_template" style="display: none;">
+ [%- IF CatalogConcernTemplate && CatalogConcernTemplate.content && CatalogConcernTemplate.content.count > 0 -%]
+ [%- FOREACH template IN CatalogConcernTemplate.content -%]
+ [%- template.content | $raw -%]
+ [%- END -%]
+ [%- END -%]
+ </div>
</div>
</fieldset>
</div>
}
$('#addConcernModal').on('show.bs.modal', function(e) {
+ // Redirect to login modal if not logged in
if (logged_in_user_id === "") {
$('#modalAuth').append('<input type="hidden" name="return" value="' + window.location.pathname + window.location.search + '&modal=concern" />');
$('#loginModal').modal('show');
return false;
}
+
+ $('#addConfirm').prop('disabled', false);
+ let concern_body = $('#concern_body');
+ if ( concern_body.val() === "" ) {
+ let template = $('#concern_template').text();
+ concern_body.val(template);
+ }
});
$('#addConcernModal').on('click', '#addConfirm', function(e) {