Permalink
Browse files

changed: updated for Elgg 1.8

  • Loading branch information...
jdalsem committed Apr 2, 2012
1 parent 81452ab commit bd46ed7fc5976f1e3dbb425fd112ae465709f1e8
View
@@ -0,0 +1,9 @@
+= Version history =
+
+1.0 (2012-04-02):
+
+- changed: updated for Elgg 1.8
+
+0.1 (2012-02-13):
+
+- initial release
View
@@ -0,0 +1,2 @@
+= Content Redirector =
+Redirect users to the right content creation pages
View
@@ -4,9 +4,7 @@
$title_text = elgg_echo("content_redirector:add:title");
- $title = elgg_view_title($title_text);
-
$body = elgg_view("content_redirector/selector");
- page_draw($title_text, elgg_view_layout("one_column", $title . $body));
+ echo elgg_view_page($title_text, elgg_view_layout("one_column", array("title" => $title_text, "content" => $body)));
View
@@ -2,16 +2,15 @@
function content_redirector_init(){
// register page handler for nice URL's
- register_page_handler("add", "content_redirector_page_handler");
-
- elgg_extend_view("css", "content_redirector/css");
+ elgg_register_page_handler("add", "content_redirector_page_handler");
+ elgg_extend_view("js/elgg", "content_redirector/js/site");
}
function content_redirector_page_handler(){
- //
include(dirname(__FILE__) . "/pages/add.php");
+ return true;
}
- register_elgg_event_handler("init", "system", "content_redirector_init");
+ elgg_register_event_handler("init", "system", "content_redirector_init");
@@ -1,16 +0,0 @@
-<?php
-?>
-.content-redirector-selector-info {
- color: #CCCCCC;
- font-size: 80%;
- margin-bottom: 5px;
-}
-#content-redirector-selector input[type='button'] {
- cursor: pointer;
-}
-
-#content-redirector-selector-add,
-#content-redirector-container-selection,
-#content-redirector-group-selection {
- display: none;
-}
@@ -0,0 +1,72 @@
+<?php ?>
+//<script>
+
+$(document).ready(function(){
+ $("#content-redirector-selector input[type='button']").live("click", function(event){
+ $(this).parent().find("input").removeClass("elgg-button-submit");
+ $(this).addClass("elgg-button-submit")
+ });
+
+ $("#content-redirector-selector-container-group").click(function(event){
+ $("#content-redirector-group-selection").show();
+ $("#content-redirector-group-selection input").removeClass("elgg-button-submit");
+ $("#content-redirector-selector-add").hide();
+ });
+
+ $("#content-redirector-selector-container-personal").click(function(event){
+ $("#content-redirector-group-selection").hide();
+ $("#content-redirector-selector-add").show();
+ });
+
+ $("#content-redirector-group-selection input").click(function(event){
+ $("#content-redirector-selector-add").show();
+ });
+
+ $("#content-redirector-type-selection input").click(function(event){
+ $("#content-redirector-container-selection").show();
+ content_redirector_check_groups($(this).attr("id"));
+ // no container selection available
+ if($("#content-redirector-container-selection").length === 0){
+ $("#content-redirector-selector-add").show();
+ } else {
+ if($("#content-redirector-group-selection input:visible.elgg-button-submit").length === 0){
+ $("#content-redirector-selector-add").hide();
+ } else {
+ $("#content-redirector-selector-add").show();
+ }
+ }
+ });
+
+ $("#content-redirector-selector-add").click(function(event){
+ var content_type = $("#content-redirector-type-selection input.elgg-button-submit").attr("id");
+ var group_guid = $("#content-redirector-group-selection input:visible.elgg-button-submit").attr("id");
+ var group_username = $("#content-redirector-group-selection input:visible.elgg-button-submit").attr("name");
+
+ if(content_type){
+ if(group_guid == undefined){
+ link = eval(content_type + "_details[0]");
+ link = link.replace("[USERNAME]", elgg.get_logged_in_user_entity().username).replace("[GUID]", elgg.get_logged_in_user_guid());
+ document.location.href = elgg.config.wwwroot + link;
+ } else {
+ link = eval(content_type + "_details[1]");
+ link = link.replace("[USERNAME]", group_username).replace("[GUID]", group_guid);
+ document.location.href = elgg.config.wwwroot + link;
+ }
+ }
+
+ event.stopPropagation();
+ });
+});
+
+function content_redirector_check_groups(content_type){
+ if($("#content-redirector-group-selection").length > 0){
+ $("#content-redirector-group-selection input").hide();
+ $("#content-redirector-group-selection input[rel*='" + content_type + "']").show();
+
+ $("#content-redirector-group-none").hide();
+ if($("#content-redirector-group-selection input[rel*='" + content_type + "']").length == 0){
+ $("#content-redirector-group-none").show();
+ $("#content-redirector-group-selection input").hide();
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit bd46ed7

Please sign in to comment.