CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviPetition, and more generally writing a new component for civi
Pages: [1] 2

Author Topic: CiviPetition, and more generally writing a new component for civi  (Read 4289 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
CiviPetition, and more generally writing a new component for civi
March 09, 2010, 09:57:59 am
Hi,

We are working on a new function "petition". that would mean some entries in the navigation menu, new tables in the database, more access rights...

My initial idea was to create a new component, like report or civimail. However, I have some practical issues here and there:

1) Not sure how to "register" the new component, seems to be into the
common xml GenCode bit, not something you can put separately ?
2) Not sure how to alter the menu to register new urls
3) Not sure how to alter the navigation to register new items

I looked at SFS, might be easier to go the drupal module road ?
http://civicrm.org/node/624

More generally, should we aim at making easy(ier) to extend civi from within, like on
sugarcrm and hopefully getting more features that can easily be added ?

It seems to be easy (some issues still as described by lobo), but this means that joomla won't get as much features as drupal, eg they won't be able to get the petition module.

What do you think ? Is there a way to avoid it ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviPetition, and more generally writing a new component for civi
March 09, 2010, 11:11:00 am

A few specific responses:

1. I think the list of components is configured in the database (civicrm_component). We can create an interface to add a new component there

2. There are hooks to extend the menu system:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmxmlMenu

3. We should add hook to allow the navigation menu to be extended. if you can help with this it would be great. Kurund can assist you with this (i'd love to use it for SFS, and embed a new CiviSchool menu on install)

4. We definitely need more joomla developers in the ecosystem :(

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

geilhufe

  • I post frequently
  • ***
  • Posts: 293
  • Karma: 33
    • Social Source Software
Re: CiviPetition, and more generally writing a new component for civi
March 09, 2010, 12:10:52 pm
There is already a Civi dependent Drupal petition module that might give you a head start:
http://drupal.org/project/petition

Drupal and CiviCRM consulting, strategy and configuration
http://www.social-source.com/

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviPetition, and more generally writing a new component for civi
March 09, 2010, 12:14:08 pm

would be great if you can also take part in campaigning camp: http://civicrm.org/campcamp2010

and help get all these things together. Seems like a lot of activity with regard to campaigning / petitioning etc, so might be good to get a good mass of folks in Oxford and divvy up the work (and more importantly get some code and work done!)

also check:

http://wiki.civicrm.org/confluence/display/CRM/CiviCRM+for+Canvassing+and+GOTV

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: CiviPetition, and more generally writing a new component for civi
March 10, 2010, 02:06:18 am
Quote from: xavier on March 09, 2010, 09:57:59 am
1) Not sure how to "register" the new component, seems to be into the common xml GenCode bit, not something you can put separately ?

I’m pretty sure Michał did quite a lot of work on creating a component base; I’ll get him to reply here, but in the meantime check out the (dummy/example) Touchstone component in CRM/Touchstone.

Quote
2) Not sure how to alter the menu to register new urls
3) Not sure how to alter the navigation to register new items

As Lobo says, getting hooks for these would be a great first step.
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviPetition, and more generally writing a new component for civi
March 10, 2010, 04:26:45 am
Is there a way of having Touchstone on the list of component you can enable/disable ?

As for the menu, there is already a hook I think (Lobo's code on sfsschool :)
Code: [Select]
function sfschool_civicrm_xmlMenu( &$files ) {
    $files[] =
        dirname( __FILE__ ) . DIRECTORY_SEPARATOR .
        '..'                . DIRECTORY_SEPARATOR .
        '..'                . DIRECTORY_SEPARATOR .
        'SFS'               . DIRECTORY_SEPARATOR .
        'xml'               . DIRECTORY_SEPARATOR .
        'Menu'              . DIRECTORY_SEPARATOR .
        'sfschool.xml';
}
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Michał Mach

  • Ask me questions
  • ****
  • Posts: 748
  • Karma: 59
    • CiviCRM site
  • CiviCRM version: latest
  • CMS version: Drupal and Joomla latest
  • MySQL version: numerous
  • PHP version: 5.3 and 5.2
Re: CiviPetition, and more generally writing a new component for civi
March 10, 2010, 06:15:27 am
Xavier,

Quote from: xavier on March 09, 2010, 09:57:59 am
1) Not sure how to "register" the new component, seems to be into the
common xml GenCode bit, not something you can put separately ?

Most of information about creating and registering new components in CiviCRM is here: http://wiki.civicrm.org/confluence/display/CRMDOC/Creating+custom+components. Basically, once you have CRM_Petition_Info class ready (use CRM_Contribute_Info as an example), you just need to add an entry to civicrm_component table and you're ready to go with the rest of implementation.

Thx,
m
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My absolute favourite: Wordpress Integration!.

Donate Now!

Michał Mach

  • Ask me questions
  • ****
  • Posts: 748
  • Karma: 59
    • CiviCRM site
  • CiviCRM version: latest
  • CMS version: Drupal and Joomla latest
  • MySQL version: numerous
  • PHP version: 5.3 and 5.2
Re: CiviPetition, and more generally writing a new component for civi
March 10, 2010, 06:58:44 am
Quote from: Piotr Szotkowski on March 10, 2010, 02:06:18 am
but in the meantime check out the (dummy/example) Touchstone component in CRM/Touchstone.

Xavier,

I would rather avoid using Touchstone as an example, it might mislead you. There were some changes to component infrastructure in the meantime and I don't think it has been appropriately updated. Use one of functioning components as examples (CRM_Contribute_*), also take a look at CRM_Core_Component, CRM_Core_Component_Info, CRM_Core_Component_Config classes. Would be cool if you could also let me know about how things are going forward around it, I could update documentation and Touchstone based on your experience. :-)

Thx,
m
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My absolute favourite: Wordpress Integration!.

Donate Now!

Tiggr

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 1
    • Rodgauer Workshop
  • CiviCRM version: 4.7.beta3
  • CMS version: Drupal 7
Re: CiviPetition, and more generally writing a new component for civi
March 11, 2010, 04:13:45 pm
Hi!

Is there somewhere a more explicit howto on how to build a new component?

I know http://wiki.civicrm.org/confluence/display/CRMDOC/Creating+custom+components, but it doesn't really answer all questions!

I would like to try to do some where basic "webmailer" into CiviCRM - just for my own need, a crude and simple version just for handling one mailbox. Most is of the needed parts are allready in CiviCRM (reading the content of an IMAP mailbox, sending mail, mail activities) - but I can't do the first steps.

What I don't see is:

- How do I add my component to CiviCRM without adding a entry into the database by hand?
- How do I add my component into the top menu?
- How may I use CiviCRM-Hooks from inside a component, not an module?
- How do I add new tables without doing the sql from outside CiviCRM?

What's the best way for an hobby programmer with only a small knowledge to get some CiviCRM knowledge?

Bye and Thanks
Marcus (aka Tiggr)
« Last Edit: March 12, 2010, 12:43:51 am by Tiggr »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviPetition, and more generally writing a new component for civi
March 12, 2010, 11:12:58 pm
Not quite sure what the goal of a webmail within Civi is, but let's try to find a way to add a module ;)

Have you looked at CiviReports or other components? I think the best way is to look how others are done and imitate.

Quote from: Tiggr on March 11, 2010, 04:13:45 pm
- How do I add my component to CiviCRM without adding a entry into the database by hand?
I think you have to run by hand:
insert into civicrm_component (name, namespace) values ('YourComponent', 'CRM_YourComponentPath');
Or instert it into a mysql ugrade script into the civicrm version.

Quote from: Tiggr on March 11, 2010, 04:13:45 pm
- How do I add my component into the top menu?
I don't think it's possible, I haven't seen any registrerNavigation() in Info.php
(or other method)
Quote from: Tiggr on March 11, 2010, 04:13:45 pm
- How may I use CiviCRM-Hooks from inside a component, not an module?

Don't know

Quote from: Tiggr on March 11, 2010, 04:13:45 pm
- How do I add new tables without doing the sql from outside CiviCRM?

You can create new xml schema files and run genCode. This generates the sql.

Quote from: Tiggr on March 11, 2010, 04:13:45 pm
What's the best way for an hobby programmer with only a small knowledge to get some CiviCRM knowledge?

The usual suspects: civicrm.org/architecture , the wiki, this forum, IRC...

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Tiggr

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 1
    • Rodgauer Workshop
  • CiviCRM version: 4.7.beta3
  • CMS version: Drupal 7
Re: CiviPetition, and more generally writing a new component for civi
March 13, 2010, 06:53:59 am
Hi Xavier!

Quote from: xavier on March 12, 2010, 11:12:58 pm
Not quite sure what the goal of a webmail within Civi is, but let's try to find a way to add a module ;)

A bit offtopic:

Webmail is perhabs not the right word for it! It is about the "support-mail"-inbox. We are a small team of 3 people, using CiviCRM (yeah, a really small application of CiviCRM - but CiviCRM is really great even for small jobs). We have one email-adresse info@....de, and I want all of us to be able, to read and answers mails received at that inbox. It should be possible to read and answer form everywhere (home, work, mobile computer, ...) - that's why I want to have a webinterface. No problems with firewalls, no installations, just open the browser and start to work.

And everybody of us should be able to see the whole communication done with one contact, all phone calls, emails, meetings, no matter who has done them.

So I'm thinking about a small component, fetching mails from the mailbox per imap, showing them as simple list. I want to have the possibility to read them, reply to them, and attach them as activity to an contact.

Quote
Have you looked at CiviReports or other components? I think the best way is to look how others are done and imitate.

Of course, I did! ;-)

Quote
Quote from: Tiggr on March 11, 2010, 04:13:45 pm
- How do I add my component into the top menu?
I don't think it's possible, I haven't seen any registrerNavigation() in Info.php
(or other method)

That's where I ended too! Digging through the code gave me the impression, half of the infrastructure for this is allready in CiviCRM, but not enought to use it allready... but I may be wrong about it.

Bye
Marcus (aka Tiggr)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviPetition, and more generally writing a new component for civi
March 14, 2010, 01:02:14 pm
Now that's getting clearer ;)

We have similar needs. The path we are tempted to go into is to use the mail processing that would parse the emails and convert them to activities (of type incoming requests).

For what I see, it works pretty well already (bin/CiviMailProcessor.php), but it might need some tuning, on how to find the proper contacts, and who to assign it to and so on.

If you have a logic of "helpdesk", it might need some dashlet or equivalent to see what requests are on the pipe.

Does it make sense ? What do you think ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Tiggr

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 1
    • Rodgauer Workshop
  • CiviCRM version: 4.7.beta3
  • CMS version: Drupal 7
Re: CiviPetition, and more generally writing a new component for civi
March 14, 2010, 04:04:54 pm
Hi Xavier!

Quote
For what I see, it works pretty well already (bin/CiviMailProcessor.php), but it might need some tuning, on how to find the proper contacts, and who to assign it to and so on.

I thought about bin/CiviMailProcessor.php too! But we do only one hobby workshop a year. (I told you, we are a very small CiviCRM-Application! ;-)) So there is a huge part of mails of a more private nature. I don't want to have these inside the CRM automaticly. And some of our participants use changing mail adresses (at home, at work, ...) - so I want an alternative way to attach a mail manualy as activity to a contact.

Do be a bit more honest: I'm modelling this a bit after the model of how such common mail adresses are handled in Microsoft Dynamics CRM. We implement this at work at the moment! ;-) They call such "group mailboxes" Microsoft Dynamics CRM queues.

Quote
If you have a logic of "helpdesk", it might need some dashlet or equivalent to see what requests are on the pipe.

Does it make sense ? What do you think ?

Yes, that makes sense!

But because of our small application, and seeing, that I'm no programmer, I decided to try to do one step after another. ;-) My first aim at the moment is: Getting the mail from the IMAP-Mailbox into the database, and showing them! Most of that is very new to me!

Perhaps we should go with this "incoming mail handling" to an new thread, not bloating this one!

Bye
Marcus (aka Tiggr)

Tiggr

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 1
    • Rodgauer Workshop
  • CiviCRM version: 4.7.beta3
  • CMS version: Drupal 7
Re: CiviPetition, and more generally writing a new component for civi
March 15, 2010, 06:54:22 am
Hi again!

Some more questions on how to build your own component:

- Where may I put templates for my new component? The only place that works, is into the templates directory inside civicrms root (templates/CRM/<component>/Page). Wouldn't it be better, to have all files of one component together under CRM/<component>? Templates only used by one component under CRM/<component>/Templates?

- Where do I put component specific files like images and css? /i and /css ?

Bye
Marcus (aka Tiggr)

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviPetition, and more generally writing a new component for civi
March 15, 2010, 08:18:39 am

1. yes as we move components to be self-contained, moving the templates/i/js/css files to within CRM/Component makes more sense. Note that within civicrm-drupal modules we are going with the above setup (i.e. templates within the module directory)

2. current images / css all share the top level namespace, i.e. CIVICRM_ROOT/i and CIVICRM_ROOT/css

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviPetition, and more generally writing a new component for civi

This forum was archived on 2017-11-26.