Commits

Julio Flores-Schwarzbeck  committed 2851619

Continuing working on the project after some time, nothing much to add

  • Participants
  • Parent commits c1bf94a

Comments (0)

Files changed (3)

File controllers/admin.py

 def qa_mgmt_hq():
     questions = db(db.questions.is_visible==False).select(
         db.questions.ALL, orderby=~db.questions.modified_on)
-    return dict(questions=questions)
+    return dict(questions=questions)
+
+@auth_user.requires_role('SysAdmin')
+def qa_mgmt_actions():
+    """ This really should be a "helper" method for a module instead
+    of a controller method, ask Massimo what would be the _preferred_
+    way of doing things here, since this only executes "stuff" and redirects
+    back to the calling page.
+    
+    """
+    # "action", "action_type" and "question" are always provided as "vars"
+    req = request.vars
+    action = req.action
+    action_type = req.action_type
+    question = req.question
+    
+    # Request restore of a hidden question:
+    if action == 'release' and action_type == 'question':
+        # Here basically change the flag of the question, all of the
+        # other question's siblings (comments, answers, and answers
+        # to comments should become visible as well
+        db(db.questions.id==question).update(is_visible=True)
+    redirect(URL(r=request, c='admin', f='qa_mgmt_hq'))

File static/qastack_stylesheet.css

     font-weight:bold;
 }
 
-a.nolink {
+a.nolink:active, a.nolink:link, a.nolink:hover {
     text-decoration:none;
     background-color:transparent;
 }

File views/admin/qa_mgmt_hq.html

 
 <h2 class="fancy">Administrative Messages - Q&amp;A Management - Hidden Questions</h2>
 
+<p><a href="{{=URL(r=request, c='admin', f='qa_mgmt')}}" title="">&lt;&lt; Back</a></p>
+
 {{if questions:}}
     <table cellspacing="0" cellpadding="0" class="ftable">
         <thead>
                         title="">{{=stackhelper.get_member_property('m_display_name', q.created_by, q.created_by)}}</a>
                     </td>
                     <td>
-                        <img src="{{=URL(r=request, c='static/images/small', f='checkmark.png')}}"
+                        <a href="{{=URL(r=request, c='admin', f='qa_mgmt_actions', vars=dict(action='release', action_type='question', question=q.id))}}"
+                           title="Make it publicly available"
+                           onclick="return confirm('This question and any dependencies (answers/comments) will become visible.\n\nPlease Confirm');"
+                           class="nolink"
+                        ><img src="{{=URL(r=request, c='static/images/small', f='checkmark.png')}}"
                             alt="Restore"
-                            style="vertical-align:middle;" />
-                        <img src="{{=URL(r=request, c='static/images/small', f='x.png')}}"
+                            style="vertical-align:middle;" /></a>
+                        <a href="{{=URL(r=request, c='admin', f='qa_mgmt_actions', vars=dict(action='remove', action_type='question', question=q.id))}}"
+                           title="Remove from the system"
+                           onclick="return confirm('This question and any dependancies (answers/comments) will be removed permanently from the system.\n\nPlease Confirm');"
+                           class="nolink"
+                        ><img src="{{=URL(r=request, c='static/images/small', f='x.png')}}"
                             alt="Remove Permanently"
-                            style="vertical-align:middle;" />
+                            style="vertical-align:middle;" /></a>
                     </td>
                 </tr>
             {{pass}}