List Info

Thread: modularized data and dd




modularized data and dd
user name
2006-12-15 14:44:46
I have a few questions about how to setup a pubtype and use
dd. This  
is what I'd like to do but not sure how to set it up. I need
a custom  
pubtype that draws all of its data from a standalone dd
table. Is it  
possible to do this but have the standard articles fields
also set in  
dd? I create a pubtype and it gives me the standard title,
notes, body  
fields in the xar_articles table. What I'd like is to have
these in a  
standalone dd table as well as the other fields I need to
create. The  
table is going to have to be updated regularly with csv
files with  
data moving in and out of the table regularly. Is it also
possible to  
associate categories to this pubtype also from a standalone
dd table?

Thanks, all

Tim

_______________________________________________
Xaraya_devel mailing list
Xaraya_develxaraya.com
http:
//xaraya.com/mailman/listinfo/xaraya_devel
modularized data and dd
user name
2006-12-15 17:58:43
to my knowledge, if you name a dd field the same as a
built-in one  
(body, notes, etc), the dd field will override.

linoj


On Dec 15, 2006, at 9:44 AM, tstalkerword-builder.com wrote:

> I have a few questions about how to setup a pubtype and
use dd. This
> is what I'd like to do but not sure how to set it up. I
need a custom
> pubtype that draws all of its data from a standalone dd
table. Is it
> possible to do this but have the standard articles
fields also set in
> dd? I create a pubtype and it gives me the standard
title, notes, body
> fields in the xar_articles table. What I'd like is to
have these in a
> standalone dd table as well as the other fields I need
to create. The
> table is going to have to be updated regularly with csv
files with
> data moving in and out of the table regularly. Is it
also possible to
> associate categories to this pubtype also from a
standalone dd table?
>
> Thanks, all
>
> Tim
>
> _______________________________________________
> Xaraya_devel mailing list
> Xaraya_develxaraya.com
> http:
//xaraya.com/mailman/listinfo/xaraya_devel

_______________________________________________
Xaraya_devel mailing list
Xaraya_develxaraya.com
http:
//xaraya.com/mailman/listinfo/xaraya_devel
modularized data and dd
user name
2006-12-15 21:22:40
Hi,

On Fri, Dec 15, 2006 at 09:44:46AM -0500, tstalkerword-builder.com wrote:
> I have a few questions about how to setup a pubtype and
use dd. This  
> is what I'd like to do but not sure how to set it up. I
need a custom  
> pubtype that draws all of its data from a standalone dd
table. Is it  
> possible to do this but have the standard articles
fields also set in  
> dd? I create a pubtype and it gives me the standard
title, notes, body  
> fields in the xar_articles table. What I'd like is to
have these in a  
> standalone dd table as well as the other fields I need
to create. The  
> table is going to have to be updated regularly with csv
files with  
> data moving in and out of the table regularly.....

I'm not aware of any way to specify a source for pubtype
fields
(excluding DD fields) other than the
<xar-prefix>_articles table itself.
If you are willing to use pure Dynamic Data objects though,
you can use
a standalone database table as a data source. The
disadvantage of this is
that you can't (easily) take advantage of the 'Myself' role 
- which is
the privilege system's way of enabling certain privileges (
e.g. edit &
delete privileges ) to be assigned specifically to the
*author* of an
item[1]. If this isn't a significant issue for you though, I
think it's
a relatively straight-forward process.

Here's the 'CREATE TABLE' statement (in PostgreSQL) for an
example table
that the Dynamic Data module could use as a data source for
the object:

  CREATE TABLE test_table (
    id integer,
    title character varying(30),
    summary text,
    body text,
    authorid integer,
    extra_field_1 character varying(30),
    extra_field_2 character varying(30),
    extra_field_3 character varying(30)
  );

As you can see, the first 5 columns are analogues of columns
in the
<xar_prefix>_articles table. Replace the
'extra_field...' columns with
whatever number of custom columns/fields you need yourself.

Then create a pure Dynamic Data object, and - for each of
the
properties - simply specify test_table.<column> as the
data
source. And don't forget that - because it's a 'pure'
Dynamic Data
object - you need to create one property of type 'Item ID'.

Here's the XML definition for a test object I created using
columns in
the above table as data sources for each of the object
properties
(..sorry about the length - I'm not sure if the list accepts
attachments).

############################
### Begin XML definition ###
############################

<object name="test_object">
  <objectid>25</objectid>
  <label>Test object</label>
  <moduleid>182</moduleid>
  <itemtype>1</itemtype>
  <urlparam>itemid</urlparam>
  <maxid>0</maxid>
  <config></config>
  <isalias>1</isalias>
  <properties>
    <property name="id">
      <id>116</id>
      <label>id</label>
      <type>itemid</type>
      <default></default>
      <source>test_table.id</source>
      <status>2</status>
      <order>1</order>
      <validation></validation>
    </property>
    <property name="title">
      <id>117</id>
      <label>Title</label>
      <type>textbox</type>
      <default></default>
      <source>test_table.title</source>
      <status>1</status>
      <order>2</order>
      <validation></validation>
    </property>
    <property name="summary">
      <id>119</id>
      <label>Summary</label>
      <type>textarea_small</type>
      <default></default>
      <source>test_table.summary</source>
      <status>1</status>
      <order>3</order>
      <validation></validation>
    </property>
    <property name="body">
      <id>120</id>
      <label>Body</label>
      <type>textarea_large</type>
      <default></default>
      <source>test_table.body</source>
      <status>1</status>
      <order>4</order>
      <validation></validation>
    </property>
    <property name="author">
      <id>121</id>
      <label>Author</label>
      <type>username</type>
      <default></default>
      <source>test_table.authorid</source>
      <status>2</status>
      <order>5</order>
      <validation></validation>
    </property>
    <property name="extra_field_1">
      <id>122</id> 
      <label>Extra field 1</label>
      <type>textbox</type>
      <default></default>
      <source>test_table.extra_field_1</source>
      <status>2</status>
      <order>6</order>
      <validation></validation>
    </property>
    <property name="extra_field_2">
      <id>123</id> 
      <label>Extra field 2</label>
      <type>textbox</type>
      <default></default>
      <source>test_table.extra_field_2</source>
      <status>2</status>
      <order>7</order>
      <validation></validation>
    </property>
    <property name="extra_field_3">
      <id>124</id> 
      <label>Extra field 3</label>
      <type>textbox</type>
      <default></default>
      <source>test_table.extra_field_3</source>
      <status>2</status>
      <order>8</order>
      <validation></validation>
    </property>
  </properties>
</object>

##########################
### End XML definition ###
##########################

You can import that - just copy and paste - using the
'Utilities'
function in the Dynamic Data module. Xaraya will
automatically fix the
ids for your own installation.

If you want to customize the appearance of pages displaying
this object,
you can use the templates in the
modules/dynamicdata/xartemplates/objects/ directory as a
basis for
custom templates - similarly to how one would use
user-view-<pubtype>.xt
and user-display-<pubtype>.xt templates in the
Articles module.

> ....Is it also possible to associate categories to this
pubtype also from
> a standalone dd table?

I'm not sure what you mean by this.

One of the developers will quite likely come along and point
out some
things that I have overlooked, but it seems to work for me
anyway. Hope
it helps!

[1] If you really need these sort of privileges with pure
Dynamic Data
objects, see a response by mikespub to a thread I started,
here:
http://xaraya.com/pipermail/xaraya_user/2006-June/0
04208.html

-- 
David Collins				GPG id 646C8A43 
--

_______________________________________________
Xaraya_devel mailing list
Xaraya_develxaraya.com
http:
//xaraya.com/mailman/listinfo/xaraya_devel
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )