[cc-commits] [CC SVN] r12576 - in cchost/trunk: cchost_lib/ccextras ccskins/cc5 ccskins/cc5/css ccskins/shared

webmaster at creativecommons.org webmaster at creativecommons.org
Fri May 8 02:59:19 EDT 2009


Author: fourstones
Date: 2009-05-08 06:59:19 +0000 (Fri, 08 May 2009)
New Revision: 12576

Modified:
   cchost/trunk/cchost_lib/ccextras/cc-content-page.inc
   cchost/trunk/ccskins/cc5/body.tpl
   cchost/trunk/ccskins/cc5/css/cc5.css
   cchost/trunk/ccskins/shared/content_manage.tpl
Log:
admin: you can re-title content page without chaning url
admin: 'sticky' content hack
cc5 (snapshot checkin)

Modified: cchost/trunk/cchost_lib/ccextras/cc-content-page.inc
===================================================================
--- cchost/trunk/cchost_lib/ccextras/cc-content-page.inc	2009-05-08 00:33:14 UTC (rev 12575)
+++ cchost/trunk/cchost_lib/ccextras/cc-content-page.inc	2009-05-08 06:59:19 UTC (rev 12576)
@@ -139,7 +139,7 @@
     * Constructor
     *
     */
-    function CCContentPageForm()
+    function CCContentPageForm($old_name=false)
     {
         $this->CCForm();
 
@@ -149,6 +149,17 @@
                                'formatter'   => 'textedit',
                                'flags'       => CCFF_POPULATE | CCFF_REQUIRED );
 
+        if( $old_name )
+        {
+            $old_url = ccl($old_name);
+            $tip = sprintf(_('Check this to keep the URL as %s even if you edit the title above.'),'<b>'.$old_url.'</b>');
+            $fields['keep_name'] = array( 'label' => _('URL Follows Title'),
+                              'form_tip' => $tip,
+                              'formatter' => 'checkbox',
+                              'value' => '',
+                              'flags' => CCFF_NONE );
+        }
+
         $types = CCDatabase::QueryItems('SELECT DISTINCT topic_type FROM cc_tbl_topics');
         $types = array_filter($types);
         $types = empty($types) ? array( 'home' => 'home' ) : array_combine( array_values($types), $types );
@@ -421,15 +432,15 @@
         $props = $fp->GetFileProps($page);
         $props['type'] = $props['topic_type'];
         $props['title'] = $props['desc'];
-
-        $form = new CCContentPageForm();
+        $short_page = str_replace('.php','',basename($page));
+        $form = new CCContentPageForm($short_page);
         if( empty($_POST['contentpage']) )
         {
             $form->PopulateValues($props);                
         }
         elseif( $form->ValidateFields() && $this->_valid_target_dir($form,$target) )
         {
-            $this->_save_page($form,false,$target);
+            $this->_save_page($form,false,$target,$short_page);
             $url = url_args( ccl('admin','content','manage'), 'topic_type=' . $props['type'] );
             CCUtil::SendBrowserTo($url);
         }
@@ -476,12 +487,19 @@
         return true;
     }
 
-    function _save_page(&$form,$new,$target_dir)
+    function _save_page(&$form,$new,$target_dir,$old_name='')
     {
         $form->GetFormValues($values);
-        $fname = trim(preg_replace('/[^0-9a-z_-]+/', '-', strtolower($values['title'])),'-');
-        if( empty($fname) )
-            $fname = 'topicpage';
+        if( empty($values['keep_name']) || empty($old_name) )
+        {
+            $fname = trim(preg_replace('/[^0-9a-z_-]+/', '-', strtolower($values['title'])),'-');
+            if( empty($fname) )
+                $fname = 'topicpage';
+        }
+        else
+        {
+            $fname = $old_name;
+        }
         $path = $target_dir . '/' . $fname . '.php';
         if( $new )
         {
@@ -501,7 +519,7 @@
         ksort($values);
         foreach( $values as $K => $V )
         {
-            if( ($K == 'title') || ($K == 'type') )
+            if( ($K == 'title') || ($K == 'type') || ($K == 'keep_name') )
                 continue;
             $meta .= '      ' . $K . ' = ' . $V . "\n";
         }

Modified: cchost/trunk/ccskins/cc5/body.tpl
===================================================================
--- cchost/trunk/ccskins/cc5/body.tpl	2009-05-08 00:33:14 UTC (rev 12575)
+++ cchost/trunk/ccskins/cc5/body.tpl	2009-05-08 06:59:19 UTC (rev 12576)
@@ -1,122 +1,85 @@
 <body>
+<div id="container">
 %if_not_empty(site-disabled)%
-    <div id="site_disabled_message" style="position:absolute">%text(str_site_disabled)%</div>
+  <div id="site_disabled_message" style="position:absolute">%text(str_site_disabled)%</div>
 %end_if%
 %if_not_empty(beta_message)%
-    <div id="beta_message" style="position:absolute;">%(beta_message)%</div>
+  <div id="beta_message" style="position:absolute;">%(beta_message)%</div>
 %end_if%
 
 <div class="hide">
   <a href="#content">%text(skip)%</a>
 </div>
 
- <div id="globalWrapper">
-   <div id="headerWrapper">
-     <div id="headerLogo">
-       <h1><a href="%(root-url)%" title="%(site-title)%" >
-        %if_not_null(logo/src)% 
+  <div id="globalWrapper">
+    <div id="headerWrapper">
+        <div id="headerLogo">
+            <h1><a href="%(root-url)%" title="%(site-title)%" >
+            %if_not_null(logo/src)% 
             <? $bimg = ccd($A['logo']['src']); ?><img src="%(#bimg)%" style="width:%(logo/w)%px;height:%(logo/h)%px"/> 
-        %else% 
+            %else% 
             <span class="light_color">%(site-title)%</span>
-        %end_if%
-          </a></h1>
-     </div>
-     
-     <div id="headerNav">
-        %if_not_empty(tab_pos/in_header)%
-            %call('tabs.tpl/print_tabs')%
-        %end_if%
-     </div>
-   </div><!-- headerWrapper -->
-   
-   <div id="mainContent" class="ccbox">
-     <!-- toolboxes -->
-%call(print_bread_crumbs)%
+            %end_if%
+            </a></h1>
+        </div><!-- #headerLogo -->
+ 
+        <div id="headerNav">
+            %if_not_empty(tab_pos/in_header)%
+                %call('tabs.tpl/print_tabs')%
+            %end_if%
+        </div><!-- #headerNav -->
+    </div><!-- #headerWrapper -->
 
-%if_not_empty(tab_pos/subclient)%
-     <div id="pageNav">
-    %call('tabs.tpl/print_sub_tabs')% <!-- -->
-     </div>
-%end_if%
-     
+    <div id="wrapper"><div id="content">
+        <div id="tools">
+            <div class="sideitem">
+                <form method="get" id="searchform" action="%(home-url)%search/results">
+                    <div>
+                        <input title="Search" accesskey="f"
+                            value="" name="search_text" id="search_text" class="inactive" type="text">
+                        <input id="searchsubmit" value="Go" type="submit">
+                        <input type="hidden" name="search_in" value="all"></input>
+                    </div>
+                </form>
+                %if_null(logged_in_as)%
+                     <span><a href="%(home-url)%login">Log in / create account</a></span>
+                     %if_not_empty(openid-type)%
+                      <span>(<a href="%(home-url)%login/openid">OpenID</a>)</span>
+                     %end_if%
+                %else%
+                     <span>%text(loggedin)%: <b><span>%(logged_in_as)%</span></b> 
+                        <span><a class="small_button" href="%(home-url)%logout">%text(logout)%</a></span>
+                %end_if%
+            </div><!-- .sideitem -->
+            <div style="margin-right:200px">
+            %call(print_bread_crumbs)%
 
-     <div class="block" id="page_title">
- 	    <div class="sideitem">
-         <form method="get" id="searchform" action="%(home-url)%search/results">
-           <div>
-             <input title="Search" accesskey="f"
-                 value="" name="search_text" id="search_text" class="inactive" type="text">
-                 <input id="searchsubmit" value="Go" type="submit">
-                <input type="hidden" name="search_in" value="all"></input>
-           </div>
-         </form>
-    %if_null(logged_in_as)%
-         <span><a href="%(home-url)%login">Log in / create account</a></span>
-         %if_not_empty(openid-type)%
-          <span>(<a href="%(home-url)%login/openid">OpenID</a>)</span>
-         %end_if%
-    %else%
-         <span>%text(loggedin)%: <b><span>%(logged_in_as)%</span></b> 
-            <span><a class="small_button" href="%(home-url)%logout">%text(logout)%</a></span>
-    %end_if%
-         
-       </div><!-- sideitem -->
-       
-%if_not_empty(page-title)%
-    <h1 class="page_title">%text(page-title)%</h1>
-%end_if%
-    </div><!-- block #title -->
-     
-    <!-- page content -->
-    <div id="contentPrimary">
-	  <div class="block page">
-            		
-<a name="content" ></a>    
-<div id="inner_content">
+            <div id="pageNav">
+                %call('tabs.tpl/print_sub_tabs')% <!-- -->
+            </div><!-- #pageNav -->
+            </div>
+        </div><!-- tools -->
+        <div id="page_title">
+            %if_not_empty(page-title)%
+                <h1 class="page_title">%text(page-title)%</h1>
+            %end_if%
+            <br class="page_title_breaker" />
+        </div><!-- #page_title -->
+<!-- page content -->
+ 
+        <a name="content" ></a>    
+        <div id="inner_content">
 <?
-    if( !empty($A['macro_names'] ) )
-        while( $macro = array_shift($A['macro_names']) )
-            $T->Call($macro);
+            if( !empty($A['macro_names'] ) )
+                while( $macro = array_shift($A['macro_names']) )
+                    $T->Call($macro);
 ?>
-</div><!-- inner_content -->
-%loop(inc_names,inc_name)%   %call(#inc_name)% %end_loop%
-
+        </div><!-- inner_content -->
+        %loop(inc_names,inc_name)%   %call(#inc_name)% %end_loop%
+    </div></div><!-- #content / wrapper -->
 <!-- end content -->
 
-</div><!-- block page -->
-</div><!-- content primary -->
-</div><!-- main content -->
-   
-   <!-- footer -->
-   <div id="footer">
-     <div id="footerContent" class="ccbox">%text(footer)%</div>
-     <div id="footerLicense">
-       <p class="ccbox">
-         %text(site-license)%
-       </p>
-     </div>
-   </div>
-   
- </div><!-- global wrapper -->
-%loop(end_script_links,script_link)%
-    <script type="text/javascript" src="%url(#script_link)%" ></script>
-%end_loop%
-
-%loop(end_script_blocks,block)%
-    %call(#block)%
-%end_loop%
-
-<script type="text/javascript"> 
-    new modalHook( [ 'search_site_link', 'mi_login', 'mi_register']);  
-    $$('.selected_tab a').each( function(e) { e.style.cursor = 'default'; e.href = 'javascript:// disabled'; } );
-%loop(end_script_text,tblock)%
-    %(#tblock)%
-%end_loop%
-   
-</script>
-<div id="menu_block" style="position:absolute">
-    <a href="javascript://main menu" class="small_button" id="menu_expander">Show Menu &gt;&gt;&gt;</a>
-    <div id="menu_hang" class="box" style="display:none">
+    <div id="navigation">
         %loop(menu_groups,group)%
             <div class="menu_group">
                 <p>%text(#group/group_name)%</p>
@@ -125,6 +88,9 @@
                 %end_loop% </ul>
             </div>
         %end_loop%
+    </div>
+
+    <div id="extra">
         %if_null(edit_extra)%
             %settings(extras,custom_macros)%
             %loop(custom_macros/macros,mac)%
@@ -133,39 +99,40 @@
                 </div>
             %end_loop%
         %else%
+            <br style="clear:both" />
+            <br />
+            
             <!-- editing extras -->
             %(edit_extra)%
         %end_if%
-        <br class="menu_hang_breaker" />
     </div>
-</div><!-- menu block -->
-<script>
-var menu_expanded = 0;
-function expand_main_menu()
-{
-    try {
-    if( menu_expanded )
-    {
-        $('menu_expander').innerHTML = 'Show Menu &gt;&gt;&gt;';
-        $('menu_hang').style.display = 'none';
-        menu_expanded = 0;
-    }
-    else
-    {
-        $('menu_expander').innerHTML = 'Hide Menu &lt;&lt;&lt';
-        $('menu_hang').style.display = 'block';
-        menu_expanded = 1;
-    }
-    }
-    catch(e)
-    {
-        alert(e);
-    }
-}
-function hook_main_menu()
-{
-    Event.observe('menu_expander','click',expand_main_menu);
-}
-hook_main_menu();
+   
+   <!-- footer -->
+    <div id="footer">
+        <div id="footerContent" class="ccbox">%text(footer)%</div>
+        <div id="footerLicense">
+            <p class="ccbox">
+             %text(site-license)%
+            </p>
+        </div>
+    </div>
+   
+  </div><!-- global wrapper -->
+
+%loop(end_script_links,script_link)%
+  <script type="text/javascript" src="%url(#script_link)%" ></script>
+%end_loop%
+
+%loop(end_script_blocks,block)%
+  %call(#block)%
+%end_loop%
+
+<script type="text/javascript"> 
+    new modalHook( [ 'search_site_link', 'mi_login', 'mi_register']);  
+    $$('.selected_tab a').each( function(e) { e.style.cursor = 'default'; e.href = 'javascript:// disabled'; } );
+%loop(end_script_text,tblock)%
+    %(#tblock)%
+%end_loop%
 </script>
+</div><!-- #container -->
 </body>

Modified: cchost/trunk/ccskins/cc5/css/cc5.css
===================================================================
--- cchost/trunk/ccskins/cc5/css/cc5.css	2009-05-08 00:33:14 UTC (rev 12575)
+++ cchost/trunk/ccskins/cc5/css/cc5.css	2009-05-08 06:59:19 UTC (rev 12576)
@@ -2,9 +2,6 @@
 	margin: 0;
 	padding: 0;
 	color: #333;
-	font:  62.5% Arial, sans-serif;
-	line-height: 1.5em;
-	text-align: center;
 }
 
 .hide {
@@ -15,13 +12,12 @@
 	border: 0px;
 }
 
-#mainContent h1, h2, h3, h4, h5 {
+#content h1, h2, h3, h4, h5 {
 	font-family: helvetica, arial, sans-serif;
 	margin-top: 0;
 	color: #202020;
 }
 
-
 h1 { font-size: 2em; font-family: "helvetica neue", helvetica, arial, sans-serif; } 
 h2 { font-size: 1.5em; font-family: "helvetica neue", helvetica, arial, sans-serif; } 
 h3 { font-size: 1.25em;}
@@ -29,13 +25,9 @@
 h5 { font-size: 1em;}
 
 
-h1, h2, h3, h4 { line-height: 1.5em;}
+h1, h2, h3, h4, h5 { line-height: 1.5em;}
 
-h5 {
-	line-height: 1.5em;
-}
-
-a {
+a, a:visited {
 	text-decoration: none;
 	color: #1c438b;
 }
@@ -46,58 +38,20 @@
 
 p { margin-bottom: 10px; line-height:1.5em;}
 
-blockquote { 
-	padding: 5px 5px 5px 10px; 
-	margin: 5px 5px 5px 3px; 
-	font-style: italic; 
-	border-left: 1px solid #ddd; 
-}
 
-img.mugshot {
-	border: 2px solid #cccccc; 
-	margin-right: 10px; 
-	margin-bottom: 10px;
+#globalWrapper {
+	background: #fff url('../images/header-bar-thin.png') repeat-x top left;
 }
 
-.alignleft {
-        float: left;
-        margin-right: 10px;
+#headerWrapper {
+	height: 63px;
 }
 
-.alignright {
-        float: right;
-        margin-left: 10px;
+#headerLogo {
+  float: left;
+  margin: 0px 0px 0px 5%;
 }
 
-.subTitle {
-	color: #487100;
-}
-
-/* --- */
-
-#mainContent { 
-	/* font-size: 1.3em; */
-	overflow: visible;
-	margin-top: 65px;
-}
-
-.ccbox {
-	position: relative;
-	width: 960px;
-	margin: 0 auto;
-	text-align: left;
-}
-
-#s.inactive {
-	color: #666;
-}
-#s.active {
-	color: #000;
-}
-
-#headerLogo h1 span {
-}
-
 #headerLogo a {
 	display: block;
 	width: 100%;
@@ -105,106 +59,44 @@
 }
 
 #headerNav {
-	position: absolute;
-	right: 0;
+	float:right;
 	color: #fff;
-	/* font-size: 0.9em; */
-	top: 13px;
 }
 
+#headerNav ul {
+	padding-top: 20px;
+}
+
 #headerNav ul, #footerContent ul {
-	list-style-type: none;
-	padding-top: 1.1em;
 	margin: 0;
+	list-style-type: none;
 }
 
 #headerNav ul li {
 	display: inline;
-	padding-left: 2em;
+	padding-left: 0.5em;
 }
 
 #headerNav a {
 	color: #fff;
 }
 
-/** Footer **/
-#footer { 
-	background-color: #eee; 
-	clear: both; 
-	margin-top: 6em; 
-	padding: 1.5em 0; 
-	color: #555; 
-	/* font-size: 80%;  */
+#tools {
+	height: 60px;
 }
 
-#footerContent ul {
-	padding: 0;
-	margin-bottom: 1em;
-}
-#footerContent ul li {
-	display: inline;
-	padding-right: 2em;
-}
 
-#footerLicense {
-	border-top: 1px solid #ccc;
-	padding-top: 2em;
-	margin-bottom: 2em;
-	/* font-size: 85%; */
-}
-
-#footerLicense img {
-	float: left;
-	margin-right: 1em;
-	padding-top: 4px;
-}
-
-
-
-#globalWrapper {
-	background: #fff url('../images/header-bar-thin.png') repeat-x top left;
-}
-
-#headerNav {
-}
-
-#headerWrapper {
-	height: 63px;
-}
-
-#headerLogo {
-  float: left;
-  margin: 0px 0px 0px 5%;
-}
-
-#headerLogo h1 {
-}
-
-#headerNav ul {
-	padding-top: 17px;
-}
-
-.cc_breadcrumbs {
-	margin-top: -44px;
-}
-
 #pageNav {
-	position: absolute;
-	top: -50px;
-	left: 31px;
-	/* font-size: 0.9em; */
-	padding-bottom: 0.125em;
-	width: 935px;	
+	margin-left: 31px;
+	width: 80%;
 }
 
-.post_sub_tab_breaker {
-	border-bottom: 1px solid #e0e0e0;
-	clear: both;
+#pageNav, #pageNav a {
+	color: #505050;
 }
 
 #pageNav ul {
 	float: left;
-/*	clear: both;*/
 	list-style-type: none;
 	padding: 0 0 0.35em 16px;
 	margin: 0;
@@ -215,10 +107,17 @@
 	padding-right: 1em;
 }
 
-#pageNav, #pageNav a {
-	color: #505050;
+.selected_tab a:hover {
+  text-decoration: none;
 }
 
+.selected_tab a {
+	background-color: #CCC;
+	border: 2px solid #CCC;
+	color: white;
+	}
+
+
 #pageNav #t-page, #sub_tabs {
 	background: url(../images/page.png) no-repeat 0px 1px;
 }
@@ -235,86 +134,63 @@
 	color: #111;
 }
 
+.post_sub_tab_breaker {
+	border-bottom: 1px solid #e0e0e0;
+	clear: both;
+}
+
+
 #page_title {
 	padding-right: 5px;
 	padding-left: 31px;
+	height: 68px;
 }
-#page_title h2 {
+.page_title_breaker {
+	clear: right;
+}
+
+#page_title h2,
+#page_title h1,
+#inner_content h1  {
 	margin-right: 200px !important;
 }
-#page_title .sideitem {
+
+#inner_content h1 {
+	margin-top: -68px;
+	margin-bottom: 0px;
+	margin-left: -20px;
+	height: 68px;
+	
+}
+#tools .sideitem {
 	float: right;
-	/* padding-top: 0.5em; */
+	margin-right: 30px;
 }
 
-#page_title .sideitem #searchform	{
+#tools .sideitem #searchform	{
 	margin-bottom: 0.5em;
 }
 
-#page_title .sideitem #searchform input	{
+#tools .sideitem #searchform input	{
 	font-size: 0.95em;
 }
 
-#page_title .sideitem #searchform #search_text {
+#tools .sideitem #searchform #search_text {
 	background: url(../images/search_icon.gif) top left no-repeat;
 	padding-left: 18px;
 	font-family: verdana;
-}
-
-#page_title .sideitem input#s {
 	width: 96px;
 }
 
-#toc {
-	position: absolute;
-	top: 4.5em;
-	right: 0px;
-	width: 230px;
-	padding-top: 1.39em;
-	padding-left: 1em;
-	/* font-size: 90%; */
-	background-color: #f6f6f6;
+/*
+    inner_content is tricky because
+    templates set it all over the place
+*/
+#content #inner_content {
+   width: 85%;
+   margin: 0px 0px 0px 6%;
 }
 
-#toc ul {
-	padding-left: 0;
-	margin-left: 0;
-	list-style: none;
-}
-
-#toc h2 {
-	margin-top: 0;
-}
-
-#toc li.toclevel-2, #toc li.toclevel-3, #toc li.toclevel-4 {
-	margin-left: 1em !important;
-}
-
-.noToc {
-	width: 800px !important;
-	padding-right: 0 !important;
-}
-
-#menu_block {
-	position: absolute;
-	top: 75px;
-	left: 4px;
-	text-align: left;
-}
-
-#menu_hang {
-   z-index: 3;
-}
-
-.menu_group {
-  float: left;
-  margin-left: 2em;
-}
-
-.menu_hang_breaker {
-	clear: both;
-}
-
 .menu_group p {
 	font-weight: bold;
 	margin: 5px 0px 0px 0px;
@@ -351,12 +227,56 @@
   padding-left: 21px;
  }
 
-.selected_tab a:hover {
-  text-decoration: none;
+.menu_group .topic_dump_name {
+  background-color: #BBB;
+  padding: 2px;
 }
 
-.selected_tab a {
-	background-color: #CCC;
-	border: 2px solid #CCC;
-	color: white;
-	}
+.menu_group .topic_dump_name,
+.menu_group .topic_dump div {
+    width: 120px;
+}
+
+
+/** Footer **/
+#footer { 
+	background-color: #eee; 
+	clear: both; 
+	margin-top: 6em; 
+	padding: 1.5em 0; 
+	color: #555; 
+	/* font-size: 80%;  */
+}
+
+#footerContent {
+	position: relative;
+	width: 900px;
+	margin: 0 auto;
+	text-align: left;
+}
+
+#footerContent ul {
+	padding: 0;
+	margin-bottom: 1em;
+}
+
+#footerContent ul li {
+	display: inline;
+	padding-right: 2em;
+}
+
+#footerLicense {
+	border-top: 1px solid #ccc;
+	padding-top: 2em;
+	margin-bottom: 2em;
+	/* font-size: 85%; */
+}
+
+#footerLicense img {
+	float: left;
+	margin-right: 1em;
+	padding-top: 4px;
+}
+
+
+<!-- end

Modified: cchost/trunk/ccskins/shared/content_manage.tpl
===================================================================
--- cchost/trunk/ccskins/shared/content_manage.tpl	2009-05-08 00:33:14 UTC (rev 12575)
+++ cchost/trunk/ccskins/shared/content_manage.tpl	2009-05-08 06:59:19 UTC (rev 12576)
@@ -65,7 +65,8 @@
 %loop(content_pages,cp)%
 <? $class = $i_cp & 1 ? 'odd_row' : 'even_row'; ?>
 <tr class="%(#class)%" >
-    <td>%(#cp)%</td>
+   <? $short_name = str_replace('.php','',basename($k_cp)); ?>
+    <td><b>%(#cp)%</b> (/%(#short_name)%)</td>
     <td><a href="%(home-url)%admin/content/page/edit/%(q)%page=%(#k_cp)%" class="small_button"><span>edit</span></a></td>
     <td><a href="%(home-url)%admin/content/page/delete/%(q)%page=%(#k_cp)%" class="small_button"><span>delete</span></a></td>
     <? $page = ccl(preg_replace('/\.[^\.]+$/','',basename($k_cp))); ?>
@@ -97,4 +98,4 @@
 </tr>
 %end_loop%
 </table>
-%call(prev_next_links)%
\ No newline at end of file
+%call(prev_next_links)%




More information about the cc-commits mailing list