Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 11:51:47 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155532 Posts in 21713 Topics by 7738 Members
Latest Member: Pattieardathfe
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Integrate Javascript admin in news module  (Read 1487 times)
pieterb

Offline Offline

Posts: 46



« on: January 09, 2010, 05:16:15 PM »

Hi everybody,

I am working on a website where I've modded the news module, so that I can show a calendar on the homepage with short news items from it. Now I would like to be able to drag and drop the newsitems in stead of using the arrow keys. Really exactly like with the Javascript admin turned on and then moving pages around. Is this very hard to implement? Can anybody point me in the right direction?
Furthermore, I would really like a copy function for the News module, so I can copy an existing news item and then only change the date. Again, does anyone know if this is doable for a non-programmer?

If you want to see the website, you can go to www.comingoutday200 9.nl/cocrotterdam. On the homepage, you will see the calendar.

Thanks in advance for your help!
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #1 on: January 22, 2010, 01:31:37 AM »

Hi,

I really like your AGENDA block.. im curious how you did it ?
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
chio
WebsiteBaker Org e.V.

Offline Offline

Posts: 2264


« Reply #2 on: January 22, 2010, 08:25:25 AM »

I am also intersted in some help how to integrate Drag&Drop into News - and Topics, which is quite similar there.

@pieterb: A very nice and good looking site!
Logged

*weg*
pieterb

Offline Offline

Posts: 46



« Reply #3 on: January 22, 2010, 09:53:02 AM »

For the agenda block, I hired a PHP programmer. He did the fancy stuff with the agenda popping out. But I used the standard news module. The PHP script just reads out the information from the same table in the database. The look is all CSS.

I didn't get the drag and drop in the news module to work, so I made a workaround: I made an editable date field right in the news module "home screen". I also made a copy button that simply copies the database entry, so that the user only has to fill in the new date. I did this because we have many recurring agenda items.
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #4 on: January 22, 2010, 11:53:51 AM »

Could you please post a code for Agenda, I realy like it, it could be used as a new event calendar..
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pieterb

Offline Offline

Posts: 46



« Reply #5 on: January 31, 2010, 10:30:55 PM »

Hey everybody, my PHP programmer said it was fine to post the code. That said, it was made especially for this website, so probably there are some things that need redoing if you want to make it into a module. Please see the attachment. I've attached the complete template, so you can find the correct items for yourself.
Logged
snark
Guest
« Reply #6 on: August 24, 2010, 04:48:52 PM »

hey the calendar looks great,

as I look at your template the first part is
Code:
  set_include_path(
    get_include_path(). PATH_SEPARATOR.
    $_SERVER['DOCUMENT_ROOT']. "/include/coc"
  );

I think besides the template we would also need the "include/coc" folder to get it to work ...
now I get an empty page
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #7 on: August 24, 2010, 06:48:32 PM »

Hi,

I liked this agenda so I am willing to make a snippet from this.

My idea is to make a snippet, which can be simply adjusted with tutorial to use data from various modules (news, event and concert calendars and even more Smiley )

to make agenda work, install the template, then open index.php of template and:
Code:
find
  require_once("global.inc.php");

and replace with
  require_once(WB_PATH."/templates/COChome/include/global.inc.php");

then use this ajax.txt file and rename it to ajax.php and uload it to root

Also, If you use TABLE_PREFIX, open TEMPATE_DIR/include/agenda.class.php and find and replace SQL line with:

Code:
      $sql = "SELECT `title`, `content_short`, `published_when` FROM `".TABLE_PREFIX."mod_news_posts` WHERE `published_when` >= {$start_date} ORDER BY `published_when` ASC";



You will notice that I added ".TABLE_PREFIX." in SQL there..

cheers

Edit: Of course, this is just for test purposes.. to see how agenda works...I expect not to abuse Pieter's hard work Smiley and good will to share with us such a nice effect
« Last Edit: August 24, 2010, 06:54:43 PM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
« Reply #8 on: August 25, 2010, 11:00:59 AM »

hey,

it shows the calendar but dos not load any messages when I tested it (with news 3.5)
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #9 on: August 25, 2010, 11:08:30 AM »

Did you add table prefix?
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
snark
Guest
« Reply #10 on: August 25, 2010, 11:15:05 AM »

tried it with and without

it gives the calendarfolding out on mouse over

the text underneath says "Helaas geen events gevonden!" (too bad, nothing happening here)

but when clicking a date it keeps showing the spinning gif

and for the people thinking i am stupid: I have made a bunch of newsitems


Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #11 on: August 25, 2010, 12:22:52 PM »

Strange

haven't installed so can't look at it yet

sorry.
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #12 on: August 25, 2010, 01:04:21 PM »

Check if your newsitems have starting date..

then
Do you have table prefix at all ?
If you do, around line 25 in agenda.class.php find:

Code:
      $mysql = mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD) or die("Could not connect to mysql server.");
      mysql_select_db(DB_NAME, $mysql) or die("Could not select database.");
     
      $sql = "SELECT `title`, `content_short`, `published_when` FROM `".TABLE_PREFIX."mod_news_posts` WHERE `published_when` >= {$start_date} ORDER BY `published_when` ASC";
 
now try to replace DB_HOST, user, pass, db_name and table prefix with your data:

Code:
      $mysql = mysql_connect("localhost","root","password") or die("Could not connect to mysql server.");
      mysql_select_db("myDB", $mysql) or die("Could not select database.");
     
      $sql = "SELECT `title`, `content_short`, `published_when` FROM `_mod_news_posts` WHERE `published_when` >= {$start_date} ORDER BY `published_when` ASC";
 

try that..
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
« Reply #13 on: August 25, 2010, 02:50:47 PM »

hey, the newsitems are visible underneath the calendar on opening the page ..
but the links do not work

in calender.class.php @ line 74

Code:
   $result .= "<td class=\"{$sClass}\"><a href=\"#\" rel=\"{$sDate}\" title=\"Bekijk agenda vanaf: {$sTitle}\">". $sDay. "</a></td>";

the link here is # ... I guess something has to be produced there but it doesn't ... it tries to bring me to #
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #14 on: August 25, 2010, 03:34:22 PM »

Did you uploaded ajax.php from my post above to your root Huh It handles clicked links..
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
« Reply #15 on: August 25, 2010, 03:58:38 PM »

yes I uploaded it, i tried the root, the template, the includes file,  ....


but how does the script know there is a ajax.php?

Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #16 on: August 25, 2010, 04:17:38 PM »

templatedir/js/common.m.js calls it Wink

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #17 on: August 25, 2010, 04:37:21 PM »

wierd... is it on some live site so I can take a look ?
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #18 on: August 27, 2010, 08:26:36 AM »

did you follow steps from here:

http://www.websitebaker2.org/forum/index.php/topic,16631.msg127626.html#msg127626

Also, I forgot to mention, in template folder find index.php and comment error reporting line at the start of the file...

Then turn on error reporting in advanced Settings

cheers 
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!