示例#1
0
 function aclAjaxBlock($msg)
 {
     $objResponse = new JAXResponse();
     $title = XiptText::_('CC PROFILE VIDEO');
     $objResponse->addScriptCall('cWindowShow', '', $title, 430, 80);
     return parent::aclAjaxBlock($msg, $objResponse);
 }
示例#2
0
 public function ajaxAddFeatured($memberId)
 {
     $filter = JFilterInput::getInstance();
     $memberId = $filter->clean($memberId, 'int');
     $objResponse = new JAXResponse();
     CFactory::load('helpers', 'owner');
     $my = CFactory::getUser();
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     if (COwnerHelper::isCommunityAdmin()) {
         $model = CFactory::getModel('Featured');
         if (!$model->isExists(FEATURED_USERS, $memberId)) {
             CFactory::load('libraries', 'featured');
             $featured = new CFeatured(FEATURED_USERS);
             $member = CFactory::getUser($memberId);
             $featured->add($memberId, $my->id);
             $html = JText::sprintf('COM_COMMUNITY_MEMBER_IS_FEATURED', $member->getDisplayName());
         } else {
             $html = JText::_('COM_COMMUNITY_USER_ALREADY_FEATURED');
         }
     } else {
         $html = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION');
     }
     $actions = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '"/>';
     $objResponse->addScriptCall('cWindowAddContent', $html, $actions);
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_FEATURED));
     return $objResponse->sendResponse();
 }
示例#3
0
 public function render()
 {
     // When dispatch() is called from JApplication,
     // the rendered content is immediately stored
     // in the component buffer, so instead of rerendering
     // our component, we'll extract it out from the buffer.
     $this->content = $this->_buffer['component'][''];
     unset($this->_buffer);
     // and send the document back within jax response.
     $objResponse = new JAXResponse();
     $objResponse->addScriptCall('__callback', $this);
     return $objResponse->sendResponse();
 }
示例#4
0
 public function ajaxResetPrivacy($photoPrivacy = 0, $profilePrivacy = 0, $friendsPrivacy = 0)
 {
     $response = new JAXResponse();
     CFactory::load('helpers', 'owner');
     if (!COwnerHelper::isCommunityAdmin()) {
         $response->addScriptCall(JText::_('COM_COMMUNITY_NOT_ALLOWED'));
         return $response->sendResponse();
     }
     $model = $this->getModel('Configuration');
     $model->updatePrivacy($photoPrivacy, $profilePrivacy, $friendsPrivacy);
     $response->addAssign('privacy-update-result', 'innerHTML', JText::_('COM_COMMUNITY_FRONTPAGE_ALL_PRIVACY_RESET'));
     return $response->sendResponse();
 }
示例#5
0
 public function ajaxSendMessage($title, $message, $limit = 1)
 {
     if (!$title || !$message) {
         $response = new JAXResponse();
         $response->addScriptCall("joms.jQuery('#error').remove();");
         $response->addScriptCall('joms.jQuery("#messaging-form").prepend("<p id=error style=color:red>Error:Title or Message cannot be empty</p>");');
         return $response->sendResponse();
     }
     $limitstart = $limit - 1;
     $model =& $this->getModel('users');
     $userId = $model->getSiteUsers($limitstart, 1);
     $response = new JAXResponse();
     $response->addScriptCall('joms.jQuery("#messaging-form").hide();');
     $response->addScriptCall('joms.jQuery("#messaging-result").show();');
     $user = CFactory::getUser($userId);
     $my =& JFactory::getUser();
     if (!empty($userId)) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'notification.php';
         CNotificationLibrary::add('etype_system_messaging', $my->id, $user->id, $title, $message);
         $response->addScriptCall('joms.jQuery("#no-progress").css("display","none");');
         $response->addScriptCall('joms.jQuery("#progress-status").append("<div>' . JText::sprintf('Sending message to <strong>%1$s</strong>', str_replace(array("\r", "\n"), ' ', $user->getDisplayname())) . '<span style=\\"color: green;margin-left: 5px;\\">' . JText::_('COM_COMMUNITY_SUCCESS') . '</span></div>");');
         $response->addScriptCall('sendMessage', $title, $message, $limit + 1);
     } else {
         $response->addScriptCall('joms.jQuery("#progress-status").append("<div style=\\"font-weight:700;\\">' . JText::_('COM_COMMUNITY_UPDATED') . '</div>");');
     }
     return $response->sendResponse();
 }
示例#6
0
 public function ajaxEmailPage($uri, $emails, $message = '')
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     $emails = $filter->clean($emails, 'string');
     $message = $filter->clean($message, 'string');
     $message = stripslashes($message);
     $mainframe =& JFactory::getApplication();
     $bookmarks = CFactory::getBookmarks($uri);
     $mailqModel = CFactory::getModel('mailq');
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     if (empty($emails)) {
         $content = '<div>' . JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL') . '</div>';
         $actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
     } else {
         $emails = explode(',', $emails);
         $errors = array();
         // Add notification
         CFactory::load('libraries', 'notification');
         foreach ($emails as $email) {
             $email = JString::trim($email);
             CFactory::load('helpers', 'validate');
             if (!empty($email) && CValidateHelper::email($email)) {
                 $params = new CParameter('');
                 $params->set('uri', $uri);
                 $params->set('message', $message);
                 CNotificationLibrary::add('etype_system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
             } else {
                 // If there is errors with email, inform the user.
                 $errors[] = $email;
             }
         }
         if ($errors) {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
             foreach ($errors as $error) {
                 $content .= '<div style="font-weight:700;color: red;">' . $error . '</span>';
             }
             $actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
         } else {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS') . '</div>';
             $actions = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_DONE_BUTTON') . '"/>';
         }
     }
     $response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS'));
     $response->addScriptCall('cWindowAddContent', $content, $actions);
     return $response->sendResponse();
 }
示例#7
0
 function ajaxTogglePublish($id, $type)
 {
     $user =& JFactory::getUser();
     // @rule: Disallow guests.
     if ($user->get('guest')) {
         JError::raiseError(403, JText::_('CC ACCESS FORBIDDEN'));
         return;
     }
     $response = new JAXResponse();
     // Load the JTable Object.
     $row =& JTable::getInstance('MultiProfile', 'CTable');
     $row->load($id);
     $row->publish($row->id, (int) (!$row->published));
     $row->load($id);
     $image = $row->published ? 'publish_x.png' : 'tick.png';
     $view =& $this->getView('multiprofile', 'html');
     $html = $view->getPublish($row, 'published', 'multiprofile,ajaxTogglePublish');
     $response->addAssign($type . $id, 'innerHTML', $html);
     return $response->sendResponse();
 }
示例#8
0
文件: search.php 项目: bizanto/Hooked
 public function ajaxAddFeatured($memberId)
 {
     $objResponse = new JAXResponse();
     CFactory::load('helpers', 'owner');
     $my = CFactory::getUser();
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     if (COwnerHelper::isCommunityAdmin()) {
         $model = CFactory::getModel('Featured');
         if (!$model->isExists(FEATURED_USERS, $memberId)) {
             CFactory::load('libraries', 'featured');
             $featured = new CFeatured(FEATURED_USERS);
             $member = CFactory::getUser($memberId);
             $featured->add($memberId, $my->id);
             $objResponse->addAssign('cWindowContent', 'innerHTML', JText::sprintf('CC MEMBER IS FEATURED', $member->getDisplayName()));
         } else {
             $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC USER ALREADY FEATURED'));
         }
     } else {
         $objResponse->addAssign('cWindowContent', 'innerHTML', JText::_('CC NOT ALLOWED TO ACCESS SECTION'));
     }
     $buttons = '<input type="button" class="button" onclick="window.location.reload();" value="' . JText::_('CC BUTTON CLOSE') . '"/>';
     $objResponse->addScriptCall('cWindowActions', $buttons);
     return $objResponse->sendResponse();
 }
示例#9
0
 /**
  * Ajax functiion to handle ajax calls
  */
 public function ajaxPerformAction($actionId, $ignore = 0)
 {
     $objResponse = new JAXResponse();
     $output = '';
     // Require Jomsocial core lib
     require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
     $language = JFactory::getLanguage();
     $language->load('com_community', JPATH_ROOT);
     // Get the action data
     $action = JTable::getInstance('ReportsActions', 'CommunityTable');
     $action->load($actionId);
     // Get the report data
     $report = JTable::getInstance('Reports', 'CommunityTable');
     $report->load($action->reportid);
     $actions = '<input type="button" class="btn btn-inverse btn-mini pull-left" onclick="cWindowHide(); location.reload();" value="' . JText::_('COM_COMMUNITY_CLOSE') . '"/>';
     if ($ignore != 0) {
         $report->status = 2;
         $report->store();
         $output = JText::_('COM_COMMUNITY_REPORTS_IGNORED_MESSAGE');
         $objResponse->addAssign('cWindowContent', 'innerHTML', $output);
         $objResponse->addScriptCall('cWindowActions', $actions);
         return $objResponse->sendResponse();
     }
     $method = explode(',', $action->method);
     $args = explode(',', $action->parameters);
     if (is_array($method) && $method[0] != 'plugins') {
         $controller = JString::strtolower($method[0]);
         require_once JPATH_ROOT . '/components/com_community/controllers/controller.php';
         require_once JPATH_ROOT . '/components/com_community/controllers/' . $controller . '.php';
         $controller = JString::ucfirst($controller);
         $controller = 'Community' . $controller . 'Controller';
         $controller = new $controller();
         $output = call_user_func_array(array(&$controller, $method[1]), $args);
     } else {
         if (is_array($method) && $method[0] == 'plugins') {
             // Application method calls
             $element = JString::strtolower($method[1]);
             require_once CPluginHelper::getPluginPath('community', $element) . '/' . $element . '.php';
             $className = 'plgCommunity' . JString::ucfirst($element);
             $output = call_user_func_array(array($className, $method[2]), $args);
         }
     }
     $objResponse->addAssign('cWindowContent', 'innerHTML', $output);
     $objResponse->addScriptCall('cWindowActions', $actions);
     if ($report->status == 1) {
         $report->status = 0;
     } else {
         $report->status = 1;
     }
     $report->store();
     return $objResponse->sendResponse();
 }
示例#10
0
 function ajaxEditRelations($listing_id, $cat_id = '', $single_select = 0)
 {
     $objResponse = new JAXResponse();
     if (is_numeric($listing_id)) {
         JRequest::setVar('listing_id', $listing_id);
     }
     if ($cat_id) {
         JRequest::setVar('cat', $cat_id);
     }
     if ($single_select) {
         JRequest::setVar('ss', $single_select);
     }
     JRequest::setVar('view', 'edit');
     JFactory::getDocument()->setType('html');
     ob_start();
     $this->display();
     $html = ob_get_contents();
     ob_end_clean();
     $objResponse->addAssign('cWindowContent', 'innerHTML', $html);
     $objResponse->addScriptCall('cWindowResize', 395);
     $objResponse->addScriptCall('_initEditRelations', $listing_id, $cat_id, $single_select);
     return $objResponse->sendResponse();
 }
示例#11
0
 public function ajaxShowSaveForm()
 {
     CFactory::load('helpers', 'owner');
     require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
     if (!COwnerHelper::isCommunityAdmin()) {
         echo JText::_('CC RESTRICTED ACCESS');
         return;
     }
     $response = new JAXResponse();
     $args = func_get_args();
     if (!isset($args[0])) {
         $response->addScriptCall('alert', 'CC INVALID ID');
         return $resopnse->sendResponse();
     }
     $condition = $args[0];
     array_shift($args);
     $avatarOnly = $args[0];
     array_shift($args);
     $filters = $args;
     $menuTypes = MenusHelper::getMenuTypeList();
     $menuAccess = new stdClass();
     $menuAccess->access = 0;
     $tmpl = new CTemplate();
     $tmpl->set('condition', $condition);
     $tmpl->set('menuTypes', $menuTypes);
     $tmpl->set('menuAccess', $menuAccess);
     $tmpl->set('avatarOnly', $avatarOnly);
     $tmpl->set('filters', $filters);
     $html = $tmpl->fetch('ajax.memberlistform');
     $response->addAssign('cwin_logo', 'innerHTML', JText::_('CC SEARCH FILTER'));
     $response->addAssign('cWindowContent', 'innerHTML', $html);
     $action = '<button  class="button" onclick="cWindowHide();">' . JText::_('CC BUTTON CANCEL') . '</button>';
     $action .= '<button  class="button" onclick="joms.memberlist.submit();">' . JText::_('CC BUTTON SAVE') . '</button>';
     $response->addScriptCall('cWindowActions', $action);
     return $response->sendResponse();
 }
示例#12
0
 function ajaxSaveTemplateFile($templateName, $fileName, $fileData, $override)
 {
     $response = new JAXResponse();
     $filePath = COMMUNITY_BASE_PATH . DS . 'templates' . DS . JString::strtolower($templateName) . DS . JString::strtolower($fileName);
     if ($override) {
         $filePath = JPATH_ROOT . DS . 'templates' . DS . JString::strtolower($templateName) . DS . 'html' . DS . 'com_community' . DS . JString::strtolower($fileName);
     }
     jimport('joomla.filesystem.file');
     if (JFile::write($filePath, $fileData)) {
         $response->addScriptCall('joms.jQuery("#status").html("' . JText::sprintf('%1$s saved successfully.', $fileName) . '");');
         $response->addScriptCall('joms.jQuery("#status").attr("class","info");');
     } else {
         $response->addScriptCall('alert', JText::_('CC ERROR WHILE SAVING FILE PLEASE CHECK PERMISSIONS OF FILE'));
     }
     return $response->sendResponse();
 }
示例#13
0
 public function ajaxResetNotification($params)
 {
     $response = new JAXResponse();
     if (!COwnerHelper::isCommunityAdmin()) {
         $response->addAssign('notification-update-result', 'innerHTML', JText::_('COM_COMMUNITY_NOT_ALLOWED'));
         return $response->sendResponse();
     }
     $model = $this->getModel('Configuration');
     $model->updateNotification($params);
     $response->addAssign('notification-update-result', 'innerHTML', JText::_('COM_COMMUNITY_FRONTPAGE_ALL_NOTIFICATION_RESET'));
     $response->addScriptCall("joms.jQuery('#notification-update-result').parent().find('input').val('" . JText::_('COM_COMMUNITY_CONFIGURATION_PRIVACY_RESET_EXISTING_NOTIFICATION_BUTTON') . "');");
     return $response->sendResponse();
 }
示例#14
0
 function ajaxSendMessage($title, $message, $limit = 1)
 {
     $limitstart = $limit - 1;
     $model =& $this->getModel('users');
     $userId = $model->getSiteUsers($limitstart, 1);
     $response = new JAXResponse();
     $response->addScriptCall('joms.jQuery("#messaging-form").hide();');
     $response->addScriptCall('joms.jQuery("#messaging-result").show();');
     $user = CFactory::getUser($userId);
     $my =& JFactory::getUser();
     if (!empty($userId)) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'notification.php';
         CNotificationLibrary::add('system.messaging', $my->id, $user->id, $title, $message);
         $response->addScriptCall('joms.jQuery("#no-progress").css("display","none");');
         $response->addScriptCall('joms.jQuery("#progress-status").append("<div>' . JText::sprintf('Sending message to <strong>%1$s</strong>', $user->getDisplayname()) . '<span style=\\"color: green;margin-left: 5px;\\">' . JText::_('CC SUCCESS') . '</span></div>");');
         $response->addScriptCall('sendMessage', $title, $message, $limit + 1);
     } else {
         $response->addScriptCall('joms.jQuery("#progress-status").append("<div style=\\"font-weight:700;\\">' . JText::_('CC UPDATE COMPLETED') . '</div>");');
     }
     return $response->sendResponse();
 }
示例#15
0
 /**
  * 
  * @param type $coords
  */
 public function ajaxGetAddressFromCoords($coords)
 {
     $objResponse = new JAXResponse();
     $model = CFactory::getModel('activities');
     $user = CFactory::getUser();
     $locations = $model->getUserVisitedLocation($user->id);
     $address = array();
     /**
      * Get address from array of coors
      */
     $coords = array_filter($coords);
     foreach ($coords as $coord) {
         if (isset($coord[0]) && isset($coords[1])) {
             /* Get address from coords */
             $geoAddress = $this->_getAddressFromCoord($coord[0], $coord[1]);
             if ($geoAddress) {
                 /* Store array of address */
                 $address[] = array('lat' => $coord[0], 'lng' => $coord[1], 'name' => $geoAddress->formatted_address);
             }
         }
     }
     /**
      * Get address from database
      */
     if ($locations) {
         foreach ($locations as $location) {
             $address[] = array('lat' => $location->latitude, 'lng' => $location->longitude, 'name' => $location->location);
         }
     }
     /**
      * These address will use for auto complete
      */
     $address = array_filter($address);
     $objResponse->addScriptCall('joms.location.updateAddress', $address);
     /**
      * Do update init location
      * @todo We'll need find out which address is better for init
      */
     $objResponse->addScriptCall('joms.sharebox.location.initLocation', $address[0]['name'], $address[0]['lat'], $address[0]['lng']);
     /*  */
     $objResponse->sendResponse($locations);
 }
示例#16
0
文件: photos.php 项目: Jougito/DynWeb
    public function ajaxEditPhoto($id)
    {
        $response = new JAXResponse();
        $photo = JTable::getInstance('Photos', 'CommunityTable');
        $photo->load($id);
        //var_dump($photo);exit;
        ob_start();
        ?>
	<form name="editphoto" action="" method="post" id="editphoto">
		<table cellspacing="0" class="admintable" border="0" width="100%">
			<tbody>
			<tr>
				<td class="key"><?php 
        echo JText::_('COM_COMMUNITY_TITLE');
        ?>
</td>
				<td><input type="text" id="caption" name="caption" class="input text" value="<?php 
        echo $photo->caption;
        ?>
" style="width: 90%;"  maxlength="255"  /></tD>
			</tr>
			</tbody>
		</table>
		<input type="hidden" name="id" value="<?php 
        echo $photo->id;
        ?>
"/>
		<input type="hidden" name="option" value="com_community"/>
		<input type="hidden" name="task" value="savephotos"/>
		<input type="hidden" name="view" value="photos"/>
	</form>
	<?php 
        $contents = ob_get_contents();
        ob_end_clean();
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $action = '<input type="button" class="btn btn-small btn-primary pull-right" onclick="azcommunity.savePhoto();" name="' . JText::_('COM_COMMUNITY_SAVE') . '" value="' . JText::_('COM_COMMUNITY_SAVE') . '" />';
        $action .= '&nbsp;<input type="button" class="btn btn-small pull-left" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />';
        $response->addScriptCall('cWindowActions', $action);
        return $response->sendResponse();
    }
示例#17
0
 /**
  * Ajax functiion to handle ajax calls
  */
 function ajaxPerformAction($actionId)
 {
     $objResponse = new JAXResponse();
     $output = '';
     // Require Jomsocial core lib
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
     $language =& JFactory::getLanguage();
     $language->load('com_community', JPATH_ROOT);
     // Get the action data
     $action =& JTable::getInstance('ReportsActions', 'CommunityTable');
     $action->load($actionId);
     // Get the report data
     $report =& JTable::getInstance('Reports', 'CommunityTable');
     $report->load($action->reportid);
     $method = explode(',', $action->method);
     $args = explode(',', $action->parameters);
     if (is_array($method) && $method[0] != 'plugins') {
         $controller = JString::strtolower($method[0]);
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'controllers' . DS . 'controller.php';
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'controllers' . DS . $controller . '.php';
         $controller = JString::ucfirst($controller);
         $controller = 'Community' . $controller . 'Controller';
         $controller = new $controller();
         $output = call_user_func_array(array(&$controller, $method[1]), $args);
     } else {
         if (is_array($method) && $method[0] == 'plugins') {
             // Application method calls
             $element = JString::strtolower($method[1]);
             require_once JPATH_PLUGINS . DS . 'community' . DS . $element . '.php';
             $className = 'plgCommunity' . JString::ucfirst($element);
             $output = call_user_func_array(array($className, $method[2]), $args);
         }
     }
     $objResponse->addAssign('cWindowContent', 'innerHTML', $output);
     $report->status = 1;
     $report->store();
     return $objResponse->sendResponse();
 }
示例#18
0
 public function ajaxEmailPage($uri, $emails, $message = '')
 {
     $message = stripslashes($message);
     $mainframe =& JFactory::getApplication();
     $bookmarks = CFactory::getBookmarks($uri);
     $mailqModel = CFactory::getModel('mailq');
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     if (empty($emails)) {
         $content = '<div>' . JText::_('CC SHARE INVALID EMAIL') . '</div>';
         $buttons = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('CC BUTTON GO BACK') . '"/>';
     } else {
         $emails = explode(',', $emails);
         $errors = array();
         // Add notification
         CFactory::load('libraries', 'notification');
         foreach ($emails as $email) {
             $email = JString::trim($email);
             if (!empty($email) && preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})\$/i", $email)) {
                 $params = new JParameter('');
                 $params->set('uri', $uri);
                 $params->set('message', $message);
                 CNotificationLibrary::add('system.bookmarks.email', '', $email, JText::sprintf('CC SHARE EMAIL SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
             } else {
                 // If there is errors with email, inform the user.
                 $errors[] = $email;
             }
         }
         if ($errors) {
             $content = '<div>' . JText::_('CC EMAILS ARE INVALID') . '</div>';
             foreach ($errors as $error) {
                 $content .= '<div style="font-weight:700;color: red;">' . $error . '</span>';
             }
             $buttons = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('CC BUTTON GO BACK') . '"/>';
         } else {
             $content = '<div>' . JText::_('CC EMAIL SENT TO RECIPIENTS') . '</div>';
             $buttons = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('CC BUTTON DONE') . '"/>';
         }
     }
     $response->addAssign('cwin_logo', 'innerHTML', JText::_('CC SHARE THIS'));
     $response->addAssign('cWindowContent', 'innerHTML', $content);
     $response->addScriptCall('cWindowActions', $buttons);
     $response->addScriptCall('cWindowResize', 100);
     return $response->sendResponse();
 }
示例#19
0
    public function ajaxEditGroup($groupId)
    {
        $response = new JAXResponse();
        $model = $this->getModel('groupcategories');
        $categories = $model->getCategories();
        $group =& JTable::getInstance('Group', 'CTable');
        $group->load($groupId);
        $requireApproval = $group->approvals ? ' checked="true"' : '';
        $noApproval = !$group->approvals ? '' : ' checked="true"';
        // Escape the output
        CFactory::load('helpers', 'string');
        $group->name = CStringHelper::escape($group->name);
        $group->description = CStringHelper::escape($group->description);
        ob_start();
        ?>
<form name="editgroup" action="" method="post" id="editgroup">
<div style="background-color: #F9F9F9; border: 1px solid #D5D5D5; margin-bottom: 10px; padding: 5px;font-weight: bold;">
	<?php 
        echo JText::_('COM_COMMUNITY_GROUPS_EDIT_GROUP');
        ?>
</div>
<table cellspacing="0" class="admintable" border="0" width="100%">
	<tbody>
		<tr>
			<td class="key" valign="top"><?php 
        echo JText::_('COM_COMMUNITY_AVATAR');
        ?>
</td>
			<td valign="top">:</td>
			<td>
				<img width="90" src="<?php 
        echo $group->getThumbAvatar();
        ?>
" style="border: 1px solid #eee;"/>
			</td>
		</tr>
		<tr>
			<td class="key"><?php 
        echo JText::_('COM_COMMUNITY_PUBLISH_STATUS');
        ?>
</td>
			<td>:</td>
			<td>
				<input type="radio" name="published" value="1" id="publish" <?php 
        echo $group->published == '1' ? 'checked="true"' : '';
        ?>
/>
				<label for="publish"><?php 
        echo JText::_('COM_COMMUNITY_PUBLISH');
        ?>
</label>
				<input type="radio" name="published" value="0" id="unpublish" <?php 
        echo $group->published == '0' ? 'checked="true"' : '';
        ?>
>
				<label for="unpublish"><?php 
        echo JText::_('COM_COMMUNITY_UNPUBLISH');
        ?>
</label>
			</td>
		</tr>
		<tr>
			<td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUP_TYPE');
        ?>
</td>
			<td>:</td>
			<td>
				<input type="radio" name="approvals" value="1" id="approve" <?php 
        echo $group->approvals == '1' ? 'checked="true"' : '';
        ?>
/>
				<label for="approve"><?php 
        echo JText::_('COM_COMMUNITY_GROUP_PRIVATE');
        ?>
</label>
				<input type="radio" name="approvals" value="0" id="unapprove" <?php 
        echo $group->approvals == '0' ? 'checked="true"' : '';
        ?>
/>
				<label for="unapprove"><?php 
        echo JText::_('COM_COMMUNITY_PUBLIC');
        ?>
</label>
			</td>
		</tr>
		<tr>
			<td class="key"><?php 
        echo JText::_('COM_COMMUNITY_CATEGORY');
        ?>
</td>
			<td>:</td>
			<td>
				<select name="categoryid">
				<?php 
        for ($i = 0; $i < count($categories); $i++) {
            $selected = $group->categoryid == $categories[$i]->id ? ' selected="selected"' : '';
            ?>
						<option value="<?php 
            echo $categories[$i]->id;
            ?>
"<?php 
            echo $selected;
            ?>
><?php 
            echo $categories[$i]->name;
            ?>
</option>
				<?php 
        }
        ?>
				</select>
			</td>
		</tr>
		<tr>
			<td class="key"><?php 
        echo JText::_('COM_COMMUNITY_NAME');
        ?>
</td>
			<td>:</td>
			<td>
				<span>
					<input type="text" name="name" class="inputbox" value="<?php 
        echo $group->name;
        ?>
" style="width: 250px;" />
				</span>
			</td>
		</tr>
		<tr>
			<td class="key"><?php 
        echo JText::_('COM_COMMUNITY_DESCRIPTION');
        ?>
</td>
			<td>:</td>
			<td>
				<textarea name="description" style="width: 250px;" rows="5"><?php 
        echo $group->description;
        ?>
</textarea>
			</td>
		</tr>
	</tbody>
</table>
<input type="hidden" name="id" value="<?php 
        echo $group->id;
        ?>
" />
<input type="hidden" name="option" value="com_community" />
<input type="hidden" name="task" value="savegroup" />
<input type="hidden" name="view" value="groups" />
<?php 
        $contents = ob_get_contents();
        ob_end_clean();
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $action = '<input type="button" class="button" onclick="azcommunity.saveGroup();" name="' . JText::_('COM_COMMUNITY_SAVE') . '" value="' . JText::_('COM_COMMUNITY_SAVE') . '" />';
        $action .= '&nbsp;<input type="button" class="button" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />';
        $response->addScriptCall('cWindowActions', $action);
        return $response->sendResponse();
    }
示例#20
0
文件: photos.php 项目: Jougito/DynWeb
 public function ajaxCheckDefaultAlbum()
 {
     if ($this->blockUnregister()) {
         return;
     }
     $my = CFactory::getUser();
     $model = CFactory::getModel('photos');
     $objResponse = new JAXResponse();
     $album = $model->getDefaultAlbum($my->id);
     if ($album) {
         $objResponse->addScriptCall("joms.status.Creator['photo'].setURL", $album->id);
     } else {
         //create album
         $album = JTable::getInstance('Album', 'CTable');
         $album->load();
         $now = new JDate();
         $handler = $this->_getHandler($album);
         $newAlbum = true;
         $album->creator = $my->id;
         $album->created = $now->toSql();
         $album->name = JText::sprintf('COM_COMMUNITY_DEFAULT_ALBUM_CAPTION', $my->getDisplayName());
         $album->type = $handler->getType();
         $album->default = '1';
         $albumPath = $handler->getAlbumPath($album->id);
         $albumPath = CString::str_ireplace(JPATH_ROOT . '/', '', $albumPath);
         $albumPath = CString::str_ireplace('\\', '/', $albumPath);
         $album->path = $albumPath;
         $album->store();
         $objResponse->addScriptCall("joms.status.Creator['photo'].setURL", $album->id);
     }
     return $objResponse->sendResponse();
 }
示例#21
0
 /**
  * restrict blocked user to access owner details
  */
 public function ajaxBlockWarn()
 {
     $objResponse = new JAXResponse();
     $config = CFactory::getConfig();
     $html = JText::_('COM_COMMUNITY_YOU_HAD_BLOCKED_THIS_USER');
     $actions = '<form method="post" action="" style="float:right;">';
     $actions .= '<input type="button" class="button" onclick="cWindowHide();return false;" name="cancel" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '" />';
     $actions .= '</form>';
     $objResponse->addScriptCall('cWindowAddContent', $html, $actions);
     $objResponse->addScriptCall('joms.jQuery("#cwin_logo").html("' . $config->get('sitename') . '");');
     return $objResponse->sendResponse();
 }
示例#22
0
 public function ajaxGetStreamTitle($streamId)
 {
     $objResponse = new JAXResponse();
     $table = JTable::getInstance('Activity', 'CTable');
     $table->load($streamId);
     $objResponse->addScriptCall('joms.stream.showTextarea', $table->title, $streamId);
     $objResponse->sendResponse();
 }
示例#23
0
    /**
     * AJAX method to display the form
     * 
     * @param	int	fieldId	The fieldId that we are editing
     * @param	boolean	isGroup	Determines whether the current field is a group
     * 
     * @return	JAXResponse object	Azrul's AJAX Response object
     **/
    function ajaxEditField($fieldId, $isGroup = false)
    {
        $user =& JFactory::getUser();
        CFactory::load('helpers', 'string');
        if ($user->get('guest')) {
            JError::raiseError(403, JText::_('CC ACCESS FORBIDDEN'));
            return;
        }
        $response = new JAXResponse();
        $model =& $this->getModel('profiles');
        $fieldGroups = $model->getGroups();
        // Load the JTable Object.
        $row =& JTable::getInstance('profiles', 'CommunityTable');
        $row->load($fieldId);
        $windowTitle = $row->id == 0 ? JText::_('CC NEW FIELD') : JText::_('CC EDIT FIELD');
        $group = $model->getFieldGroup($row->ordering);
        ob_start();
        ?>
<div style="background-color: #F9F9F9; border: 1px solid #D5D5D5; margin-bottom: 10px; padding: 5px;font-weight: bold;">
	<?php 
        echo JText::_('CC CREATE NEW CUSTOM PROFILE FOR YOUR SITE');
        ?>
</div>
<div id="error-notice" style="color: red; font-weight:700;"></div>
<div style="clear: both;"></div>
<form action="#" method="post" name="editField" id="editField">
<table cellspacing="0" class="paramlist admintable" border="0" width="100%">
	<tbody>
		<tr>
			<td class="key"><?php 
        echo JText::_('CC NAME');
        ?>
</td>
			<td>:</td>
			<td>
				<input type="text" value="<?php 
        echo CStringHelper::escape($row->name);
        ?>
" name="name" />
			</td>
			<td class="key"><?php 
        echo JText::_('CC PUBLISHED');
        ?>
</td>
			<td>:</td>
			<td>
				<span><?php 
        echo $this->_buildRadio($row->published, 'published', array('Yes', 'No'));
        ?>
</span>
			</td>
		</tr>
		<tr>
			<td class="key"><?php 
        echo JText::_('CC TYPE');
        ?>
</td>
			<td>:</td>
			<td><?php 
        echo $this->_buildTypes($row->type);
        ?>
</td>
			<td class="key"><?php 
        echo JText::_('CC REQUIRED');
        ?>
</td>
			<td>:</td>
			<td colspan="4"><?php 
        echo $this->_buildRadio($row->required, 'required', array('Yes', 'No'));
        ?>
</td>
		</tr>
		<tr style="<?php 
        echo $row->type != 'group' ? 'display: table-row;' : 'display: none;';
        ?>
" class="fieldGroups">
			<td class="key"><?php 
        echo JText::_('CC GROUP');
        ?>
</td>
			<td>:</td>
			<td colspan="4">
				<select name="group">
			<?php 
        for ($i = 0; $i < count($fieldGroups); $i++) {
            $selected = isset($group->id) && $group->id == $fieldGroups[$i]->id ? ' selected="selected"' : '';
            ?>
				<option value="<?php 
            echo $fieldGroups[$i]->ordering;
            ?>
"<?php 
            echo $selected;
            ?>
><?php 
            echo $fieldGroups[$i]->name;
            ?>
</option>
			<?php 
        }
        ?>
				</select>
			</td>
		</tr>		
		<tr>
			<td class="key"><?php 
        echo JText::_('CC FIELD CODE');
        ?>
</td>
			<td>:</td>
			<td><input type="text" value="<?php 
        echo CStringHelper::escape($row->fieldcode);
        ?>
" name="fieldcode" maxlength="255" /></td>
			<td class="key"><?php 
        echo JText::_('CC VISIBLE');
        ?>
</td>
			<td>:</td>
			<td><?php 
        echo $this->_buildRadio($row->visible, 'visible', array('Yes', 'No'));
        ?>
</td>
		</tr>
		
		<tr>
			<td valign="top" class="key"><?php 
        echo JText::_('CC REGISTRATION');
        ?>
</td>
			<td valign="top">:</td>
			<td colspan="4">
				<?php 
        echo $this->_buildRadio($row->registration, 'registration', array('Yes', 'No'));
        ?>
			</td>
		</tr>
		<?php 
        echo $this->_buildSize($row);
        ?>
		<tr>
			<td valign="top" class="key"><?php 
        echo JText::_('CC TOOLTIP');
        ?>
</td>
			<td valign="top">:</td>
			<td colspan="4">
				<textarea rows="3" cols="50" name="tips"><?php 
        echo $row->tips;
        ?>
</textarea>
			</td>
		</tr>
		<?php 
        echo $this->_buildOptions($row, $row->id, $row->type);
        ?>
	</tbody>
</table>
<!-- Start custom params -->
<div id="fieldParams" class="fieldParams">
		<?php 
        echo $this->_buildFieldParams($row->type, $row->params);
        ?>
</div>
<!-- End custom params -->
</form>
<?php 
        $contents = ob_get_contents();
        ob_end_clean();
        $buttons = '<input type="button" class="button" onclick="javascript:azcommunity.saveField(\'' . $row->id . '\');return false;" value="' . JText::_('CC SAVE') . '"/>';
        $buttons .= '&nbsp;&nbsp;<input type="button" class="button" onclick="javascript:cWindowHide();" value="' . JText::_('CC CANCEL') . '"/>';
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $response->addAssign('cwin_logo', 'innerHTML', $windowTitle);
        $response->addScriptCall('cWindowActions', $buttons);
        return $response->sendResponse();
    }
示例#24
0
 /**
  * restrict user to block community admin
  */
 public function ajaxRestrictBlockAdmin()
 {
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     $buttons = '<form name="jsform-profile-ajaxblockuser" method="post" action="" style="float:right;">';
     $buttons .= '<input type="button" class="button" onclick="cWindowHide();return false;" name="cancel" value="' . JText::_('CC BUTTON CLOSE') . '" />';
     $buttons .= '</form>';
     $response->addAssign('cWindowContent', 'innerHTML', JText::_('CC CANNOT BLOCK COMMUNITY ADMIN'));
     $response->addScriptCall('joms.jQuery("#cwin_logo").html("' . $config->get('sitename') . '");');
     $response->addScriptCall('cWindowActions', $buttons);
     $response->sendResponse();
 }
示例#25
0
    public function ajaxEditCategory($id)
    {
        $response = new JAXResponse();
        $uri = JURI::base();
        $db = JFactory::getDBO();
        $data = '';
        $children = array();
        // Get the event categories
        $model = $this->getModel('groupcategories');
        $categories = $model->getCategories();
        //all the children cannot be the parent to this id
        if ($id) {
            $children = $model->getCategoryChilds($id, $categories);
        }
        $row = JTable::getInstance('groupcategories', 'CommunityTable');
        $row->load($id);
        // Escape the output
        //CFactory::load( 'helpers' , 'string' );
        $row->name = CStringHelper::escape($row->name);
        $row->description = CStringHelper::escape($row->description);
        ob_start();
        ?>

		<div class="alert notice">
			<?php 
        echo JText::_('COM_COMMUNITY_GROUPS_CATEGORY_DESC');
        ?>
		</div>

		<form action="#" method="post" name="editGroupCategory" id="editGroupCategory">
		<table cellspacing="0" class="admintable" border="0" width="100%">
			<tbody>
				<tr>
					<td class="key" width="150" ><span class="js-tooltip"  title="<?php 
        echo JText::_('COM_COMMUNITY_PARENT_TIPS');
        ?>
"><?php 
        echo JText::_('COM_COMMUNITY_PARENT');
        ?>
</span></td>
					<td>
					    <select name="parent">
						    <option value="<?php 
        echo COMMUNITY_NO_PARENT;
        ?>
"><?php 
        echo JText::_('COM_COMMUNITY_NO_PARENT');
        ?>
</option>
						    <?php 
        for ($i = 0; $i < count($categories); $i++) {
            if ($categories[$i]->id != $id && !in_array($categories[$i]->id, $children)) {
                $selected = $row->parent == $categories[$i]->id ? ' selected="selected"' : '';
                ?>
						    <option value="<?php 
                echo $categories[$i]->id;
                ?>
"<?php 
                echo $selected;
                ?>
><?php 
                echo $categories[$i]->name;
                ?>
</option>
						    <?php 
            }
        }
        ?>
					    </select>
					</td>
				</tr>
				<tr>
					<td class="key"><span class="js-tooltip"  title="<?php 
        echo JText::_('COM_COMMUNITY_NAME_CATEGORY_TIPS');
        ?>
"><?php 
        echo JText::_('COM_COMMUNITY_NAME');
        ?>
</span></td>
					<td><input type="text" name="name" size="35" value="<?php 
        echo $id ? $row->name : '';
        ?>
" /></td>
				</tr>
				<tr>
					<td class="key"><span class="js-tooltip"  title="<?php 
        echo JText::_('COM_COMMUNITY_DESC_CATEGORY_TIPS');
        ?>
"><?php 
        echo JText::_('COM_COMMUNITY_DESCRIPTION');
        ?>
</span></td>
					<td>
						<textarea name="description" rows="5" cols="30"><?php 
        echo $id ? $row->description : '';
        ?>
</textarea>
					</td>
				</tr>
			</tbody>

			<input type="hidden" name="id" value="<?php 
        echo $id ? $row->id : 0;
        ?>
" />
		</table>
		</form>

<?php 
        $contents = ob_get_contents();
        ob_end_clean();
        $buttons = '<input type="button" class="btn btn-small btn-primary pull-right" onclick="javascript:azcommunity.saveGroupCategory();return false;" value="' . JText::_('COM_COMMUNITY_SAVE') . '"/>';
        $buttons .= '<input type="button" class="btn btn-small pull-left" onclick="javascript:cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL') . '"/>';
        $this->cacheClean(array(COMMUNITY_CACHE_TAG_GROUPS_CAT));
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $response->addScriptCall('cWindowActions', $buttons);
        return $response->sendResponse();
    }
示例#26
0
文件: inbox.php 项目: Jougito/DynWeb
 /**
  * Set message as Read
  */
 public function ajaxMarkMessageAsUnread($msgId)
 {
     $filter = JFilterInput::getInstance();
     $msgId = $filter->clean($msgId, 'int');
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $view = $this->getView('inbox');
     $model = $this->getModel('inbox');
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     $filter = array('parent' => $msgId, 'user_id' => $my->id);
     $model->markAsUnread($filter);
     $objResponse->addScriptCall('markAsUnread', $msgId);
     $objResponse->sendResponse();
 }
示例#27
0
 /**
  * AJAX method to add predefined activity
  **/
 public function ajaxAddPredefined($key, $message = '')
 {
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $key = $filter->clean($key, 'string');
     $message = $filter->clean($message, 'string');
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     if (!COwnerHelper::isCommunityAdmin()) {
         return;
     }
     // Predefined system custom activity.
     $system = array('system.registered', 'system.populargroup', 'system.totalphotos', 'system.popularprofiles', 'system.popularphotos', 'system.popularvideos');
     $act = new stdClass();
     $act->actor = $my->id;
     $act->target = 0;
     $act->app = 'system';
     $act->access = PRIVACY_FORCE_PUBLIC;
     $params = new CParameter('');
     if (in_array($key, $system)) {
         switch ($key) {
             case 'system.registered':
                 CFactory::load('helpers', 'time');
                 $usersModel = CFactory::getModel('user');
                 $now = new JDate();
                 $date = CTimeHelper::getDate();
                 $title = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $usersModel->getTotalRegisteredByMonth($now->toFormat('%Y-%m')), $date->_monthToString($now->toFormat('%m')));
                 $act->cmd = 'system.registered';
                 $act->title = $title;
                 $act->content = '';
                 break;
             case 'system.populargroup':
                 $groupsModel = CFactory::getModel('groups');
                 $activeGroup = $groupsModel->getMostActiveGroup();
                 $title = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', $activeGroup->name);
                 $params->set('action', 'groups.join');
                 $params->set('group_url', CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $activeGroup->id));
                 $act->cmd = 'groups.popular';
                 $act->cid = $activeGroup->id;
                 $act->title = $title;
                 break;
             case 'system.totalphotos':
                 $photosModel = CFactory::getModel('photos');
                 $total = $photosModel->getTotalSitePhotos();
                 $params->set('photos_url', CRoute::_('index.php?option=com_community&view=photos'));
                 $act->cmd = 'photos.total';
                 $act->title = JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', $total);
                 break;
             case 'system.popularprofiles':
                 CFactory::load('libraries', 'tooltip');
                 $act->cmd = 'members.popular';
                 $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PROFILES', 5);
                 $params->set('action', 'top_users');
                 $params->set('count', 5);
                 break;
             case 'system.popularphotos':
                 $act->cmd = 'photos.popular';
                 $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS', 5);
                 $params->set('action', 'top_photos');
                 $params->set('count', 5);
                 break;
             case 'system.popularvideos':
                 $act->cmd = 'videos.popular';
                 $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS', 5);
                 $params->set('action', 'top_videos');
                 $params->set('count', 5);
                 break;
         }
     } else {
         // For additional custom activities, we only take the content passed by them.
         if (!empty($message)) {
             CFactory::load('helpers', 'string');
             $message = CStringHelper::escape($message);
             $app = explode('.', $key);
             $app = isset($app[0]) ? $app[0] : 'system';
             $act->title = JText::_($message);
             $act->app = $app;
         }
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     // Allow comments on all these
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = $key;
     // Allow like for all admin activities
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = $key;
     // Add activity logging
     CActivityStream::add($act, $params->toString());
     $objResponse->addAssign('activity-stream-container', 'innerHTML', $this->_getActivityStream());
     $objResponse->addScriptCall("joms.jQuery('.jomTipsJax').addClass('jomTips');");
     $objResponse->addScriptCall('joms.tooltip.setup();');
     return $objResponse->sendResponse();
 }
示例#28
0
 public function ajaxAddApp($name, $position)
 {
     // Check permissions
     $my =& JFactory::getUser();
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     $filter = JFilterInput::getInstance();
     $name = $filter->clean($name, 'string');
     $position = $filter->clean($position, 'string');
     // Add application
     $appModel = CFactory::getModel('apps');
     $appModel->addApp($my->id, $name, $position);
     // Activity stream
     $act = new stdClass();
     $act->cmd = 'application.add';
     $act->actor = $my->id;
     $act->target = 0;
     $act->title = JText::_('COM_COMMUNITY_ACTIVITIES_APPLICATIONS_ADDED');
     $act->content = '';
     $act->app = $name;
     $act->cid = $my->id;
     CFactory::load('libraries', 'activities');
     CActivityStream::add($act);
     // User points
     CFactory::load('libraries', 'userpoints');
     CUserPoints::assignPoint('application.add');
     // Get application
     $id = $appModel->getUserApplicationId($name, $my->id);
     $appInfo = $appModel->getAppInfo($name);
     $params = new CParameter($appModel->getPluginParams($id, null));
     $isCoreApp = $params->get('coreapp');
     $app->id = $id;
     $app->title = isset($appInfo->title) ? $appInfo->title : '';
     $app->description = isset($appInfo->description) ? $appInfo->description : '';
     $app->isCoreApp = $isCoreApp;
     $app->name = $name;
     if (JFile::exists(CPluginHelper::getPluginPath('community', $name) . DS . $name . DS . 'favicon.png')) {
         $app->favicon['16'] = rtrim(JURI::root(), '/') . CPluginHelper::getPluginURI('community', $name) . '/' . $name . '/favicon.png';
     } else {
         $app->favicon['16'] = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png';
     }
     $tmpl = new CTemplate();
     $tmpl->set('apps', array($app));
     $tmpl->set('itemType', 'edit');
     $html = $tmpl->fetch('application.item');
     $objResponse = new JAXResponse();
     $objResponse->addScriptCall('joms.apps.showSettingsWindow', $app->id, $app->name);
     $objResponse->addScriptCall('joms.editLayout.addAppToLayout', $position, $html);
     // $objResponse->addScriptCall('cWindowHide();');
     return $objResponse->sendResponse();
 }
示例#29
0
    public function ajaxEditGroup($groupId)
    {
        $response = new JAXResponse();
        $model = $this->getModel('groupcategories');
        $categories = $model->getCategories();
        $group = JTable::getInstance('Group', 'CTable');
        $group->load($groupId);
        $requireApproval = $group->approvals ? ' checked="true"' : '';
        $noApproval = !$group->approvals ? '' : ' checked="true"';
        // Escape the output
        $group->name = CStringHelper::escape($group->name);
        $group->description = CStringHelper::escape($group->description);
        $params = $group->getParams();
        $config = CFactory::getConfig();
        ob_start();
        ?>
<form name="editgroup" action="" method="post" id="editgroup">
<div class="alert alert-info">
    <?php 
        echo JText::_('COM_COMMUNITY_GROUPS_EDIT_GROUP');
        ?>
</div>
<table cellspacing="0" class="admintable" border="0" width="100%">
    <tbody>
        <tr>
            <td class="key" width="100"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_TITLE');
        ?>
</td>
            <td>
                <input type="text" name="name" value="<?php 
        echo $group->name;
        ?>
" style="width: 200px;" />
            </td>
        </tr>
        <tr>
            <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_AVATAR');
        ?>
</td>
            <td>
                <img width="90" src="<?php 
        echo $group->getThumbAvatar();
        ?>
" style="border: 1px solid #eee;"/>
            </td>
        </tr>
        <tr>
            <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_PUBLISH_STATUS');
        ?>
</td>
            <td>
                <?php 
        echo CHTMLInput::checkbox('published', 'ace-switch ace-switch-5', null, $group->get('published'));
        ?>
            </td>
        </tr>
        <tr>
            <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUP_TYPE');
        ?>
</td>
            <td>
                <select style="visibility:visible;" name='approvals'>
                    <option value='0' <?php 
        echo $group->approvals == COMMUNITY_PUBLIC_GROUP ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_PUBLIC');
        ?>
</option>
                    <option value='1' <?php 
        echo $group->approvals == COMMUNITY_PRIVATE_GROUP ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUP_PRIVATE');
        ?>
</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_CATEGORY');
        ?>
</td>
            <td>
                <select name="categoryid">
                <?php 
        for ($i = 0; $i < count($categories); $i++) {
            $selected = $group->categoryid == $categories[$i]->id ? ' selected="selected"' : '';
            ?>
                        <option value="<?php 
            echo $categories[$i]->id;
            ?>
"<?php 
            echo $selected;
            ?>
><?php 
            echo $categories[$i]->name;
            ?>
</option>
                <?php 
        }
        ?>
                </select>
            </td>
        </tr>
        <tr>
            <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_DESCRIPTION');
        ?>
</td>
            <td>
                <textarea name="description" style="width: 250px;" rows="5"
                    data-wysiwyg="trumbowyg" data-btns="viewHTML,|,bold,italic,underline,|,unorderedList,orderedList"><?php 
        echo $group->description;
        ?>
</textarea>
            </td>
        </tr>
    <!--    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_DISCUSS_ORDER');
        ?>
</td>
        <td class="paramlist_value">
            <select style="visibility:visible;" name='discussordering'>
                <option value='0' <?php 
        echo $params->get('discussordering') == 0 ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_DISCUSS_ORDER_LAST_REPLIED');
        ?>
</option>
                <option value='1' <?php 
        echo $params->get('discussordering') == 1 ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_DISCUSS_ORDER_CREATION_DATE');
        ?>
</option>
            </select>
        </td>
    </tr>-->
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_PHOTOS');
        ?>
</td>
        <td class="paramlist_value">
            <select style="visibility:visible;" name='photopermission'>
                <option value='-1' <?php 
        echo $params->get('photopermission') == GROUP_PHOTO_PERMISSION_DISABLE ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_PHOTO_DISABLED');
        ?>
</option>
                <option value='1'  <?php 
        echo $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ADMINS ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_PHOTO_UPLOAD_ALOW_ADMIN');
        ?>
</option>
                <option value='2'  <?php 
        echo $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ALL ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_PHOTO_UPLOAD_ALLOW_MEMBER');
        ?>
</option>
            </select>
        </td>
    </tr>
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_RECENT_PHOTO');
        ?>
</td>
        <td class="paramlist_value">
            <input type="text" name="grouprecentphotos" id="grouprecentphotos-admin" size="1" value="<?php 
        echo $params->get('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT);
        ?>
" />
        </td>
    </tr>
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_VIDEOS');
        ?>
</td>
        <td class="paramlist_value">
            <div class="space-12"></div>
            <select style="visibility:visible;" name='videopermission'>
                <option value='-1' <?php 
        echo $params->get('videopermission') == GROUP_VIDEO_PERMISSION_DISABLE ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_DISABLED');
        ?>
</option>
                <option value='1' <?php 
        echo $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ADMINS ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_UPLOAD_ALLOW_ADMIN');
        ?>
</option>
                <option value='2' <?php 
        echo $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ALL ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_UPLOAD_ALLOW_MEMBER');
        ?>
</option>
            </select>
            <div class="space-12"></div>
        </td>
    </tr>
    <tr>
        <td class="key">
            <label for="grouprecentvideos-admin" class="title"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_RECENT_VIDEO');
        ?>
</td>
        <td class="paramlist_value">
            <input type="text" name="grouprecentvideos" id="grouprecentvideos-admin" size="1" value="<?php 
        echo $params->get('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT);
        ?>
" />
        </td>
    </tr>
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_EVENTS');
        ?>
</td>
        <td class="paramlist_value">
            <div class="space-12"></div>
            <select style="visibility:visible;" name='eventpermission'>
                <option value='-1' <?php 
        echo $params->get('eventpermission') == GROUP_EVENT_PERMISSION_DISABLE ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUP_EVENTS_DISABLE');
        ?>
</option>
                <option value='1' <?php 
        echo $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ADMINS ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUP_EVENTS_ADMIN_CREATION');
        ?>
</option>
                <option value='2' <?php 
        echo $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ALL ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_GROUP_EVENTS_MEMBERS_CREATION');
        ?>
</option>
            </select>
            <div class="space-12"></div>
        </td>
    </tr>
    <tr>
        <td class="key">
            <label for="grouprecentevents-admin" class="title"><?php 
        echo JText::_('COM_COMMUNITY_GROUP_EVENTS');
        ?>
</td>
        <td class="paramlist_value">
            <input type="text" name="grouprecentevents" id="grouprecentevents-admin" size="1" value="<?php 
        echo $params->get('grouprecentevents', GROUP_EVENT_RECENT_LIMIT);
        ?>
" />
        </td>
    </tr>
    <?php 
        if ($config->get('groupdiscussfilesharing') && $config->get('creatediscussion')) {
            ?>
    <tr>
        <td class="key"><?php 
            echo JText::_('COM_COMMUNITY_DISCUSSION');
            ?>
</td>
        <td>
            <label>
                <input type="checkbox" name="groupdiscussionfilesharing" style="position:relative;opacity:1" value="1"
                    <?php 
            echo $params->get('groupdiscussionfilesharing') >= 1 ? 'checked' : '';
            ?>
                > <?php 
            echo JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_ENABLE_FILE_SHARING');
            ?>
                <input type="hidden" name="discussordering" value="0" />
            </label>
        </td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($config->get('createannouncement')) {
            ?>
    <tr>
        <td class="key"><?php 
            echo JText::_('COM_COMMUNITY_ANNOUNCEMENT');
            ?>
</td>
        <td>
            <label>
                <input type="checkbox" name="groupannouncementfilesharing" style="position:relative;opacity:1" value="1"
                    <?php 
            echo $params->get('groupannouncementfilesharing') >= 1 ? 'checked' : '';
            ?>
                > <?php 
            echo JText::_('COM_COMMUNITY_GROUPS_ANNOUNCEMENT_ENABLE_FILE_SHARING');
            ?>
            </label>
        </td>
    </tr>
    <?php 
        }
        ?>
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_NEW_MEMBER_NOTIFICATION');
        ?>
</td>
        <td class="paramlist_value">
            <div class="space-12"></div>
            <select style="visibility:visible;" name='newmembernotification'>
                <option value='1' <?php 
        echo $params->get('newmembernotification', '1') == true ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_ENABLE');
        ?>
</option>
                <option value='0' <?php 
        echo $params->get('newmembernotification', '1') == false ? ' selected="selected"' : '';
        ?>
><?php 
        echo JText::_('COM_COMMUNITY_DISABLE');
        ?>
</option>
            </select>
            <div class="space-12"></div>
        </td>
    </tr>
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_JOIN_REQUEST_NOTIFICATION');
        ?>
</td>
        <td class="paramlist_value">
            <div class="space-12"></div>
            <select style="visibility:visible;" name='joinrequestnotification'>
                <option value='1' <?php 
        echo $params->get('joinrequestnotification', '1') == true ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_ENABLE');
        ?>
</option>
                <option value='0' <?php 
        echo $params->get('joinrequestnotification', '1') == false ? ' selected="selected"' : '';
        ?>
><?php 
        echo JText::_('COM_COMMUNITY_DISABLE');
        ?>
</option>
            </select>
            <div class="space-12"></div>
        </td>
    </tr>
    <tr>
        <td class="key"><?php 
        echo JText::_('COM_COMMUNITY_GROUPS_WALL_NOTIFICATION');
        ?>
</td>
        <td class="paramlist_value">
            <div class="space-12"></div>
            <select style="visibility:visible;" name='wallnotification'>
                <option value='1' <?php 
        echo $params->get('wallnotification', '1') == true ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_ENABLE');
        ?>
</option>
                <option value='0' <?php 
        echo $params->get('wallnotification', '1') == false ? ' selected="selected"' : '';
        ?>
 ><?php 
        echo JText::_('COM_COMMUNITY_DISABLE');
        ?>
</option>
            </select>
            <div class="space-12"></div>
        </td>
    </tr>
    </tbody>
</table>
<input type="hidden" name="id" value="<?php 
        echo $group->id;
        ?>
" />
<input type="hidden" name="option" value="com_community" />
<input type="hidden" name="task" value="savegroup" />
<input type="hidden" name="view" value="groups" />
<?php 
        $contents = ob_get_contents();
        ob_end_clean();
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $action = '<input type="button" class="btn btn-small btn-primary pull-right" onclick="azcommunity.saveGroup();" name="' . JText::_('COM_COMMUNITY_SAVE') . '" value="' . JText::_('COM_COMMUNITY_SAVE') . '" />';
        $action .= '&nbsp;<input type="button" class="btn btn-small pull-left" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />';
        $response->addScriptCall('cWindowActions', $action);
        $response->addScriptCall('joms.util.wysiwyg.start');
        return $response->sendResponse();
    }
示例#30
0
文件: update.php 项目: Jougito/DynWeb
    public function ajaxCheckVersion()
    {
        $response = new JAXResponse();
        $communityController = new CommunityController();
        $stableVersion = $communityController->_getCurrentVersionData();
        $localVersion = $communityController->_getLocalVersionNumber();
        $data = $this->_getCurrentVersionData();
        //this is only used to get the links for change log and update instructions
        ob_start();
        if ($stableVersion) {
            // Test versions
            if (version_compare($localVersion, $stableVersion->version, '<')) {
                ?>

                    <h5><?php 
                echo JText::_('COM_COMMUNITY_UPDATE_SUMMARY');
                ?>
</h5>
                    <div style="color: red"><?php 
                echo JText::_('COM_COMMUNITY_OLDER_VERSION_OF_JOM_SOCIAL');
                ?>
</div>
                    <div><?php 
                echo JText::sprintf('Version installed: <span style="font-weight:700; color: red">%1$s</span>', $this->_getLocalVersionString());
                ?>
</div>
                    <div><?php 
                echo JText::sprintf('Latest version available: <span style="font-weight:700;">%1$s</span>', $stableVersion->version);
                ?>
</div>
                    <div><?php 
                echo JText::sprintf('View full changelog at <a href="%1$s" target="_blank">%2$s</a>', $data->changelogURL, $data->changelogURL);
                ?>
</div>
                    <div><?php 
                echo JText::sprintf('View the upgrade instructions at <a href="%1$s" target="_blank">%2$s</a>', $data->instructionURL, $data->instructionURL);
                ?>
</div>
                <?php 
            } else {
                ?>
                    <div class="clearfix">
                        <h5><?php 
                echo JText::_('COM_COMMUNITY_UPDATE_SUMMARY');
                ?>
</h5>

                        <div><?php 
                echo JText::_('COM_COMMUNITY_LATEST_VERSION_OF_JOM_SOCIAL');
                ?>
</div>
                        <div><?php 
                echo JText::sprintf('Version installed: <span style="font-weight:700;">%1$s</span>', $this->_getLocalVersionString());
                ?>
</div>
                    </div>
                <?php 
            }
        } else {
            ?>
                <div
                    style="color: red"><?php 
            echo JText::_('Please enable "allow_url_fopen" to check version');
            ?>
</div>
            <?php 
        }
        $contents = ob_get_contents();
        ob_end_clean();
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $action = '<input type="button" class="btn btn-small pull-right" onclick="cWindowHide();" name="' . JText::_('COM_COMMUNITY_CLOSE') . '" value="' . JText::_('COM_COMMUNITY_CLOSE') . '" />';
        $response->addScriptCall('cWindowActions', $action);
        return $response->sendResponse();
    }