PageRenderTime 26ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/sites/fwshub/mason/utils/edit_summary.pl

https://github.com/fws-hub/xPapers
Perl | 127 lines | 107 code | 20 blank | 0 comment | 15 complexity | 3cbe0703ad4d348622f23a8d848e7622 MD5 | raw file
  1. <& ../checkLogin.html, %ARGS &>
  2. <%perl>
  3. my $cat = xPapers::Cat->get($ARGS{cId});
  4. error("Category not found") unless $cat;
  5. error("Not allowed") unless $cat->isEditor($user) or $SECURE;
  6. use HTML::TagFilter;
  7. if ($ARGS{submit}) {
  8. my @modified;
  9. my $filter = new HTML::TagFilter;
  10. my $nSummary = $filter->filter($ARGS{summary});
  11. push @modified,"summary" if $nSummary ne $cat->summary;
  12. $cat->summary($nSummary);
  13. my $nIntroductions = $filter->filter($ARGS{introductions});
  14. push @modified,"introductions" if $cat->introductions ne $nIntroductions;
  15. $cat->introductions($nIntroductions);
  16. my $nKey = $filter->filter($ARGS{keyWorks});
  17. push @modified,"key works" if $nKey ne $cat->keyWorks;
  18. $cat->keyWorks($nKey);
  19. $cat->save(modified_only=>1);
  20. $cat->summaryUpdated(DateTime->now);
  21. $cat->summaryChecked(0 and $SECURE);
  22. $cat->save(modified_only=>1);
  23. $ARGS{_mmsg} = "Category updated";
  24. $ARGS{noheader} = 0;
  25. unless (1 or $SECURE) {
  26. xPapers::Mail::MessageMng->notifyAdmin("Category summary updated:",$user->fullname . " modified " . join(",",@modified) . " for $cat->{name}. See $s->{server}/browse/$cat->{uName}");
  27. }
  28. }
  29. my $alsoBib;
  30. if ($cat->seeAlso) {
  31. $alsoBib = $cat->also;
  32. } else {
  33. $alsoBib = xPapers::Cat->new(system=>1,name=>"$cat->{name} -- See also",publish=>0)->save;
  34. $cat->seeAlso($alsoBib->id);
  35. $cat->save;
  36. }
  37. if ($ARGS{addSeeAlso}) {
  38. my $ref = xPapers::Cat->get($ARGS{addSeeAlso});
  39. $alsoBib->add_child($ref);
  40. } elsif ($ARGS{deleteSeeAlso}) {
  41. my $ref = xPapers::Cat->get($ARGS{deleteSeeAlso});
  42. $alsoBib->remove_child($ref);
  43. }
  44. </%perl>
  45. <& ../header.html, subtitle=>"Category summary for $cat->{name}",%ARGS &>
  46. <% gh("Summary, key works and see-also for <a href='/browse/$cat->{uName}/'>$cat->{name}</a>") %>
  47. <form method="POST" action="/utils/edit_summary.pl">
  48. <input type="hidden" name="cId" value="<%$ARGS{cId}%>">
  49. <input type="hidden" name="submit" value="ok">
  50. <div class="miniheader" style="border-top:1px solid black;height:20px">
  51. <h3>See also references</h3>
  52. </div>
  53. Please indicate related categories which are not sub-categories or sibling categories of this category.
  54. <& ../checkLogin.html, %ARGS &>
  55. <%perl>
  56. print "<ul>";
  57. for my $ref ($alsoBib->children) {
  58. print "<li>";
  59. print $ref->name;
  60. print " (<a href='?cId=$cat->{id}&amp;deleteSeeAlso=$ref->{id}'>remove</a>)";
  61. print "</li>";
  62. }
  63. print "<li>There are currently no see-also references for this category</li>" unless $alsoBib->catCount;
  64. print "</ul>";
  65. </%perl>
  66. Add to see-also categories:
  67. <& ../bits/cat_picker.html, field=>"addSeeAlso" &>
  68. <input type="submit" value="Add">
  69. <p>
  70. <div class="miniheader" style="border-top:1px solid black;height:20px">
  71. <h3>Summary texts</h3>
  72. </div>
  73. On most category pages, we aim to have a one paragraph summary of the category, followed by key works and introductions. The idea is to give non-expert readers an idea of the main issues and pointers about where to go next. For a few categories, such as "Misc" categories, a summary may be unnecessary.
  74. <p>
  75. Please see <a href="http://philpapers.org/browse/zombies-and-the-conceivability-argument">this page</a> as an example.
  76. You should aim to use roughly the space of the provided boxes.
  77. <p>
  78. <h3>How to cite works (important)</h3>
  79. Please use one of the following methods when referring to a book or article:
  80. <ol>
  81. <li>Write the lastname of the author followed by a code of this form: e#[ID], where [ID] is replaced by the internal identifier of the work (which you can insert using the "Cite" button in the editor). For example: <blockquote><code>Chalmers (e#CHATCM)</code></blockquote> will appear like this to the user:<blockquote>Chalmers (<a href="/rec/CHATCM">1996</a>)</blockquote>The link will take the user to the work's record page. The parentheses are optional. </li>
  82. <li>In case where a link on the work's date is not appropriate, create links using this notation:<blockquote><code>[e#CHATCM:linked text]</code></blockquote>The generated link will look as follows:<blockquote><a href="/rec/CHATCM/">linked text</a></blockquote></li></blockquote>
  83. </ol>
  84. Please add any missing works you'd like to cite to PhilPapers using the "Submit material" -> "Submit a book or article" menu option at the top of the screen. Please do not use full citations in summary texts.
  85. <p>
  86. <b>Make sure to check out the result <a href="/browse/<%$cat->uName%>" target="_blank">here</a> after saving.</b>
  87. <p>
  88. <h3>Summary</h3>
  89. State the main issues covered by the category in a paragraph. Please do not include citations here if possible.
  90. <p>
  91. <textarea id="editor1" name="summary"><%$cat->summary%></textarea>
  92. <& ../bits/rich_editor.html, id=>1,height=>150,width=>500 &>
  93. <p>
  94. <h3>Key works</h3>
  95. Indicate 1-10 key works on this topic and their relationships and roles, within context of English prose, in a paragraph. Please use the citation method described above for each work referred to.
  96. <p>
  97. <textarea id="editor3" name="keyWorks"><%$cat->keyWorks%></textarea>
  98. <& ../bits/rich_editor.html, id=>3,height=>150,width=>500 &>
  99. <h3>Introductions</h3>
  100. Indicate 1-5 recommended introductory articles. This can be either in the form of a list or in the context of English prose (in either case, using the citation method described above).
  101. <p>
  102. <textarea id="editor2" name="introductions"><%$cat->introductions%></textarea>
  103. <& ../bits/rich_editor.html, id=>2,height=>150,width=>500 &>
  104. <p>
  105. <input type="submit" value="Save" name="submit">
  106. </form>
  107. %$m->comp("../footer.html",%ARGS) if exists $ARGS{noheader}