Jump to content


- - - - -

[Modification] Document Content Variables


  • This topic is locked This topic is locked
118 replies to this topic

#31 kartav

    Etomite Forum Newbie

  • Member
  • 10 posts

Posted 21 September 2004 - 01:49 PM

apodigm, on Sep 21 2004, 05:07 AM, said:

Good luck.

Thank you very much Apodigm.
I will try to use your help.

#32 Dimmy

    Etomite Forum Fan

  • Member
  • Pip
  • 109 posts

Posted 21 September 2004 - 08:25 PM

I found a small bug

when you paste some html in the Default Value: field you get this result Attached File  Gax_Export.gif   4.31K   281 downloads

I paste this piece of code to get that
<IMG src="/assets/images/logo_2.gif">


it works fine but looks a bit weard as you can see in the image

Greets Dimmy

(also implemented the Spaw editor works like a charm.)

#33 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 21 September 2004 - 09:48 PM

hmmm...

Yeah. you might need to use htmlspecialchars to clean the raw results from the database if it has ' or " characters in it.

#34 Dimmy

    Etomite Forum Fan

  • Member
  • Pip
  • 109 posts

Posted 23 September 2004 - 08:40 PM

When making a new weblink the DCV are still ther but there is no use for them so I added this line in mutate_content.dynamic.action.php so that the DCV's are not showing in the making a weblink page.

<?php if($content['type']=="document" || $_REQUEST['a']==4) { ?>

looks like this now:

<!--//Added by Apodigm 09-06-2004- DocVars - web@apodigm.com-->

<?php if($content['type']=="document" || $_REQUEST['a']==4) { ?>
<?php
$sql2 = "select field_name, field_description, field_caption, field_type, default_text, rank, field_elements from $dbase.".$table_prefix."docvars_fields order by rank"; 
$rs2 = mysql_query($sql2); 
$limit2 = mysql_num_rows($rs2);
if($limit2>0){
?>


Greets Dimmy

[edit] Somthing whent wrong it workt but now I get a parse error:
Parse error: parse error in /var/www/html/manager/actions/dynamic/mutate_content.dynamic.action.php on line 721
line 721 is an empty line on the end of the document

So sorry I think this is not working some how.. [/edit]


#35 Guest_rthrash_*

  • Guests

Posted 06 October 2004 - 05:09 PM

Got a small bit of trouble with this one on the very last install step, for modifying the main index.php on .6 release:

Quote

9) Lastly, you need to modify the main index.php file in the root of your etomite website


Around line 576, find this code:
# this is now the document :) #
$this->documentObject = $this->fetchRow($result);

There's not much like that around line 576 that I can find... :( I certainly don't want to mung things up, so any advice would be appreciated. Getting this to work will be a tremendous stopgap measure until .7.

Thanks!

#36 Guest_rthrash_*

  • Guests

Posted 06 October 2004 - 05:14 PM

Actually, it looks like it's near line 708. Off to test...

#37 Guest_rthrash_*

  • Guests

Posted 06 October 2004 - 05:26 PM

OK, first bug I've run into. When logging into the manager and going to manage resources to start adding some variables, I get the following error:

Quote

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /Etomite0.6/manager/actions/dynamic/resources.dynamic.action.php on line 109
No results found

Could this have something to do with no data being put in etomite_docvars_values by the supplied MySQL dump?

#38 Guest_rthrash_*

  • Guests

Posted 06 October 2004 - 05:31 PM

One more... when trying to add a new variable I hit the save button and get the following in my browser:

Quote

$rs not set! New variable not saved!

Help will be tremendously appreciated. :unsure:

FYI, I had also added stebrennans changes as well.

#39 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 06 October 2004 - 06:01 PM

not sure why you are having problems.

Did you run the SQL commands in the contribution files?

You should be able to overwrite your existing Etomite 0.6 install with the changed files that I included in the contribution. Or use a Diff program (like www.scootersoftware.com Beyond Compare or WinDiff) to compare the files to see what is different in your install.

#40 Guest_rthrash_*

  • Guests

Posted 06 October 2004 - 06:06 PM

I did run the SQL and it added the various tables and data.

I also updated the files per the instructions. (FYI, I run OS X, so no beyond compare).

The reason I didn't just replace the files is the .6 release index is larger than the RC2 index file and changed some of the function/class names. Therefore, I went about the changes manually.

Any other ideas?

#41 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 06 October 2004 - 06:11 PM

dump RC2. install 0.6 ... then start over with the contribution. It was specifically coded for 0.6.

...or you can use a diff program in MAC (linux kernal?) to compare the 06/Docvars clean install to your existing installation.

...or send me the backup of your entire site, along with database and I will reproduce on my machine to correct your problem and send the files back. But I will not have the time to troubleshoot your website until Monday.

#42 marco

    Etomite Forum Newbie

  • Member
  • 17 posts

Posted 06 October 2004 - 06:52 PM

stebrennan, on Sep 8 2004, 04:32 PM, said:

--------
forget this, wrong thread.

#43 Guest_rthrash_*

  • Guests

Posted 07 October 2004 - 12:11 AM

apodigm, on Oct 6 2004, 01:11 PM, said:

dump RC2.  install 0.6 ... then start over with the contribution.  It was specifically coded for 0.6.

...or you can use a diff program in MAC (linux kernal?) to compare the 06/Docvars clean install to your existing installation.

...or send me the backup of your entire site, along with database and I will reproduce on my machine to correct your problem and send the files back.  But I will not have the time to troubleshoot your website until Monday.

I think the download in the first post of this thread must not be the latest version (and I can't find any others here), especially given that it was coded for RC2 and the difference in the main Index files and classes contained therein between the download index and the .6 release index are substantial. Know where I might pick up the latest version?

#44 jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 07 October 2004 - 02:56 AM

Main site page for downloads:

http://www.etomite.com/downloads.html

#45 Guest_rthrash_*

  • Guests

Posted 07 October 2004 - 03:29 AM

jaredc, on Oct 6 2004, 09:56 PM, said:

Main site page for downloads:

http://www.etomite.com/downloads.html

lol

I should have been more clear about looking for the location for the latest version of the DCV mod. As posted in the first message of this thread it appears to be written for a semi-prerelease version of Etomite 0.6 (around September 23), which causes it to not exactly work.

Either that or the .tar.gz version of Etomite on the main downloads page is out of date.

Thanks! :)

#46 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 07 October 2004 - 03:33 AM

All... apparently not all "0.6" are created equal. I have just been noticed that there are some minor changes between 0.6 RC2 and the final version of 0.6.

Never fear. I have just downloaded the most recent version of 0.6 and updated DocVars so that it is compatible with the final release of 0.6.

.... In this roll-up, I have also included the template manager changes by stebrennan, some tweaks for the weblinks, docvar handling, and updated SQL install script.

So.... if you start with a stock install of 0.6 and then follow the new DocVars contribution, you will be set up in no time with custom document variables - associated with the templates.

Please go to the first post in this message thread to download the new version of DocVars.

#47 mrpif

    Etomite Forum Newbie

  • Member
  • 4 posts

Posted 19 October 2004 - 11:20 AM

First I want to say I've started to use DocVar and I really like it! Great job!

I'm using it for an agenda section on my site. One of the document variables I need in this section is a date (the event's date, independent from the (un)publication dates), but I'm running across what seems to be a bug in the way dates are retrieved and displayed when one wants to enter a date on a new page or modify an existing one:

1. When setting the date for the first time, clicking on the 'Select a Date' button opens the calendar pop-up in January 1970

2. When modifying a page, whatever the saved date was, the input box show "01-01-1970 01:00:22" ("01:00:22" being the current local time), even though the date was previously saved correctly. Hence, clicking on the 'Select a Date' button opens the calendar pop-up in January 1970.

This problem occurs only for date DocVars, not for the standard date variables (publication / unpublication).

Help!

#48 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 19 October 2004 - 11:53 AM

mrpif, on Oct 19 2004, 05:20 PM, said:

First I want to say I've started to use DocVar and I really like it! Great job!

1. When setting the date for the first time, clicking on the 'Select a Date' button opens the calendar pop-up in January 1970

Help!

Hmmm.... I don't use the date function much. I'll do some testing on it.

Try this...

In manager/includes/docvars_fields.php around line 39...
comment out this line so it looks like this:
   //            if($field_value=='') $field_value=0;
This will remove the default value of the date field. The default value is being changed to "0" which the calendar popup interprets as January 1st, 1970. (not sure... I didn't write that control.

I noticed that Alex already had some code to set the default value to "" so this should fixe everything for you as far as the default value goes.

let me know if this works.

#49 mrpif

    Etomite Forum Newbie

  • Member
  • 4 posts

Posted 20 October 2004 - 11:03 AM

apodigm, on Oct 19 2004, 01:53 PM, said:

In manager/includes/docvars_fields.php around line 39...
comment out this line so it looks like this:
   //            if($field_value=='') $field_value=0;

This does not solve the problem. Although, modifying that line this way:
$current_time=time();
if($field_value=='') $field_value=$current_time;
... and replacing the two
$field_value==0
conditions a few lines lower by
$field_value==$current_time
seems like it solves the problem.

But I found there's a deeper problem: if I select a date, say "21-10-2004 15:37:17" in the calendar and then save the page, the date gets stored as "21-10-2004 15:37:17" (i.e. a string) in the etomite_docvars_values table, not as "1098365837" (correct date format, i.e. an integer representing the number of seconds since Jan 1st, 1970).

So when etomite retrieves the date, it doesn't parse it correctly (actually, it just takes the two first digits --the day-- and displays it as the seconds of "1970-01-01 01:00:SS".

I'm searching the actions/dynamic/*.php files for the place where the date gets formatted wrong before it gets sent to MySQL...

#50 mrpif

    Etomite Forum Newbie

  • Member
  • 4 posts

Posted 20 October 2004 - 11:51 AM

Oops, my mistake, there isn't any problem as long as the Date DocVar hasn't been saved to MySQL. All apologies. So no need to modify includes/docvar_fields.php, it works just fine to select a date the first time.

What needs to be done instead is to insert a condition similar to the one used for the publication date (lines 49-59 in save_content.processor.php), which would convert the date string into a date integer for all date DocVars.

In save_content.processor.php, I inserted the lines:
       }elseif($row['field_type']=='date'){
            $docvar_date = $_POST[$row['field_name']];
            if($docvar_date=="") {
           	 $docvar_date="0";
            } else {
           	 list($d, $m, $Y, $H, $M, $S) = sscanf($docvar_date, "%2d-%2d-%4d %2d:%2d:%2d");
           	 $docvar_date = strtotime("$m/$d/$Y $H:$M:$S");
            }
            $docvars[$row['field_name']] = $docvar_date;
around line 175, before the "else" part of this conditional (starting at line 128)
       if($row['field_type']=='file'){
... and now the date is stored properly in MySQL.

My next problem is: now this date DocVar gets displayed as an integer when I use its [*...*] code. I guess a short snippet will do the conversion...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users