kpac : added content
authorBill Erickson <berick@esilibrary.com>
Fri, 25 May 2012 13:47:02 +0000 (09:47 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 30 Jul 2012 19:05:04 +0000 (15:05 -0400)
Integrate the added content support from tpac and clean up the old added
content stub code.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/templates/kpac/parts/addedcontent.tt2 [new file with mode: 0644]
Open-ILS/src/templates/kpac/record.tt2
Open-ILS/web/css/skin/default/kpac/style.css

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..bcea6c6
--- /dev/null
@@ -0,0 +1,54 @@
+<a name='addedcontent'></a> <!-- for page focus -->
+<div class='item_detail_extras_tabs'>
+[%-
+    # NOTE: enabling all of these types may result in the tabs occupying 
+    # too much horizontal space to fit within the fixed-width box.
+
+    ac_types = {
+        reviews => l('Reviews'),
+        anotes  => l('Author Notes'),
+        toc     => l('Table of Contents'),
+        excerpt => l('Excerpt'),
+        summary => l('Smmary')
+    };
+
+    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.
+
+    all_hidden = 1;
+    FOR type IN ac_types.keys;
+        tab_class = '';
+        SET tab_class = 'ac_tab_selected' IF type == selected_type; 
+        '<!-- status = ' _ type _ ' : ' _ ctx.added_content.$type.status _ '-->';
+        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 %]
+            <a class="[% tab_class %]" id="ac:[% type %]" href="[% mkurl('', {ac => type}) _ '#addedcontent' %]">[% ac_types.$type %]</a>
+        [% END;
+    END %]
+
+    <div class="clear">&nbsp;</div>
+</div>
+
+<div style='width:98%; padding:5px;'> 
+    <div id='ac_content'>
+        [% 
+            IF selected_type; 
+                content = ctx.added_content.$selected_type.content;
+                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 %]
index ba050ce..f937fa2 100755 (executable)
@@ -620,8 +620,7 @@ input[type=text], input[type=password], textarea {
        background:#e3e3e3;\r
 }\r
 \r
-.item_detail_extras_tabs a,\r
-.item_detail_extras_tabs div.selected {\r
+.item_detail_extras_tabs a {\r
        display:block;\r
        float:left;\r
        padding:14px 35px;\r
@@ -631,8 +630,8 @@ input[type=text], input[type=password], textarea {
        margin-right:10px;\r
 }\r
 \r
-.item_detail_extras_tabs a.selected,\r
-.item_detail_extras_tabs div.selected {\r
+.item_detail_extras_tabs a.ac_tab_selected,\r
+.item_detail_extras_tabs div.ac_tab_selected {\r
        background:white;\r
        color:#424242;\r
 }\r
@@ -1019,16 +1018,8 @@ div.hr {
     visibility : hidden;\r
 }\r
 \r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+.hidden {\r
+    visibility : hidden;\r
+    display : none;\r
+}\r
 \r