[cc-commits] [CC SVN] r12193 - in cchost/trunk: ccdataviews cchost_lib cchost_lib/ccextras ccskins/shared ccskins/shared/css ccskins/shared/formats ccskins/shared/layouts ccskins/shared/profiles ccskins/shared/strings

webmaster at creativecommons.org webmaster at creativecommons.org
Wed Apr 15 13:11:19 EDT 2009


Author: fourstones
Date: 2009-04-15 17:11:19 +0000 (Wed, 15 Apr 2009)
New Revision: 12193

Added:
   cchost/trunk/cchost_lib/ccextras/update_v_5_1_paging.inc
   cchost/trunk/ccskins/shared/css/paging.css
   cchost/trunk/ccskins/shared/layouts/paging_basic.php
   cchost/trunk/ccskins/shared/layouts/paging_google.php
   cchost/trunk/ccskins/shared/paging.php
Modified:
   cchost/trunk/ccdataviews/playlist_line.php
   cchost/trunk/cchost_lib/cc-config.php
   cchost/trunk/cchost_lib/cc-includes.php
   cchost/trunk/cchost_lib/cc-login.php
   cchost/trunk/cchost_lib/cc-non-ui.php
   cchost/trunk/cchost_lib/cc-page.php
   cchost/trunk/cchost_lib/cc-skin-admin.php
   cchost/trunk/cchost_lib/cc-template.php
   cchost/trunk/cchost_lib/ccextras/cc-mail.inc
   cchost/trunk/ccskins/shared/formats/ajax_menu.php
   cchost/trunk/ccskins/shared/formats/info.php
   cchost/trunk/ccskins/shared/formats/reccby.tpl
   cchost/trunk/ccskins/shared/playlist_2_audio.tpl
   cchost/trunk/ccskins/shared/profiles/profile_blog.php
   cchost/trunk/ccskins/shared/profiles/profile_blog_music.php
   cchost/trunk/ccskins/shared/profiles/profile_bottomgoodies.php
   cchost/trunk/ccskins/shared/profiles/profile_cc.php
   cchost/trunk/ccskins/shared/profiles/profile_ccMixter.php
   cchost/trunk/ccskins/shared/profiles/profile_cc_image.php
   cchost/trunk/ccskins/shared/profiles/profile_cchost.php
   cchost/trunk/ccskins/shared/skin.php
   cchost/trunk/ccskins/shared/strings/all_media.php
   cchost/trunk/ccskins/shared/tags.php
Log:
admin: new installs now default to CC skin (not plain)
bugfix: fixed a bunch of leaking 'str_' values
feature: google style paging
admin: paging style now admin choice in admin/skins/settings

Modified: cchost/trunk/ccdataviews/playlist_line.php
===================================================================
--- cchost/trunk/ccdataviews/playlist_line.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccdataviews/playlist_line.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -18,7 +18,7 @@
     upload_id, upload_name, {$user_sql}, user_name, 
     CONCAT( '$urlf', user_name, '/', upload_id ) as file_page_url,
     upload_num_playlists,
-    CONCAT( '{$ccp}', user_name, '/playlists' ) as artist_page_url,
+    CONCAT( '{$ccp}', user_name ) as artist_page_url,
     CONCAT('{$browse_ref_url}', upload_id ) as playlist_browse_url,
     CONCAT( '$urll', license_logo ) as license_logo_url, license_url, license_name,
     upload_contest
@@ -42,4 +42,4 @@
                                 )
                 );
 }
-?>
\ No newline at end of file
+?>

Modified: cchost/trunk/cchost_lib/cc-config.php
===================================================================
--- cchost/trunk/cchost_lib/cc-config.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-config.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -241,7 +241,7 @@
         {
             // old install? hack through this for now...
             require_once('cchost_lib/cc-skin-admin.php');
-            CCSkinAdmin::_load_profile('ccskins/shared/profiles/profile_cchost.php');
+            CCSkinAdmin::_load_profile('ccskins/shared/profiles/profile_cc.php');
         }
         $settings = $configs->GetConfig('settings');
         $CC_GLOBALS = array_merge($CC_GLOBALS,$settings,$skin_settings);

Modified: cchost/trunk/cchost_lib/cc-includes.php
===================================================================
--- cchost/trunk/cchost_lib/cc-includes.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-includes.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -25,7 +25,6 @@
 require_once( 'cchost_lib/cc-user.php' );
 require_once( 'cchost_lib/cc-upload-table.php' );
 require_once( 'cchost_lib/cc-file-props.php' );
-require_once( 'cchost_lib/cc-dataview.php' );
 require_once( 'cchost_lib/cc-if-modified.php' );
 
 ?>

Modified: cchost/trunk/cchost_lib/cc-login.php
===================================================================
--- cchost/trunk/cchost_lib/cc-login.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-login.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -241,7 +241,7 @@
                                'flags'      => CCFF_REQUIRED ),
 
                     '_new_user' =>
-                       array( 'label'       => 'str_new_user',
+                       array( 'label'       => 'str_login_new_user',
                                'formatter'  => 'statictext',
                                'value'      => '<a href="' . ccl('register') . '">' . _('Click Here') . '</a>',
                                'flags'      => CCFF_NOUPDATE  | CCFF_STATIC),

Modified: cchost/trunk/cchost_lib/cc-non-ui.php
===================================================================
--- cchost/trunk/cchost_lib/cc-non-ui.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-non-ui.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -29,6 +29,7 @@
 require_once( 'cchost_lib/cc-table.php' );
 require_once( 'cchost_lib/cc-config.php' );
 require_once( 'cchost_lib/cc-url.php' );
+require_once( 'cchost_lib/cc-dataview.php' );
 
 
-?>
\ No newline at end of file
+?>

Modified: cchost/trunk/cchost_lib/cc-page.php
===================================================================
--- cchost/trunk/cchost_lib/cc-page.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-page.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -814,6 +814,10 @@
             $all_row_count = $table_or_dataview->CountRows($sql_where);
             $table_or_dataview->SetOffsetAndLimit($offset,$limit);
         }
+
+        $args['limit'] = $limit;                     // 3
+        $args['all_row_count'] = $all_row_count;     // 8
+        
         if( $limit < $all_row_count )
         {
             $current_url = cc_current_url(); // ccl(CCEvents::_current_action());
@@ -828,32 +832,48 @@
                 }
             }
 
-            if( $offset )
+            $args['paging'] = 1;
+            $args['current_url'] = $current_url;
+            $args['num_pages'] =  intval($all_row_count / $limit);  // 2
+            if( ($all_row_count % $limit) > 0 )
+              ++$args['num_pages'];                                 // 3
+
+            if( $offset )                                           // 6
             {
-               $prev_offs = 'offset=' . ($offset - $limit);
-               $url = url_args( $current_url, $prev_offs );
-               $back_text = '<<< ' . _('Back');
-               CCPage::PageArg('back_text',$back_text);
-               CCPage::PageArg('prev_link',$url);
-               $args['prev_link'] = $url;
-               $args['back_text'] = $back_text;
-               $args['prev_offs'] = $prev_offs;
-
+               $prev_num = $offset - $limit;                        // 3
+               if( $prev_num < 0 )
+                 $prev_num = 0;
+               $args['prev_link'] = url_args( $current_url, 'offset=' . $prev_num );
+               $args['prev_offs'] = $prev_num;
+               $args['current_page'] = intval( $offset / $limit );  // 2
             }
-            if( $offset + $limit < $all_row_count )
+            else
             {
-               $next_offs = 'offset=' . ($offset + $limit);
-               $url = url_args( $current_url, $next_offs );
-               $more_text = _('More') . ' >>>';
-               CCPage::PageArg('more_text',$more_text);
-               CCPage::PageArg('next_link',$url);
-               $args['next_link'] = $url;
-               $args['more_text'] = $more_text;
+               $args['current_page'] = 0;
+            }
+            
+            if( $offset + $limit < $all_row_count )                 // (6 + 3) < 8
+            {
+               $next_offs = $offset + $limit;
+               $args['next_link'] = url_args( $current_url, 'offset=' . $next_offs );
                $args['next_offs'] = $next_offs;
             }
-
         }
+        else
+        {
+            $args['paging'] = 0;
+        }
+        
+       CCPage::PageArg('paging_stats',$args);
 
+       // this is all deprecated since 5.1
+       CCPage::PageArg('more_text', _('More') . ' >>>');
+       CCPage::PageArg('back_text','<<< ' . _('Back'));
+       if( !empty($args['prev_link']) )
+          CCPage::PageArg('prev_link',$args['prev_link']);
+       if( !empty($args['next_link']) )
+          CCPage::PageArg('next_link',$args['next_link']);
+
         return $args;
     }
 }

Modified: cchost/trunk/cchost_lib/cc-skin-admin.php
===================================================================
--- cchost/trunk/cchost_lib/cc-skin-admin.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-skin-admin.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -126,11 +126,14 @@
         $this->CCEditConfigForm('skin-settings');
 
         require_once('cchost_lib/cc-template.inc');
-        $ffiles = CCTemplateAdmin::GetMultipleTypes( array( 'skin', 'list', 'page', 'head', 'string_profile' ) );
+        $ffiles = CCTemplateAdmin::GetMultipleTypes( array( 'skin', 'list', 'page', 
+                                                            'head', 'string_profile',
+                                                            'paging_style' ) );
         $skins             = $ffiles['skin'];
         $list_format_files = $ffiles['list'];
         $page_format_files = $ffiles['page'];
         $heads             = $ffiles['head'];
+        $paging_styles     = $ffiles['paging_style'];
         $str_profiles      = $ffiles['string_profile'];
 
         $fields['string_profile'] =
@@ -159,6 +162,13 @@
                    'class'       => 'cc_form_input_short',
                    'formatter'   => 'textedit',
                    'flags'       => CCFF_POPULATE | CCFF_REQUIRED);
+        $fields['paging_style'] =
+            array( 'label'       => _('Paging Style'),
+                   'form_tip'    => _('Select the default paging buttons ("prev"/"next")'),
+                   'formatter'   => 'select',
+                   'options'     => $paging_styles,
+                   'flags'       => CCFF_POPULATE );
+
         $fields['head-type'] =
             array( 'label'       => _('Optimized HEAD'),
                    'form_tip'    => _('Combine scripts and styles in common files'),
@@ -409,6 +419,9 @@
         $props = $fp->GetFileProps($skin_profile);
         unset($props['type']);
         unset($props['desc']);
+        if( empty($props['paging_style']) ) // added in 5.1
+            $props['paging_style'] = 'ccskins/shared/layouts/paging_basic.php';
+
         $props['skin_profile'] = $skin_profile;
         $config =& CCConfigs::GetTable();
         /* wtf was this about??
@@ -547,6 +560,7 @@
     font_scheme       = ccskins/shared/colors/font_arial.php
     font_size         = ccskins/shared/colors/fontsize_sz_small.php
     color_scheme      = ccskins/shared/colors/color_mono.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>
 EOF;
@@ -648,4 +662,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>

Modified: cchost/trunk/cchost_lib/cc-template.php
===================================================================
--- cchost/trunk/cchost_lib/cc-template.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/cc-template.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -62,7 +62,7 @@
 
         // this seems like (memory) overkill, need to optimize
         $this->vars = array_merge($CC_GLOBALS,$this->vars,$site_logo);
-
+        
         // for compat with pre 5.0.beta.2 
         if( empty($this->vars['head-type']) )
             $this->vars['head-type'] = 'ccskins/shared/head.tpl';
@@ -197,16 +197,22 @@
     function AddCustomizations()
     {
         $T =& $this;
-        $A =& $this->vars;
-        foreach( array( 'page_layout', 'color_scheme', 'font_scheme', 'font_size', 'tab_pos', 'box_shape', ) as $inc )
+        $V =& $this->vars;
+        $A = array();
+        $keys = array( 'paging_style', 'page_layout', 'color_scheme', 'font_scheme', 'font_size', 
+                                'tab_pos', 'box_shape',  ) ;
+        foreach( $keys as $inc )
         {
             if( !empty($_REQUEST[$inc]) )
-                $A[$inc] = $_REQUEST[$inc];
-            if( !empty($A[$inc]) && file_exists($A[$inc]))
+                $V[$inc] = $_REQUEST[$inc];
+
+            if( !empty($V[$inc]) && file_exists($V[$inc]))
             {
-                require_once($A[$inc]);
+                require_once($V[$inc]);
             }
         }
+        $V = array_merge($V,$A);
+        return $A;
     }
 
     function _d($t)
@@ -223,10 +229,19 @@
         if( empty($files) && $auto_create )
         {
             $base .= date('YmdHis');
-            return array( $base . '.css', $base . '.js' );
+            return array( 'css' => $base . '.css', 
+                          'inc' => $base . '.inc', 
+                          'js'  => $base . '.js',  );
         }
 
-        return $files;
+        $name = array();
+        foreach( $files as $f )
+        {
+            preg_match( '/\.([a-z]+)$/',$f,$m);
+            $name[$m[1]] = $f;
+        }
+        
+        return $name;
     }
 
     /**
@@ -250,14 +265,18 @@
     function CachedHead()
     {
         // this returns valid file names even if they don't exist
-        list( $css_file, $script_file ) = $this->_get_head_files();
+        $fnames = $this->_get_head_files();
+        $css_file = $fnames['css'];
+        $script_file = $fnames['js'];
+        $inc_file = $fnames['inc'];
 
-        if( !file_exists($script_file) )
+        if( !file_exists($inc_file) )
         {
             // there are no cached files so we create them
 
             $f_js  = fopen($script_file,'w');
             $f_css = fopen($css_file,   'w');
+            $f_inc = fopen($inc_file,   'w');
 
             // we're going to suck in all the CSS files 
 
@@ -277,16 +296,22 @@
             }
 
             // There is already a list of js files in this->var['script_links'] and they
-            // will be written to the cache first, but the customizations are freewheeling
+            // will be written to the cache first, but the customizations are PHP that
+            // generates JS and CSS as well as assigns PHP variables.
             // so we will parse those first and add any links we find links or blocks in
             // the generated HTML
 
             ob_start();
-            $this->AddCustomizations();
+            $cache_settings = $this->AddCustomizations();
             $text = ob_get_contents();
             ob_end_clean();
 
+            // We'll need to load these every session as PHP
+            if( !empty($cache_settings['end_script_text']) )
+                unset($cache_settings['end_script_text']);
+            fwrite($f_inc,serialize($cache_settings));
 
+            // now parse out the css/script blocks and links
             require_once('cchost_lib/htmlparser/htmlparser.inc');
             $parser = new HtmlParser($text);
             $tag = null;
@@ -416,17 +441,27 @@
                 $this->_write_js($f_js,$text);
             }
 
-            if( !empty($this->vars['script_blocks']) ) foreach( $this->vars['script_blocks'] as $FL ) {
+            if( !empty($this->vars['script_blocks']) ) 
+                foreach( $this->vars['script_blocks'] as $FL ) {
                     $this->_write_js($f_js,$FL);
-            }
+                }
 
             fclose($f_js);
             fclose($f_css);
+            fclose($f_inc);
         }
 
         print "\n" . '<script type="text/javascript" src="' . ccd($script_file) . '"></script>';
         print "\n" . '<link rel="stylesheet"  type="text/css" title="Default Style" href="' . ccd($css_file) . '" />';
 
+        $opts = unserialize(file_get_contents($inc_file));
+        global $CC_GLOBALS;
+        foreach( $opts as $K => $V )
+        {
+            $CC_GLOBALS[$K] = $V; // for future instantiated templates
+            $this->vars[$K] = $V; // for this one
+        }
+
         $this->vars['end_script_text'][] = "if( typeof(_cc_post_page_load) == 'function' ) { _cc_post_page_load(); }";
 
     }

Modified: cchost/trunk/cchost_lib/ccextras/cc-mail.inc
===================================================================
--- cchost/trunk/cchost_lib/ccextras/cc-mail.inc	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/cchost_lib/ccextras/cc-mail.inc	2009-04-15 17:11:19 UTC (rev 12193)
@@ -221,6 +221,7 @@
 
         if( empty($this->_from) && empty($CC_GLOBALS['mail_sender']) )
         {
+            print 'failed';
             $this->_confim_install();
             return;
         }
@@ -264,9 +265,11 @@
         
         $add_params = empty($GLOBALS['mail_add_params']) ? '' : $GLOBALS['mail_add_params'];
 
+        if( function_exists('cc_mailer_func') )
+            return @cc_mailer_func( $to, $subject, $message, $headers, $add_params );
+        
         return @mail( $to, $subject, $message, $headers, $add_params );
 
-        //return 1;
     }
 } 
 

Added: cchost/trunk/cchost_lib/ccextras/update_v_5_1_paging.inc
===================================================================
--- cchost/trunk/cchost_lib/ccextras/update_v_5_1_paging.inc	                        (rev 0)
+++ cchost/trunk/cchost_lib/ccextras/update_v_5_1_paging.inc	2009-04-15 17:11:19 UTC (rev 12193)
@@ -0,0 +1,44 @@
+<?
+/*
+* Creative Commons has made the contents of this file
+* available under a CC-GNU-GPL license:
+*
+* http://creativecommons.org/licenses/GPL/2.0/
+*
+* A copy of the full license can be found as part of this
+* distribution in the file LICENSE.TXT.
+* 
+* You may use the ccHost software in accordance with the
+* terms of that license. You agree that you are solely 
+* responsible for your use of the ccHost software and you
+* represent and warrant to Creative Commons that your use
+* of the ccHost software will comply with the CC-GNU-GPL.
+*
+* $id$
+*
+*/
+
+/**
+* @package cchost
+* @subpackage admin
+*/
+
+if( !defined('IN_CC_HOST') )
+   die('Welcome to CC Host');
+
+/**
+*/
+class v_5_1_paging extends CCUpdate
+{
+    function Update()
+    {
+        global $CC_GLOBALS;
+        $cfg = new CCConfigs();
+        $skin_settings = $cfg->GetConfig('skin-settings');
+        $CC_GLOBALS['paging_style'] = $skin_settings['paging_style'] = 'ccskins/shared/layouts/paging_basic.php';
+        $cfg->SaveConfig( 'skin-settings', $skin_settings,'',false );
+        CCPage::Prompt( sprintf(_('Installed new paging styles') ) );
+    }
+}
+
+?>

Added: cchost/trunk/ccskins/shared/css/paging.css
===================================================================
--- cchost/trunk/ccskins/shared/css/paging.css	                        (rev 0)
+++ cchost/trunk/ccskins/shared/css/paging.css	2009-04-15 17:11:19 UTC (rev 12193)
@@ -0,0 +1,29 @@
+
+#page_buttons, #page_links {
+  margin: 3px; 
+}
+
+#page_buttons td, #page_links td {
+  font-size: 1.05em; 
+}
+
+#page_buttons a, #page_links a {
+  margin: 3px;  
+  padding: 3px;
+  display: block;
+  border: 1px solid black;
+  background-color: #CCC;
+  color: black;
+  text-decoration: none;
+}
+
+#page_buttons a:hover, #page_links a:hover {
+  background-color: #FFF;
+  text-decoration: none;
+}
+
+#page_buttons {
+}
+
+#page_links {
+}

Modified: cchost/trunk/ccskins/shared/formats/ajax_menu.php
===================================================================
--- cchost/trunk/ccskins/shared/formats/ajax_menu.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/formats/ajax_menu.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -76,7 +76,7 @@
 */
 ?>
 <script src="/ccskins/shared/js/prototype.js" /></script>
-
+<!-- template ajax_menu -->
 <?
 if( !empty($A['records']) )
     $R =& $A['records'][0];

Modified: cchost/trunk/ccskins/shared/formats/info.php
===================================================================
--- cchost/trunk/ccskins/shared/formats/info.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/formats/info.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -44,10 +44,13 @@
 [/dataview]
 */
 
+if( empty($A['records'][0]) )
+  die('no record found');
+  
 $R =& $A['records'][0];
 
 ?>
-<!--- INFO DETAIL -->
+<!--- template info  -->
 <div class="info_detail" style="margin:0px;padding:0px;">
 <div  class="info_list" id="_info_<?= $R['upload_id']?>">
 
@@ -153,4 +156,4 @@
     </tr>
 </table>
 </div><!-- info_list -->
-</div><!-- info_detail -->
\ No newline at end of file
+</div><!-- info_detail -->

Modified: cchost/trunk/ccskins/shared/formats/reccby.tpl
===================================================================
--- cchost/trunk/ccskins/shared/formats/reccby.tpl	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/formats/reccby.tpl	2009-04-15 17:11:19 UTC (rev 12193)
@@ -6,7 +6,7 @@
 [/meta]
 */
 ?>
-
+<!-- template reccby.tpl -->
 %loop(records,R)%
 <div  class="trr">
     <div  class="tdc cc_playlist_item" id="_pli_%(#R/upload_id)%">
@@ -27,4 +27,4 @@
     %end_if%
     <div  class="hrc"></div>
 </div>
-%end_loop%
\ No newline at end of file
+%end_loop%

Added: cchost/trunk/ccskins/shared/layouts/paging_basic.php
===================================================================
--- cchost/trunk/ccskins/shared/layouts/paging_basic.php	                        (rev 0)
+++ cchost/trunk/ccskins/shared/layouts/paging_basic.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -0,0 +1,11 @@
+<?
+/*
+[meta]
+    type  = paging_style
+    desc  = _('Basic Prev-More Buttons')
+[/meta]    
+*/
+
+$A['prev_next_links'] = 'paging.php/prev_next_links';
+
+?>

Added: cchost/trunk/ccskins/shared/layouts/paging_google.php
===================================================================
--- cchost/trunk/ccskins/shared/layouts/paging_google.php	                        (rev 0)
+++ cchost/trunk/ccskins/shared/layouts/paging_google.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -0,0 +1,12 @@
+<?
+/*
+[meta]
+    type  = paging_style
+    desc  = _('Google [tm] style paging')
+[/meta]    
+*/
+global $A;
+
+$A['prev_next_links'] = 'paging.php/google_style_paging';
+
+?>

Added: cchost/trunk/ccskins/shared/paging.php
===================================================================
--- cchost/trunk/ccskins/shared/paging.php	                        (rev 0)
+++ cchost/trunk/ccskins/shared/paging.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -0,0 +1,126 @@
+<?
+
+function _t_paging_prev_next_links(&$T,&$A) 
+{
+    if( empty($A['paging_stats']) )
+        return;
+        
+    $stats = $A['paging_stats'];
+    
+    if( empty($stats['paging']) )
+        return;
+        
+    print '<table id="cc_prev_next_links"><tr >';
+
+    if ( !empty($stats['prev_link'])) 
+        print "<td ><a class=\"cc_gen_button\" href=\"{$stats['prev_link']}\"><span >{$T->String('str_prev_link')}</span></a></td>\n";
+
+    print '<td  class="cc_list_list_space">&nbsp</td>';
+
+    if ( !empty($stats['next_link'])) 
+        print "<td ><a class=\"cc_gen_button\" href=\"{$stats['next_link']}\"><span >{$T->String('str_next_link')}</span></a></td>\n";
+
+    print '</tr></table>';
+
+} // END: function prev_next_links
+
+function _t_paging_google_style_paging(&$T,&$A) 
+{
+    if( empty($A['paging_stats']) )
+        return;
+        
+    $stats = $A['paging_stats'];
+    
+    if( empty($stats['paging']) )
+        return;
+    
+    /*
+    [paging] => 1
+    [limit] => 15
+    [all_row_count] => 14360
+    [current_page] => 957
+    [num_pages] => 958
+    [current_url] => http://cchost.org/api/query
+    [prev_link] => http://cchost.org/api/query?offset=0
+    [prev_offs] => offset=0
+    [next_link] => http://cchost.org/api/query?offset=30
+    [next_offs] => offset=30
+     */
+
+    $mod = $stats['all_row_count'] % $stats['limit'];
+    if( !$mod )
+        $mod = $stats['limit'];
+        
+    $url                = url_args($stats['current_url'],'offset=');
+    $first_page         = $url . '0';
+    $last_page          = $url . ($stats['all_row_count'] - $mod);
+    $pagesgroup         = 10;
+    $full_numb_of_pages = $stats['num_pages'];
+    $page               = $stats['current_page'];
+    
+    $pagination = '<link rel="stylesheet" type="text/css" href="' . $T->URL('css/paging.css'). '" />';
+    
+    $pagination .= '<table id="page_buttons"><tr>';
+    
+    if( !empty($stats['prev_link']) ) {
+        $text = $T->String('str_pagination_prev_link');
+        $pagination .= "<td><a href=\"{$stats['prev_link']}\"><span >{$text}</span></a></td> ";
+    }
+    $first = ($stats['limit'] * $page);
+    $last  = $first + $stats['limit'];
+    if( $last > $stats['all_row_count'] )
+        $last = $stats['all_row_count'];
+    
+    $pagination .= '<td>' .$T->String(array('str_pagination_prompt',
+                             number_format($first + 1),
+                             number_format($last),
+                             number_format($stats['all_row_count']))) . '</td>';
+    if ( !empty($stats['next_link'])) {
+        $text2 = $T->String('str_pagination_next_link');
+        $pagination .= " <td><a href=\"{$stats['next_link']}\"><span >{$text2}</span></a></td>";
+    }
+    $pagination .= '</tr></table>';
+    
+    $pagination .= '<table id="page_links"><tr>';
+
+    if( $page ) {
+        $pagination .= "<td><a href=\"$first_page\">{$T->String('str_pagination_first')}</a></td>";
+    }
+    $numpages = $pagesgroup + $page;
+    if ($page > ($pagesgroup / 2)){
+        $pages_to_display = $page - (int)($pagesgroup / 2);
+        $numpages =  $numpages - (int)($pagesgroup / 2);
+    }else{
+        $pages_to_display = 0;
+    }
+    if ($numpages > $full_numb_of_pages){
+        $numpages = $full_numb_of_pages;
+    }
+    if( $pages_to_display > 0 ) {
+        $pagination .= '<td> ... </td>';  
+    }              
+    for ($i=$pages_to_display; $i <$numpages; $i++)
+    {
+        $y = $i+1;
+        if ($i == $page){
+            $pagination .= "<td class=\"selected_page_link\"><b>{$y}</b></td>";
+        }else{
+            $next_link = $url . ($stats['limit'] * $i);
+            $pagination .= "<td><a href=\"{$next_link}\">{$y}</a></td>";
+        }
+    }
+    if( $i < $full_numb_of_pages ) {
+        $pagination .= '<td> ... </td>';     
+    }           
+    if( $page != ($numpages-1) ) {
+        $pagination .= "\n<td><a href=\"{$last_page}\">{$T->String('str_pagination_last')}</a></td>";
+    }
+ 
+    $pagination .= "</td></table>";    
+    
+    print $pagination;
+    
+    
+} // END: function google_style_paging
+
+?>

Modified: cchost/trunk/ccskins/shared/playlist_2_audio.tpl
===================================================================
--- cchost/trunk/ccskins/shared/playlist_2_audio.tpl	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/playlist_2_audio.tpl	2009-04-15 17:11:19 UTC (rev 12193)
@@ -5,7 +5,7 @@
     dataview       = playlist_line
 [/meta]
 %%
-<!-- template playlist_audio -->
+<!-- template playlist_2_audio -->
 %loop(records,R)%
 <div class="trr">
   <div class="tdc cc_playlist_item" id="_pli_%(#R/upload_id)%">
@@ -26,7 +26,7 @@
     </div>
     %end_if%
   %end_if%
-  <div class="tdc" ">
+  <div class="tdc">
     <a href="%(#R/license_url)%" title="%(#R/license_name)%"><img src="%(#R/license_logo_url)%" title="%(#R/license_name)%"/></a>
   </div>
   %if_not_null(#R/fplay_url)%

Modified: cchost/trunk/ccskins/shared/profiles/profile_blog.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_blog.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_blog.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -16,5 +16,6 @@
     font_scheme       = ccskins/shared/colors/font_verdana.php
     font_size         = ccskins/shared/colors/fontsize_px11.php
     color_scheme      = ccskins/shared/colors/color_blue.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/profiles/profile_blog_music.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_blog_music.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_blog_music.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -16,5 +16,6 @@
     font_scheme       = ccskins/shared/colors/font_verdana.php
     font_size         = ccskins/shared/colors/fontsize_px11.php
     color_scheme      = ccskins/shared/colors/color_blue.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/profiles/profile_bottomgoodies.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_bottomgoodies.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_bottomgoodies.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -16,5 +16,6 @@
     color_scheme  = ccskins/shared/colors/color_mono.php
     font_scheme  = ccskins/shared/colors/font_verdana.php
     font_size  = ccskins/shared/colors/fontsize_px11.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/profiles/profile_cc.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_cc.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_cc.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -16,5 +16,6 @@
     font_scheme       = ccskins/shared/colors/font_verdana.php
     font_size         = ccskins/shared/colors/fontsize_px11.php
     color_scheme      = ccskins/shared/colors/color_mono.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/profiles/profile_ccMixter.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_ccMixter.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_ccMixter.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -16,5 +16,6 @@
     font_scheme       = ccskins/shared/colors/font_verdana.php
     font_size         = ccskins/shared/colors/fontsize_px11.php
     color_scheme      = ccskins/shared/colors/color_mono.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/profiles/profile_cc_image.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_cc_image.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_cc_image.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -17,5 +17,6 @@
     font_size         = ccskins/shared/colors/fontsize_px11.php
     color_scheme      = ccskins/shared/colors/color_sky.php
     profile_extras    = ccskins/shared/image_extras.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/profiles/profile_cchost.php
===================================================================
--- cchost/trunk/ccskins/shared/profiles/profile_cchost.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/profiles/profile_cchost.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -16,5 +16,6 @@
     font_scheme       = ccskins/shared/colors/font_arial.php
     font_size         = ccskins/shared/colors/fontsize_sz_med.php
     color_scheme      = ccskins/shared/colors/color_mono.php
+    paging_style      = ccskins/shared/layouts/paging_basic.php
 [/meta]
 */?>

Modified: cchost/trunk/ccskins/shared/skin.php
===================================================================
--- cchost/trunk/ccskins/shared/skin.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/skin.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -13,7 +13,6 @@
 $A['hide_upload_form']   = 'util.php/hide_upload_form';
 $A['popup_background'] = 'popup_background.php';
 $A['print_prompts']      = 'util.php/print_prompts';
-$A['prev_next_links']      = 'util.php/prev_next_links';
 $A['print_bread_crumbs'] = 'util.php/print_bread_crumbs';
 $A['print_client_menu'] = 'util.php/print_client_menu';
 $A['format_sig'] = 'util.php/format_signature';
@@ -67,4 +66,4 @@
 $A['style_sheets'][] = 'css/cc-format.css';
 $A['style_sheets'][] = 'css/form.css';
 
-?>
\ No newline at end of file
+?>

Modified: cchost/trunk/ccskins/shared/strings/all_media.php
===================================================================
--- cchost/trunk/ccskins/shared/strings/all_media.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/strings/all_media.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -341,6 +341,13 @@
 $GLOBALS['str_nsfw_mark_this_upload'] = _('Mark this upload as %s if it contains questionable language.');
 $GLOBALS['str_nsfw_t']                = _('This upload might be %sNot Safe For Work%s');
 $GLOBALS['str_ok']                    = _('ok');
+
+$GLOBALS['str_pagination_next_link']  = _('More') . ' &gt;&gt;&gt';
+$GLOBALS['str_pagination_prev_link']  = '&lt;&lt;&lt; ' . _('Back');
+$GLOBALS['str_pagination_prompt']     = _('Viewing %s through %s of %s');
+$GLOBALS['str_pagination_first']      = _('first page');
+$GLOBALS['str_pagination_last']       = _('last page');
+
 $GLOBALS['str_people']                = _('People');
 $GLOBALS['str_pick_submission_type']  = _('Pick Submission Type');
 

Modified: cchost/trunk/ccskins/shared/tags.php
===================================================================
--- cchost/trunk/ccskins/shared/tags.php	2009-04-15 17:05:26 UTC (rev 12192)
+++ cchost/trunk/ccskins/shared/tags.php	2009-04-15 17:11:19 UTC (rev 12193)
@@ -92,4 +92,4 @@
     d($A);
 }
 
-?>
\ No newline at end of file
+?>




More information about the cc-commits mailing list