Commit 9c0acbd9 authored by jaapjansma's avatar jaapjansma

initial commit

parents
<?php
use CRM_Sharepoint_ExtensionUtil as E;
/**
* Form controller class
*
* @see https://wiki.civicrm.org/confluence/display/CRMDOC/QuickForm+Reference
*/
class CRM_Sharepoint_Form_Settings extends CRM_Admin_Form {
public function buildQuickForm() {
// add form elements
$this->add(
'text', // field type
'url', // field name
E::ts('Url'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'site', // field name
E::ts('Site'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'username', // field name
E::ts('Username'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'password', // field type
'password', // field name
E::ts('Passowrd'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'library', // field name
E::ts('Library name'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'contact_id_field_name', // field name
E::ts('Contact ID field name'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'case_id_field_name', // field name
E::ts('Case ID field name'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'civicrm_link_field_name', // field name
E::ts('Link To CiviCRM field name'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'title_field', // field name
E::ts('Title field name'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'contact_documentset_contenttype_id', // field name
E::ts('Content Type ID for the contact documentset'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
$this->add(
'text', // field type
'case_documentset_contenttype_id', // field name
E::ts('Content Type ID for the case documentset'), // field label
array(
'class' => 'huge40',
),
TRUE // is required,
);
parent::buildQuickForm();
}
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
$settings = _sharepoint_settings();
return array_merge($defaults, $settings);
}
public function postProcess() {
$values = $this->exportValues();
$settings = _sharepoint_settings();
foreach($settings as $setting_name => $old_value) {
if (isset($values[$setting_name])) {
CRM_Core_BAO_Setting::setItem($values[$setting_name], 'sharepoint', $setting_name);
}
}
CRM_Core_Session::setStatus(E::ts('Saved sharepoint settings'), '', 'success');
parent::postProcess();
}
}
This diff is collapsed.
# Sharepoint
![Screenshot](/images/screenshot.gif)
This extension does the following:
- Creates a document set in Sharepoint for each contact in CiviCRM
- CReate a document set in Sharepoint for each case in CiviCRM
- Provides a link to the sharepoint document set on the contact summary screen
- Provides a link to the sharepoint document set on the case summary screen
The extension is licensed under [AGPL-3.0](LICENSE.txt).
## Requirements
* PHP v5.6+
* CiviCRM 5.3+
* Administrator access to a sharepoint environment
* Enabled document sets in sharepoint
## Configuration of Sharepoint
Before you can use this extension you have to configure sharepoint.
## Custom fields
Create the following fields:
* contact_id a numeric field
* case_id a numeric field
* link_to_civicrm a Hyperlink field
## Document sets
Make sure you have enabled document sets in sharepoint. If you dont know how to do this google it and feel free to update this manual.
After you have enabled the document sets you have to create the content types for the document set for _contacts_ and _casess_.
You can do that by navigating to site settings --> Site Content Types and add a new one, select _Document Set Content Type_ at the parent type.
After you have created the content type go to edit the content type and add the created fields to the content type. At the settings of the content type you can
configure which fields should be shown at the start page of the content type. Possibly you want here the field _link_to_civicrm_
![sharepoint 1](/images/sharepoint_content_type1.png)
![sharepoint 2](/images/sharepoint_content_type2.png)
### Note the content type id
Whilst editing a content type, you can see in the url the ID of the content type, which looks like _&ctype=0x0120D5...._ Note this ID because you need this in your CiviCRM settings later on.
# CiviCRM configuration
Install and enable this extension. You can then go to http://yoursite.com/civicrm/admin/sharepoint?reset=1 and fill in all the settings.
![Settings](/images/settings.png)
## Installation (Web UI)
This extension has not yet been published for installation via the web UI.
## Installation (CLI, Zip)
Sysadmins and developers may download the `.zip` file for this extension and
install it with the command-line tool [cv](https://github.com/civicrm/cv).
```bash
cd <extension-dir>
cv dl sharepoint@https://lab.civicrm.org/extensions/sharepoint/-/archive/master/form-procesor-master.zip
```
## Installation (CLI, Git)
Sysadmins and developers may clone the [Git](https://en.wikipedia.org/wiki/Git) repo for this extension and
install it with the command-line tool [cv](https://github.com/civicrm/cv).
```bash
git clone https://lab.civicrm.org/extensions/form-procesor.git
cv en sharepoint
```
## Usage
(* FIXME: Where would a new user navigate to get started? What changes would they see? *)
## Known Issues
(* FIXME *)
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "03e558b8a7fe9340c94a19032b87e4ae",
"packages": [
{
"name": "vgrem/php-spo",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/vgrem/phpSPO.git",
"reference": "1f4a9c5ca2a964fa1c415e4d16486667ed39c637"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vgrem/phpSPO/zipball/1f4a9c5ca2a964fa1c415e4d16486667ed39c637",
"reference": "1f4a9c5ca2a964fa1c415e4d16486667ed39c637",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Office365\\PHP\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0+"
],
"authors": [
{
"name": "Vadim Gremyachev",
"email": "vvgrem@gmail.com"
}
],
"description": "The library provides a Office 365 REST client for PHP. It allows to performs CRUD operations against Office 365 resources via an REST/OData based API",
"keywords": [
"Office365",
"api",
"curl",
"rest",
"sharepoint"
],
"time": "2018-06-29T21:49:34+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"vgrem/php-spo": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
This diff is collapsed.
<?xml version="1.0"?>
<extension key="sharepoint" type="module">
<file>sharepoint</file>
<name>Sharepoint</name>
<description>Creates a link to sharepoint document set on the contact summary screen and a link to a sharepoint document set on the case summary screen. Also ensures that the document set ecists for the contact or the case.</description>
<license>AGPL-3.0</license>
<maintainer>
<author>Jaap Jansma</author>
<email>jaap.jansma@civicoop.org</email>
</maintainer>
<urls>
<url desc="Main Extension Page">https://lab.civicrm.org/extensions/sharepoint</url>
<url desc="Documentation">https://lab.civicrm.org/extensions/sharepoint/README.md</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2018-07-12</releaseDate>
<version>1.0</version>
<develStage>alpha</develStage>
<compatibility>
<ver>5.3</ver>
</compatibility>
<comments>Funded by Bindkracht 10</comments>
<civix>
<namespace>CRM/Sharepoint</namespace>
</civix>
</extension>
This diff is collapsed.
This diff is collapsed.
{capture assign="sharepoint_button"}{strip}
<li class="crm-sharepoint-action crm-contact-sharepoint">
<a href="{$link_to_sharepoint}" class="sharepoint button" target="cd dock_blank" title="{ts}View in Sharepoint{/ts}">
<span>{ts}Sharepoint{/ts}</span>
</a>
</li>
{/strip}{/capture}
<script type="text/javascript">
{literal}
cj(function() {
cj('li.crm-summary-block').after('{/literal}{$sharepoint_button}{literal}');
});
{/literal}
</script>
\ No newline at end of file
{* HEADER *}
<div class="crm-block crm-form-block crm-sharepoint-form-block">
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
<div class="crm-section">
<div class="label">{$form.url.label}</div>
<div class="content">
{$form.url.html} <br />
<span class="description">{ts}The URL to your sharepoint. E.g. https://mysharepoint.sharepoint.com{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.site.label}</div>
<div class="content">{$form.site.html} <br />
<span class="description">{ts}The sharepoint site. Leave empty if you wish to use your main sharepoint site. E.g. /sites/mysubsite<br />
Example if the url to your site is https://example.sharepoint.com/sites/yoursubsite then https://exmaple.sharepoint.com is the url and sites/yoursubsite is the site.{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.username.label}</div>
<div class="content">{$form.username.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.password.label}</div>
<div class="content">{$form.password.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.library.label}</div>
<div class="content">{$form.library.html} <br />
<span class="description">{ts}The name of the library into which the document sets are stored.{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.contact_id_field_name.label}</div>
<div class="content">{$form.contact_id_field_name.html} <br />
<span class="description">{ts}Each document set is linked to a contact. The contact ID is stored in this field. You should create your field within sharepoint and link it to your contact documentset and case document set.{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.case_id_field_name.label}</div>
<div class="content">{$form.case_id_field_name.html} <br />
<span class="description">{ts}Each case document set is linked to a case. The case ID is stored in this field. You should create your field within sharepoint and link it to your case document set.{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.civicrm_link_field_name.label}</div>
<div class="content">{$form.civicrm_link_field_name.html} <br />
<span class="description">{ts}The name of the field which holds a link back to civicrm. You should create this field within sharepoint and link it to your contact document set and your case document set{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.title_field.label}</div>
<div class="content">{$form.title_field.html} <br />
<span class="description">{ts}The name of the title field of a folder (document set) in sharepoint. E.g. Title or Naam{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.contact_documentset_contenttype_id.label}</div>
<div class="content">{$form.contact_documentset_contenttype_id.html} <br />
<span class="description">{ts}The content type Id of the contact documentset. The contaent type Id starts with '0x0120D5.....'.
<br />You can create different document sets for cases and for contacts. If you want to use the same enter the same content type Id in both fields.{/ts}</span>
</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.case_documentset_contenttype_id.label}</div>
<div class="content">{$form.case_documentset_contenttype_id.html} <br />
<span class="description">{ts}The content type Id of the case documentset. The contaent type Id starts with '0x0120D5.....'.{/ts}
<br />You can create different document sets for cases and for contacts. If you want to use the same enter the same content type Id in both fields.</span>
</div>
<div class="clear"></div>
</div>
{* FOOTER *}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
</div>
<?xml version="1.0"?>
<menu>
<item>
<path>civicrm/admin/sharepoint</path>
<page_callback>CRM_Sharepoint_Form_Settings</page_callback>
<title>Sharepoint Settings</title>
<access_arguments>administer CiviCRM</access_arguments>
</item>
</menu>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment