Merge pull request #3797 from rabuzarus/20171015_-_duplicate_event
add event action: duplicate events
This commit is contained in:
commit
d60f96f0e1
|
@ -627,6 +627,7 @@ function process_events($arr) {
|
|||
// is a real event (no bithdays).
|
||||
if (local_user() && local_user() == $rr['uid'] && $rr['type'] == 'event') {
|
||||
$edit = ((! $rr['cid']) ? array(System::baseUrl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null);
|
||||
$copy = ((! $rr['cid']) ? array(System::baseUrl() . '/events/copy/' . $rr['id'], t('Duplicate event'), '', '') : null);
|
||||
$drop = array(System::baseUrl() . '/events/drop/' . $rr['id'], t('Delete event'), '', '');
|
||||
}
|
||||
|
||||
|
@ -650,6 +651,7 @@ function process_events($arr) {
|
|||
'd' => $d,
|
||||
'edit' => $edit,
|
||||
'drop' => $drop,
|
||||
'copy' => $copy,
|
||||
'is_first' => $is_first,
|
||||
'item' => $rr,
|
||||
'html' => $html,
|
||||
|
|
|
@ -250,6 +250,10 @@ function events_content(App $a) {
|
|||
$mode = 'drop';
|
||||
$event_id = intval($a->argv[2]);
|
||||
}
|
||||
if ($a->argc > 2 && $a->argv[1] == 'copy') {
|
||||
$mode = 'copy';
|
||||
$event_id = intval($a->argv[2]);
|
||||
}
|
||||
if ($a->argv[1] === 'new') {
|
||||
$mode = 'new';
|
||||
$event_id = 0;
|
||||
|
@ -399,7 +403,7 @@ function events_content(App $a) {
|
|||
return $o;
|
||||
}
|
||||
|
||||
if ($mode === 'edit' && $event_id) {
|
||||
if (($mode === 'edit' || $mode === 'copy') && $event_id) {
|
||||
$r = q("SELECT * FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($event_id),
|
||||
intval(local_user())
|
||||
|
@ -410,7 +414,7 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
// Passed parameters overrides anything found in the DB
|
||||
if ($mode === 'edit' || $mode === 'new') {
|
||||
if (in_array($mode, array('edit', 'new', 'copy'))) {
|
||||
if (!x($orig_event)) {$orig_event = array();}
|
||||
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
|
||||
if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||
|
@ -431,17 +435,18 @@ function events_content(App $a) {
|
|||
$cid = ((x($orig_event)) ? $orig_event['cid'] : 0);
|
||||
$uri = ((x($orig_event)) ? $orig_event['uri'] : '');
|
||||
|
||||
if (! x($orig_event)) {
|
||||
$sh_checked = '';
|
||||
} else {
|
||||
$sh_disabled = '';
|
||||
$sh_checked = '';
|
||||
|
||||
if (x($orig_event)) {
|
||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ');
|
||||
}
|
||||
|
||||
if ($cid || ($mode !== 'new')) {
|
||||
$sh_checked .= ' disabled="disabled" ';
|
||||
if ($cid || $mode === 'edit') {
|
||||
$sh_disabled = 'disabled="disabled"';
|
||||
}
|
||||
|
||||
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
|
||||
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
|
||||
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
|
||||
|
||||
$tz = date_default_timezone_get();
|
||||
|
@ -470,17 +475,31 @@ function events_content(App $a) {
|
|||
|
||||
require_once 'include/acl_selectors.php' ;
|
||||
|
||||
if ($mode === 'new') {
|
||||
$perms = get_acl_permissions($orig_event);
|
||||
|
||||
if ($mode === 'new' || $mode === 'copy') {
|
||||
$acl = (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user)));
|
||||
}
|
||||
|
||||
// If we copy an old event, we need to remove the ID and URI
|
||||
// from the original event.
|
||||
if ($mode === 'copy') {
|
||||
$eid = 0;
|
||||
$uri = '';
|
||||
}
|
||||
|
||||
$tpl = get_markup_template('event_form.tpl');
|
||||
|
||||
$o .= replace_macros($tpl,array(
|
||||
'$post' => System::baseUrl() . '/events',
|
||||
'$eid' => $eid,
|
||||
'$cid' => $cid,
|
||||
'$uri' => $uri,
|
||||
'$eid' => $eid,
|
||||
'$cid' => $cid,
|
||||
'$uri' => $uri,
|
||||
|
||||
'$allow_cid' => json_encode($perms['allow_cid']),
|
||||
'$allow_gid' => json_encode($perms['allow_gid']),
|
||||
'$deny_cid' => json_encode($perms['deny_cid']),
|
||||
'$deny_gid' => json_encode($perms['deny_gid']),
|
||||
|
||||
'$title' => t('Event details'),
|
||||
'$desc' => t('Starting date and Title are required.'),
|
||||
|
@ -500,7 +519,7 @@ function events_content(App $a) {
|
|||
'$t_orig' => $t_orig,
|
||||
'$summary' => array('summary', t('Title:'), $t_orig, '', '*'),
|
||||
'$sh_text' => t('Share this event'),
|
||||
'$share' => array('share', t('Share this event'), $sh_checked, ''),
|
||||
'$share' => array('share', t('Share this event'), $sh_checked, '', $sh_disabled),
|
||||
'$sh_checked' => $sh_checked,
|
||||
'$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked),
|
||||
'$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked),
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
{{$event.html}}
|
||||
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" target="_blank" class="plink-event-link icon s22 remote-link"></a>{{/if}}
|
||||
{{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link icon s22 pencil"></a>{{/if}}
|
||||
{{if $event.copy}}<a href="{{$event.copy.0}}" title="{{$event.copy.1}}" class="copy-event-link icon s22 copy"></a>{{/if}}
|
||||
{{if $event.drop}}<a href="{{$event.drop.0}}" onclick="return confirmDelete();" title="{{$event.drop.1}}" class="drop-event-link icon s22 delete"></a>{{/if}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="field checkbox" id="div_id_{{$field.0}}">
|
||||
<label for="id_{{$field.0}}">{{$field.1}}</label>
|
||||
<input type="hidden" name="{{$field.0}}" value="0">
|
||||
<input type="checkbox" name="{{$field.0}}" id="id_{{$field.0}}" aria-describedby="{{$field.0}}_tip" value="1" {{if $field.2}}checked="checked"{{/if}}>
|
||||
<input type="checkbox" name="{{$field.0}}" id="id_{{$field.0}}" aria-describedby="{{$field.0}}_tip" value="1" {{if $field.2}}checked="checked"{{/if}} {{if $field.4}}{{$field.4}}{{/if}}>
|
||||
<span class="field_help" role="tooltip" id="{{$field.0}}_tip">{{$field.3}}</span>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
$(document).ready(function() {
|
||||
// go to the permissions tab if the checkbox is checked
|
||||
$('body').on("change", "#id_share", function() {
|
||||
$(document).ready(function() {
|
||||
// Go to the permissions tab if the checkbox is checked.
|
||||
$('body').on("click", "#id_share", function() {
|
||||
if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) {
|
||||
$('#acl-wrapper').show();
|
||||
$("a#event-perms-lnk").parent("li").show();
|
||||
|
@ -13,12 +13,12 @@ $(document).ready(function() {
|
|||
}
|
||||
}).trigger('change');
|
||||
|
||||
// disable the finish time input if the user disable it
|
||||
// Disable the finish time input if the user disable it.
|
||||
$('body').on("change", "#id_nofinish", function() {
|
||||
enableDisableFinishDate()
|
||||
}).trigger('change');
|
||||
|
||||
// js for the permission sextion
|
||||
// JS for the permission section.
|
||||
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
|
||||
var selstr;
|
||||
$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
|
||||
|
@ -31,29 +31,47 @@ $(document).ready(function() {
|
|||
|
||||
}).trigger('change');
|
||||
|
||||
// Change the event nav menu.tabs on click
|
||||
// Change the event nav menu.tabs on click.
|
||||
$("body").on("click", "#event-nav > li > a", function(e){
|
||||
e.preventDefault();
|
||||
toggleEventNav(this);
|
||||
});
|
||||
|
||||
// this is experimental. We maybe can make use of it to inject
|
||||
// some js code while the event modal opens
|
||||
// This is experimental. We maybe can make use of it to inject
|
||||
// some js code while the event modal opens.
|
||||
//$('body').on('show.bs.modal', function () {
|
||||
// enableDisableFinishDate();
|
||||
//});
|
||||
|
||||
// clear some elements (e.g. the event-preview container) when
|
||||
// selecting a event nav link so it don't appear more than once
|
||||
// Clear some elements (e.g. the event-preview container) when
|
||||
// selecting a event nav link so it don't appear more than once.
|
||||
$('body').on("click", "#event-nav a", function(e) {
|
||||
$("#event-preview").empty();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Construct a new ACL. We need this everytime the 'event-edit-form' is loaded
|
||||
// without page reloading (e.g. closing an old modal and open a new modal).
|
||||
// Otherwise we wouldn't get the ACL data.
|
||||
/// @todo: Try to implement some kind of ACL reloading in acl.js.
|
||||
if (typeof acl !== "undefined") {
|
||||
var eventPerms = document.getElementById('event-edit-form');
|
||||
|
||||
acl = new ACL(
|
||||
baseurl + "/acl",
|
||||
[
|
||||
eventPerms.dataset.allow_cid,
|
||||
eventPerms.dataset.allow_gid,
|
||||
eventPerms.dataset.deny_cid,
|
||||
eventPerms.dataset.deny_gid
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Load the html of the actual event and incect the output to the
|
||||
// event-edit section
|
||||
// event-edit section.
|
||||
function doEventPreview() {
|
||||
$('#event-edit-preview').val(1);
|
||||
$.post('events',$('#event-edit-form').serialize(), function(data) {
|
||||
|
@ -63,21 +81,8 @@ function doEventPreview() {
|
|||
}
|
||||
|
||||
|
||||
// this function load the content of the edit url into a modal
|
||||
function eventEdit(url) {
|
||||
var char = qOrAmp(url);
|
||||
url = url + char + 'mode=none';
|
||||
|
||||
$.get(url, function(data) {
|
||||
$("#modal-body").empty();
|
||||
$("#modal-body").append(data);
|
||||
}).done(function() {
|
||||
loadModalTitle();
|
||||
});
|
||||
}
|
||||
|
||||
// the following functions show/hide the specific event-edit content
|
||||
// in dependence of the selected nav
|
||||
// The following functions show/hide the specific event-edit content
|
||||
// in dependence of the selected nav.
|
||||
function eventAclActive() {
|
||||
$("#event-edit-wrapper, #event-preview, #event-desc-wrapper").hide();
|
||||
$("#event-acl-wrapper").show();
|
||||
|
@ -94,8 +99,8 @@ function eventEditActive() {
|
|||
$("#event-acl-wrapper, #event-preview, #event-desc-wrapper").hide();
|
||||
$("#event-edit-wrapper").show();
|
||||
|
||||
//make sure jot text does have really the active class (we do this because there are some
|
||||
// other events which trigger jot text
|
||||
// Make sure jot text does have really the active class (we do this because there are some
|
||||
// other events which trigger jot text.
|
||||
toggleEventNav($("#event-edit-lnk"));
|
||||
}
|
||||
|
||||
|
@ -104,17 +109,17 @@ function eventDescActive() {
|
|||
$("#event-desc-wrapper").show();
|
||||
}
|
||||
|
||||
// Give the active "event-nav" list element the class "active"
|
||||
// Give the active "event-nav" list element the class "active".
|
||||
function toggleEventNav (elm) {
|
||||
// select all li of #event-nav and remove the active class
|
||||
// Select all li of #event-nav and remove the active class.
|
||||
$(elm).closest("#event-nav").children("li").removeClass("active");
|
||||
// add the active class to the parent of the link which was selected
|
||||
// Add the active class to the parent of the link which was selected.
|
||||
$(elm).parent("li").addClass("active");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// disable the input for the finish date if it is not available
|
||||
// Disable the input for the finish date if it is not available.
|
||||
function enableDisableFinishDate() {
|
||||
if( $('#id_nofinish').is(':checked'))
|
||||
$('#id_finish_text').prop("disabled", true);
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
/*
|
||||
* @brief contains functions for bootstrap modal handling
|
||||
/**
|
||||
* @brief Contains functions for bootstrap modal handling.
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
// Clear bs modal on close
|
||||
// We need this to prevent that the modal displays old content
|
||||
// Clear bs modal on close.
|
||||
// We need this to prevent that the modal displays old content.
|
||||
$('body, footer').on('hidden.bs.modal', '.modal', function () {
|
||||
$(this).removeData('bs.modal');
|
||||
$("#modal-title").empty();
|
||||
$('#modal-body').empty();
|
||||
// Remove the file browser from jot (else we would have problems
|
||||
// with AjaxUpload
|
||||
// with AjaxUpload.
|
||||
$(".fbrowser").remove();
|
||||
// Remove the AjaxUpload element
|
||||
// Remove the AjaxUpload element.
|
||||
$("[name=userfile]").parent().remove();
|
||||
});
|
||||
|
||||
// Clear bs modal on close
|
||||
// We need this to prevent that the modal displays old content
|
||||
// Clear bs modal on close.
|
||||
// We need this to prevent that the modal displays old content.
|
||||
$('body').on('hidden.bs.modal', '#jot-modal', function () {
|
||||
// restore cached jot at its hidden position ("#jot-content")
|
||||
// Restore cached jot at its hidden position ("#jot-content").
|
||||
$("#jot-content").append(jotcache);
|
||||
// clear the jotcache
|
||||
// Clear the jotcache.
|
||||
jotcache = '';
|
||||
});
|
||||
|
||||
// Add Colorbox for viewing Network page images
|
||||
// Add Colorbox for viewing Network page images.
|
||||
//var cBoxClasses = new Array();
|
||||
$("body").on("click", ".wall-item-body a img", function(){
|
||||
var aElem = $(this).parent();
|
||||
var imgHref = aElem.attr("href");
|
||||
|
||||
// We need to make sure we only put a Colorbox on links to Friendica images
|
||||
// We need to make sure we only put a Colorbox on links to Friendica images.
|
||||
// We'll try to do this by looking for links of the form
|
||||
// .../photo/ab803d8eg08daf85023adfec08 (with nothing more following), in hopes
|
||||
// that that will be unique enough
|
||||
// that that will be unique enough.
|
||||
if(imgHref.match(/\/photo\/[a-fA-F0-9]+(-[0-9]\.[\w]+?)?$/)) {
|
||||
|
||||
// Add a unique class to all the images of a certain post, to allow scrolling through
|
||||
|
@ -46,52 +46,52 @@ $(document).ready(function(){
|
|||
|
||||
aElem.colorbox({
|
||||
maxHeight: '90%',
|
||||
photo: true, // Colorbox doesn't recognize a URL that don't end in .jpg, etc. as a photo
|
||||
rel: cBoxClass //$(this).attr("class").match(/wall-item-body-[\d]+-lightbox/)[0]
|
||||
photo: true, // Colorbox doesn't recognize a URL that don't end in .jpg, etc. as a photo.
|
||||
rel: cBoxClass //$(this).attr("class").match(/wall-item-body-[\d]+-lightbox/)[0].
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Navbar login
|
||||
// Navbar login.
|
||||
$("body").on("click", "#nav-login", function(e){
|
||||
e.preventDefault();
|
||||
Dialog.show(this.href, this.dataset.originalTitle || this.title);
|
||||
});
|
||||
|
||||
// Jot nav menu.
|
||||
// Jot nav menu..
|
||||
$("body").on("click", "#jot-modal .jot-nav li .jot-nav-lnk", function(e){
|
||||
e.preventDefault();
|
||||
toggleJotNav(this);
|
||||
});
|
||||
|
||||
// bookmarklet page needs an jot modal which appears automatically
|
||||
// Bookmarklet page needs an jot modal which appears automatically.
|
||||
if(window.location.pathname.indexOf("/bookmarklet") >=0 && $("#jot-modal").length){
|
||||
jotShow();
|
||||
}
|
||||
|
||||
// Open filebrowser for elements with the class "image-select"
|
||||
// The following part handles the filebrowser for field_fileinput.tpl
|
||||
// The following part handles the filebrowser for field_fileinput.tpl.
|
||||
$("body").on("click", ".image-select", function(){
|
||||
// set a extra attribute to mark the clicked button
|
||||
// Set a extra attribute to mark the clicked button.
|
||||
this.setAttribute("image-input", "select");
|
||||
Dialog.doImageBrowser("input");
|
||||
});
|
||||
|
||||
// Insert filebrowser images into the input field (field_fileinput.tpl)
|
||||
// Insert filebrowser images into the input field (field_fileinput.tpl).
|
||||
$("body").on("fbrowser.image.input", function(e, filename, embedcode, id, img) {
|
||||
// select the clicked button by it's attribute
|
||||
// Select the clicked button by it's attribute.
|
||||
var elm = $("[image-input='select']");
|
||||
// select the input field which belongs to this button
|
||||
// Select the input field which belongs to this button.
|
||||
var input = elm.parent(".input-group").children("input");
|
||||
// remove the special indicator attribut from the button
|
||||
// Remove the special indicator attribut from the button.
|
||||
elm.removeAttr("image-input");
|
||||
// inserte the link from the image into the input field
|
||||
// Insert the link from the image into the input field.
|
||||
input.val(img);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// overwrite Dialog.show from main js to load the filebrowser into a bs modal
|
||||
// Overwrite Dialog.show from main js to load the filebrowser into a bs modal.
|
||||
Dialog.show = function(url, title) {
|
||||
if (typeof(title) === 'undefined') {
|
||||
title = "";
|
||||
|
@ -112,21 +112,21 @@ Dialog.show = function(url, title) {
|
|||
});
|
||||
};
|
||||
|
||||
// overwrite the function _get_url from main.js
|
||||
// Overwrite the function _get_url from main.js.
|
||||
Dialog._get_url = function(type, name, id) {
|
||||
var hash = name;
|
||||
if (id !== undefined) hash = hash + "-" + id;
|
||||
return "fbrowser/"+type+"/?mode=none#"+hash;
|
||||
};
|
||||
|
||||
// does load the filebrowser into the jot modal
|
||||
// Does load the filebrowser into the jot modal.
|
||||
Dialog.showJot = function() {
|
||||
var type = "image";
|
||||
var name = "main";
|
||||
|
||||
var url = Dialog._get_url(type, name);
|
||||
if(($(".modal-body #jot-fbrowser-wrapper .fbrowser").length) < 1 ) {
|
||||
// load new content to fbrowser window
|
||||
// Load new content to fbrowser window.
|
||||
$("#jot-fbrowser-wrapper").load(url,function(responseText, textStatus){
|
||||
if ( textStatus === 'success' ||
|
||||
textStatus === 'notmodified')
|
||||
|
@ -137,18 +137,18 @@ Dialog.showJot = function() {
|
|||
}
|
||||
};
|
||||
|
||||
// init the filebrowser after page load
|
||||
// Init the filebrowser after page load.
|
||||
Dialog._load = function(url) {
|
||||
// get nickname & filebrowser type from the modal content
|
||||
// Get nickname & filebrowser type from the modal content.
|
||||
var nickname = $("#fb-nickname").attr("value");
|
||||
var type = $("#fb-type").attr("value");
|
||||
|
||||
// try to fetch the hash form the url
|
||||
// Try to fetch the hash form the url.
|
||||
var match = url.match(/fbrowser\/[a-z]+\/\?mode=none(.*)/);
|
||||
if (match===null) return; //not fbrowser
|
||||
var hash = match[1];
|
||||
|
||||
// initialize the filebrowser
|
||||
// Initialize the filebrowser.
|
||||
var jsbrowser = function() {
|
||||
FileBrowser.init(nickname, type, hash);
|
||||
};
|
||||
|
@ -163,15 +163,15 @@ Dialog._load = function(url) {
|
|||
* moment or where it isn't possible because of design
|
||||
*/
|
||||
function loadModalTitle() {
|
||||
// clear the text of the title
|
||||
// Clear the text of the title.
|
||||
$("#modal-title").empty();
|
||||
|
||||
// hide the first element with the class "heading" of the modal body
|
||||
// Hide the first element with the class "heading" of the modal body.
|
||||
$("#modal-body .heading").first().hide();
|
||||
|
||||
var title = "";
|
||||
|
||||
// get the text of the first element with "heading" class
|
||||
// Get the text of the first element with "heading" class.
|
||||
title = $("#modal-body .heading").first().text();
|
||||
|
||||
// for event modals we need some speacial handling
|
||||
|
@ -181,14 +181,14 @@ function loadModalTitle() {
|
|||
title = title + eventsum;
|
||||
}
|
||||
|
||||
// and append it to modal title
|
||||
// And append it to modal title.
|
||||
if (title!=="") {
|
||||
$("#modal-title").append(title);
|
||||
}
|
||||
}
|
||||
|
||||
// This function loads html content from a friendica page
|
||||
// into a modal
|
||||
// into a modal.
|
||||
function addToModal(url) {
|
||||
var char = qOrAmp(url);
|
||||
|
||||
|
@ -204,13 +204,13 @@ function addToModal(url) {
|
|||
modal.show();
|
||||
|
||||
//Get first element with the class "heading"
|
||||
//and use it as title
|
||||
//and use it as title.
|
||||
loadModalTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add a element (by it's id) to a bootstrap modal
|
||||
// Add a element (by it's id) to a bootstrap modal.
|
||||
function addElmToModal(id) {
|
||||
var elm = $(id).html();
|
||||
var modal = $('#modal').modal();
|
||||
|
@ -223,17 +223,17 @@ function addElmToModal(id) {
|
|||
loadModalTitle();
|
||||
}
|
||||
|
||||
// function to load the html from the edit post page into
|
||||
// the jot modal
|
||||
// Function to load the html from the edit post page into
|
||||
// the jot modal.
|
||||
function editpost(url) {
|
||||
// next to normel posts the post can be an event post. The event posts don't
|
||||
// Next to normel posts the post can be an event post. The event posts don't
|
||||
// use the normal Jot modal. For event posts we will use a normal modal
|
||||
// But first we have to test if the url links to an event. So we will split up
|
||||
// the url in its parts
|
||||
// the url in its parts.
|
||||
var splitURL = parseUrl(url);
|
||||
// Test if in the url path containing "events/event". If the path containing this
|
||||
// expression then we will call the addToModal function and exit this function at
|
||||
// this point
|
||||
// this point.
|
||||
if (splitURL.path.indexOf('events/event') > -1) {
|
||||
addToModal(splitURL.path);
|
||||
return;
|
||||
|
@ -250,11 +250,11 @@ function editpost(url) {
|
|||
// After closing the modal original jot should be restored at its orginal position in the html structure.
|
||||
jotcache = $("#jot-content > #jot-sections");
|
||||
|
||||
// remove the original Jot as long as the edit Jot is open
|
||||
// Remove the original Jot as long as the edit Jot is open.
|
||||
jotcache.remove();
|
||||
|
||||
// add the class "edit" to the modal to have some kind of identifier to
|
||||
// have the possibility to e.g. put special event-listener
|
||||
// Add the class "edit" to the modal to have some kind of identifier to
|
||||
// have the possibility to e.g. put special event-listener.
|
||||
$("#jot-modal").addClass("edit-jot");
|
||||
|
||||
jotreset();
|
||||
|
@ -265,11 +265,11 @@ function editpost(url) {
|
|||
if ( textStatus === 'success' ||
|
||||
textStatus === 'notmodified')
|
||||
{
|
||||
// get the item type and hide the input for title and category if it isn't needed
|
||||
// get the item type and hide the input for title and category if it isn't needed.
|
||||
var type = $(responseText).find("#profile-jot-form input[name='type']").val();
|
||||
if(type === "wall-comment" || type === "remote-comment")
|
||||
{
|
||||
// hide title and category input fields because we don't
|
||||
// Hide title and category input fields because we don't.
|
||||
$("#profile-jot-form #jot-title-wrap").hide();
|
||||
$("#profile-jot-form #jot-category-wrap").hide();
|
||||
}
|
||||
|
@ -280,10 +280,10 @@ function editpost(url) {
|
|||
});
|
||||
}
|
||||
|
||||
// remove content from the jot modal
|
||||
// Remove content from the jot modal.
|
||||
function jotreset() {
|
||||
// Clear bs modal on close
|
||||
// We need this to prevent that the modal displays old content
|
||||
// Clear bs modal on close.
|
||||
// We need this to prevent that the modal displays old content.
|
||||
$('body').on('hidden.bs.modal', '#jot-modal.edit-jot', function () {
|
||||
$(this).removeData('bs.modal');
|
||||
$(".jot-nav .jot-perms-lnk").parent("li").removeClass("hidden");
|
||||
|
@ -291,32 +291,32 @@ function jotreset() {
|
|||
$("#profile-jot-form #jot-category-wrap").show();
|
||||
|
||||
// the following was commented out because it is needed anymore
|
||||
// because we changed the behavior at an other place
|
||||
// because we changed the behavior at an other place.
|
||||
// var rand_num = random_digits(12);
|
||||
// $('#jot-title, #jot-category, #profile-jot-text').val("");
|
||||
// $( "#profile-jot-form input[name='type']" ).val("wall");
|
||||
// $( "#profile-jot-form input[name='post_id']" ).val("");
|
||||
// $( "#profile-jot-form input[name='post_id_random']" ).val(rand_num);
|
||||
|
||||
// remove the "edit-jot" class so we can the standard behavior on close
|
||||
// Remove the "edit-jot" class so we can the standard behavior on close.
|
||||
$("#jot-modal.edit-jot").removeClass("edit-jot");
|
||||
$("#jot-modal-content").empty();
|
||||
});
|
||||
}
|
||||
|
||||
// Give the active "jot-nav" list element the class "active"
|
||||
// Give the active "jot-nav" list element the class "active".
|
||||
function toggleJotNav (elm) {
|
||||
// Get the ID of the tab panel which should be activated
|
||||
// Get the ID of the tab panel which should be activated.
|
||||
var tabpanel = elm.getAttribute("aria-controls");
|
||||
var cls = hasClass(elm, "jot-nav-lnk-mobile");
|
||||
|
||||
// Select all li of jot-nav and remove the active class
|
||||
// Select all li of jot-nav and remove the active class.
|
||||
$(elm).parent("li").siblings("li").removeClass("active");
|
||||
// Add the active class to the parent of the link which was selected
|
||||
// Add the active class to the parent of the link which was selected.
|
||||
$(elm).parent("li").addClass("active");
|
||||
|
||||
// Minimize all tab content wrapper and activate only the selected
|
||||
// tab panel
|
||||
// tab panel.
|
||||
$('#jot-modal [role=tabpanel]').addClass("minimize").attr("aria-hidden" ,"true");
|
||||
$('#jot-modal #' + tabpanel).removeClass("minimize").attr("aria-hidden" ,"false");
|
||||
|
||||
|
@ -324,7 +324,7 @@ function toggleJotNav (elm) {
|
|||
$("#jot-modal .nav-tabs .jot-nav-lnk").attr("aria-selected", "false");
|
||||
elm.setAttribute("aria-selected", "true");
|
||||
|
||||
// For some some tab panels we need to execute other js functions
|
||||
// For some some tab panels we need to execute other js functions.
|
||||
if (tabpanel === "jot-preview-content") {
|
||||
preview_post();
|
||||
} else if (tabpanel === "jot-fbrowser-wrapper") {
|
||||
|
@ -333,7 +333,7 @@ function toggleJotNav (elm) {
|
|||
});
|
||||
}
|
||||
|
||||
// If element is a mobile dropdown nav menu we need to change the botton text
|
||||
// If element is a mobile dropdown nav menu we need to change the botton text.
|
||||
if (cls) {
|
||||
toggleDropdownText(elm);
|
||||
}
|
||||
|
@ -341,17 +341,31 @@ function toggleJotNav (elm) {
|
|||
|
||||
// Wall Message needs a special handling because in some cases
|
||||
// it redirects you to your own server. In such cases we can't
|
||||
// load it into a modal
|
||||
// load it into a modal.
|
||||
function openWallMessage(url) {
|
||||
// split the the url in its parts
|
||||
// Split the the url in its parts.
|
||||
var parts = parseUrl(url);
|
||||
|
||||
// If the host isn't the same we can't load it in a modal.
|
||||
// So we will go to to the url directly
|
||||
// So we will go to to the url directly.
|
||||
if( ("host" in parts) && (parts.host !== window.location.host)) {
|
||||
window.location.href = url;
|
||||
} else {
|
||||
// otherwise load the wall message into a modal
|
||||
// Otherwise load the wall message into a modal.
|
||||
addToModal(url);
|
||||
}
|
||||
}
|
||||
|
||||
// This function load the content of the edit url into a modal.
|
||||
/// @todo Rename this function because it can be used for more than events.
|
||||
function eventEdit(url) {
|
||||
var char = qOrAmp(url);
|
||||
url = url + char + 'mode=none';
|
||||
|
||||
$.get(url, function(data) {
|
||||
$("#modal-body").empty();
|
||||
$("#modal-body").append(data);
|
||||
}).done(function() {
|
||||
loadModalTitle();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<script language="javascript" type="text/javascript"
|
||||
src="{{$baseurl}}/view/theme/frio/js/event_edit.js"></script>
|
||||
|
||||
{{foreach $events as $event}}
|
||||
<div class="event-wrapper">
|
||||
|
@ -18,6 +16,7 @@
|
|||
|
||||
<div class="event-buttons pull-right">
|
||||
{{if $event.edit}}<button type="button" class="btn" onclick="eventEdit('{{$event.edit.0}}')" title="{{$event.edit.1}}"><i class="fa fa-pencil" aria-hidden="true"></i></button>{{/if}}
|
||||
{{if $event.copy}}<button type="button" class="btn" onclick="eventEdit('{{$event.copy.0}}')" title="{{$event.copy.1}}"><i class="fa fa-files-o" aria-hidden="true"></i></button>{{/if}}
|
||||
{{if $event.drop}}<a href="{{$event.drop.0}}" onclick="return confirmDelete();" title="{{$event.drop.1}}" class="drop-event-link btn"><i class="fa fa-trash-o" aria-hidden="true"></i></a>{{/if}}
|
||||
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link btn "><i class="fa fa-external-link" aria-hidden="true"></i></a>{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</ul>
|
||||
|
||||
<div id="event-edit-form-wrapper">
|
||||
<form id="event-edit-form" action="{{$post}}" method="post" >
|
||||
<form id="event-edit-form" action="{{$post}}" method="post" data-allow_cid="{{$allow_cid}}" data-allow_gid="{{$allow_gid}}" data-deny_cid="{{$deny_cid}}" data-deny_gid="{{$deny_gid}}">
|
||||
|
||||
<input type="hidden" name="event_id" value="{{$eid}}" />
|
||||
<input type="hidden" name="cid" value="{{$cid}}" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
<div class="field checkbox" id="div_id_{{$field.0}}">
|
||||
<input type="hidden" name="{{$field.0}}" value="0">
|
||||
<input type="checkbox" name="{{$field.0}}" id="id_{{$field.0}}" value="1" {{if $field.2}}checked="checked"{{/if}} aria-checked="{{if $field.2}}true{{else}}false{{/if}}" aria-describedby="{{$field.0}}_tip">
|
||||
<input type="checkbox" name="{{$field.0}}" id="id_{{$field.0}}" value="1" {{if $field.2}}checked="checked"{{/if}} aria-checked="{{if $field.2}}true{{else}}false{{/if}}" aria-describedby="{{$field.0}}_tip" {{if $field.4}}{{$field.4}}{{/if}}>
|
||||
<label for="id_{{$field.0}}">
|
||||
{{$field.1}}
|
||||
<span class="help-block" id="{{$field.0}}_tip" role="tooltip">{{$field.3}}</span>
|
||||
|
|
|
@ -334,6 +334,7 @@ li.icon.icon-large:before {
|
|||
|
||||
.icon.drop:before { content: "\f014"; }
|
||||
.icon.drophide:before { content: "\f014"; }
|
||||
.icon.copy:before { content: "\f0c5"; }
|
||||
|
||||
.small-pencil:before, .savedsearchdrop:before {
|
||||
font-family: FontAwesome;
|
||||
|
|
Loading…
Reference in New Issue
Block a user