kpac: added content integration
authorBill Erickson <berick@esilibrary.com>
Mon, 21 May 2012 16:17:41 +0000 (12:17 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 21 May 2012 16:17:41 +0000 (12:17 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/kpac/parts/addedcontent.tt2 [new file with mode: 0644]
Open-ILS/src/templates/kpac/record.tt2

diff --git a/Open-ILS/src/templates/kpac/parts/addedcontent.tt2 b/Open-ILS/src/templates/kpac/parts/addedcontent.tt2
new file mode 100644 (file)
index 0000000..6103703
--- /dev/null
@@ -0,0 +1,55 @@
+<div class='item_detail_extras_tabs' style='width:98%; padding:5px;'> 
+
+[% 
+    ac_types = {
+        reviews => l('Reviews'),
+        anotes  => l('Author Notes'),
+        toc     => l('Table of Contents'),
+        excerpt => l('Excerpt'),
+        summary => l('Summary')
+    };
+
+    selected_type = CGI.param('ac');
+    
+    # For each type of added content, render the link if it's known to have
+    # content, do not render the link if it's known to not have content.  If 
+    # the content status is unknown, render the link, but hide the link via CSS
+    # if dojo is enabled.  If dojo is not enabled, render and display the link.
+%]
+
+    <div id='ac_tab_wrapper'>
+    [% 
+        all_hidden = 1;
+        FOR type IN ac_types.keys;
+            tab_class = 'ac_tab';
+            SET tab_class = tab_class _ ' ac_tab_selected' IF type == selected_type; 
+            IF ctx.added_content.$type.status != '2'; # no content
+                all_hidden = 0;
+                IF ctx.added_content.$type.status == '3' AND want_dojo; # status unknown
+                    tab_class = tab_class _ ' hidden';
+                END %]
+            <div class="[% tab_class %]" id="ac:[% type %]">
+                <a href="[% mkurl('', {ac => type}) _ '#addedcontent' %]">[% ac_types.$type %]</a>
+            </div>
+            [% END;
+        END;
+    %]
+    </div>
+
+    <div class='clear'></div>
+    <div id='ac_content'>
+        [% 
+            IF selected_type; 
+                content = ctx.added_content.$selected_type.content;
+                '<hr/>';
+                IF content;
+                    content;
+                ELSE;
+                    l('No Content Available');
+                END;
+            END;
+        %]
+    </div>
+</div>
+
+
index ce175dd..f727b4a 100644 (file)
         </div>
     [% END %]
 
-    <!-- TODO -->
-    <div class="item_detail_extras_tabs">
-        <a href="javascript:;">[% l('Reviews') %]</a>
-        <!--
-        <div class="selected">Rate this Item</div>
-        -->
-        <a href="javascript:;">[% l('About the Author') %]</a>
-        <div class="clear">&nbsp;</div>
-    </div>
-    <!--
-    <div class="item_detail_rating">
-        <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center" width="100%"></div>
-    </div>
-    -->
+    [% INCLUDE 'kpac/parts/addedcontent.tt2' %]
 </div>
 
-<!--
-    <div class="item_detail_rating_top">
-        <table cellpadding="0" cellspacing="0" border="0" class="item_avg_rate_table">
-            <tr>
-                <td class="avg_rate">Average Rating</td>
-                <td class="stars"><img alt="rating" src="[% ctx.media_prefix %]/images/kpac/stars.png" /></td>
-                <td class="total_rates">out of 132 reviews</td>
-            </tr>
-        </table>
-        <div class="clear">&nbsp;</div>
-    </div>
-
-<div class="item_detail_rating">
-    <div class="review_box_top">&nbsp;</div>
-    <div class="review_box_body">
-        <div class="input_boxes">
-            <table cellpadding="0" cellspacing="0" border="0">
-                <tr>
-                    <td class="review_name_cell"><input type="text" class="review_name" style="color:#aaa;" value=" Name " onfocus="if(this.value==' Name '){this.value='';this.style.color='#424242';}" onblur="if(this.value==''){this.value=' Name '; this.style.color='#aaa';}" /></td>
-                    <td class="review_email_cell"><input type="text" class="review_email" style="color:#aaa;" value=" Email Address " onfocus="if(this.value==' Email Address '){this.value='';this.style.color='#424242';}" onblur="if(this.value==''){this.value=' Email Address '; this.style.color='#aaa';}" /></td>
-                    <td class="rating_msg_box">Your email address will not<br />be displayed to other users.</td>
-                </tr>
-            </table>
-        </div>
-        <div class="item_detail_rating2">
-            <table cellpadding="0" cellspacing="0" border="0" class="item_avg_rate_table2"><tr>
-                    <td class="rate">Rating</td>
-                    <td class="stars"><img alt="rating" src="[% ctx.media_prefix %]/images/kpac/stars_gray.png" /></td>
-                    <td class="scale">1 = Poor, 5 = Awesome</td>
-                </tr>
-            </table>
-        </div>
-        <div class="review_comment_box"><textarea class="review_comment" style="color:#aaa;" onfocus="if(this.value==' Write the reasons for your rating here. '){this.value='';this.style.color='#424242';}" onblur="if(this.value==''){this.value=' Write the reasons for your rating here. '; this.style.color='#aaa';}"> Write the reasons for your rating here. </textarea></div>
-        <div class="clear">&nbsp;</div>
-    </div>
-    <div class="review_submit_box"><a href="javascript:;"><img alt="submit review" src="[% ctx.media_prefix %]/images/kpac/review_submit_btn.png" /></a></div>
-</div>
-  
-<div class="sub_navigation1">
-    <table cellpadding="0" cellspacing="0" border="0" width="100%">
-        <tr>
-            <td><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/go_back_btn.png" /></a></td>
-            <td width="100%" class="nav_mid_bg"></td>
-            <td class="to_top_btn"><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/to_top_btn.png" /></a></td>
-        </tr>
-    </table>
-</div>
--->
-  
 [% END %]