Permalink
Browse files

Add menu hooks for the index / Dashboard, tasks page and plugin setti…

…ngs addon

add the Add on to the default setting page
add a yellow background to sub menus in timesheet and daily notes
Created the menu in x_ofuz_hooks_plugin.conf.inc.php

now need to write some documentation
  • Loading branch information...
1 parent 8d0aeb9 commit f98233b39bc85bddb1d6600c48056262b5e7c45c @philfree committed Jan 8, 2012
View
@@ -1077,226 +1077,7 @@ function eventAddTagMultiple(EventControler $event_controler) {
$_SESSION['tag_refresh_now'] = true;
}
- /**
- * eventGetForMailMerge
- * Get the list of contact for mailmerge
- * load in the current contact object the list of
- * selected contacts from the contacts.php
- * Then redirect to the contact_sendemail.php.
- */
- function eventGetForMailMerge(EventControler $event_controler) {
-
- $idcontacts = $event_controler->getParam("ck");
- $sql_in = "(";
- foreach($idcontacts as $idcontact) {
- $sql_in .= $idcontact.",";
- }
- $sql_in = substr($sql_in, 0, -1);
- $sql_in .= ")";
- $tag_search = $this->getSearchTags();
- if(is_array($tag_search) && count($tag_search > 0)){
- $_SESSION['searched_tags'] = $tag_search ;
- }
-
- $this->clearSearch();
- $this->setSqlQuery("SELECT * FROM contact WHERE idcontact in ".$sql_in);
- $event_controler->goto = "contact_sendemail.php";
- $event_controler->setDisplayNext(new Display("contact_sendemail.php"));
- }
-
- /**
- * eventSendMessage
- * This will send a message to one or multiple users.
- * @todo Problem with the getBodyText(true) it returns some bad encoding and no newline, could also be the problem in the template it self...
- */
-
- function eventSendMessage(EventControler $event_controler) {
- $this->setLog("\n eventSendMessage (".date("Y/m/d H:i:s").")");
- if ($event_controler->send == _('Send Mailing')) {
- $email_template = $_SESSION['do_message'];
- $email_template->setApplyFieldFormating(false);
- $this->setLog("\n EmailTemplate id: ".$email_template->getPrimarykeyValue());
- $this->setLog("\n SQL:".$this->getSqlQuery());
- $this->query();
- $this->setLog("\n ".$this->getNumRows()." contacts to send the message");
-
- while ($this->next()) {
- set_time_limit(500);
- if($event_controler->unsubtag == 'on'){ // set unsubscribe auto-responder list
- $values_contact = $this->getValues();
- $tag_values = array("flag"=>"unsubscribe_autoresponder","idtag"=>$event_controler->idtag);
- $values = array_merge($values_contact,$tag_values);
- $message = $this->sendMessage($email_template, $values);
- }else{
- $message = $this->sendMessage($email_template, $this->getValues());
- }
- if ($this->last_message_sent) {
- //$do_contact_notes->iduser = $_SESSION['do_User']->iduser;
- $do_contact_notes = new ContactNotes();
- $do_contact_notes->iduser = $_SESSION['do_User']->iduser;
- //$do_contact_notes->note = '<b>'.$message->getSubject().'</b><br/>'.$message->getBodyText(true);
- //->getTemplateBodyHtml();
- $note_text = preg_replace('/^(.*?)<hr>.*$/','$1',str_replace("\n",'',$message->getBodyHtml(true)));
- $do_contact_notes->note = '<b>'.$message->getSubject().'</b><br/>'.$note_text;
- $do_contact_notes->date_added = date("Y-m-d");
- $do_contact_notes->idcontact = $this->getPrimaryKeyValue();
- $do_contact_notes->add();
-
-
- /*
- * Recording the messages sent by User
- */
- $msg_con = new sqlQuery($this->getDbCon());
- $sql_msg_check = "SELECT * FROM `message_usage` WHERE `iduser` = ".$_SESSION['do_User']->iduser." AND `date_sent` = '".date("Y-m-d")."'";
- $msg_con->query($sql_msg_check);
- if($msg_con->getNumRows()) {
- $msg_con->fetch();
- $sql_con_update = new sqlQuery($this->getDbCon());
- $sql_msg_update = "UPDATE `message_usage` SET `num_msg_sent` = num_msg_sent+1 WHERE `idmessage_usage` = ".$msg_con->getData("idmessage_usage");
- $sql_con_update->query($sql_msg_update);
- } else {
- $sql_con_ins = new sqlQuery($this->getDbCon());
- $sql_msg_ins = "INSERT INTO `message_usage`(iduser,date_sent,num_msg_sent) VALUES(".$_SESSION['do_User']->iduser.",'".date("Y-m-d")."',1)";
- $sql_con_ins->query($sql_msg_ins);
- }
-
-
-
- }
- }
- } else { $event_controler->goto = "contacts.php"; }
- $this->clearSearch();
- $this->free();
- }
-
- /**
- * eventSendNote
- * This event is triggered when adding a note in a contact
- * It will send a copy of the note the contact.
- */
-
- function eventSendNote(EventControler $event_controler) {
- $send_note = $event_controler->fields['send_email'];
- $this->setLog("eventSendNote starting (".date("Y/m/d H:i:s").")");
- $this->setLog("do we send a message:".$send_note);
- if ($send_note == "y") {
- $template = new EmailTemplate();
- $template->setSubject("{Ofuz} Message: ".substr($event_controler->fields['note'], 0, 70)."...")
- ->setMessage($event_controler->fields['note']);
- $this->sendMessage($template);
- }
- }
-
- /**
- * sendMessage
- * This abstract the message sending so we use a general function
- * that will send email or facebook or twitter based on the user
- * preferences and settings.
- * its possible to generate an EmailTemplate on the fly with no records in the DB
- * Here is an exemple:
- * <code php>
- * $do_template = new EmailTemplate();
- * $do_template->senderemail = "philippe@sqlfusion.com";
- * $do_template->sendername = "Philippe Lewicki";
- * $do_template->subject = "This is an example";
- * $do_template->bodytext = "This is the content of the sample message";
- * $do_template->bodyhtml = nl2br($do_template->bodytext);
- * </code>
- *
- * An other example more OO / stylish
- * <code php>
- * $do_template = new EmailTemplate();
- * $do_template->setFrom("phil@sqlfusion.com", "Philippe Lewicki")
- * ->setSubject("This is an example")
- * ->setMessage("This is the content of the sample message");
- * </code>
- * setFrom() is optional, if not provided it takes the do_User data
- *
- * Then send the message with: $contact->sendMessage($do_template);
- *
- * If you used a saved EmailTemplate like
- * $do_template = new EmailTemplate("my template in email template table");
- * and want the sender to be the currently signed in user, make sure the senderemail field
- * is empty.
- *
- * @param $message an EmailTemplate object.
- * @param $values an array with values to merge, optional.
- *
- */
- function sendMessage($template, $values=Array()) {
- if (!is_object($template)) { return false; }
- if (empty($values)) { $values = $this->getValues(); }
- $this->last_message_sent = false;
- $do_contact_email = $this->getChildContactEmail();
- $email_to = $do_contact_email->getDefaultEmail();
- $this->setLog("\n Sending message to:".$email_to);
- $contact_link = '<a href="/Contact/'.$this->idcontact.'">'.$this->firstname.' '.$this->lastname.'</a>';
- if (strlen($email_to) > 4) {
- if ($this->email_optout != 'y') {
- $emailer = new Ofuz_Emailer('UTF-8');
- if (strlen($template->senderemail) == 0) {
- $template->setFrom($_SESSION['do_User']->email, $_SESSION['do_User']->getFullName());
- }
- $emailer->setEmailTemplate($template);
- $emailer->mergeArrayWithFooter($values);
- $emailer->addTo($email_to);
- $this->last_message_sent = true;
- return $emailer->send();
- } else {
- $_SESSION['in_page_message'] .= _("<br>".$contact_link." has opt-out and will not receive this email");
- }
- } elseif (strlen($this->tw_user_id) > 0) {
- // send direct message using twitter api.
- try{
- $do_twitter = new OfuzTwitter();
- $tw_config = $do_twitter->getTwitterConfig();
- $serialized_token = $do_twitter->getAccessToken();
- $token = unserialize($serialized_token);
- $ofuz_twitter = new Ofuz_Service_Twitter($token->getParam('user_id'), $tw_config, $token);
- $followers = $ofuz_twitter->userFollowers(false);
- if (is_object($followers) && count($followers->user) > 0) {
- foreach ($followers->user as $follower) {
- if ($follower->id == $this->tw_user_id) {
- $merge = new MergeString();
- $message = $merge->withArray($template->bodytext, $values);
- $ofuz_twitter->directMessageNew($this->tw_user_id, $message);
- $do_contact_notes = new ContactNotes();
- $do_contact_notes->iduser = $_SESSION['do_User']->iduser;
- $do_contact_notes->note = $message;
- $do_contact_notes->date_added = date('Y-m-d');
- $do_contact_notes->idcontact = $this->idcontact;
- $do_contact_notes->add();
- return true;
- }
- }
- }
- $_SESSION['in_page_message'] .= _("<br>Notification can not be sent to ".$contact_link);
- }catch(Exception $e){
- $_SESSION['in_page_message'] .= _("<br>Notification can not be sent to ".$contact_link);
- }
- } elseif ($this->fb_userid && $_SESSION["do_User"]->global_fb_connected) {
- // send message using facebook api.
- include_once 'facebook_client/facebook.php';
- include_once 'class/OfuzFacebook.class.php';
- $facebook = new Facebook(FACEBOOK_API_KEY, FACEBOOK_APP_SECRET);
- try{
- $msg = _(' has sent the following message using ofuz').'<br />';
- $msg .= '<b>'.$template->subject.'</b><br/>'.$template->bodyhtml;
- $facebook->api_client->notifications_send($this->fb_userid, $msg, 'user_to_user');
- //$this->last_message_sent = true;
- }catch(Exception $e){
- $_SESSION['in_page_message'] .= _("<br>Notification can not be sent to ".$contact_link);
- }
- } else {
- $_SESSION['in_page_message'] .= _("<br>".$contact_link." doesn't have a valid email address, facebook account, or twitter id.");
- }
-
- if ($this->last_message_sent) {
- return true;
- } else {
- return false;
- }
- }
+
function eventdelContactTagById(EventControler $event_controler){
$do_tag =new Tag();
View
@@ -335,14 +335,14 @@ function loadContacts() {
<?php
foreach ($GLOBALS['cfg_plugin_eventmultiple_placement']['contacts'] as $event_multiple_plugin) {
if (strlen($event_multiple_plugin['event'])>0) {
- echo "\n<br>"._('or ').'<span class="redlink"><a href="#" onclick="eventActionMultiple(\''.$event_multiple_plugin['event'].'\',\''._($event_multiple_plugin['confirm']).'\');return false;">'._($event_multiple_plugin['name']).'</a></span> ';
+ echo "\n<br>"._('or ').'<span class="redlink"><a href="#" onclick="eventActionMultiple(\''.$event_multiple_plugin['event'].'\',\''.$event_multiple_plugin['confirm'].'\');return false;">'._($event_multiple_plugin['name']).'</a></span> ';
} elseif (strlen($event_multiple_plugin['action'])>0) {
echo "\n<br>"._('or ').
'<span class="redlink">
<a href="#" onclick="actionMultiple(\''.
$event_multiple_plugin['action'].
'\',\''.
- _($event_multiple_plugin['confirm']).
+ $event_multiple_plugin['confirm'].
'\');return false;">'._($event_multiple_plugin['name']).'</a></span> ';
}
View
@@ -33,14 +33,17 @@
$msg->getMessageFromContext("daily notes");
echo $msg->displayMessage();
?>
- <table class="mainheader pad20" width="100%">
- <tr>
- <td><span class="headline14"><?php echo _('Daily Notes & Discussion');?></span></td>
- <td align="right">&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php"><?php echo _('Work Feed'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="daily_notes.php"><?php echo _('Notes & Discussion'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="timesheet.php"><?php echo _('Timesheet'); ?></a></td>
- </tr>
- </table>
-
-
+ <div class="mainheader">
+ <div class="pad20">
+ <span class="headline14"><?php echo _('Daily Notes & Discussion');?></span>
+ <?php
+ if (is_object($GLOBALS['cfg_submenu_placement']['daily_notes'] ) ) {
+ echo $GLOBALS['cfg_submenu_placement']['daily_notes']->getMenu();
+ }
+ ?>
+ </div>
+ </div>
+ <div class="sub_action_menu">
<?php
if(!is_object($_SESSION['adm_project'])){
@@ -93,7 +96,7 @@
$e_user_search_false->addParam('goto',$_SERVER['PHP_SELF']);
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$e_user_search_false->getLink(_("All Users"));
}
- echo '<div class="dottedline"></div>
+ echo '</div><div class="dottedline"></div>
<div class="headline_fuscia">'._('Projects').'</div>
';
while($_SESSION['adm_project']->next()){
@@ -139,7 +142,7 @@
}
}
}
-
+/** lets hide this for now we will move it to its own page.
$do_adm_contacts = new ContactNotes();
$do_adm_contact_notes = new ContactNotes();
$do_contact = new Contact();
@@ -164,7 +167,7 @@
}
}
}
-
+ **/
?>
<div class="dottedline"></div>
View
@@ -29,8 +29,21 @@
<div class="settingsbottom"></div></div>
</td><td class="layout_rcolumn">
<div class="banner60 pad020 text32"><?php echo _('Add-On'); ?></div>
- <div class="banner50 pad020 text16 fuscia_text"><?php echo _('Add-On Settings'); ?></div>
+ <div class="mainheader">
+ <div class="pad20">
+ <span class="headline14"><?php
+ echo _('Enable Add-On');
+ ?></span>
+ <?php
+ if (is_object($GLOBALS['cfg_submenu_placement']['settings_plugin'] ) ) {
+ echo $GLOBALS['cfg_submenu_placement']['settings_plugin']->getMenu();
+ }
+ ?>
+ </div>
+ </div>
+
<div class="contentfull">
+ <div class="spacerblock_20"></div>
<?php
if($_SESSION['in_page_message'] != ''){
echo '<div style="margin-left:0px;">';
@@ -54,7 +67,7 @@
}*/
- echo '<b>'._('Add-On').':</b><br/><br/>';
+ // echo '<b>'._('Add-On').':</b><br/><br/>';
$do_plugin_enable = new PluginEnable();
$do_dynamic_button = new DynamicButton();
@@ -160,7 +160,7 @@
include_once("class/OfuzBeanstalkd.class.php");
- define('RADRIA_LOG_RUN_OFUZ', false);
+ define('RADRIA_LOG_RUN_OFUZ', true);
define('OFUZ_LOG_RUN_TAG', false);
define('OFUZ_LOG_RUN_CONTACT', false);
define('OFUZ_LOG_RUN_WEBFORM', false);
@@ -182,7 +182,7 @@ h2.headline { padding: 20px 0; position: relative; padding: 20px 0; font-size:
.left_text { text-align: left; }
.right_text { text-align: right; }
-.message { position: relative; margin: 2px 5px 5px 0; padding: 20px 20px 12px 20px; background-color: #fff6c1; background-image: url("/images/welcomebannerbg.png"); background-repeat: repeat-x; border-top: solid 1px #ededed; border-bottom: solid 2px #ededed; }
+.message { position: relative; margin: 2px 20px 5px 0; padding: 20px 20px 12px 20px; background-color: #fff6c1; background-image: url("/images/welcomebannerbg.png"); background-repeat: repeat-x; border-top: solid 1px #ededed; border-bottom: solid 2px #ededed; }
.messageshadow { margin: 2px 0; background-color: #ffffcc; border-right: solid 2px #b28c6e; border-bottom: solid 2px #b28c6e; margin-right: 20px; }
.messageshadow_95 { width: 95%; margin: 2px 0; background-color: #ffffcc; border-right: solid 2px #b28c6e; border-bottom: solid 2px #b28c6e; }
@@ -253,6 +253,13 @@ background-color: #135e91;
font-size: 12px;
}
+.sub_action_menu {
+ padding: 6px 20px;
+ margin: 0px 20px 0px 0px;
+ background-color: #ffffcc;
+ border-top: solid 1px #ffa500;
+}
+
.text_black { color: #000000; }
.text_fuscia { color: #c52687; }
.text_gray { color: #666666; }
Oops, something went wrong.

0 comments on commit f98233b

Please sign in to comment.