added new article field to store a menu value which can be filtered in certain articl...
authorAdrian Oldham <adriann@visualthought.com.au>
Wed, 8 Aug 2007 06:14:57 +0000 (06:14 +0000)
committeradriann <adriann@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Wed, 8 Aug 2007 06:14:57 +0000 (06:14 +0000)
schema/bse.sql
site/cgi-bin/modules/Article.pm
site/cgi-bin/modules/BSE/DB/Mysql.pm
site/docs/config.pod
site/templates/admin/edit_1.tmpl
site/templates/admin/edit_catalog.tmpl
site/templates/admin/edit_product.tmpl
site/templates/admin/edit_seminar.tmpl
site/util/initial.pl

index cf223f4a3cb58aeef54da6cc44988bc22e42f38d..d63eba94ce95457675866ba3537ef94807e7c0fd 100644 (file)
@@ -90,6 +90,10 @@ CREATE TABLE article (
   -- x just so we don't get a name issue with product
   summaryx text default '' not null,
 
+  -- added by adrian
+  -- filter menu value in allkids_of iterators
+  menu smallint(5) not null default 0,
+  
   PRIMARY KEY (id),
 
   -- if we keep id in the indexes MySQL will sometimes be able to
index cff79dbd39d797f853c04cbd328170ab8975a467..64e664eca25fedae2b8773a623b089b65fdf3d84 100644 (file)
@@ -15,12 +15,12 @@ sub columns {
     customInt1 customInt2 customInt3 customInt4 
     lastModifiedBy created createdBy author pageTitle
     force_dynamic cached_dynamic inherit_siteuser_rights
-    metaDescription metaKeywords summary/;
+    metaDescription metaKeywords summary menu/;
 }
 
 sub numeric {
   qw(id listed parentid threshold summaryLength level 
-     customInt1 customInt2 customInt3 customInt4);
+     customInt1 customInt2 customInt3 customInt4 menu);
 }
 
 sub step_parents {
index df66529b20cd7c4acdc0d7f542560f2b65886e7e..97d68bab211b65775b1272e6e771f64d6d1a620e 100644 (file)
@@ -18,9 +18,9 @@ my %statements =
   (
    Articles => 'select * from article',
    replaceArticle =>
-     'replace article values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+     'replace article values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
    addArticle =>  
-     'insert article values (null, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
+     'insert article values (null, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
    deleteArticle => 'delete from article where id = ?',
    getArticleByPkey => 'select * from article where id = ?',
    
index 32e0104e25755871b50770bd48303e7fd86ec3f3..e1360e8c72caa38082a692e5c5bc1f3348d71059 100644 (file)
@@ -1507,6 +1507,28 @@ If this is non-zero then siteuser_saveopts is called.
 
 =back
 
+=head2 [levelI<level> menus]
+
+Where I<level> is the article level at which the defined menu options will be available.
+Configure each menu value and description as I<key> and I<value>.
+
+=over
+
+For example:
+
+  [level1 menus]
+  0=Default
+  1=Sidebar
+  2=Footer
+
+To create a menus using such values, use the "allkids_of" iterator "filter" option.
+
+For example:
+
+  <:iterator begin allkids_of -1 filter: [menu] == 2 :>
+
+=back
+
 =head1 AUTHOR
 
 Tony Cook <tony@develop-help.com>
index 6ecfff1c96160defd396e1cb3a48b9302e889790..b606f35fb0f68ee273efdf8bac8d72ee023b5a09 100644 (file)
             </td>
             <td valign="top" nowrap="nowrap" bgcolor="#FFFFFF"><:help body body:> <:error_img body:></td>
           </tr>
+          <:if Cfgsection [concatenate level [article level] " menus"]:><tr> 
+            <th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Menu:</th>
+            <td bgcolor="#FFFFFF" width="100%"> 
+              <select name="menu" id="menu">
+                <:iterator begin cfgsection [concatenate level [article level] " menus"] sort=key:><option value="<:cfgentry key:>"<:if Eq [old menu] [cfgentry key]:> selected="selected"<:or Eq:><:eif Eq:>><:cfgentry value:></option><:iterator separator cfgsection:>
+                <:iterator end cfgsection:>
+              </select>
+            </td>
+            <td nowrap="nowrap" bgcolor="#FFFFFF"><:help article menu:> <:error_img menu:></td>
+          </tr><:or Cfgsection:><:eif Cfgsection:>
           <tr> 
             <th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Template:</th>
             <td bgcolor="#FFFFFF" width="100%"><:ifFieldPerm template:> <:templates:><:or:><:article template:><:eif:> </td>
index cc1449debc1055a37c3f13387d7e8a06e955db41..5c1af315753ee0e1fd0229c2fb74c9f6d7105863 100644 (file)
             <td valign="top" nowrap="nowrap" bgcolor="#FFFFFF"><:help body body:> <:error_img
             body:></td>
           </tr>
+          <:if Cfgsection [concatenate level [article level] " menus"]:><tr> 
+            <th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Menu:</th>
+            <td bgcolor="#FFFFFF" width="100%"> 
+              <select name="menu" id="menu">
+                <:iterator begin cfgsection [concatenate level [article level] " menus"] sort=key:><option value="<:cfgentry key:>"<:if Eq [old menu] [cfgentry key]:> selected="selected"<:or Eq:><:eif Eq:>><:cfgentry value:></option><:iterator separator cfgsection:>
+                <:iterator end cfgsection:>
+              </select>
+            </td>
+            <td nowrap="nowrap" bgcolor="#FFFFFF"><:help article menu:> <:error_img menu:></td>
+          </tr><:or Cfgsection:><:eif Cfgsection:>
                  <tr> 
             <th bgcolor="#FFFFFF" nowrap="nowrap" align="left"> Template: </th>
             <td bgcolor="#FFFFFF" width="100%"> <:ifFieldPerm titleImage:><:templates:><:or:><:article titleImage:><:eif:> </td>
index 0f1baaadd6f71eb6545e2d8020fb35cf095c3073..649eb6c14ebae4efae5c6ed7127f52322fa14521 100644 (file)
             <td nowrap="nowrap" bgcolor="#FFFFFF" valign="top"><:help body body:> <:error_img
             body:></td>
           </tr>
+          <:if Cfgsection [concatenate level [article level] " menus"]:><tr> 
+            <th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Menu:</th>
+            <td bgcolor="#FFFFFF" width="100%"> 
+              <select name="menu" id="menu">
+                <:iterator begin cfgsection [concatenate level [article level] " menus"] sort=key:><option value="<:cfgentry key:>"<:if Eq [old menu] [cfgentry key]:> selected="selected"<:or Eq:><:eif Eq:>><:cfgentry value:></option><:iterator separator cfgsection:>
+                <:iterator end cfgsection:>
+              </select>
+            </td>
+            <td nowrap="nowrap" bgcolor="#FFFFFF"><:help article menu:> <:error_img menu:></td>
+          </tr><:or Cfgsection:><:eif Cfgsection:>
                  <tr> 
             <th nowrap="nowrap" align="left" bgcolor="#FFFFFF">Template:</th>
             <td nowrap="nowrap" bgcolor="#FFFFFF"><:ifFieldPerm template:><:templates:><:or:><:product template:><:eif:></td>
index 28b140a6120ddded38f5d2b2a4f059bc19a491df..5dbca9d163914d88e6b16de1747cf42b61dbf873 100644 (file)
             <td nowrap="nowrap" bgcolor="#FFFFFF"><:ifFieldPerm duration:><input type="text" name="duration" value="<:old duration default duration:>" size="10" /> minutes<:or:><:seminar duration:><:eif:></td>
             <td nowrap="nowrap" bgcolor="#FFFFFF"><:help product duration:> <:error_img duration:></td>
           </tr>
+          <:if Cfgsection [concatenate level [article level] " menus"]:><tr> 
+            <th nowrap="nowrap" bgcolor="#FFFFFF" align="left">Menu:</th>
+            <td bgcolor="#FFFFFF" width="100%"> 
+              <select name="menu" id="menu">
+                <:iterator begin cfgsection [concatenate level [article level] " menus"] sort=key:><option value="<:cfgentry key:>"<:if Eq [old menu] [cfgentry key]:> selected="selected"<:or Eq:><:eif Eq:>><:cfgentry value:></option><:iterator separator cfgsection:>
+                <:iterator end cfgsection:>
+              </select>
+            </td>
+            <td nowrap="nowrap" bgcolor="#FFFFFF"><:help article menu:> <:error_img menu:></td>
+          </tr><:or Cfgsection:><:eif Cfgsection:>
                  <tr> 
             <th nowrap="nowrap" align="left" bgcolor="#FFFFFF">Template:</th>
             <td nowrap="nowrap" bgcolor="#FFFFFF"><:ifFieldPerm template:><:templates:><:or:><:seminar template:><:eif:></td>
index 7670cb571e5d6f023c0fced07590b19383da676e..5842fd68b0035b43f95d8f4d95e64914b22cda83 100644 (file)
@@ -55,6 +55,7 @@ my @prebuilt =
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     # the invisible subsection for what's hot
@@ -92,6 +93,7 @@ my @prebuilt =
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     id=>3,
@@ -128,6 +130,7 @@ my @prebuilt =
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     id=>4,
@@ -164,6 +167,7 @@ my @prebuilt =
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     id=>5,
@@ -200,6 +204,7 @@ my @prebuilt =
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     id=>6,
@@ -466,6 +471,7 @@ EOS
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     id=>7,
@@ -506,6 +512,7 @@ EOS
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
    {
     id=>8,
@@ -546,6 +553,7 @@ EOS
     metaDescription=>'',
     metaKeywords=>'',
     summary => '',
+    menu => 0,
    },
   );