[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/common/tracker ArtifactMessage.class, 1.1, 1.2
From: |
tperdue |
Subject: |
[Gforge-commits] gforge/common/tracker ArtifactMessage.class, 1.1, 1.2 |
Date: |
Sat, 28 Feb 2004 15:44:16 -0600 |
Update of /cvsroot/gforge/gforge/common/tracker
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/common/tracker
Modified Files:
ArtifactMessage.class
Log Message:
enable ArtifactMessage
Index: ArtifactMessage.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/tracker/ArtifactMessage.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ArtifactMessage.class 28 Feb 2004 14:11:52 -0000 1.1
+++ ArtifactMessage.class 28 Feb 2004 21:44:13 -0000 1.2
@@ -79,45 +79,57 @@
/**
* create - create a new item in the database.
*
- * @param string Item name.
- * @param int User_id of assignee.
+ * @param string Body.
+ * @param string email of submitter (obsolete?).
* @return id on success / false on failure.
- * /
- function create($name, $auto_assign_to) {
+ */
+ function create($body,$by=false) {
global $Language;
- //
- // data validation
- //
- if (!$name || !$auto_assign_to) {
-
$this->setError($Language->getText('artifact_category','required_fields'));
- return false;
- }
- if (!$this->Artifact->userIsAdmin()) {
- $this->setPermissionDeniedError();
+ if (!$body) {
+ $this->setMissingParamsError();
return false;
}
- $sql="INSERT INTO artifact_category
(group_artifact_id,category_name,auto_assign_to)
- VALUES
('".$this->Artifact->getID()."','".htmlspecialchars($name)."','$auto_assign_to')";
- $result=db_query($sql);
+ if (session_loggedin()) {
+ $user_id=user_getid();
+ $user =& user_get_object($user_id);
+ if (!$user || !is_object($user)) {
+ $this->setError('ERROR - Logged In User Bug
Could Not Get User Object');
+ return false;
+ }
+
$body=$Language->getText('tracker_artifact','logged_in_yes')."
\nuser_id=$user_id\n\n".$body;
- if ($result && db_affected_rows($result) > 0) {
- $this->clearError();
- return true;
+ // we'll store this email even though it will likely
never be used -
+ // since we have their correct user_id, we can join
the USERS table to get email
+ $by=$user->getEmail();
} else {
+
$body=$Language->getText('tracker_artifact','logged_in_no')." \n\n".$body;
+ $user_id=100;
+ if (!$by || !validate_email($by)) {
+ $this->setMissingParamsError();
+ return false;
+ }
+ }
+
+ $sql="insert into artifact_message
(artifact_id,submitted_by,from_email,adddate,body)
+ VALUES ('". $this->getID() ."','$user_id','$by','".
time() ."','". htmlspecialchars($body). "')";
+ $res = db_query($sql);
+
+ if (!$res) {
$this->setError(db_error());
return false;
+ } else {
+ $id=db_insertid($res,'artifact_message','id');
}
-/*
- //
- // Now set up our internal data structures
- //
- if (!$this->fetchData($id)) {
- return false;
- }
-*/
+ //
+ // Now set up our internal data structures
+ //
+ if (!$this->fetchData($id)) {
+ return false;
+ }
+ return $id;
}
/**
@@ -182,10 +194,6 @@
return $this->data_array['user_id'];
}
-//TODO email
-//user_name
-//realname
-
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/common/tracker ArtifactMessage.class, 1.1, 1.2,
tperdue <=
- Prev by Date:
[Gforge-commits] gforge/www/soap index.php,NONE,1.1
- Next by Date:
[Gforge-commits] gforge/www/soap/common group.php, NONE, 1.1 user.php, NONE, 1.1
- Previous by thread:
[Gforge-commits] gforge/www/soap index.php,NONE,1.1
- Next by thread:
[Gforge-commits] gforge/www/soap/common group.php, NONE, 1.1 user.php, NONE, 1.1
- Index(es):