Exemplo n.º 1
0
 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 3
0
 function aclAjaxBlock($msg)
 {
     $objResponse = new JAXResponse();
     $title = XiptText::_('CC PROFILE VIDEO');
     $objResponse->addScriptCall('cWindowShow', '', $title, 430, 80);
     return parent::aclAjaxBlock($msg, $objResponse);
 }
Exemplo n.º 4
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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 6
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();
 }
Exemplo n.º 7
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();
 }
Exemplo n.º 8
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();
 }
Exemplo n.º 9
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();
 }
Exemplo n.º 10
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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 12
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();
 }
Exemplo n.º 13
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
     **/
    public function ajaxEditField($fieldId, $isGroup = false)
    {
        $user = JFactory::getUser();
        //CFactory::load( 'helpers' , 'string' );
        if ($user->get('guest')) {
            JError::raiseError(403, JText::_('COM_COMMUNITY_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::_('COM_COMMUNITY_NEW_FIELD') : JText::_('COM_COMMUNITY_PROFILE_EDIT_FIELD');
        $group = $model->getFieldGroup($row->ordering);
        ob_start();
        ?>
<div class="alert alert-info">
    <?php 
        echo JText::_('COM_COMMUNITY_NEW_CUSTOM_PROFILE_LABEL');
        ?>
</div>
<div id="error-notice" style="color:red"></div>
<div style="clear: both;"></div>
<form action="#" method="post" name="editField" id="editField">
<table cellspacing="0" border="0" width="100%">
    <tbody>
        <tr>
            <td class="key"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_NAME_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_NAME');
        ?>
</span> <span class="required-sign">*</span></td>
            <td>
                <input type="text" value="<?php 
        echo CStringHelper::escape($row->name);
        ?>
" name="name" />
            </td>
        </tr>
        <tr>
            <td class="key"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_TYPE_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_TYPE');
        ?>
</span></td>
            <td><?php 
        echo $this->_buildTypes($row->type);
        ?>
</td>
        </tr>
        <tr style="<?php 
        echo $row->type != 'group' ? 'display: table-row;' : 'display: none;';
        ?>
" class="fieldGroups">
            <td class="key"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_GROUPS_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_GROUPS');
        ?>
</span></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"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_FIELD_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_FIELD_CODE');
        ?>
 </span><span class="required-sign">*</span></td>
            <td><input type="text" value="<?php 
        echo CStringHelper::escape($row->fieldcode);
        ?>
" name="fieldcode" maxlength="255" /></td>
        </tr>

        <tr>
            <td valign="top" class="key"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_REGISTRATION_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_REGISTRATION');
        ?>
</span></td>
            <td colspan="4">
                <?php 
        echo $this->_buildRadio($row->registration, 'registration', array(JText::_('COM_COMMUNITY_NO_OPTION'), JText::_('COM_COMMUNITY_YES_OPTION')));
        ?>
                <?php 
        // echo CHTMLInput::checkbox('registration' ,'ace-switch ace-switch-5', null , $row->registration );
        ?>
            </td>
        </tr>
        <tr>
            <td class="key"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_VISIBLE_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_VISIBLE');
        ?>
</span></td>
            <td><?php 
        echo $this->_buildRadio($row->visible, 'visible', array(JText::_('COM_COMMUNITY_PROFILEFIELD_PERSONAL_OPTION'), JText::_('COM_COMMUNITY_PROFILEFIELD_ALL_OPTION'), JText::_('COM_COMMUNITY_PROFILEFIELD_ADMINONLY_OPTION')));
        ?>
</td>
        </tr>
        <tr>
            <td class="key"><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_PUBLISHED_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_PUBLISHED');
        ?>
</span></td>
            <td>
                <span><?php 
        echo $this->_buildRadio($row->published, 'published', array(JText::_('COM_COMMUNITY_NO_OPTION'), JText::_('COM_COMMUNITY_YES_OPTION')));
        ?>
</span>
            </td>
        </tr>
        <tr>
            <td class="key" width="200" ><span class="js-tooltip" title="<?php 
        echo JText::_('COM_COMMUNITY_PROFILE_REQUIRED_TIPS');
        ?>
 "><?php 
        echo JText::_('COM_COMMUNITY_REQUIRED');
        ?>
</span></td>
            <td><?php 
        echo $this->_buildRadio($row->required, 'required', array(JText::_('COM_COMMUNITY_NO_OPTION'), JText::_('COM_COMMUNITY_YES_OPTION')));
        ?>
</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="btn btn-small btn-primary pull-right" onclick="javascript:azcommunity.saveField(\'' . $row->id . '\');return false;" value="' . JText::_('COM_COMMUNITY_SAVE') . '"/>';
        $buttons .= '&nbsp;&nbsp;<input type="button" class="btn btn-small pull-left" onclick="javascript:cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL') . '"/>';
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $response->addAssign('cwin_logo', 'innerHTML', $windowTitle);
        $response->addScriptCall('jQuery(".js-tooltip, .hasTooltip").tooltip({html: true,placement:\'right\'});');
        $response->addScriptCall('if (window.MooTools) (function($) { $$(".js-tooltip, .hasTooltip").each(function (e) {e.hide = null;});})(MooTools);');
        $response->addScriptCall('cWindowActions', $buttons);
        return $response->sendResponse();
    }
Exemplo n.º 14
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();
 }
Exemplo n.º 15
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();
 }
Exemplo n.º 16
0
 /**
  * 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();
 }
Exemplo n.º 17
0
 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();
 }
Exemplo n.º 18
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();
 }
Exemplo n.º 19
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();
    }
Exemplo n.º 20
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();
    }
Exemplo n.º 21
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();
 }
Exemplo n.º 22
0
 public function ajaxAssignAuthKey()
 {
     $objResponse = new JAXResponse();
     $authKey = "";
     $ipaddress = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
     $mySess = JFactory::getSession();
     $token = $mySess->get('JS_REG_TOKEN', '');
     $model = $this->getModel('register');
     $authKey = $model->getAuthKey($token, $ipaddress);
     $objResponse->addScriptCall("joms.registrations.assignAuthKey('jomsForm','authkey','" . $authKey . "');");
     $objResponse->addScriptCall("joms.jQuery('#authenticate').val('1');");
     $objResponse->addScriptCall("joms.jQuery('#btnSubmit').click();");
     $json = array();
     $json['authKey'] = $authKey;
     die(json_encode($json));
     // return $objResponse->sendResponse();
 }
Exemplo n.º 23
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);
 }
Exemplo n.º 24
0
 /**
  *
  */
 public function ajaxStreamAddLike($actid, $type = null)
 {
     $filter = JFilterInput::getInstance();
     $actid = $filter->clean($actid, 'int');
     $objResponse = new JAXResponse();
     $wallModel = CFactory::getModel('wall');
     $like = new CLike();
     $act = JTable::getInstance('Activity', 'CTable');
     $act->load($actid);
     //guest cannot like
     $user = CFactory::getUser();
     if (!$user->id) {
         die;
     }
     /**
      * some like_type are missing and causing stream id cannot be like, in this case, group create.
      * This condition is used to fix the existing activity with such issue.
      */
     if ($act->comment_type == 'groups.create' && empty($act->like_type)) {
         $act->like_type = 'groups.create';
         $act->store();
     }
     if ($type == 'comment') {
         $act = JTable::getInstance('Wall', 'CTable');
         $act->load($actid);
         $act->like_type = 'comment';
         $act->like_id = $act->id;
     }
     $params = new CParameter($act->params);
     // this is used to seperate the like from the actual pictures
     if (isset($act->app) && $act->app == 'photos' && $params->get('batchcount', 0) >= 1) {
         $act->like_type = 'album.self.share';
         $act->like_id = $act->id;
     } else {
         if (isset($act->app) && $act->app == 'videos') {
             $act->like_type = 'videos.self.share';
             $act->like_id = $act->id;
         }
     }
     // Count before the add
     $oldLikeCount = $like->getLikeCount($act->like_type, $act->like_id);
     $like->addLike($act->like_type, $act->like_id);
     $likeCount = $like->getLikeCount($act->like_type, $act->like_id);
     $json = array();
     $json['success'] = true;
     // If the like count is 1, then, the like bar most likely not there before
     // but, people might just click twice, hence the need to compare it before
     // the actual like
     if ($likeCount == 1 && $oldLikeCount != $likeCount) {
         // Clear old like status
         $objResponse->addScriptCall("joms.jQuery('#wall-cmt-{$actid} .cStream-Likes').remove", '');
         $objResponse->addScriptCall("joms.jQuery('#wall-cmt-{$actid}').prepend", '<div class="cStream-Likes"></div>');
     }
     if ($type == 'comment') {
         $json['html'] = $this->_commentShowLikes($objResponse, $act->id);
     } else {
         $json['html'] = $this->_streamShowLikes($objResponse, $act->id, $act->like_type, $act->like_id);
     }
     die(json_encode($json));
 }
Exemplo n.º 25
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();
 }
Exemplo n.º 26
0
    public function ajaxEditCategory($id)
    {
        $response = new JAXResponse();
        $uri = JURI::base();
        $db =& JFactory::getDBO();
        $data = '';
        // Get the event categories
        $model = $this->getModel('videoscategories');
        $categories = $model->getCategories();
        $row =& JTable::getInstance('VideosCategory', 'CTable');
        $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 style="line-height: 32px; padding-bottom: 10px;">
			<img src="<?php 
        echo $uri;
        ?>
components/com_community/assets/icons/groups_add.gif" style="float: left;" />
			<?php 
        echo JText::_('COM_COMMUNITY_VIDEOS_CREATE_NEW_CATEGORIES');
        ?>
		</div>
		<div style="clear: both;"></div>
		
		<form action="#" method="post" name="editVideosCategory" id="editVideosCategory">
		<table cellspacing="0" class="admintable" border="0" width="100%">
			<tbody>
				<tr>
					<td class="key" width="10%"><?php 
        echo JText::_('COM_COMMUNITY_PARENT');
        ?>
</td>
					<td>:</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++) {
            // Do not show itself as potential parent
            if ($categories[$i]->id != $id) {
                $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" width="10%"><?php 
        echo JText::_('COM_COMMUNITY_NAME');
        ?>
</td>
					<td>:</td>
					<td><input type="text" name="name" size="35" value="<?php 
        echo $id ? $row->name : '';
        ?>
" /></td>
				</tr>
				<tr>
					<td class="key" valign="top"><?php 
        echo JText::_('COM_COMMUNITY_DESCRIPTION');
        ?>
</td>
					<td valign="top">:</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="button" onclick="javascript:azcommunity.saveVideosCategory();return false;" value="' . JText::_('COM_COMMUNITY_SAVE') . '"/>';
        $buttons .= '&nbsp;&nbsp;<input type="button" class="button" onclick="javascript:cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL') . '"/>';
        $this->cacheClean(array(COMMUNITY_CACHE_TAG_VIDEOS_CAT));
        $response->addAssign('cWindowContent', 'innerHTML', $contents);
        $response->addScriptCall('cWindowActions', $buttons);
        return $response->sendResponse();
    }
Exemplo n.º 27
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();
    }
Exemplo n.º 28
0
 public function ajaxAutoupdate($ordercode = '', $email = '')
 {
     //do save config first
     if (!empty($ordercode) && !empty($email)) {
         $config = JTable::getInstance('configuration', 'CommunityTable');
         $config->load('config');
         $config->name = 'config';
         $params = new JRegistry($config->params);
         $params->set('autoupdateordercode', $ordercode);
         $params->set('autoupdateemail', $email);
         $config->params = $params->toString();
         $saved = $config->store();
     }
     require_once JPATH_ROOT . '/administrator/components/com_community/libraries/autoupdate.php';
     //Check update
     $res = CAutoUpdate::getUpdate();
     @ob_end_clean();
     $objResponse = new JAXResponse();
     if (!$res) {
         $msg = implode("\n", CAutoUpdate::getError());
         $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide(); ');
         $objResponse->addScriptCall('joms.jQuery("#autoupdateordercode,#autoupdateemail,#autoupdatesubmit").removeAttr("disabled");');
         $objResponse->addScriptCall('joms.jQuery("#autoupdatesubmit").val("' . JText::_('COM_COMMUNITY_CONFIGURATION_CHECK_AUTOUPDATE') . '");');
         $objResponse->addScriptCall('alert("' . JText::sprintf('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_ERROR', $msg) . '");');
         return $objResponse->sendResponse();
     }
     $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide(); ');
     $objResponse->addScriptCall('joms.jQuery("#autoupdateordercode,#autoupdateemail,#autoupdatesubmit").removeAttr("disabled");');
     $objResponse->addScriptCall('joms.jQuery("#autoupdatesubmit").val("' . JText::_('COM_COMMUNITY_CONFIGURATION_CHECK_AUTOUPDATE') . '");');
     if ($res) {
         jimport('joomla.installer.installer');
         jimport('joomla.installer.helper');
         //$package = JInstallerHelper::unpack($res);
         //Adapted from JInstallerHelper::unpack
         // Path to the archive =========
         $archivename = $res;
         // Temporary folder to extract the archive into
         $tmpdir = uniqid('install_');
         // Clean the paths to use for archive extraction
         $extractdir = JPath::clean(dirname($res) . '/' . $tmpdir);
         $archivename = JPath::clean($archivename);
         // Do the unpacking of the archive
         $result = JArchive::extract($archivename, $extractdir);
         if ($result === false) {
             $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide();');
             $objResponse->addScriptCall('joms.jQuery(".do-download-update").remove();');
             $objResponse->addScriptCall('alert("JomSocial package cannot be unpacked.")');
             return $objResponse->sendResponse();
         }
         $appszip = false;
         $extractdirfiles = scandir($extractdir);
         //error_log(print_r($extractdirfiles, true));
         foreach ($extractdirfiles as $f) {
             if (strpos($f, 'com_community_') !== FALSE) {
                 //error_log('DIR: '.$extractdir.'/'.$f);
                 $package = JInstallerHelper::unpack($extractdir . '/' . $f);
             }
         }
         //shouldnt be empty here, something's wrong with the package
         if (empty($package)) {
             $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide();');
             $objResponse->addScriptCall('joms.jQuery(".do-download-update").remove();');
             $objResponse->addScriptCall('alert("' . JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_ERROR_NO_COMPONENT') . '")');
             return $objResponse->sendResponse();
         }
         //error_log( 'PACKAGE:'. print_r($package,true) );
         // Get an installer instance
         //
         //$installer = JInstaller::getInstance();
         //$installer->install($package['dir']);
         $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide();');
         $objResponse->addScriptCall('joms.jQuery(".do-download-update").remove();');
         $objResponse->addScriptCall('joms.jQuery("#autoupdate-progress").empty();');
         $objResponse->addScriptCall("joms.jQuery('#autoupdatesubmit').after(' <form onsubmit=\"return confirm(\\'" . JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_ASK_PROCEED') . "\\');\" class=\"do-download-update\" style=\"display:inline\" method=\"post\" action=\"" . JURI::base() . "index.php?option=com_installer&view=install\"><input type=\"hidden\" name=\"install_directory\" value=\\'" . $package['extractdir'] . "\\'><input type=\"hidden\" name=\"task\" value=\"install.install\"><input type=\"hidden\" name=\"installtype\" value=\"folder\"><input type=\"submit\" value=\"" . JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_INSTALL_BUTTON') . "\" />" . JHTML::_('form.token') . "</form>');");
     }
     return $objResponse->sendResponse();
 }
Exemplo n.º 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();
    }
Exemplo n.º 30
0
    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();
    }