コード例 #1
0
ファイル: WorkspaceTest.php プロジェクト: rambo/jackalope
 public function testGetNodeTypeManager()
 {
     $factory = new \Jackalope\Factory();
     $session = $this->getMock('Jackalope\\Session', array(), array($factory), '', false);
     $transport = $this->getMock('Jackalope\\Transport\\Davex\\Client', array(), array($factory, 'http://example.com'));
     $objManager = $this->getMock('Jackalope\\ObjectManager', array(), array($factory, $session, $transport, 'a3lkjas'), '', false);
     $name = 'a3lkjas';
     $w = new Workspace($factory, $session, $objManager, $name);
     $ntm = $w->getNodeTypeManager();
     $this->assertType('Jackalope\\NodeType\\NodeTypeManager', $ntm);
 }
コード例 #2
0
ファイル: WorkspaceTest.php プロジェクト: ruflin/jackalope
 public function testGetNodeTypeManager()
 {
     $factory = new Factory();
     $session = $this->getMock('Jackalope\\Session', array(), array($factory), '', false);
     $transport = $this->getMockBuilder('Jackalope\\Transport\\TransportInterface')->disableOriginalConstructor()->getMock(array());
     $objManager = $this->getMock('Jackalope\\ObjectManager', array(), array($factory, $session, $transport, 'a3lkjas'), '', false);
     $name = 'a3lkjas';
     $w = new Workspace($factory, $session, $objManager, $name);
     $ntm = $w->getNodeTypeManager();
     $this->assertInstanceOf('Jackalope\\NodeType\\NodeTypeManager', $ntm);
 }
コード例 #3
0
 /**
  * WorkspaceProjects constructor.
  *
  * @param array $properties
  */
 public function __construct(array $properties)
 {
     parent::__construct($properties);
     $this->uri = str_replace('{active}', $this->active ? 'true' : 'false', $this->uri);
     $this->uri = str_replace('{actual_hours}', $this->actualHours ? 'true' : 'false', $this->uri);
     $this->uri = str_replace('{only_templates}', $this->onlyTemplates ? 'true' : 'false', $this->uri);
 }
コード例 #4
0
 function updateWorkspace($workspaceId, $workspaceParamsArray)
 {
     $workspaceParamsArray = $this->labelParamKeys('Workspace', $workspaceParamsArray);
     $updatePath = Workspace::getResourcePath($workspaceId);
     $curl = $this->createPutRequest($updatePath, $this->loginInfo, $workspaceParamsArray);
     $response = curl_exec($curl);
     return $response;
 }
コード例 #5
0
 function __construct($sac_theurl, $sac_newstatus, $sac_thexml = '')
 {
     // Store the URL
     $this->sac_url = $sac_theurl;
     // Store the status
     $this->sac_status = $sac_newstatus;
     // Store the raw xml
     $this->sac_xml = $sac_thexml;
     // Store the status message
     switch ($this->sac_status) {
         case 200:
             $this->sac_statusmessage = "OK";
             break;
         case 401:
             $this->sac_statusmessage = "Unauthorized";
             break;
         case 404:
             $this->sac_statusmessage = "Service document not found";
             break;
         default:
             $this->sac_statusmessage = "Unknown error (status code " . $this->sac_status . ")";
             break;
     }
     // Parse the xml if there is some
     if ($sac_thexml != '') {
         $sac_xml = @new SimpleXMLElement($sac_thexml);
         $sac_ns = $sac_xml->getNamespaces(true);
         if (!isset($sac_ns['sword'])) {
             $sac_ns['sword'] = 'http://purl.org/net/sword/terms/';
         }
         $this->sac_version = $sac_xml->children($sac_ns['sword'])->version;
         $this->sac_verbose = $sac_xml->children($sac_ns['sword'])->verbose;
         $this->sac_noop = $sac_xml->children($sac_ns['sword'])->noOp;
         $this->sac_maxuploadsize = $sac_xml->children($sac_ns['sword'])->maxUploadSize;
         // Build the workspaces
         $sac_ws = @$sac_xml->children($sac_ns['app'])->workspace;
         foreach ($sac_ws as $sac_workspace) {
             $sac_newworkspace = new Workspace($sac_workspace->children($sac_ns['atom'])->title);
             $sac_newworkspace->buildhierarchy(@$sac_workspace->children($sac_ns['app']), $sac_ns);
             $this->sac_workspaces[] = $sac_newworkspace;
         }
     }
 }
コード例 #6
0
 /**
  * Given a node, returns an array of all the components inside that node. If
  * the node is a component itself, returns an array of only one element.
  *
  * @param DomNode $node
  * @return array
  * @static
  * @access public
  */
 public static function get_components_from_node($node)
 {
     $result = array();
     foreach (self::$components as $shortname => $class) {
         $matched_node = $class::node_matches($node);
         // Nothing matched? Skip to next match.
         if (!$matched_node) {
             continue;
         }
         // Did we match several components? If so, a hash is returned. Both the
         // body and heading components can returns this, in the case they find
         // non-markdown-able elements inside.
         if (is_array($matched_node)) {
             foreach ($matched_node as $base_component) {
                 $result[] = self::get_component($base_component['name'], $base_component['value']);
             }
             return $result;
         }
         // We matched a single node
         $html = $node->ownerDocument->saveXML($matched_node);
         $result[] = self::get_component($shortname, $html);
         return $result;
     }
     // Nothing found. Maybe it's a container element?
     if ($node->hasChildNodes()) {
         foreach ($node->childNodes as $child) {
             $result = array_merge($result, self::get_components_from_node($child, $node));
         }
         // Remove all nulls from the array
         $result = array_filter($result);
     }
     // If nothing was found, log this as a component error by recording the node name.
     // Only record components with a tagName since otherwise there is nothing to report.
     // Others nodes without a match are almost always just stray empty text nodes
     // that are always safe to remove. Paragraphs should also be ignored for this reason.
     if (empty($result) && (!empty($node->tagName) && 'p' !== $node->tagName)) {
         self::$workspace->log_error('component_errors', $node->tagName);
     }
     return $result;
 }
コード例 #7
0
 /**
  * Clean up the current workspace.
  *
  * @access private
  */
 private function clean_workspace()
 {
     $this->workspace->clean_up();
 }
コード例 #8
0
 /**
  * Calls the current workspace bundle_source method to allow for
  * different implementations of the bundling technique.
  *
  * @param string $filename  The name of the file to be created
  * @param string $source    The path or URL of the resource which is going to
  *                          be bundled
  */
 protected function bundle_source($filename, $source)
 {
     $this->workspace->bundle_source($filename, $source);
 }
コード例 #9
0
ファイル: Workspace.php プロジェクト: vojtajina/sitellite
 /**
  * Creates an "in response to" HTML table row for display
  * in messages that are responses to another message, specified by
  * the $id parameter.  $current is the id of the current message.
  * 
  * @access	public
  * @param	integer	$id
  * @param	integer	$current
  * @return	string
  * 
  */
 function response($id, $current)
 {
     if ($id > 0) {
         global $intl, $db;
         $out = '<tr><td class="tinted">' . $intl->get('In Response To') . '</td><td class="odd">';
         $row = $db->fetch('select subject from sitellite_message where id = ?', $id);
         if (is_object($row)) {
             $out .= '<a href="readMessage.php?id=' . $id . '">' . $row->subject . '</a>';
         } else {
             $out .= '<a href="readMessage.php?id=' . $id . '">' . $intl->get('Message Number') . ' ' . $id . '</a>';
         }
         $out .= ' &nbsp; [ <a href="readMessage.php?view=thread&id=' . $id . '">' . $intl->get('Read Thread') . '</a> ]';
         return $out . '</td></tr>';
     } elseif ($responses = Workspace::isThread($current, $id)) {
         global $intl;
         return '<tr><td class="tinted">' . $intl->get('Responses') . '</td><td class="odd">' . $responses . ' &nbsp; [ <a href="readMessage.php?view=thread&id=' . $current . '">' . $intl->get('Read Thread') . '</a> ]</td></tr>';
     } else {
         return '';
     }
 }
コード例 #10
0
ファイル: user.php プロジェクト: smith46102/koda
 /**
  * Get user's workspace
  *
  * @return \Models\Workspace
  */
 public function getWorkspace()
 {
     if ($this->workspace) {
         return Workspace::get($this->workspace);
     }
     return null;
 }
コード例 #11
0
 public function testGetNodeTypeManager()
 {
     $w = new Workspace($this->factory, $this->session, $this->om, $this->name);
     $ntm = $w->getNodeTypeManager();
     $this->assertInstanceOf('Jackalope\\NodeType\\NodeTypeManager', $ntm);
 }
コード例 #12
0
ファイル: index.php プロジェクト: vojtajina/sitellite
    $res = $msg->get($cgi->id);
}
if (!$res) {
    page_title(intl_get('Reading Message'));
    echo '<p>Error: ' . $msg->error . '</p>';
    return;
}
if ($cgi->category == 'Sent') {
    $res->category = 'Sent';
} elseif ($cgi->category == 'Trash') {
    $res->category = 'Trash';
} elseif ($res->category == '') {
    $res->category = 'Inbox';
}
page_title(intl_get('Reading Message') . ': ' . $res->subject);
$res->response_subject = Workspace::createResponseSubject($res->subject);
$list = $msg->getRecipients($cgi->id);
if (!$list) {
    $user_list = array();
    $recipients = array(session_username());
} else {
    $user_list = array();
    $recipients = array();
    foreach ($list as $user) {
        if ($user->user != $res->from_user) {
            $recipients[] = $user->user;
        }
        if ($user->user == session_username()) {
            continue;
        }
        if ($user->type == 'email') {
コード例 #13
0
 /**
  * WorkspaceTasks constructor.
  *
  * @param array $properties
  */
 public function __construct(array $properties)
 {
     parent::__construct($properties);
     $this->uri = str_replace('{active}', $this->active ? 'true' : 'false', $this->uri);
 }
コード例 #14
0
 /**
  * Returns the path of this Release.
  *
  * @return string
  */
 public function getPath()
 {
     return sprintf('%s/%s', $this->workspace->getReleasesDirectory(), $this->getVersion());
 }